Updates
This commit is contained in:
parent
3ece042f1a
commit
b54a821928
6
vim/bundle/cctrlp.vim/.gitignore
vendored
6
vim/bundle/cctrlp.vim/.gitignore
vendored
|
@ -1,6 +0,0 @@
|
|||
*.markdown
|
||||
*.zip
|
||||
note.txt
|
||||
tags
|
||||
.hg*
|
||||
tmp/*
|
File diff suppressed because it is too large
Load Diff
|
@ -1,140 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/bookmarkdir.vim
|
||||
" Description: Bookmarked directories extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_bookmarkdir') && g:loaded_ctrlp_bookmarkdir
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_bookmarkdir = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#bookmarkdir#init()',
|
||||
\ 'accept': 'ctrlp#bookmarkdir#accept',
|
||||
\ 'lname': 'bookmarked dirs',
|
||||
\ 'sname': 'bkd',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opmul': 1,
|
||||
\ 'nolim': 1,
|
||||
\ 'wipe': 'ctrlp#bookmarkdir#remove',
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:getinput(str, ...)
|
||||
echoh Identifier
|
||||
cal inputsave()
|
||||
let input = call('input', a:0 ? [a:str] + a:000 : [a:str])
|
||||
cal inputrestore()
|
||||
echoh None
|
||||
retu input
|
||||
endf
|
||||
|
||||
fu! s:cachefile()
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'bkd'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
retu s:cafile
|
||||
endf
|
||||
|
||||
fu! s:writecache(lines)
|
||||
cal ctrlp#utils#writecache(a:lines, s:cadir, s:cafile)
|
||||
endf
|
||||
|
||||
fu! s:getbookmarks()
|
||||
retu ctrlp#utils#readfile(s:cachefile())
|
||||
endf
|
||||
|
||||
fu! s:savebookmark(name, cwd)
|
||||
let cwds = exists('+ssl') ? [tr(a:cwd, '\', '/'), tr(a:cwd, '/', '\')] : [a:cwd]
|
||||
let entries = filter(s:getbookmarks(), 'index(cwds, s:parts(v:val)[1]) < 0')
|
||||
cal s:writecache(insert(entries, a:name.' '.a:cwd))
|
||||
endf
|
||||
|
||||
fu! s:setentries()
|
||||
let time = getftime(s:cachefile())
|
||||
if !( exists('s:bookmarks') && time == s:bookmarks[0] )
|
||||
let s:bookmarks = [time, s:getbookmarks()]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:parts(str)
|
||||
let mlist = matchlist(a:str, '\v([^\t]+)\t(.*)$')
|
||||
retu mlist != [] ? mlist[1:2] : ['', '']
|
||||
endf
|
||||
|
||||
fu! s:process(entries, type)
|
||||
retu map(a:entries, 's:modify(v:val, a:type)')
|
||||
endf
|
||||
|
||||
fu! s:modify(entry, type)
|
||||
let [name, dir] = s:parts(a:entry)
|
||||
let dir = fnamemodify(dir, a:type)
|
||||
retu name.' '.( dir == '' ? '.' : dir )
|
||||
endf
|
||||
|
||||
fu! s:msg(name, cwd)
|
||||
redr
|
||||
echoh Identifier | echon 'Bookmarked ' | echoh Constant
|
||||
echon a:name.' ' | echoh Directory | echon a:cwd
|
||||
echoh None
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBookmark', 'Identifier')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBookmark '^> [^\t]\+' contains=CtrlPLinePre
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#bookmarkdir#init()
|
||||
cal s:setentries()
|
||||
cal s:syntax()
|
||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#accept(mode, str)
|
||||
let parts = s:parts(s:modify(a:str, ':p'))
|
||||
cal call('s:savebookmark', parts)
|
||||
if a:mode =~ 't\|v\|h'
|
||||
cal ctrlp#exit()
|
||||
en
|
||||
cal ctrlp#setdir(parts[1], a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
||||
if a:mode == 'e'
|
||||
cal ctrlp#switchtype(0)
|
||||
cal ctrlp#recordhist()
|
||||
cal ctrlp#prtclear()
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#add(dir)
|
||||
let str = 'Directory to bookmark: '
|
||||
let cwd = a:dir != '' ? a:dir : s:getinput(str, getcwd(), 'dir')
|
||||
if cwd == '' | retu | en
|
||||
let cwd = fnamemodify(cwd, ':p')
|
||||
let name = s:getinput('Bookmark as: ', cwd)
|
||||
if name == '' | retu | en
|
||||
let name = tr(name, ' ', ' ')
|
||||
cal s:savebookmark(name, cwd)
|
||||
cal s:msg(name, cwd)
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#remove(entries)
|
||||
cal s:process(a:entries, ':p')
|
||||
cal s:writecache(a:entries == [] ? [] :
|
||||
\ filter(s:getbookmarks(), 'index(a:entries, v:val) < 0'))
|
||||
cal s:setentries()
|
||||
retu s:process(copy(s:bookmarks[1]), ':.')
|
||||
endf
|
||||
|
||||
fu! ctrlp#bookmarkdir#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,261 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/buffertag.vim
|
||||
" Description: Buffer Tag extension
|
||||
" Maintainer: Kien Nguyen <github.com/kien>
|
||||
" Credits: Much of the code was taken from tagbar.vim by Jan Larres, plus
|
||||
" a few lines from taglist.vim by Yegappan Lakshmanan and from
|
||||
" buffertag.vim by Takeshi Nishida.
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_buftag') && g:loaded_ctrlp_buftag
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_buftag = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#buffertag#init(s:crfile)',
|
||||
\ 'accept': 'ctrlp#buffertag#accept',
|
||||
\ 'lname': 'buffer tags',
|
||||
\ 'sname': 'bft',
|
||||
\ 'exit': 'ctrlp#buffertag#exit()',
|
||||
\ 'type': 'tabs',
|
||||
\ 'opts': 'ctrlp#buffertag#opts()',
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
let [s:pref, s:opts] = ['g:ctrlp_buftag_', {
|
||||
\ 'systemenc': ['s:enc', &enc],
|
||||
\ 'ctags_bin': ['s:bin', ''],
|
||||
\ 'types': ['s:usr_types', {}],
|
||||
\ }]
|
||||
|
||||
let s:bins = [
|
||||
\ 'ctags-exuberant',
|
||||
\ 'exuberant-ctags',
|
||||
\ 'exctags',
|
||||
\ '/usr/local/bin/ctags',
|
||||
\ '/opt/local/bin/ctags',
|
||||
\ 'ctags',
|
||||
\ 'ctags.exe',
|
||||
\ 'tags',
|
||||
\ ]
|
||||
|
||||
let s:types = {
|
||||
\ 'asm' : '%sasm%sasm%sdlmt',
|
||||
\ 'aspperl': '%sasp%sasp%sfsv',
|
||||
\ 'aspvbs' : '%sasp%sasp%sfsv',
|
||||
\ 'awk' : '%sawk%sawk%sf',
|
||||
\ 'beta' : '%sbeta%sbeta%sfsv',
|
||||
\ 'c' : '%sc%sc%sdgsutvf',
|
||||
\ 'cpp' : '%sc++%sc++%snvdtcgsuf',
|
||||
\ 'cs' : '%sc#%sc#%sdtncEgsipm',
|
||||
\ 'cobol' : '%scobol%scobol%sdfgpPs',
|
||||
\ 'eiffel' : '%seiffel%seiffel%scf',
|
||||
\ 'erlang' : '%serlang%serlang%sdrmf',
|
||||
\ 'expect' : '%stcl%stcl%scfp',
|
||||
\ 'fortran': '%sfortran%sfortran%spbceiklmntvfs',
|
||||
\ 'html' : '%shtml%shtml%saf',
|
||||
\ 'java' : '%sjava%sjava%spcifm',
|
||||
\ 'javascript': '%sjavascript%sjavascript%sf',
|
||||
\ 'lisp' : '%slisp%slisp%sf',
|
||||
\ 'lua' : '%slua%slua%sf',
|
||||
\ 'make' : '%smake%smake%sm',
|
||||
\ 'pascal' : '%spascal%spascal%sfp',
|
||||
\ 'perl' : '%sperl%sperl%sclps',
|
||||
\ 'php' : '%sphp%sphp%scdvf',
|
||||
\ 'python' : '%spython%spython%scmf',
|
||||
\ 'rexx' : '%srexx%srexx%ss',
|
||||
\ 'ruby' : '%sruby%sruby%scfFm',
|
||||
\ 'scheme' : '%sscheme%sscheme%ssf',
|
||||
\ 'sh' : '%ssh%ssh%sf',
|
||||
\ 'csh' : '%ssh%ssh%sf',
|
||||
\ 'zsh' : '%ssh%ssh%sf',
|
||||
\ 'slang' : '%sslang%sslang%snf',
|
||||
\ 'sml' : '%ssml%ssml%secsrtvf',
|
||||
\ 'sql' : '%ssql%ssql%scFPrstTvfp',
|
||||
\ 'tcl' : '%stcl%stcl%scfmp',
|
||||
\ 'vera' : '%svera%svera%scdefgmpPtTvx',
|
||||
\ 'verilog': '%sverilog%sverilog%smcPertwpvf',
|
||||
\ 'vim' : '%svim%svim%savf',
|
||||
\ 'yacc' : '%syacc%syacc%sl',
|
||||
\ }
|
||||
|
||||
cal map(s:types, 'printf(v:val, "--language-force=", " --", "-types=")')
|
||||
|
||||
if executable('jsctags')
|
||||
cal extend(s:types, { 'javascript': { 'args': '-f -', 'bin': 'jsctags' } })
|
||||
en
|
||||
|
||||
fu! ctrlp#buffertag#opts()
|
||||
for [ke, va] in items(s:opts)
|
||||
let {va[0]} = exists(s:pref.ke) ? {s:pref.ke} : va[1]
|
||||
endfo
|
||||
" Ctags bin
|
||||
if empty(s:bin)
|
||||
for bin in s:bins | if executable(bin)
|
||||
let s:bin = bin
|
||||
brea
|
||||
en | endfo
|
||||
el
|
||||
let s:bin = expand(s:bin, 1)
|
||||
en
|
||||
" Types
|
||||
cal extend(s:types, s:usr_types)
|
||||
endf
|
||||
" Utilities {{{1
|
||||
fu! s:validfile(fname, ftype)
|
||||
if ( !empty(a:fname) || !empty(a:ftype) ) && filereadable(a:fname)
|
||||
\ && index(keys(s:types), a:ftype) >= 0 | retu 1 | en
|
||||
retu 0
|
||||
endf
|
||||
|
||||
fu! s:exectags(cmd)
|
||||
if exists('+ssl')
|
||||
let [ssl, &ssl] = [&ssl, 0]
|
||||
en
|
||||
if &sh =~ 'cmd\.exe'
|
||||
let [sxq, &sxq, shcf, &shcf] = [&sxq, '"', &shcf, '/s /c']
|
||||
en
|
||||
let output = system(a:cmd)
|
||||
if &sh =~ 'cmd\.exe'
|
||||
let [&sxq, &shcf] = [sxq, shcf]
|
||||
en
|
||||
if exists('+ssl')
|
||||
let &ssl = ssl
|
||||
en
|
||||
retu output
|
||||
endf
|
||||
|
||||
fu! s:exectagsonfile(fname, ftype)
|
||||
let [ags, ft] = ['-f - --sort=no --excmd=pattern --fields=nKs ', a:ftype]
|
||||
if type(s:types[ft]) == 1
|
||||
let ags .= s:types[ft]
|
||||
let bin = s:bin
|
||||
elsei type(s:types[ft]) == 4
|
||||
let ags = s:types[ft]['args']
|
||||
let bin = expand(s:types[ft]['bin'], 1)
|
||||
en
|
||||
if empty(bin) | retu '' | en
|
||||
let cmd = s:esctagscmd(bin, ags, a:fname)
|
||||
if empty(cmd) | retu '' | en
|
||||
let output = s:exectags(cmd)
|
||||
if v:shell_error || output =~ 'Warning: cannot open' | retu '' | en
|
||||
retu output
|
||||
endf
|
||||
|
||||
fu! s:esctagscmd(bin, args, ...)
|
||||
if exists('+ssl')
|
||||
let [ssl, &ssl] = [&ssl, 0]
|
||||
en
|
||||
let fname = a:0 ? shellescape(a:1) : ''
|
||||
let cmd = shellescape(a:bin).' '.a:args.' '.fname
|
||||
if &sh =~ 'cmd\.exe'
|
||||
let cmd = substitute(cmd, '[&()@^<>|]', '^\0', 'g')
|
||||
en
|
||||
if exists('+ssl')
|
||||
let &ssl = ssl
|
||||
en
|
||||
if has('iconv')
|
||||
let last = s:enc != &enc ? s:enc : !empty($LANG) ? $LANG : &enc
|
||||
let cmd = iconv(cmd, &enc, last)
|
||||
en
|
||||
retu cmd
|
||||
endf
|
||||
|
||||
fu! s:process(fname, ftype)
|
||||
if !s:validfile(a:fname, a:ftype) | retu [] | endif
|
||||
let ftime = getftime(a:fname)
|
||||
if has_key(g:ctrlp_buftags, a:fname)
|
||||
\ && g:ctrlp_buftags[a:fname]['time'] >= ftime
|
||||
let lines = g:ctrlp_buftags[a:fname]['lines']
|
||||
el
|
||||
let data = s:exectagsonfile(a:fname, a:ftype)
|
||||
let [raw, lines] = [split(data, '\n\+'), []]
|
||||
for line in raw
|
||||
if line !~# '^!_TAG_' && len(split(line, ';"')) == 2
|
||||
let parsed_line = s:parseline(line)
|
||||
if parsed_line != ''
|
||||
cal add(lines, parsed_line)
|
||||
en
|
||||
en
|
||||
endfo
|
||||
let cache = { a:fname : { 'time': ftime, 'lines': lines } }
|
||||
cal extend(g:ctrlp_buftags, cache)
|
||||
en
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! s:parseline(line)
|
||||
let vals = matchlist(a:line,
|
||||
\ '\v^([^\t]+)\t(.+)\t[?/]\^?(.{-1,})\$?[?/]\;\"\t(.+)\tline(no)?\:(\d+)')
|
||||
if vals == [] | retu '' | en
|
||||
let [bufnr, bufname] = [bufnr('^'.vals[2].'$'), fnamemodify(vals[2], ':p:t')]
|
||||
retu vals[1].' '.vals[4].'|'.bufnr.':'.bufname.'|'.vals[6].'| '.vals[3]
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTagKind', 'Title')
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTagKind '\zs[^\t|]\+\ze|\d\+:[^|]\+|\d\+|'
|
||||
sy match CtrlPBufName '|\d\+:\zs[^|]\+\ze|\d\+|'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName,CtrlPTagKind
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:chknearby(pat)
|
||||
if match(getline('.'), a:pat) < 0
|
||||
let [int, forw, maxl] = [1, 1, line('$')]
|
||||
wh !search(a:pat, 'W'.( forw ? '' : 'b' ))
|
||||
if !forw
|
||||
if int > maxl | brea | en
|
||||
let int += int
|
||||
en
|
||||
let forw = !forw
|
||||
endw
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#buffertag#init(fname)
|
||||
let bufs = exists('s:btmode') && s:btmode
|
||||
\ ? filter(ctrlp#buffers(), 'filereadable(v:val)')
|
||||
\ : [exists('s:bufname') ? s:bufname : a:fname]
|
||||
let lines = []
|
||||
for each in bufs
|
||||
let bname = fnamemodify(each, ':p')
|
||||
let tftype = get(split(getbufvar('^'.bname.'$', '&ft'), '\.'), 0, '')
|
||||
cal extend(lines, s:process(bname, tftype))
|
||||
endfo
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#accept(mode, str)
|
||||
let vals = matchlist(a:str,
|
||||
\ '\v^[^\t]+\t+[^\t|]+\|(\d+)\:[^\t|]+\|(\d+)\|\s(.+)$')
|
||||
let bufnr = str2nr(get(vals, 1))
|
||||
if bufnr
|
||||
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
|
||||
exe 'norm!' str2nr(get(vals, 2, line('.'))).'G'
|
||||
cal s:chknearby('\V\C'.get(vals, 3, ''))
|
||||
sil! norm! zvzz
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#cmd(mode, ...)
|
||||
let s:btmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufname = fnamemodify(a:1, ':p')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#buffertag#exit()
|
||||
unl! s:btmode s:bufname
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,95 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/changes.vim
|
||||
" Description: Change list extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_changes') && g:loaded_ctrlp_changes
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_changes = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#changes#init(s:bufnr, s:crbufnr)',
|
||||
\ 'accept': 'ctrlp#changes#accept',
|
||||
\ 'lname': 'changes',
|
||||
\ 'sname': 'chs',
|
||||
\ 'exit': 'ctrlp#changes#exit()',
|
||||
\ 'type': 'tabe',
|
||||
\ 'sort': 0,
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:changelist(bufnr)
|
||||
sil! exe 'noa hid b' a:bufnr
|
||||
redi => result
|
||||
sil! changes
|
||||
redi END
|
||||
retu map(split(result, "\n")[1:], 'tr(v:val, " ", " ")')
|
||||
endf
|
||||
|
||||
fu! s:process(clines, ...)
|
||||
let [clines, evas] = [[], []]
|
||||
for each in a:clines
|
||||
let parts = matchlist(each, '\v^.\s*\d+\s+(\d+)\s+(\d+)\s(.*)$')
|
||||
if !empty(parts)
|
||||
if parts[3] == '' | let parts[3] = ' ' | en
|
||||
cal add(clines, parts[3].' |'.a:1.':'.a:2.'|'.parts[1].':'.parts[2].'|')
|
||||
en
|
||||
endfo
|
||||
retu reverse(filter(clines, 'count(clines, v:val) == 1'))
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\d\+:\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#changes#init(original_bufnr, bufnr)
|
||||
let bufnr = exists('s:bufnr') ? s:bufnr : a:bufnr
|
||||
let bufs = exists('s:clmode') && s:clmode ? ctrlp#buffers('id') : [bufnr]
|
||||
cal filter(bufs, 'v:val > 0')
|
||||
let [swb, &swb] = [&swb, '']
|
||||
let lines = []
|
||||
for each in bufs
|
||||
let fnamet = fnamemodify(bufname(each), ':t')
|
||||
cal extend(lines, s:process(s:changelist(each), each, fnamet))
|
||||
endfo
|
||||
sil! exe 'noa hid b' a:original_bufnr
|
||||
let &swb = swb
|
||||
cal ctrlp#syntax()
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#changes#accept(mode, str)
|
||||
let info = matchlist(a:str, '\t|\(\d\+\):[^|]\+|\(\d\+\):\(\d\+\)|$')
|
||||
let bufnr = str2nr(get(info, 1))
|
||||
if bufnr
|
||||
cal ctrlp#acceptfile(a:mode, bufname(bufnr))
|
||||
cal cursor(get(info, 2), get(info, 3))
|
||||
sil! norm! zvzz
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#changes#cmd(mode, ...)
|
||||
let s:clmode = a:mode
|
||||
if a:0 && !empty(a:1)
|
||||
let s:bufnr = bufnr('^'.fnamemodify(a:1, ':p').'$')
|
||||
en
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#changes#exit()
|
||||
unl! s:clmode s:bufnr
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,93 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/dir.vim
|
||||
" Description: Directory extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_dir') && g:loaded_ctrlp_dir
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_dir, g:ctrlp_newdir] = [1, 0]
|
||||
|
||||
let s:ars = ['s:maxdepth', 's:maxfiles', 's:compare_lim', 's:glob', 's:caching']
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#dir#init('.join(s:ars, ', ').')',
|
||||
\ 'accept': 'ctrlp#dir#accept',
|
||||
\ 'lname': 'dirs',
|
||||
\ 'sname': 'dir',
|
||||
\ 'type': 'path',
|
||||
\ 'specinput': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
let s:dircounts = {}
|
||||
" Utilities {{{1
|
||||
fu! s:globdirs(dirs, depth)
|
||||
let entries = split(globpath(a:dirs, s:glob), "\n")
|
||||
let [dirs, depth] = [ctrlp#dirnfile(entries)[0], a:depth + 1]
|
||||
cal extend(g:ctrlp_alldirs, dirs)
|
||||
let nr = len(g:ctrlp_alldirs)
|
||||
if !empty(dirs) && !s:max(nr, s:maxfiles) && depth <= s:maxdepth
|
||||
sil! cal ctrlp#progress(nr)
|
||||
cal map(dirs, 'ctrlp#utils#fnesc(v:val, "g", ",")')
|
||||
cal s:globdirs(join(dirs, ','), depth)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:max(len, max)
|
||||
retu a:max && a:len > a:max
|
||||
endf
|
||||
|
||||
fu! s:nocache()
|
||||
retu !s:caching || ( s:caching > 1 && get(s:dircounts, s:cwd) < s:caching )
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#dir#init(...)
|
||||
let s:cwd = getcwd()
|
||||
for each in range(len(s:ars))
|
||||
let {s:ars[each]} = a:{each + 1}
|
||||
endfo
|
||||
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'dir'
|
||||
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile('dir')
|
||||
if g:ctrlp_newdir || s:nocache() || !filereadable(cafile)
|
||||
let [s:initcwd, g:ctrlp_alldirs] = [s:cwd, []]
|
||||
cal s:globdirs(ctrlp#utils#fnesc(s:cwd, 'g', ','), 0)
|
||||
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
|
||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
||||
en
|
||||
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
|
||||
let g:ctrlp_newdir = 0
|
||||
el
|
||||
if !( exists('s:initcwd') && s:initcwd == s:cwd )
|
||||
let s:initcwd = s:cwd
|
||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
||||
en
|
||||
en
|
||||
cal extend(s:dircounts, { s:cwd : len(g:ctrlp_alldirs) })
|
||||
retu g:ctrlp_alldirs
|
||||
endf
|
||||
|
||||
fu! ctrlp#dir#accept(mode, str)
|
||||
let path = a:mode == 'h' ? getcwd() : s:cwd.ctrlp#utils#lash().a:str
|
||||
if a:mode =~ 't\|v\|h'
|
||||
cal ctrlp#exit()
|
||||
en
|
||||
cal ctrlp#setdir(path, a:mode =~ 't\|h' ? 'chd!' : 'lc!')
|
||||
if a:mode == 'e'
|
||||
sil! cal ctrlp#statusline()
|
||||
cal ctrlp#setlines(s:id)
|
||||
cal ctrlp#recordhist()
|
||||
cal ctrlp#prtclear()
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#dir#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,62 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/line.vim
|
||||
" Description: Line extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_line') && g:loaded_ctrlp_line
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_line = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#line#init()',
|
||||
\ 'accept': 'ctrlp#line#accept',
|
||||
\ 'lname': 'lines',
|
||||
\ 'sname': 'lns',
|
||||
\ 'type': 'tabe',
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPBufName', 'Directory')
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPBufName '\t|\zs[^|]\+\ze|\d\+:\d\+|$'
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$' contains=CtrlPBufName
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#line#init()
|
||||
let [bufs, lines] = [ctrlp#buffers('id'), []]
|
||||
for bufnr in bufs
|
||||
let [lfb, bufn] = [getbufline(bufnr, 1, '$'), bufname(bufnr)]
|
||||
let lfb = lfb == [] ? ctrlp#utils#readfile(fnamemodify(bufn, ':p')) : lfb
|
||||
cal map(lfb, 'tr(v:val, '' '', '' '')')
|
||||
let [linenr, len_lfb, buft] = [1, len(lfb), fnamemodify(bufn, ':t')]
|
||||
wh linenr <= len_lfb
|
||||
let lfb[linenr - 1] .= ' |'.buft.'|'.bufnr.':'.linenr.'|'
|
||||
let linenr += 1
|
||||
endw
|
||||
cal extend(lines, filter(lfb, 'v:val !~ ''^\s*\t|[^|]\+|\d\+:\d\+|$'''))
|
||||
endfo
|
||||
cal s:syntax()
|
||||
retu lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#accept(mode, str)
|
||||
let info = matchlist(a:str, '\t|[^|]\+|\(\d\+\):\(\d\+\)|$')
|
||||
let bufnr = str2nr(get(info, 1))
|
||||
if bufnr
|
||||
cal ctrlp#acceptfile(a:mode, bufname(bufnr), get(info, 2))
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#line#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,83 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/mixed.vim
|
||||
" Description: Mixing Files + MRU + Buffers
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_mixed') && g:loaded_ctrlp_mixed
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_mixed, g:ctrlp_newmix] = [1, 0]
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#mixed#init(s:compare_lim)',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'fil + mru + buf',
|
||||
\ 'sname': 'mix',
|
||||
\ 'type': 'path',
|
||||
\ 'opmul': 1,
|
||||
\ 'specinput': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:newcache(cwd)
|
||||
if g:ctrlp_newmix || !has_key(g:ctrlp_allmixes, 'data') | retu 1 | en
|
||||
retu g:ctrlp_allmixes['cwd'] != a:cwd
|
||||
\ || g:ctrlp_allmixes['filtime'] < getftime(ctrlp#utils#cachefile())
|
||||
\ || g:ctrlp_allmixes['mrutime'] < getftime(ctrlp#mrufiles#cachefile())
|
||||
\ || g:ctrlp_allmixes['bufs'] < len(ctrlp#mrufiles#bufs())
|
||||
endf
|
||||
|
||||
fu! s:getnewmix(cwd, clim)
|
||||
if g:ctrlp_newmix
|
||||
cal ctrlp#mrufiles#refresh('raw')
|
||||
let g:ctrlp_newcache = 1
|
||||
en
|
||||
let g:ctrlp_lines = copy(ctrlp#files())
|
||||
cal ctrlp#progress('Mixing...')
|
||||
let mrufs = copy(ctrlp#mrufiles#list('raw'))
|
||||
if exists('+ssl') && &ssl
|
||||
cal map(mrufs, 'tr(v:val, "\\", "/")')
|
||||
en
|
||||
let bufs = map(ctrlp#buffers('id'), 'fnamemodify(bufname(v:val), ":p")')
|
||||
let mrufs = bufs + filter(mrufs, 'index(bufs, v:val) < 0')
|
||||
if len(mrufs) > len(g:ctrlp_lines)
|
||||
cal filter(mrufs, 'stridx(v:val, a:cwd)')
|
||||
el
|
||||
let cwd_mrufs = filter(copy(mrufs), '!stridx(v:val, a:cwd)')
|
||||
let cwd_mrufs = ctrlp#rmbasedir(cwd_mrufs)
|
||||
for each in cwd_mrufs
|
||||
let id = index(g:ctrlp_lines, each)
|
||||
if id >= 0 | cal remove(g:ctrlp_lines, id) | en
|
||||
endfo
|
||||
en
|
||||
cal map(mrufs, 'fnamemodify(v:val, ":.")')
|
||||
let g:ctrlp_lines = len(mrufs) > len(g:ctrlp_lines)
|
||||
\ ? g:ctrlp_lines + mrufs : mrufs + g:ctrlp_lines
|
||||
if len(g:ctrlp_lines) <= a:clim
|
||||
cal sort(g:ctrlp_lines, 'ctrlp#complen')
|
||||
en
|
||||
let g:ctrlp_allmixes = { 'filtime': getftime(ctrlp#utils#cachefile()),
|
||||
\ 'mrutime': getftime(ctrlp#mrufiles#cachefile()), 'cwd': a:cwd,
|
||||
\ 'bufs': len(ctrlp#mrufiles#bufs()), 'data': g:ctrlp_lines }
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#mixed#init(clim)
|
||||
let cwd = getcwd()
|
||||
if s:newcache(cwd)
|
||||
cal s:getnewmix(cwd, a:clim)
|
||||
el
|
||||
let g:ctrlp_lines = g:ctrlp_allmixes['data']
|
||||
en
|
||||
let g:ctrlp_newmix = 0
|
||||
retu g:ctrlp_lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#mixed#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,129 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/mrufiles.vim
|
||||
" Description: Most Recently Used Files extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
let [s:mrbs, s:mrufs] = [[], []]
|
||||
|
||||
fu! ctrlp#mrufiles#opts()
|
||||
let [pref, opts] = ['g:ctrlp_mruf_', {
|
||||
\ 'max': ['s:max', 250],
|
||||
\ 'include': ['s:in', ''],
|
||||
\ 'exclude': ['s:ex', ''],
|
||||
\ 'case_sensitive': ['s:cseno', 1],
|
||||
\ 'relative': ['s:re', 0],
|
||||
\ }]
|
||||
for [ke, va] in items(opts)
|
||||
let [{va[0]}, {pref.ke}] = [pref.ke, exists(pref.ke) ? {pref.ke} : va[1]]
|
||||
endfo
|
||||
endf
|
||||
cal ctrlp#mrufiles#opts()
|
||||
" Utilities {{{1
|
||||
fu! s:excl(fn)
|
||||
retu !empty({s:ex}) && a:fn =~# {s:ex}
|
||||
endf
|
||||
|
||||
fu! s:mergelists()
|
||||
let diskmrufs = ctrlp#utils#readfile(ctrlp#mrufiles#cachefile())
|
||||
cal filter(diskmrufs, 'index(s:mrufs, v:val) < 0')
|
||||
let mrufs = s:mrufs + diskmrufs
|
||||
retu s:chop(mrufs)
|
||||
endf
|
||||
|
||||
fu! s:chop(mrufs)
|
||||
if len(a:mrufs) > {s:max} | cal remove(a:mrufs, {s:max}, -1) | en
|
||||
retu a:mrufs
|
||||
endf
|
||||
|
||||
fu! s:reformat(mrufs)
|
||||
if {s:re}
|
||||
let cwd = exists('+ssl') ? tr(getcwd(), '/', '\') : getcwd()
|
||||
cal filter(a:mrufs, '!stridx(v:val, cwd)')
|
||||
en
|
||||
retu map(a:mrufs, 'fnamemodify(v:val, ":.")')
|
||||
endf
|
||||
|
||||
fu! s:record(bufnr)
|
||||
if s:locked | retu | en
|
||||
let bufnr = a:bufnr + 0
|
||||
let bufname = bufname(bufnr)
|
||||
if bufnr > 0 && !empty(bufname)
|
||||
cal filter(s:mrbs, 'v:val != bufnr')
|
||||
cal insert(s:mrbs, bufnr)
|
||||
cal s:addtomrufs(bufname)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:addtomrufs(fname)
|
||||
let fn = fnamemodify(a:fname, ':p')
|
||||
let fn = exists('+ssl') ? tr(fn, '/', '\') : fn
|
||||
if ( !empty({s:in}) && fn !~# {s:in} ) || ( !empty({s:ex}) && fn =~# {s:ex} )
|
||||
\ || !empty(getbufvar('^'.fn.'$', '&bt')) || !filereadable(fn) | retu
|
||||
en
|
||||
cal filter(s:mrufs, 'v:val !='.( {s:cseno} ? '#' : '?' ).' fn')
|
||||
cal insert(s:mrufs, fn)
|
||||
endf
|
||||
|
||||
fu! s:savetofile(mrufs)
|
||||
cal ctrlp#utils#writecache(a:mrufs, s:cadir, s:cafile)
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#mrufiles#refresh(...)
|
||||
let s:mrufs = s:mergelists()
|
||||
cal filter(s:mrufs, '!empty(ctrlp#utils#glob(v:val, 1)) && !s:excl(v:val)')
|
||||
if exists('+ssl')
|
||||
cal map(s:mrufs, 'tr(v:val, "/", "\\")')
|
||||
cal filter(s:mrufs, 'count(s:mrufs, v:val) == 1')
|
||||
en
|
||||
cal s:savetofile(s:mrufs)
|
||||
retu a:0 && a:1 == 'raw' ? [] : s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#remove(files)
|
||||
let s:mrufs = []
|
||||
if a:files != []
|
||||
let s:mrufs = s:mergelists()
|
||||
cal filter(s:mrufs, 'index(a:files, v:val, 0, '.(!{s:cseno}).') < 0')
|
||||
en
|
||||
cal s:savetofile(s:mrufs)
|
||||
retu s:reformat(copy(s:mrufs))
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#add(fn)
|
||||
if !empty(a:fn)
|
||||
cal s:addtomrufs(a:fn)
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#list(...)
|
||||
retu a:0 ? a:1 == 'raw' ? s:mergelists() : 0 : s:reformat(s:mergelists())
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#bufs()
|
||||
retu s:mrbs
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#cachefile()
|
||||
if !exists('s:cadir') || !exists('s:cafile')
|
||||
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
|
||||
let s:cafile = s:cadir.ctrlp#utils#lash().'cache.txt'
|
||||
en
|
||||
retu s:cafile
|
||||
endf
|
||||
|
||||
fu! ctrlp#mrufiles#init()
|
||||
if !has('autocmd') | retu | en
|
||||
let s:locked = 0
|
||||
aug CtrlPMRUF
|
||||
au!
|
||||
au BufAdd,BufEnter,BufLeave,BufUnload * cal s:record(expand('<abuf>', 1))
|
||||
au QuickFixCmdPre *vimgrep* let s:locked = 1
|
||||
au QuickFixCmdPost *vimgrep* let s:locked = 0
|
||||
au VimLeavePre * cal s:savetofile(s:mergelists())
|
||||
aug END
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,59 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/quickfix.vim
|
||||
" Description: Quickfix extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_quickfix') && g:loaded_ctrlp_quickfix
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_quickfix = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#quickfix#init()',
|
||||
\ 'accept': 'ctrlp#quickfix#accept',
|
||||
\ 'lname': 'quickfix',
|
||||
\ 'sname': 'qfx',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
fu! s:lineout(dict)
|
||||
retu printf('%s|%d:%d| %s', bufname(a:dict['bufnr']), a:dict['lnum'],
|
||||
\ a:dict['col'], matchstr(a:dict['text'], '\s*\zs.*\S'))
|
||||
endf
|
||||
" Utilities {{{1
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPqfLineCol', 'Search')
|
||||
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#quickfix#init()
|
||||
cal s:syntax()
|
||||
retu map(getqflist(), 's:lineout(v:val)')
|
||||
endf
|
||||
|
||||
fu! ctrlp#quickfix#accept(mode, str)
|
||||
let vals = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
|
||||
if vals == [] || vals[1] == '' | retu | en
|
||||
cal ctrlp#acceptfile(a:mode, vals[1])
|
||||
let cur_pos = getpos('.')[1:2]
|
||||
if cur_pos != [1, 1] && cur_pos != map(vals[2:3], 'str2nr(v:val)')
|
||||
mark '
|
||||
en
|
||||
cal cursor(vals[2], vals[3])
|
||||
sil! norm! zvzz
|
||||
endf
|
||||
|
||||
fu! ctrlp#quickfix#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,59 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/rtscript.vim
|
||||
" Description: Runtime scripts extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_rtscript') && g:loaded_ctrlp_rtscript
|
||||
fini
|
||||
en
|
||||
let [g:loaded_ctrlp_rtscript, g:ctrlp_newrts] = [1, 0]
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#rtscript#init(s:caching)',
|
||||
\ 'accept': 'ctrlp#acceptfile',
|
||||
\ 'lname': 'runtime scripts',
|
||||
\ 'sname': 'rts',
|
||||
\ 'type': 'path',
|
||||
\ 'opmul': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
let s:filecounts = {}
|
||||
" Utilities {{{1
|
||||
fu! s:nocache()
|
||||
retu g:ctrlp_newrts ||
|
||||
\ !s:caching || ( s:caching > 1 && get(s:filecounts, s:cwd) < s:caching )
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#rtscript#init(caching)
|
||||
let [s:caching, s:cwd] = [a:caching, getcwd()]
|
||||
if s:nocache() ||
|
||||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[0] == &rtp )
|
||||
sil! cal ctrlp#progress('Indexing...')
|
||||
let entries = split(globpath(ctrlp#utils#fnesc(&rtp, 'g'), '**/*.*'), "\n")
|
||||
cal filter(entries, 'count(entries, v:val) == 1')
|
||||
let [entries, echoed] = [ctrlp#dirnfile(entries)[1], 1]
|
||||
el
|
||||
let [entries, results] = g:ctrlp_rtscache[2:3]
|
||||
en
|
||||
if s:nocache() ||
|
||||
\ !( exists('g:ctrlp_rtscache') && g:ctrlp_rtscache[:1] == [&rtp, s:cwd] )
|
||||
if !exists('echoed')
|
||||
sil! cal ctrlp#progress('Processing...')
|
||||
en
|
||||
let results = map(copy(entries), 'fnamemodify(v:val, '':.'')')
|
||||
en
|
||||
let [g:ctrlp_rtscache, g:ctrlp_newrts] = [[&rtp, s:cwd, entries, results], 0]
|
||||
cal extend(s:filecounts, { s:cwd : len(results) })
|
||||
retu results
|
||||
endf
|
||||
|
||||
fu! ctrlp#rtscript#id()
|
||||
retu s:id
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,125 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/tag.vim
|
||||
" Description: Tag file extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if exists('g:loaded_ctrlp_tag') && g:loaded_ctrlp_tag
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_tag = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#tag#init()',
|
||||
\ 'accept': 'ctrlp#tag#accept',
|
||||
\ 'lname': 'tags',
|
||||
\ 'sname': 'tag',
|
||||
\ 'enter': 'ctrlp#tag#enter()',
|
||||
\ 'type': 'tabs',
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
" Utilities {{{1
|
||||
fu! s:findcount(str)
|
||||
let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$')
|
||||
let tgs = taglist('^'.tg.'$')
|
||||
if len(tgs) < 2
|
||||
retu [1, 1]
|
||||
en
|
||||
let bname = fnamemodify(bufname('%'), ':p')
|
||||
let fname = expand(fnamemodify(simplify(fname), ':s?^[.\/]\+??:p:.'), 1)
|
||||
let [fnd, ct, pos, idx] = [0, 0, 0, 0]
|
||||
wh idx < len(tgs)
|
||||
if bname == fnamemodify(tgs[idx]["filename"], ':p')
|
||||
cal insert(tgs, remove(tgs, idx))
|
||||
brea
|
||||
en
|
||||
let idx += 1
|
||||
endw
|
||||
for each in tgs
|
||||
let ct += 1
|
||||
let fulname = fnamemodify(each["filename"], ':p')
|
||||
if stridx(fulname, fname) >= 0
|
||||
\ && strlen(fname) + stridx(fulname, fname) == strlen(fulname)
|
||||
let fnd += 1
|
||||
let pos = ct
|
||||
en
|
||||
if fnd > 1 | brea | en
|
||||
endfo
|
||||
retu [fnd, pos]
|
||||
endf
|
||||
|
||||
fu! s:filter(tags)
|
||||
let nr = 0
|
||||
wh 0 < 1
|
||||
if a:tags == [] | brea | en
|
||||
if a:tags[nr] =~ '^!' && a:tags[nr] !~# '^!_TAG_'
|
||||
let nr += 1
|
||||
con
|
||||
en
|
||||
if a:tags[nr] =~# '^!_TAG_' && len(a:tags) > nr
|
||||
cal remove(a:tags, nr)
|
||||
el
|
||||
brea
|
||||
en
|
||||
endw
|
||||
retu a:tags
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if !ctrlp#nosy()
|
||||
cal ctrlp#hicheck('CtrlPTabExtra', 'Comment')
|
||||
sy match CtrlPTabExtra '\zs\t.*\ze$'
|
||||
en
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#tag#init()
|
||||
if empty(s:tagfiles) | retu [] | en
|
||||
let g:ctrlp_alltags = []
|
||||
let tagfiles = sort(filter(s:tagfiles, 'count(s:tagfiles, v:val) == 1'))
|
||||
for each in tagfiles
|
||||
let alltags = s:filter(ctrlp#utils#readfile(each))
|
||||
cal extend(g:ctrlp_alltags, alltags)
|
||||
endfo
|
||||
cal s:syntax()
|
||||
retu g:ctrlp_alltags
|
||||
endf
|
||||
|
||||
fu! ctrlp#tag#accept(mode, str)
|
||||
cal ctrlp#exit()
|
||||
let str = matchstr(a:str, '^[^\t]\+\t\+[^\t]\+\ze\t')
|
||||
let [tg, fnd] = [split(str, '^[^\t]\+\zs\t')[0], s:findcount(str)]
|
||||
let cmds = {
|
||||
\ 't': ['tab sp', 'tab stj'],
|
||||
\ 'h': ['sp', 'stj'],
|
||||
\ 'v': ['vs', 'vert stj'],
|
||||
\ 'e': ['', 'tj'],
|
||||
\ }
|
||||
let cmd = fnd[0] == 1 ? cmds[a:mode][0] : cmds[a:mode][1]
|
||||
let cmd = a:mode == 'e' && ctrlp#modfilecond(!&aw)
|
||||
\ ? ( cmd == 'tj' ? 'stj' : 'sp' ) : cmd
|
||||
let cmd = a:mode == 't' ? ctrlp#tabcount().cmd : cmd
|
||||
if fnd[0] == 1
|
||||
if cmd != ''
|
||||
exe cmd
|
||||
en
|
||||
exe fnd[1].'ta' tg
|
||||
el
|
||||
exe cmd tg
|
||||
en
|
||||
cal ctrlp#setlcdir()
|
||||
endf
|
||||
|
||||
fu! ctrlp#tag#id()
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#tag#enter()
|
||||
let tfs = tagfiles()
|
||||
let s:tagfiles = tfs != [] ? filter(map(tfs, 'fnamemodify(v:val, ":p")'),
|
||||
\ 'filereadable(v:val)') : []
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,154 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/undo.vim
|
||||
" Description: Undo extension
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Init {{{1
|
||||
if ( exists('g:loaded_ctrlp_undo') && g:loaded_ctrlp_undo )
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp_undo = 1
|
||||
|
||||
cal add(g:ctrlp_ext_vars, {
|
||||
\ 'init': 'ctrlp#undo#init()',
|
||||
\ 'accept': 'ctrlp#undo#accept',
|
||||
\ 'lname': 'undo',
|
||||
\ 'sname': 'udo',
|
||||
\ 'enter': 'ctrlp#undo#enter()',
|
||||
\ 'exit': 'ctrlp#undo#exit()',
|
||||
\ 'type': 'line',
|
||||
\ 'sort': 0,
|
||||
\ 'nolim': 1,
|
||||
\ })
|
||||
|
||||
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
|
||||
|
||||
let s:text = map(['second', 'seconds', 'minutes', 'hours', 'days', 'weeks',
|
||||
\ 'months', 'years'], '" ".v:val." ago"')
|
||||
" Utilities {{{1
|
||||
fu! s:getundo()
|
||||
if exists('*undotree')
|
||||
\ && ( v:version > 703 || ( v:version == 703 && has('patch005') ) )
|
||||
retu [1, undotree()]
|
||||
el
|
||||
redi => result
|
||||
sil! undol
|
||||
redi END
|
||||
retu [0, split(result, "\n")[1:]]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:flatten(tree, cur)
|
||||
let flatdict = {}
|
||||
for each in a:tree
|
||||
let saved = has_key(each, 'save') ? 'saved' : ''
|
||||
let current = each['seq'] == a:cur ? 'current' : ''
|
||||
cal extend(flatdict, { each['seq'] : [each['time'], saved, current] })
|
||||
if has_key(each, 'alt')
|
||||
cal extend(flatdict, s:flatten(each['alt'], a:cur))
|
||||
en
|
||||
endfo
|
||||
retu flatdict
|
||||
endf
|
||||
|
||||
fu! s:elapsed(nr)
|
||||
let [text, time] = [s:text, localtime() - a:nr]
|
||||
let mins = time / 60
|
||||
let hrs = time / 3600
|
||||
let days = time / 86400
|
||||
let wks = time / 604800
|
||||
let mons = time / 2592000
|
||||
let yrs = time / 31536000
|
||||
if yrs > 1
|
||||
retu yrs.text[7]
|
||||
elsei mons > 1
|
||||
retu mons.text[6]
|
||||
elsei wks > 1
|
||||
retu wks.text[5]
|
||||
elsei days > 1
|
||||
retu days.text[4]
|
||||
elsei hrs > 1
|
||||
retu hrs.text[3]
|
||||
elsei mins > 1
|
||||
retu mins.text[2]
|
||||
elsei time == 1
|
||||
retu time.text[0]
|
||||
elsei time < 120
|
||||
retu time.text[1]
|
||||
en
|
||||
endf
|
||||
|
||||
fu! s:syntax()
|
||||
if ctrlp#nosy() | retu | en
|
||||
for [ke, va] in items({'T': 'Directory', 'Br': 'Comment', 'Nr': 'String',
|
||||
\ 'Sv': 'Comment', 'Po': 'Title'})
|
||||
cal ctrlp#hicheck('CtrlPUndo'.ke, va)
|
||||
endfo
|
||||
sy match CtrlPUndoT '\v\d+ \zs[^ ]+\ze|\d+:\d+:\d+'
|
||||
sy match CtrlPUndoBr '\[\|\]'
|
||||
sy match CtrlPUndoNr '\[\d\+\]' contains=CtrlPUndoBr
|
||||
sy match CtrlPUndoSv 'saved'
|
||||
sy match CtrlPUndoPo 'current'
|
||||
endf
|
||||
|
||||
fu! s:dict2list(dict)
|
||||
for ke in keys(a:dict)
|
||||
let a:dict[ke][0] = s:elapsed(a:dict[ke][0])
|
||||
endfo
|
||||
retu map(keys(a:dict), 'eval(''[v:val, a:dict[v:val]]'')')
|
||||
endf
|
||||
|
||||
fu! s:compval(...)
|
||||
retu a:2[0] - a:1[0]
|
||||
endf
|
||||
|
||||
fu! s:format(...)
|
||||
let saved = !empty(a:1[1][1]) ? ' '.a:1[1][1] : ''
|
||||
let current = !empty(a:1[1][2]) ? ' '.a:1[1][2] : ''
|
||||
retu a:1[1][0].' ['.a:1[0].']'.saved.current
|
||||
endf
|
||||
|
||||
fu! s:formatul(...)
|
||||
let parts = matchlist(a:1,
|
||||
\ '\v^\s+(\d+)\s+\d+\s+([^ ]+\s?[^ ]+|\d+\s\w+\s\w+)(\s*\d*)$')
|
||||
retu parts == [] ? '----'
|
||||
\ : parts[2].' ['.parts[1].']'.( parts[3] != '' ? ' saved' : '' )
|
||||
endf
|
||||
" Public {{{1
|
||||
fu! ctrlp#undo#init()
|
||||
let entries = s:undos[0] ? s:undos[1]['entries'] : s:undos[1]
|
||||
if empty(entries) | retu [] | en
|
||||
if !exists('s:lines')
|
||||
if s:undos[0]
|
||||
let entries = s:dict2list(s:flatten(entries, s:undos[1]['seq_cur']))
|
||||
let s:lines = map(sort(entries, 's:compval'), 's:format(v:val)')
|
||||
el
|
||||
let s:lines = map(reverse(entries), 's:formatul(v:val)')
|
||||
en
|
||||
en
|
||||
cal s:syntax()
|
||||
retu s:lines
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#accept(mode, str)
|
||||
let undon = matchstr(a:str, '\[\zs\d\+\ze\]')
|
||||
if empty(undon) | retu | en
|
||||
cal ctrlp#exit()
|
||||
exe 'u' undon
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#id()
|
||||
retu s:id
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#enter()
|
||||
let s:undos = s:getundo()
|
||||
endf
|
||||
|
||||
fu! ctrlp#undo#exit()
|
||||
unl! s:lines
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
|
@ -1,120 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: autoload/ctrlp/utils.vim
|
||||
" Description: Utilities
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
|
||||
" Static variables {{{1
|
||||
fu! ctrlp#utils#lash()
|
||||
retu &ssl || !exists('+ssl') ? '/' : '\'
|
||||
endf
|
||||
|
||||
fu! s:lash(...)
|
||||
retu ( a:0 ? a:1 : getcwd() ) !~ '[\/]$' ? s:lash : ''
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#opts()
|
||||
let s:lash = ctrlp#utils#lash()
|
||||
let usrhome = $HOME.s:lash($HOME)
|
||||
let cahome = exists('$XDG_CACHE_HOME') ? $XDG_CACHE_HOME : usrhome.'.cache'
|
||||
let cadir = isdirectory(usrhome.'.ctrlp_cache')
|
||||
\ ? usrhome.'.ctrlp_cache' : cahome.s:lash(cahome).'ctrlp'
|
||||
if exists('g:ctrlp_cache_dir')
|
||||
let cadir = expand(g:ctrlp_cache_dir, 1)
|
||||
if isdirectory(cadir.s:lash(cadir).'.ctrlp_cache')
|
||||
let cadir = cadir.s:lash(cadir).'.ctrlp_cache'
|
||||
en
|
||||
en
|
||||
let s:cache_dir = cadir
|
||||
endf
|
||||
cal ctrlp#utils#opts()
|
||||
|
||||
let s:wig_cond = v:version > 702 || ( v:version == 702 && has('patch051') )
|
||||
" Files and Directories {{{1
|
||||
fu! ctrlp#utils#cachedir()
|
||||
retu s:cache_dir
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#cachefile(...)
|
||||
let [tail, dir] = [a:0 == 1 ? '.'.a:1 : '', a:0 == 2 ? a:1 : getcwd()]
|
||||
let cache_file = substitute(dir, '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
|
||||
retu a:0 == 1 ? cache_file : s:cache_dir.s:lash(s:cache_dir).cache_file
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#readfile(file)
|
||||
if filereadable(a:file)
|
||||
let data = readfile(a:file)
|
||||
if empty(data) || type(data) != 3
|
||||
unl data
|
||||
let data = []
|
||||
en
|
||||
retu data
|
||||
en
|
||||
retu []
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#mkdir(dir)
|
||||
if exists('*mkdir') && !isdirectory(a:dir)
|
||||
sil! cal mkdir(a:dir, 'p')
|
||||
en
|
||||
retu a:dir
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#writecache(lines, ...)
|
||||
if isdirectory(ctrlp#utils#mkdir(a:0 ? a:1 : s:cache_dir))
|
||||
sil! cal writefile(a:lines, a:0 >= 2 ? a:2 : ctrlp#utils#cachefile())
|
||||
en
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#glob(...)
|
||||
let path = ctrlp#utils#fnesc(a:1, 'g')
|
||||
retu s:wig_cond ? glob(path, a:2) : glob(path)
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#globpath(...)
|
||||
retu call('globpath', s:wig_cond ? a:000 : a:000[:1])
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#fnesc(path, type, ...)
|
||||
if exists('*fnameescape')
|
||||
if exists('+ssl')
|
||||
if a:type == 'c'
|
||||
let path = escape(a:path, '%#')
|
||||
elsei a:type == 'f'
|
||||
let path = fnameescape(a:path)
|
||||
elsei a:type == 'g'
|
||||
let path = escape(a:path, '?*')
|
||||
en
|
||||
let path = substitute(path, '[', '[[]', 'g')
|
||||
el
|
||||
let path = fnameescape(a:path)
|
||||
en
|
||||
el
|
||||
if exists('+ssl')
|
||||
if a:type == 'c'
|
||||
let path = escape(a:path, '%#')
|
||||
elsei a:type == 'f'
|
||||
let path = escape(a:path, " \t\n%#*?|<\"")
|
||||
elsei a:type == 'g'
|
||||
let path = escape(a:path, '?*')
|
||||
en
|
||||
let path = substitute(path, '[', '[[]', 'g')
|
||||
el
|
||||
let path = escape(a:path, " \t\n*?[{`$\\%#'\"|!<")
|
||||
en
|
||||
en
|
||||
retu a:0 ? escape(path, a:1) : path
|
||||
endf
|
||||
|
||||
fu! ctrlp#utils#dircompl(...)
|
||||
let [hsl, str] = [match(a:1, '[\/]'), '']
|
||||
let par = substitute(a:1, '[^\/]*$', '', '')
|
||||
let path = !hsl ? par : hsl > 0 ? getcwd().s:lash().par : getcwd()
|
||||
for dir in split(globpath(ctrlp#utils#fnesc(path, 'g', ','), '*/'), '\n')
|
||||
let str .= par.split(dir, '[\/]')[-1]."\n"
|
||||
endfo
|
||||
retu str
|
||||
endf
|
||||
"}}}
|
||||
|
||||
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2
|
File diff suppressed because it is too large
Load Diff
|
@ -1,69 +0,0 @@
|
|||
" =============================================================================
|
||||
" File: plugin/ctrlp.vim
|
||||
" Description: Fuzzy file, buffer, mru, tag, etc finder.
|
||||
" Author: Kien Nguyen <github.com/kien>
|
||||
" =============================================================================
|
||||
" GetLatestVimScripts: 3736 1 :AutoInstall: ctrlp.zip
|
||||
|
||||
if ( exists('g:loaded_ctrlp') && g:loaded_ctrlp ) || v:version < 700 || &cp
|
||||
fini
|
||||
en
|
||||
let g:loaded_ctrlp = 1
|
||||
|
||||
let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
||||
\ g:ctrlp_allmixes, g:ctrlp_buftags, g:ctrlp_ext_vars, g:ctrlp_builtins]
|
||||
\ = [[], [], [], [], {}, {}, [], 2]
|
||||
|
||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||
|
||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlP
|
||||
\ cal ctrlp#init(0, { 'dir': <q-args> })
|
||||
|
||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPMRUFiles
|
||||
\ cal ctrlp#init(2, { 'dir': <q-args> })
|
||||
|
||||
com! -bar CtrlPBuffer cal ctrlp#init(1)
|
||||
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
|
||||
|
||||
com! -bar CtrlPClearCache cal ctrlp#clr()
|
||||
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
|
||||
|
||||
com! -bar ClearCtrlPCache cal ctrlp#clr()
|
||||
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
|
||||
|
||||
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
|
||||
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
|
||||
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
|
||||
|
||||
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
|
||||
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
|
||||
en
|
||||
|
||||
cal ctrlp#mrufiles#init()
|
||||
|
||||
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||
|
||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPDir
|
||||
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
|
||||
|
||||
com! -n=? -com=buffer CtrlPBufTag
|
||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
||||
|
||||
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||
|
||||
com! -n=? -com=buffer CtrlPChange
|
||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||
|
||||
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
||||
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
|
||||
|
||||
com! -n=? -com=custom,ctrlp#utils#dircompl CtrlPBookmarkDirAdd
|
||||
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
|
||||
|
||||
" vim:ts=2:sw=2:sts=2
|
|
@ -1,86 +0,0 @@
|
|||
# ctrlp.vim
|
||||
Full path fuzzy __file__, __buffer__, __mru__, __tag__, __...__ finder for Vim.
|
||||
|
||||
* Written in pure Vimscript for MacVim, gVim and Vim 7.0+.
|
||||
* Full support for Vim's regexp as search patterns.
|
||||
* Built-in Most Recently Used (MRU) files monitoring.
|
||||
* Built-in project's root finder.
|
||||
* Open multiple files at once.
|
||||
* Create new files and directories.
|
||||
* [Extensible][2].
|
||||
|
||||
![ctrlp][1]
|
||||
|
||||
## Basic Usage
|
||||
* Run `:CtrlP` or `:CtrlP [starting-directory]` to invoke CtrlP in find file mode.
|
||||
* Run `:CtrlPBuffer` or `:CtrlPMRU` to invoke CtrlP in find buffer or find MRU file mode.
|
||||
* Run `:CtrlPMixed` to search in Files, Buffers and MRU files at the same time.
|
||||
|
||||
Check `:help ctrlp-commands` and `:help ctrlp-extensions` for other commands.
|
||||
|
||||
##### Once CtrlP is open:
|
||||
* Press `<F5>` to purge the cache for the current directory to get new files, remove deleted files and apply new ignore options.
|
||||
* Press `<c-f>` and `<c-b>` to cycle between modes.
|
||||
* Press `<c-d>` to switch to filename only search instead of full path.
|
||||
* Press `<c-r>` to switch to regexp mode.
|
||||
* Use `<c-n>`, `<c-p>` to select the next/previous string in the prompt's history.
|
||||
* Use `<c-y>` to create a new file and its parent directories.
|
||||
* Use `<c-z>` to mark/unmark multiple files and `<c-o>` to open them.
|
||||
|
||||
Run `:help ctrlp-mappings` or submit `?` in CtrlP for more mapping help.
|
||||
|
||||
* Submit two or more dots `..` to go up the directory tree by one or multiple levels.
|
||||
* End the input string with a colon `:` followed by a command to execute it on the opening file(s):
|
||||
Use `:25` to jump to line 25.
|
||||
Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 files.
|
||||
|
||||
## Basic Options
|
||||
* Change the default mapping and the default command to invoke CtrlP:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_map = '<c-p>'
|
||||
let g:ctrlp_cmd = 'CtrlP'
|
||||
```
|
||||
|
||||
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_working_path_mode = 'ra'
|
||||
```
|
||||
|
||||
`'c'` - the directory of the current file.
|
||||
`'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
|
||||
`'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
|
||||
`0` or `''` (empty string) - disable this feature.
|
||||
|
||||
Define additional root markers with the `g:ctrlp_root_markers` option.
|
||||
|
||||
* Exclude files and directories using Vim's `wildignore` and CtrlP's own `g:ctrlp_custom_ignore`:
|
||||
|
||||
```vim
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
||||
set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
|
||||
|
||||
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\v[\/]\.(git|hg|svn)$',
|
||||
\ 'file': '\v\.(exe|so|dll)$',
|
||||
\ 'link': 'some_bad_symbolic_links',
|
||||
\ }
|
||||
```
|
||||
|
||||
* Use a custom file listing command:
|
||||
|
||||
```vim
|
||||
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
|
||||
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
|
||||
```
|
||||
|
||||
Check `:help ctrlp-options` for other options.
|
||||
|
||||
## Installation
|
||||
Use your favorite method or check the homepage for a [quick installation guide][3].
|
||||
|
||||
[1]: http://i.imgur.com/yIynr.png
|
||||
[2]: https://github.com/kien/ctrlp.vim/tree/extensions
|
||||
[3]: http://kien.github.com/ctrlp.vim#installation
|
1
vim/bundle/ctrlp.vim
Submodule
1
vim/bundle/ctrlp.vim
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f
|
2
vim/ftdetect/scala.vim
Normal file
2
vim/ftdetect/scala.vim
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
au BufRead,BufNewFile *.scala set filetype=scala
|
103
vim/indent/scala.vim
Normal file
103
vim/indent/scala.vim
Normal file
|
@ -0,0 +1,103 @@
|
|||
" Vim indent file
|
||||
" Language : Scala (http://scala-lang.org/)
|
||||
" Maintainer : Stefan Matthias Aust
|
||||
" Last Change: 2006 Apr 13
|
||||
|
||||
if exists("b:did_indent")
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal indentexpr=GetScalaIndent()
|
||||
|
||||
setlocal indentkeys=0{,0},0),!^F,<>>,o,O
|
||||
|
||||
setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab
|
||||
|
||||
if exists("*GetScalaIndent")
|
||||
finish
|
||||
endif
|
||||
|
||||
function! CountParens(line)
|
||||
let line = substitute(a:line, '"\(.\|\\"\)*"', '', 'g')
|
||||
let open = substitute(line, '[^(]', '', 'g')
|
||||
let close = substitute(line, '[^)]', '', 'g')
|
||||
return strlen(open) - strlen(close)
|
||||
endfunction
|
||||
|
||||
function! GetScalaIndent()
|
||||
" Find a non-blank line above the current line.
|
||||
let lnum = prevnonblank(v:lnum - 1)
|
||||
|
||||
" Hit the start of the file, use zero indent.
|
||||
if lnum == 0
|
||||
return 0
|
||||
endif
|
||||
|
||||
let ind = indent(lnum)
|
||||
let prevline = getline(lnum)
|
||||
|
||||
"Indent html literals
|
||||
if prevline !~ '/>\s*$' && prevline =~ '^\s*<[a-zA-Z][^>]*>\s*$'
|
||||
return ind + &shiftwidth
|
||||
endif
|
||||
|
||||
" Add a 'shiftwidth' after lines that start a block
|
||||
" If if, for or while end with ), this is a one-line block
|
||||
" If val, var, def end with =, this is a one-line block
|
||||
if prevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\)\>.*[)]\s*$'
|
||||
\ || prevline =~ '^\s*\<\(\(va[lr]\|def\)\>.*[=]\s*$'
|
||||
\ || prevline =~ '^\s*\<else\>\s*$'
|
||||
\ || prevline =~ '{\s*$'
|
||||
let ind = ind + &shiftwidth
|
||||
endif
|
||||
|
||||
" If parenthesis are unbalanced, indent or dedent
|
||||
let c = CountParens(prevline)
|
||||
echo c
|
||||
if c > 0
|
||||
let ind = ind + &shiftwidth
|
||||
elseif c < 0
|
||||
let ind = ind - &shiftwidth
|
||||
endif
|
||||
|
||||
" Dedent after if, for, while and val, var, def without block
|
||||
let pprevline = getline(prevnonblank(lnum - 1))
|
||||
if pprevline =~ '^\s*\<\(\(else\s\+\)\?if\|for\|while\)\>.*[)]\s*$'
|
||||
\ || pprevline =~ '^\s*\<\(\va[lr]\|def\)\>.*[=]\s*$'
|
||||
\ || pprevline =~ '^\s*\<else\>\s*$'
|
||||
let ind = ind - &shiftwidth
|
||||
endif
|
||||
|
||||
" Align 'for' clauses nicely
|
||||
if prevline =~ '^\s*\<for\> (.*;\s*$'
|
||||
let ind = ind - &shiftwidth + 5
|
||||
endif
|
||||
|
||||
" Subtract a 'shiftwidth' on '}' or html
|
||||
let thisline = getline(v:lnum)
|
||||
if thisline =~ '^\s*[})]'
|
||||
\ || thisline =~ '^\s*</[a-zA-Z][^>]*>'
|
||||
let ind = ind - &shiftwidth
|
||||
endif
|
||||
|
||||
" Indent multi-lines comments
|
||||
if prevline =~ '^\s*\/\*\($\|[^*]\(\(\*\/\)\@!.\)*$\)'
|
||||
let ind = ind + 1
|
||||
endif
|
||||
|
||||
" Indent multi-lines ScalaDoc
|
||||
if prevline =~ '^\s*\/\*\*\($\|[^*]\(\(\*\/\)\@!.\)*$\)'
|
||||
let ind = ind + 2
|
||||
endif
|
||||
|
||||
" Dedent after multi-lines comments & ScalaDoc
|
||||
if prevline =~ '^\s*\(\(\/\*\)\@!.\)*\*\/.*$'
|
||||
" Dedent 1
|
||||
let ind = ind - 1
|
||||
" Align to any multiple of 'shiftwidth'
|
||||
let ind = ind - (ind % &shiftwidth)
|
||||
endif
|
||||
|
||||
return ind
|
||||
endfunction
|
151
vim/syntax/scala.vim
Normal file
151
vim/syntax/scala.vim
Normal file
|
@ -0,0 +1,151 @@
|
|||
" Vim syntax file
|
||||
" Language : Scala (http://scala-lang.org/)
|
||||
" Maintainers: Stefan Matthias Aust, Julien Wetterwald
|
||||
" Last Change: 2007 June 13
|
||||
|
||||
if version < 600
|
||||
syntax clear
|
||||
elseif exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=50
|
||||
|
||||
" most Scala keywords
|
||||
syn keyword scalaKeyword abstract case catch do else extends final finally for forSome if implicit lazy match new null override private protected requires return sealed super this throw try type while with yield
|
||||
syn match scalaKeyword "=>"
|
||||
syn match scalaKeyword "<-"
|
||||
syn match scalaKeyword "\<_\>"
|
||||
|
||||
syn match scalaOperator ":\{2,\}" "this is not a type
|
||||
|
||||
" package and import statements
|
||||
syn keyword scalaPackage package nextgroup=scalaFqn skipwhite
|
||||
syn keyword scalaImport import nextgroup=scalaFqn skipwhite
|
||||
syn match scalaFqn "\<[._$a-zA-Z0-9,]*" contained nextgroup=scalaFqnSet
|
||||
syn region scalaFqnSet start="{" end="}" contained
|
||||
|
||||
" boolean literals
|
||||
syn keyword scalaBoolean true false
|
||||
|
||||
" definitions
|
||||
syn keyword scalaDef def nextgroup=scalaDefName skipwhite
|
||||
syn keyword scalaVal val nextgroup=scalaValName skipwhite
|
||||
syn keyword scalaVar var nextgroup=scalaVarName skipwhite
|
||||
syn keyword scalaClass class nextgroup=scalaClassName skipwhite
|
||||
syn keyword scalaObject object nextgroup=scalaClassName skipwhite
|
||||
syn keyword scalaTrait trait nextgroup=scalaClassName skipwhite
|
||||
syn match scalaDefName "[^ =:;([]\+" contained nextgroup=scalaDefSpecializer skipwhite
|
||||
syn match scalaValName "[^ =:;([]\+" contained
|
||||
syn match scalaVarName "[^ =:;([]\+" contained
|
||||
syn match scalaClassName "[^ =:;(\[]\+" contained nextgroup=scalaClassSpecializer skipwhite
|
||||
syn region scalaDefSpecializer start="\[" end="\]" contained contains=scalaDefSpecializer
|
||||
syn region scalaClassSpecializer start="\[" end="\]" contained contains=scalaClassSpecializer
|
||||
|
||||
" type constructor (actually anything with an uppercase letter)
|
||||
syn match scalaConstructor "\<[A-Z][_$a-zA-Z0-9]*\>" nextgroup=scalaConstructorSpecializer
|
||||
syn region scalaConstructorSpecializer start="\[" end="\]" contained contains=scalaConstructorSpecializer
|
||||
|
||||
" method call
|
||||
syn match scalaRoot "\<[a-zA-Z][_$a-zA-Z0-9]*\."me=e-1
|
||||
syn match scalaMethodCall "\.[a-z][_$a-zA-Z0-9]*"ms=s+1
|
||||
|
||||
" type declarations in val/var/def
|
||||
syn match scalaType ":\s*\(=>\s*\)\?[._$a-zA-Z0-9]\+\(\[[^]]*\]\+\)\?\(\s*\(<:\|>:\|#\|=>\)\s*[._$a-zA-Z0-9]\+\(\[[^]]*\]\+\)*\)*"ms=s+1
|
||||
|
||||
" comments
|
||||
syn match scalaTodo "[tT][oO][dD][oO]" contained
|
||||
syn match scalaLineComment "//.*" contains=scalaTodo
|
||||
syn region scalaComment start="/\*" end="\*/" contains=scalaTodo
|
||||
syn case ignore
|
||||
syn include @scalaHtml syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
syn case match
|
||||
syn region scalaDocComment start="/\*\*" end="\*/" contains=scalaDocTags,scalaTodo,@scalaHtml keepend
|
||||
syn region scalaDocTags start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" contained
|
||||
syn match scalaDocTags "@[a-z]\+" contained
|
||||
|
||||
syn match scalaEmptyString "\"\""
|
||||
|
||||
" multi-line string literals
|
||||
syn region scalaMultiLineString start="\"\"\"" end="\"\"\"" contains=scalaUnicode
|
||||
syn match scalaUnicode "\\u[0-9a-fA-F]\{4}" contained
|
||||
|
||||
" string literals with escapes
|
||||
syn region scalaString start="\"[^"]" skip="\\\"" end="\"" contains=scalaStringEscape " TODO end \n or not?
|
||||
syn match scalaStringEscape "\\u[0-9a-fA-F]\{4}" contained
|
||||
syn match scalaStringEscape "\\[nrfvb\\\"]" contained
|
||||
|
||||
" symbol and character literals
|
||||
syn match scalaSymbol "'[_a-zA-Z0-9][_a-zA-Z0-9]*\>"
|
||||
syn match scalaChar "'[^'\\]'\|'\\.'\|'\\u[0-9a-fA-F]\{4}'"
|
||||
|
||||
" number literals
|
||||
syn match scalaNumber "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
|
||||
syn match scalaNumber "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
|
||||
syn match scalaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
|
||||
syn match scalaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
|
||||
|
||||
" xml literals
|
||||
syn match scalaXmlTag "<[a-zA-Z]\_[^>]*/>" contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString
|
||||
syn region scalaXmlString start="\"" end="\"" contained
|
||||
syn match scalaXmlStart "<[a-zA-Z]\_[^>]*>" contained contains=scalaXmlQuote,scalaXmlEscape,scalaXmlString
|
||||
syn region scalaXml start="<\([a-zA-Z]\_[^>]*\_[^/]\|[a-zA-Z]\)>" matchgroup=scalaXmlStart end="</\_[^>]\+>" contains=scalaXmlEscape,scalaXmlQuote,scalaXml,scalaXmlStart,scalaXmlComment
|
||||
syn region scalaXmlEscape matchgroup=scalaXmlEscapeSpecial start="{" matchgroup=scalaXmlEscapeSpecial end="}" contained contains=TOP
|
||||
syn match scalaXmlQuote "&[^;]\+;" contained
|
||||
syn match scalaXmlComment "<!--\_[^>]*-->" contained
|
||||
|
||||
syn sync fromstart
|
||||
|
||||
" map Scala groups to standard groups
|
||||
hi link scalaKeyword Keyword
|
||||
hi link scalaPackage Include
|
||||
hi link scalaImport Include
|
||||
hi link scalaBoolean Boolean
|
||||
hi link scalaOperator Normal
|
||||
hi link scalaNumber Number
|
||||
hi link scalaEmptyString String
|
||||
hi link scalaString String
|
||||
hi link scalaChar String
|
||||
hi link scalaMultiLineString String
|
||||
hi link scalaStringEscape Special
|
||||
hi link scalaSymbol Special
|
||||
hi link scalaUnicode Special
|
||||
hi link scalaComment Comment
|
||||
hi link scalaLineComment Comment
|
||||
hi link scalaDocComment Comment
|
||||
hi link scalaDocTags Special
|
||||
hi link scalaTodo Todo
|
||||
hi link scalaType Type
|
||||
hi link scalaTypeSpecializer scalaType
|
||||
hi link scalaXml String
|
||||
hi link scalaXmlTag Include
|
||||
hi link scalaXmlString String
|
||||
hi link scalaXmlStart Include
|
||||
hi link scalaXmlEscape Normal
|
||||
hi link scalaXmlEscapeSpecial Special
|
||||
hi link scalaXmlQuote Special
|
||||
hi link scalaXmlComment Comment
|
||||
hi link scalaDef Keyword
|
||||
hi link scalaVar Keyword
|
||||
hi link scalaVal Keyword
|
||||
hi link scalaClass Keyword
|
||||
hi link scalaObject Keyword
|
||||
hi link scalaTrait Keyword
|
||||
hi link scalaDefName Function
|
||||
hi link scalaDefSpecializer Function
|
||||
hi link scalaClassName Special
|
||||
hi link scalaClassSpecializer Special
|
||||
hi link scalaConstructor Special
|
||||
hi link scalaConstructorSpecializer scalaConstructor
|
||||
|
||||
let b:current_syntax = "scala"
|
||||
|
||||
" you might like to put these lines in your .vimrc
|
||||
"
|
||||
" customize colors a little bit (should be a different file)
|
||||
" hi scalaNew gui=underline
|
||||
" hi scalaMethodCall gui=italic
|
||||
" hi scalaValName gui=underline
|
||||
" hi scalaVarName gui=underline
|
37
vimrc
37
vimrc
|
@ -6,23 +6,24 @@ let mapleader=","
|
|||
call pathogen#infect()
|
||||
call pathogen#helptags()
|
||||
|
||||
" ctrlp.vim Config
|
||||
set runtimepath^=~/.vim/bundle/ctrlp.vim
|
||||
let g:ctrlp_map = '<leader>ff'
|
||||
let g:ctrlp_cmd = 'CtrlP'
|
||||
let g:ctrlp_custom_ignore = 'public\|node_modules\|DS_Store\|lightscampusaction\|git|*.pyc'
|
||||
map <leader>fr :call ShowRoutes()<cr>
|
||||
map <leader>fv :CtrlP app/views<cr>
|
||||
map <leader>fc :CtrlP app/controllers<cr>
|
||||
map <leader>fm :CtrlP app/models<cr>
|
||||
map <leader>fh :CtrlP app/helpers<cr>
|
||||
map <leader>fl :CtrlP lib<cr>
|
||||
map <leader>fp :CtrlP vendor/plugins<cr>
|
||||
map <leader>fs :CtrlP spec<cr>
|
||||
map <leader>ft :CtrlP test<cr>
|
||||
map <leader>fa :CtrlP app/assets<cr>
|
||||
map <leader>fj :CtrlP app/assets/javascripts<cr>
|
||||
nnoremap <silent> <leader>fr :ClearCtrlPCache<cr>\|:CtrlP<cr>
|
||||
" Run a given vim command on the results of fuzzy selecting from a given shell
|
||||
" command. See usage below.
|
||||
function! SelectaCommand(choice_command, selecta_args, vim_command)
|
||||
try
|
||||
silent let selection = system(a:choice_command . " | selecta " . a:selecta_args)
|
||||
catch /Vim:Interrupt/
|
||||
" Swallow the ^C so that the redraw below happens; otherwise there will be
|
||||
" leftovers from selecta on the screen
|
||||
redraw!
|
||||
return
|
||||
endtry
|
||||
redraw!
|
||||
exec a:vim_command . " " . selection
|
||||
endfunction
|
||||
|
||||
" Find all files in all non-dot directories starting in the working directory.
|
||||
" Fuzzy select one of those. Open the selected file with :e.
|
||||
nnoremap <leader>ff :call SelectaCommand("find * -type f", "", ":e")<cr>
|
||||
|
||||
" # NERDtree
|
||||
nmap <leader>d :NERDTreeToggle<CR>
|
||||
|
@ -268,7 +269,7 @@ function! PromoteToLet()
|
|||
:normal ==
|
||||
endfunction
|
||||
:command! PromoteToLet :call PromoteToLet()
|
||||
:map <leader>pp :PromoteToLet<cr>
|
||||
:map <leader>pl :PromoteToLet<cr>
|
||||
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" RUNNING TESTS
|
||||
|
|
25
zsh/aliases
25
zsh/aliases
|
@ -25,6 +25,8 @@ alias be='bundle exec'
|
|||
alias bi='bundle install'
|
||||
alias be='bundle exec'
|
||||
alias beg='bundle exec guard'
|
||||
alias bl='brew link --overwrite'
|
||||
alias bld='brew link --overwrite --dry-run'
|
||||
alias bower='noglob bower'
|
||||
alias bu='bundle update'
|
||||
alias bo='bundle open'
|
||||
|
@ -40,6 +42,8 @@ alias dr='cd ~/Dropbox'
|
|||
alias duh='du -csh'
|
||||
alias functions='vim ~/.dotfiles/zsh/functions'
|
||||
alias f='fg'
|
||||
alias gib='gem install bundler'
|
||||
alias gems='cd ~/pcg/gems'
|
||||
alias history='fc -l 1'
|
||||
alias histroy='history'
|
||||
alias h='heroku'
|
||||
|
@ -52,6 +56,7 @@ alias rbg='rbenv gemset active'
|
|||
alias rbp='cd $RBENV_PATH/versions/$(rbenv version | sed -e "s/ (set.*$//")'
|
||||
alias rbl='cd $RBENV_PATH/versions/$(rbenv version | sed -e "s/ (set.*$//")/lib/ruby'
|
||||
alias rg='rails generate'
|
||||
alias rl='reload'
|
||||
alias rmr='rm -rf'
|
||||
alias rc='rails console'
|
||||
alias rs='rails server'
|
||||
|
@ -80,13 +85,14 @@ alias gaa='git add -A'
|
|||
alias gau='git add --update'
|
||||
alias gb='git branch'
|
||||
alias gbd='git branch -D'
|
||||
alias gbl='git branch --all'
|
||||
alias gc='git commit'
|
||||
alias gcl='git clone'
|
||||
alias gcm="git commit -m"
|
||||
alias gco='git checkout'
|
||||
alias gcob='git checkout -b'
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpn='git cherry-pick -n'
|
||||
alias gcps='git cherry-pick -n'
|
||||
alias gd='git diff'
|
||||
alias gdc='git diff --cached'
|
||||
alias gdm='git diff master'
|
||||
|
@ -108,6 +114,7 @@ alias gmff='git merge --ff-only'
|
|||
alias gmffs='git merge --ff-only --squash'
|
||||
alias gmtheirs='git merge -Xtheirs'
|
||||
alias gp='git push'
|
||||
alias gpa='git push && echo "pushing tags..." && git push --tags'
|
||||
alias gpd='git push && git push heroku master'
|
||||
alias gpdf='gpf && gphf'
|
||||
alias gpp='git push && git push production HEAD:production'
|
||||
|
@ -122,12 +129,14 @@ alias gpl='git pull'
|
|||
alias gpo='git push origin'
|
||||
alias gpom='git push origin master'
|
||||
alias gpr='git pull --rebase'
|
||||
alias gpt='git push --tags'
|
||||
alias gr='git reset'
|
||||
alias grb='git rebase'
|
||||
alias grba='git rebase --abort'
|
||||
alias grbc='git rebase --continue'
|
||||
alias grbi='git rebase -i'
|
||||
alias grbm='git fetch origin master && git rebase master'
|
||||
alias grbmi='git fetch origin master && git rebase master -i'
|
||||
alias grbo='git fetch origin master && git rebase origin/master'
|
||||
alias gre='git remote'
|
||||
alias gref='git reflog'
|
||||
|
@ -142,20 +151,23 @@ alias gss='git stash save'
|
|||
alias gsd='git stash drop'
|
||||
alias gsl='git stash list'
|
||||
alias gsp='git stash pop'
|
||||
alias gt='git tag'
|
||||
alias gta='git tag -a'
|
||||
alias gtd='git tag -d'
|
||||
alias gtl='git tag -l'
|
||||
alias gx='git reset --hard'
|
||||
alias gxx='git reset --hard HEAD~1 && git pull --ff-only'
|
||||
|
||||
# Notes
|
||||
alias art='cd ~/Dropbox/notes/art'
|
||||
alias bucket='cd ~/Dropbox/notes/buckets'
|
||||
alias completion='cd ~/Dropbox/notes/daily/daily-log/completion-list'
|
||||
alias daily='cd ~/Dropbox/notes/daily'
|
||||
alias guide='vim ~/Dropbox/notes/daily/DAILY_GUIDE'
|
||||
alias daily='cd ~/Dropbox/notes/daily/daily-log'
|
||||
alias log='cd ~/Dropbox/notes/daily/daily-log'
|
||||
alias notes='cd ~/Dropbox/notes'
|
||||
alias pn='vim ~/Dropbox/notes/project-notes'
|
||||
alias powerup='vim ~/Dropbox/notes/code/powerup'
|
||||
alias sharp='vim ~/Dropbox/notes/sharpening-notes'
|
||||
alias todo='vim ~/Dropbox/notes/daily/todo'
|
||||
alias writing='cd ~/Dropbox/notes/writing'
|
||||
|
||||
# Projects
|
||||
alias projects='cd ~/code/projects'
|
||||
|
@ -164,10 +176,7 @@ alias weba='cd ~/code/projects/websites/michael.is/angular'
|
|||
alias dot='cd ~/code/projects/dotfiles'
|
||||
alias work='cd ~/code/work'
|
||||
alias learn='cd ~/code/learning-area'
|
||||
alias robo='cd ~/code/projects/robocoin'
|
||||
alias roboa='cd ~/code/projects/robocoin/angular'
|
||||
alias pcg='cd ~/code/work/pcg'
|
||||
alias cur='cd ~/code/projects/things'
|
||||
|
||||
# Work
|
||||
alias pcgt='vim ~/code/work/pcg/files/time-tracker.txt'
|
||||
|
|
|
@ -73,3 +73,15 @@ function run_quirk() {
|
|||
quirk
|
||||
}
|
||||
|
||||
function bump_gem_version {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "usage: $0 <version>"
|
||||
else
|
||||
echo "Committing version bump"
|
||||
git add . && git commit -m "Version ${1}"
|
||||
echo "Creating tag v$1"
|
||||
git tag -a v${1} -m "Tagging v${1}"
|
||||
git push origin && git push origin --tags
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
11
zshrc
11
zshrc
|
@ -27,7 +27,7 @@ export TERM=xterm-256color
|
|||
export EDITOR=vi
|
||||
|
||||
# Grep tweaks
|
||||
export GREP_OPTIONS="-nRi --color --exclude-dir=.git --exclude-dir=tmp --exclude-dir=public --exclude-dir=log --exclude-dir=node_modules --exclude-dir=bower_components --exclude-dir=coverage --exclude-dir=.bundle" # --exclude-dir=vendor/assets --exclude-dir=fonts --exclude-dir=images --exclude-dir=coverage --exclude-dir=rdoc"
|
||||
export GREP_OPTIONS="-nRi --color --exclude-dir=.git --exclude-dir=tmp --exclude-dir=public --exclude-dir=log --exclude-dir=node_modules --exclude-dir=bower_components --exclude-dir=coverage --exclude-dir=.bundle --exclude=*.csv --exclude=*.pdf --exclude-dir=vendor --exclude-dir=rdoc --exclude-dir=personal" # --exclude-dir=images --exclude-dir=coverage
|
||||
|
||||
# Save a ton of history
|
||||
export HISTSIZE=20000
|
||||
|
@ -74,10 +74,11 @@ export RUBY_GC_MALLOC_LIMIT=1000000000
|
|||
export RUBY_HEAP_FREE_MIN=500000
|
||||
|
||||
# Setup Ansible
|
||||
export PATH=/Users/pulsar/Code/open-source/ansible/bin:${PATH}
|
||||
export PYTHONPATH=/Users/pulsar/Code/open-source/ansible/lib:${PYTHONPATH}
|
||||
export ANSIBLE_LIBRARY=/Users/pulsar/Code/open-source/ansible/library
|
||||
export MANPATH=/Users/pulsar/Code/open-source/ansible/docs/man:${MANPATH}
|
||||
ANSIBLE_DIR=/Users/pulsar/Code/open-source/python/ansible
|
||||
export PATH=${ANSIBLE_DIR}/bin:${PATH}
|
||||
export PYTHONPATH=${ANSIBLE_DIR}/lib:${PYTHONPATH}
|
||||
export ANSIBLE_LIBRARY=${ANSIBLE_DIR}/library
|
||||
export MANPATH=${ANSIBLE_DIR}/docs/man:${MANPATH}
|
||||
export ANSIBLE_HOSTS=~/.ansible_hosts
|
||||
|
||||
# Setup Dart
|
||||
|
|
Loading…
Reference in New Issue
Block a user