Add puppet for vim and ^p for vim

This commit is contained in:
Hunter Haugen 2011-12-15 23:34:49 -05:00
parent 09af05a45f
commit d3ad3d7b59
12 changed files with 2665 additions and 0 deletions

1323
.vim/autoload/ctrlp.vim Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,95 @@
" =============================================================================
" 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:folsym',
\ 's:dotfiles',
\ 's:maxdepth',
\ 's:maxfiles',
\ 's:compare_lim',
\ 's:glob',
\ ]
let s:dir_var = ['ctrlp#dir#init('.join(s:ars, ', ').')', 'ctrlp#dir#accept',
\ 'dirs', 'dir']
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
\ ? add(g:ctrlp_ext_vars, s:dir_var) : [s:dir_var]
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:globdirs(dirs, depth)
let entries = split(globpath(a:dirs, s:glob), "\n")
if !s:folsym
let entries = filter(entries, 'getftype(v:val) != "link"')
en
let ftrfunc = s:dotfiles ? 'ctrlp#dirfilter(v:val)' : 'isdirectory(v:val)'
let alldirs = filter(entries, ftrfunc)
cal extend(g:ctrlp_alldirs, alldirs)
let depth = a:depth + 1
if !empty(g:ctrlp_alldirs) && !s:max(len(g:ctrlp_alldirs), s:maxfiles)
\ && depth <= s:maxdepth
sil! cal ctrlp#progress(len(g:ctrlp_alldirs))
cal s:globdirs(join(alldirs, ','), depth)
en
endf
fu! s:max(len, max)
retu a:max && a:len > a:max ? 1 : 0
endf
" Public {{{1
fu! ctrlp#dir#init(...)
let s:cwd = getcwd()
for each in range(len(s:ars))
exe 'let' s:ars[each] '=' string(eval('a:'.(each + 1)))
endfo
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().s:dir_var[3]
let cafile = cadir.ctrlp#utils#lash().ctrlp#utils#cachefile(s:dir_var[3])
if g:ctrlp_newdir || !filereadable(cafile)
let g:ctrlp_alldirs = []
cal s:globdirs(s:cwd, 0)
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
let read_cache = 0
el
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
let read_cache = 1
en
if len(g:ctrlp_alldirs) <= s:compare_lim
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
en
if !read_cache
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
let g:ctrlp_newdir = 0
en
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

View file

@ -0,0 +1,61 @@
" =============================================================================
" File: autoload/ctrlp/line.vim
" Description: Line extension - find a line in any buffer.
" 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
let s:line_var = ['ctrlp#line#init()', 'ctrlp#line#accept', 'lines', 'line']
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
\ ? add(g:ctrlp_ext_vars, s:line_var) : [s:line_var]
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Public {{{1
fu! ctrlp#line#init()
let [bufs, lines] = [[], []]
for each in range(1, bufnr('$'))
if getbufvar(each, '&bl')
let bufname = bufname(each)
if strlen(bufname) && bufname != 'ControlP'
cal add(bufs, fnamemodify(bufname, ':p'))
en
en
endfo
cal filter(bufs, 'filereadable(v:val)')
for each in bufs
let from_file = readfile(each)
cal map(from_file, 'tr(v:val, '' '', '' '')')
let [id, len_ff, bufnr] = [1, len(from_file), bufnr(each)]
wh id <= len_ff
let from_file[id-1] .= ' #:'.bufnr.':'.id
let id += 1
endw
cal filter(from_file, 'v:val !~ ''^\s*\t#:\d\+:\d\+$''')
cal extend(lines, from_file)
endfo
sy match CtrlPTabExtra '\zs\t.*\ze$'
hi link CtrlPTabExtra Comment
retu lines
endf
fu! ctrlp#line#accept(mode, str)
let info = get(split(a:str, '\t#:\ze\d\+:\d\+$'), 1, 0)
let bufnr = str2nr(get(split(info, ':'), 0, 0))
let linenr = get(split(info, ':'), 1, 0)
if bufnr
cal ctrlp#acceptfile(a:mode, fnamemodify(bufname(bufnr), ':p'), linenr)
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

View file

@ -0,0 +1,68 @@
" =============================================================================
" File: autoload/ctrlp/mrufiles.vim
" Description: Most Recently Used Files extension
" Author: Kien Nguyen <github.com/kien>
" =============================================================================
" Static variables {{{1
fu! ctrlp#mrufiles#opts()
let opts = {
\ 'g:ctrlp_mruf_max': ['s:max', 250],
\ 'g:ctrlp_mruf_include': ['s:include', ''],
\ 'g:ctrlp_mruf_exclude': ['s:exclude', ''],
\ 'g:ctrlp_mruf_case_sensitive': ['s:csen', 1],
\ }
for [ke, va] in items(opts)
exe 'let' va[0] '=' string(exists(ke) ? eval(ke) : va[1])
endfo
endf
cal ctrlp#mrufiles#opts()
fu! ctrlp#mrufiles#list(bufnr, ...) "{{{1
if s:locked | retu | en
" Get the list
let cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'
let cafile = cadir.ctrlp#utils#lash().'cache.txt'
let mrufs = ctrlp#utils#readfile(cafile)
" Remove non-existent files
if exists('a:1') && a:1 == 1
let mrufs = s:rmdeleted(mrufs, cadir, cafile)
elsei exists('a:1') && a:1 == 2
cal ctrlp#utils#writecache([], cadir, cafile)
retu []
en
" Return the list
if a:bufnr == -1 | retu mrufs | en
" Filter it
let filename = fnamemodify(bufname(a:bufnr + 0), ':p')
if empty(filename) || !empty(&bt)
\ || ( !empty(s:include) && filename !~# s:include )
\ || ( !empty(s:exclude) && filename =~# s:exclude )
\ || ( index(mrufs, filename) == -1 && !filereadable(filename) )
retu
en
" Remove old matched entry
cal filter(mrufs, 'v:val !='.( s:csen ? "#" : "?" ).' filename')
" Insert new one
cal insert(mrufs, filename)
" Remove oldest entry
if len(mrufs) > s:max | cal remove(mrufs, s:max, -1) | en
cal ctrlp#utils#writecache(mrufs, cadir, cafile)
endf "}}}
fu! s:rmdeleted(mrufs, cadir, cafile) "{{{
cal filter(a:mrufs, '!empty(ctrlp#utils#glob(v:val, 1))')
cal ctrlp#utils#writecache(a:mrufs, a:cadir, a:cafile)
retu a:mrufs
endf
fu! ctrlp#mrufiles#init() "{{{1
let s:locked = 0
aug CtrlPMRUF
au!
au BufReadPost,BufNewFile,BufWritePost *
\ cal ctrlp#mrufiles#list(expand('<abuf>', 1))
au QuickFixCmdPre *vimgrep* let s:locked = 1
au QuickFixCmdPost *vimgrep* let s:locked = 0
aug END
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,55 @@
" =============================================================================
" 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
let s:var_qf = ['ctrlp#quickfix#init()', 'ctrlp#quickfix#accept', 'quickfix',
\ 'qfx', [1]]
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
\ ? add(g:ctrlp_ext_vars, s:var_qf) : [s:var_qf]
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
" Public {{{1
fu! ctrlp#quickfix#init()
let g:ctrlp_nolimit = 1
sy match CtrlPqfLineCol '|\zs\d\+:\d\+\ze|'
hi def link CtrlPqfLineCol Search
retu map(getqflist(), 's:lineout(v:val)')
endf
fu! ctrlp#quickfix#accept(mode, str)
let items = matchlist(a:str, '^\([^|]\+\ze\)|\(\d\+\):\(\d\+\)|')
let [md, filpath] = [a:mode, fnamemodify(items[1], ':p')]
if empty(filpath) | retu | en
cal ctrlp#exit()
let cmd = md == 't' ? 'tabe' : md == 'h' ? 'new' : md == 'v' ? 'vne'
\ : ctrlp#normcmd('e')
let cmd = cmd == 'e' && &modified ? 'hid e' : cmd
try
exe cmd.' '.ctrlp#fnesc(filpath)
cat
cal ctrlp#msg("Invalid command or argument.")
fina
cal cursor(items[2], items[3]) | sil! norm! zOzz
endt
endf
fu! ctrlp#quickfix#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

109
.vim/autoload/ctrlp/tag.vim Normal file
View file

@ -0,0 +1,109 @@
" =============================================================================
" 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
let s:tag_var = ['ctrlp#tag#init(s:tagfiles)', 'ctrlp#tag#accept',
\ 'tags', 'tag']
let g:ctrlp_ext_vars = exists('g:ctrlp_ext_vars') && !empty(g:ctrlp_ext_vars)
\ ? add(g:ctrlp_ext_vars, s:tag_var) : [s:tag_var]
let s:id = g:ctrlp_builtins + len(g:ctrlp_ext_vars)
" Utilities {{{1
fu! s:nodup(items)
let dict = {}
for each in a:items
cal extend(dict, { each : 0 })
endfo
retu keys(dict)
endf
fu! s:findcount(str)
let [tg, fname] = split(a:str, '\t\+\ze[^\t]\+$')
let [&l:tags, fname] = [s:ltags, expand(fname, 1)]
let tgs = taglist('^'.tg.'$')
if empty(tgs) | retu [1, 1] | en
let [fnd, ct, pos] = [0, 0, 0]
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, alltags] = [0, a:tags]
wh 0 < 1
if alltags[nr] =~ '^!' && alltags[nr] !~ '^!_TAG_'
let nr += 1
con
en
if alltags[nr] =~ '^!_TAG_' && len(alltags) > nr
cal remove(alltags, nr)
el
brea
en
endw
retu alltags
endf
" Public {{{1
fu! ctrlp#tag#init(tagfiles)
if empty(a:tagfiles) | retu [] | en
let tagfiles = sort(s:nodup(a:tagfiles))
let s:ltags = join(tagfiles, ',')
let g:ctrlp_alltags = []
for each in tagfiles
let alltags = s:filter(ctrlp#utils#readfile(each))
cal extend(g:ctrlp_alltags, alltags)
endfo
sy match CtrlPTabExtra '\zs\t.*\ze$'
hi link CtrlPTabExtra Comment
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 [md, tg] = [a:mode, split(str, '^[^\t]\+\zs\t')[0]]
let fnd = s:findcount(str)
let cmds = {
\ 't': ['tabe', 'tab stj'],
\ 'h': ['new', 'stj'],
\ 'v': ['vne', 'vert stj'],
\ 'e': ['ene', 'tj'],
\ }
let cmd = fnd[0] == 1 ? cmds[md][0] : cmds[md][1]
let cmd = cmd =~ 'tj\|ene' && &modified ? 'hid '.cmd : cmd
try
if fnd[0] == 1
exe cmd
let &l:tags = s:ltags
exe fnd[1].'ta' tg
el
exe cmd.' '.tg
en
cat
cal ctrlp#msg("Tag not found.")
endt
endf
fu! ctrlp#tag#id()
retu s:id
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

View file

@ -0,0 +1,68 @@
" =============================================================================
" 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
let s:lash = ctrlp#utils#lash()
fu! ctrlp#utils#opts()
let s:cache_dir = $HOME.s:lash.'.ctrlp_cache'
if exists('g:ctrlp_cache_dir')
let s:cache_dir = expand(g:ctrlp_cache_dir, 1)
if isdirectory(s:cache_dir.s:lash.'.ctrlp_cache')
let s:cache_dir = s:cache_dir.s:lash.'.ctrlp_cache'
en
en
endf
cal ctrlp#utils#opts()
" Files and Directories {{{1
fu! ctrlp#utils#cachedir()
retu s:cache_dir
endf
fu! ctrlp#utils#cachefile(...)
let tail = exists('a:1') ? '.'.a:1 : ''
let cache_file = substitute(getcwd(), '\([\/]\|^\a\zs:\)', '%', 'g').tail.'.txt'
retu exists('a:1') ? cache_file : s:cache_dir.s:lash.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)
en
endf
fu! ctrlp#utils#writecache(lines, ...)
let cache_dir = exists('a:1') ? a:1 : s:cache_dir
cal ctrlp#utils#mkdir(cache_dir)
if isdirectory(cache_dir)
sil! cal writefile(a:lines, exists('a:2') ? a:2 : ctrlp#utils#cachefile())
if !exists('a:1')
let g:ctrlp_newcache = 0
en
en
endf
fu! ctrlp#utils#glob(...)
retu call('glob', v:version > 701 ? a:000 : a:1)
endf
"}}}
" vim:fen:fdm=marker:fmr={{{,}}}:fdl=0:fdc=1:ts=2:sw=2:sts=2

670
.vim/doc/ctrlp.txt Normal file
View file

@ -0,0 +1,670 @@
*ctrlp.txt* Fuzzy file, buffer, mru and tag finder. v1.6.4
*CtrlP* *ControlP* *'ctrlp'* *'ctrl-p'*
===============================================================================
# #
# :::::::: ::::::::::: ::::::::: ::: ::::::::: #
# :+: :+: :+: :+: :+: :+: :+: :+: #
# +:+ +:+ +:+ +:+ +:+ +:+ +:+ #
# +#+ +#+ +#++:++#: +#+ +#++:++#+ #
# +#+ +#+ +#+ +#+ +#+ +#+ #
# #+# #+# #+# #+# #+# #+# #+# #
# ######## ### ### ### ########## ### #
# #
===============================================================================
CONTENTS *ctrlp-contents*
1. Intro........................................|ctrlp-intro|
2. Options......................................|ctrlp-options|
3. Commands.....................................|ctrlp-commands|
4. Mappings.....................................|ctrlp-mappings|
5. Input Formats................................|ctrlp-input-formats|
6. Extensions...................................|ctrlp-extensions|
===============================================================================
1. Intro *ctrlp-intro*
Full path fuzzy file, buffer and MRU file finder with an intuitive interface.
Written in pure Vimscript for MacVim and Vim version 7.0+. Has full support for
Vims |regexp| as search pattern, built-in MRU monitoring, projects root
finder, and more.
To enable optional extensions (tag, quickfix, dir...), see |ctrlp-extensions|.
===============================================================================
2. Options *ctrlp-options*
Below are the available options and their default values:~
*'g:ctrlp_map'*
Use this option to change the mapping to invoke |CtrlP| in |Normal| mode: >
let g:ctrlp_map = '<c-p>'
<
*'g:loaded_ctrlp'*
Use this option to disable the plugin completely: >
let g:loaded_ctrlp = 1
<
*'g:ctrlp_by_filename'*
Set this to 1 to set search by filename (not full path) as the default: >
let g:ctrlp_by_filename = 0
<
*'g:ctrlp_regexp_search'*
Set this to 1 to set |regexp| search as the default: >
let g:ctrlp_regexp_search = 0
<
*'g:ctrlp_match_window_bottom'*
Set this to 0 to show the match window at the top of the screen: >
let g:ctrlp_match_window_bottom = 1
<
*'g:ctrlp_match_window_reversed'*
Reverse the sort order of the matched files in the match window. The default
setting is from bottom to top: >
let g:ctrlp_match_window_reversed = 1
<
*'g:ctrlp_max_height'*
Set the maximum height of the match window: >
let g:ctrlp_max_height = 10
<
*'g:ctrlp_jump_to_buffer'*
Set this to 0 to disable the jump-to-open-buffer feature. Set to 2 to also jump
tab if the selected buffers opened in another tab: >
let g:ctrlp_jump_to_buffer = 1
<
*'g:ctrlp_working_path_mode'*
When starting up the prompt, temporarily set the working directory (i.e. the
|current-directory|) to:
1 - the parent directory of the current file.
2 - the nearest ancestor that contains one of these directories/files:
.git/
.hg/
.bzr/
_darcs/
root.dir
.vimprojects
0 - dont manage working directory.
>
let g:ctrlp_working_path_mode = 2
<
*'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones. Your
markers will take precedence: >
let g:ctrlp_root_markers = ['']
<
These markers (builtins and yours) will serve as identifiers for the '/' and
'\' special inputs (section 5.e)
*'g:ctrlp_use_caching'*
Set this to 0 to disable per-session caching. When disabled, caching will still
be enabled for directories that have more than 4000 files: >
let g:ctrlp_use_caching = 1
<
Note: you can quickly purge the cache by pressing <F5> while inside |CtrlP|.
*'g:ctrlp_clear_cache_on_exit'*
Set this to 0 to enable cross-sessions caching: >
let g:ctrlp_clear_cache_on_exit = 1
<
*'g:ctrlp_cache_dir'*
Set the directory to store the cache files: >
let g:ctrlp_cache_dir = $HOME.'/.ctrlp_cache'
<
*'g:ctrlp_prompt_mappings'*
Use this to customize the mappings inside |CtrlP|s prompt to your liking. You
only need to keep the lines that youve changed the values (inside []): >
let g:ctrlp_prompt_mappings = {
\ 'PrtBS()': ['<bs>'],
\ 'PrtDelete()': ['<del>'],
\ 'PrtDeleteWord()': ['<c-w>'],
\ 'PrtClear()': ['<c-u>'],
\ 'PrtSelectMove("j")': ['<c-j>', '<down>'],
\ 'PrtSelectMove("k")': ['<c-k>', '<up>'],
\ 'PrtHistory(-1)': ['<c-n>'],
\ 'PrtHistory(1)': ['<c-p>'],
\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],
\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],
\ 'AcceptSelection("t")': ['<c-t>', '<MiddleMouse>'],
\ 'AcceptSelection("v")': ['<c-v>', '<c-q>', '<RightMouse>'],
\ 'ToggleFocus()': ['<tab>'],
\ 'ToggleRegex()': ['<c-r>'],
\ 'ToggleByFname()': ['<c-d>'],
\ 'ToggleType(1)': ['<c-f>', '<c-up'],
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
\ 'PrtCurStart()': ['<c-a>'],
\ 'PrtCurEnd()': ['<c-e>'],
\ 'PrtCurLeft()': ['<c-h>', '<left>'],
\ 'PrtCurRight()': ['<c-l>', '<right>'],
\ 'PrtClearCache()': ['<F5>'],
\ 'PrtDeleteMRU()': ['<F7>'],
\ 'CreateNewFile()': ['<c-y>'],
\ 'MarkToOpen()': ['<c-z>'],
\ 'OpenMulti()': ['<c-o>'],
\ 'PrtExit()': ['<esc>', '<c-c>', '<c-g>'],
\ }
<
If you have problem with <bs> moving left instead of deleting a char, add this
to your |vimrc|: >
let g:ctrlp_prompt_mappings = {
\ 'PrtBS()': ['<c-h>'],
\ 'PrtCurLeft()': ['<left>'],
\ }
<
*'g:ctrlp_mruf_max'*
Specify the number of recently opened files you want |CtrlP| to remember: >
let g:ctrlp_mruf_max = 250
<
*'g:ctrlp_mruf_exclude'*
Files you dont want |CtrlP| to remember; use |regexp| to specify the patterns:
>
let g:ctrlp_mruf_exclude = ''
<
Examples: >
let g:ctrlp_mruf_exclude = '/tmp/.*\|/temp/.*' " MacOSX/Linux
let g:ctrlp_mruf_exclude = '^C:\\dev\\tmp\\.*' " Windows
<
*'g:ctrlp_mruf_include'*
And if you want |CtrlP| to only remember some files, specify them here: >
let g:ctrlp_mruf_include = ''
<
Example: >
let g:ctrlp_mruf_include = '\.py$\|\.rb$'
<
*'g:ctrlp_mruf_case_sensitive'*
Match this with your file system case-sensitivity setting to avoid duplicate
MRU entries: >
let g:ctrlp_mruf_case_sensitive = 1
<
*'g:ctrlp_dotfiles'*
Set this to 0 if you dont want |CtrlP| to search for dotfiles and dotdirs: >
let g:ctrlp_dotfiles = 1
<
You can also use |'wildignore'| to exclude anything from the search.
e.g. exclude version control directories from the results: >
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
set wildignore+=.git\*,.hg\*,.svn\* " Windows
<
Note: the `*/` in front of each dotfile glob is required for the dotfiles
search feature to work correctly along side with |wildignore|. If youve
disabled dotfiles search (set |g:ctrlp_dotfiles| to 0), then you can ignore
this.
Other note: |wildignore| influences the result of |expand()|, |globpath()| and
|glob()| which many plugins use to find stuff on the system (e.g. fugitive.vim
looks for .git/, some other plugins look for external exe tools on Windows).
So be a little mindful of what you put in your |wildignore|.
*'g:ctrlp_highlight_match'*
Use this to enable/disable highlighting of the matched patterns and to specify
the highlight group thatll be used: >
let g:ctrlp_highlight_match = [1, 'Identifier']
<
*'g:ctrlp_max_files'*
The maximum number of files to scan, set to 0 for no limit: >
let g:ctrlp_max_files = 20000
<
*'g:ctrlp_max_depth'*
The maximum depth of a directory tree to recurse into: >
let g:ctrlp_max_depth = 40
<
Note: the larger these values, the more memory Vim uses.
*'g:ctrlp_user_command'*
Specify an external tool to use for listing files instead of Vims globpath().
Use %s in place of the target directory: >
let g:ctrlp_user_command = ''
<
Examples: >
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
<
You can also use 'grep', 'findstr' or something else to filter the results.
Examples: >
let g:ctrlp_user_command = 'find %s -type f | grep (?!tmp/.*)'
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d | findstr .*\.py$'
<
Use a version control listing command when inside a repository, this is a lot
faster when working with large projects: >
let g:ctrlp_user_command = [repo_marker, vcs_ls_command, fallback_command]
<
If the fallback_command is empty or not defined, globpath() will then be used
when searching outside a repo.
Examples: >
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files']
let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate --fullpath -I .']
<
*'g:ctrlp_open_new_file'*
Use this option to specify how the newly created file is to be opened when
pressing <c-y>:
1 - in a new tab
2 - in a new horizontal split
3 - in a new vertical split
0 - in the current window
>
let g:ctrlp_open_new_file = 3
<
*'g:ctrlp_max_history'*
The maximum number of input strings you want |CtrlP| to remember. The default
value mirrors Vims global |'history'| option: >
let g:ctrlp_max_history = &history
<
Set to 0 to disable prompts history.
*'g:ctrlp_open_multi'*
If non-zero, this will enable opening multiple files with <c-z> and <c-o>: >
let g:ctrlp_open_multi = '1v'
<
For the number:
If bigger than 1, itll be used as the maximum number of windows or tabs to
create when opening the files (the rest will be hidden buffers). If is 1,
<c-o> will open all files, each in a new window or new tab.
For the letter:
t - each in a tab
h - each in a horizontal split
v - each in a vertical split
*'g:ctrlp_dont_split'*
When opening a file with <cr>, |CtrlP| avoids opening it in windows created by
plugins, help and quickfix. Use this to setup some exceptions: >
let g:ctrlp_dont_split = ''
<
Acceptable values are partial names or filetypes of the special buffers. Use
|regexp| to specify the pattern. Example: >
let g:ctrlp_dont_split = 'netrw\|help'
<
*'g:ctrlp_follow_symlinks'*
Set this to 1 to follow symbolic links when listing files: >
let g:ctrlp_follow_symlinks = 0
<
*'g:ctrlp_lazy_update'*
Set this to 1 to enable the lazy-update feature: only update the match window
after typings been stopped for a certain amount of time: >
let g:ctrlp_lazy_update = 0
<
If is 1, update after 250ms. If bigger than 1, the number will be used as the
delay time in milliseconds.
*'g:ctrlp_use_migemo'*
Set this to 1 to use Migemo Pattern for Japanese filenames. Migemo Search only
works in |regexp| mode. To split the pattern, separate words with space: >
let g:ctrlp_use_migemo = 0
<
===============================================================================
3. Commands *ctrlp-commands*
*:CtrlP*
:CtrlP [starting-directory]
Open |CtrlP| in find file mode.
If no argument is given, the value of |g:ctrlp_working_path_mode| will be
used to determine the starting directory.
You can use <tab> to auto-complete the [starting-directory] when typing it.
*:CtrlPBuffer*
:CtrlPBuffer
Open |CtrlP| in find buffer mode.
*:CtrlPMRU*
:CtrlPMRU
Open |CtrlP| in find Most-Recently-Used file mode.
*:ClearCtrlPCache*
:ClearCtrlPCache
Flush the cache for the current working directory. The same as pressing <F5>
inside |CtrlP|.
*:ClearAllCtrlPCaches*
:ClearAllCtrlPCaches
Delete all the cache files saved in |ctrlp_cache_dir|.
*:ResetCtrlP*
:ResetCtrlP
Reset all options, take in new values of the option variables in section 2.
-------------------------------------------------------------------------------
The following commands ignore the current value of |g:ctrlp_working_path_mode|:
:CtrlPCurWD *:CtrlPCurWD*
This acts like |:CtrlP| with |path_mode| = 0
:CtrlPCurFile *:CtrlPCurFile*
This acts like |:CtrlP| with |path_mode| = 1
:CtrlPRoot *:CtrlPRoot*
This acts like |:CtrlP| with |path_mode| = 2
===============================================================================
4. Mappings *ctrlp-mappings*
*'ctrlp-<c-p>'*
<c-p>
Default |Normal| mode mapping to open the |CtrlP| prompt in find file mode.
Once inside the prompt:~
<c-r> *'ctrlp-fullregexp'*
Toggle between the string mode (section 5.a & b) and full |regexp| mode.
(note: in full |regexp| mode, the prompts base is 'r>>' instead of '>>>')
See also |input-formats| and |g:ctrlp_regexp_search|.
<c-d>
Toggle between full path search and filename only search.
(note: in filename mode, the prompts base is '>d>' instead of '>>>')
<c-f>, 'forward'
<c-up>
Scroll to the 'next' search mode in the sequence.
<c-b>, 'backward'
<c-down>
Scroll to the 'previous' search mode in the sequence.
<tab>
Toggle the focus between the match window and the prompt.
<c-j>,
<down>
Move selection down
<c-k>,
<up>
Move selection up
<c-a>
Move the cursor to the 'start' of the prompt
<c-e>
Move the cursor to the 'end' of the prompt
<c-h>,
<left>
Move the cursor one character to the 'left'
<c-l>,
<right>
Move the cursor one character to the 'right'
<c-w>
Delete a preceding inner word
<c-u>
Clear the input field
<cr>
Open selected file in the active window if possible.
<c-t>
Open selected file in a new 'tab'
<c-v>
Open selected file in a 'vertical' split
<c-cr>,
<c-s>,
<c-x>
Open selected file in a 'horizontal' split
<c-y>
Create a new file and its parent directories.
<c-n>
Next string in the prompts history
<c-p>
Previous string in the prompts history
<c-z>
Mark/unmark a file to be opened with <c-o>.
<c-o>
Open files marked by <c-z>.
<F5>
- Refresh the match window and purge the cache for the current directory.
- Remove deleted files from MRU list.
<F7>
Clear MRU list.
<esc>,
<c-c>,
<c-g>
Exit |CtrlP|. <c-c> can also be used to stop the file scan.
Choose your own mappings with |g:ctrlp_prompt_mappings|.
When inside the match window (press <tab> to switch):~
a-z
0-9
~^-=;`',.+!@#$%&_(){}[]
Cycle through the lines with the first letter (of paths or filenames) that
matches that key.
===============================================================================
5. Input Formats *ctrlp-input-formats*
Formats for inputting in the prompt:~
a) Simple string.
e.g. 'abc' is understood internally as 'a[^a]\{-}b[^b]\{-}c'
b) Vim |regexp|. If the input string contains '*' or '|', itll be treated as
a Vims |regexp| |pattern| without any modification.
e.g. 'abc\d*efg' will be read as 'abc\d*efg'.
See also |ctrlp-fullregexp| (key map) and |g:ctrlp_regexp_search| (option).
c) End the string with a colon ':' followed by a Vim command to execute that
command after opening the file. If you need to use ':' in the command,
escape it with a backslash: '\:'.
e.g. 'abc:45' will open the selected file and jump to line 45.
'abc:/my\:function' will open the selected file and jump to the first
instance of 'my:function'.
'abc:+setf\ myfiletype|50' will open the selected file and set its
filetype to 'myfiletype' then jump to line 50.
See also Vims |++opt| and |+cmd|.
d) Type exactly two dots '..' at the start of the prompt and press enter to go
backward in the directory tree by 1 level. If the parent directory is
large, this might be slow.
e) Similarly submit '/' or '\' to find and go to the projects root. If the
project is large, using a VCS listing command to look for files might help
speeding up the intial scan (see |g:ctrlp_user_command| for more details).
f) Type the name of a non-existent file and press <c-y> to create it.
e.g. 'parentdir/file.txt' will create a directory named 'parentdir' as well
as 'file.txt'.
Use '\' in place of '/' on Windows (if |'ssl'| is not set).
g) Submit ? to open this help file.
===============================================================================
6. Extensions *g:ctrlp-extensions*
Extensions are optional. To enable an extension, add its name to the variable
g:ctrlp_extensions: >
let g:ctrlp_extensions = ['tag', 'quickfix', 'dir']
<
The order of the items will be the order they appear on the statusline and when
using <c-f>, <c-b>.
Available extensions:~
*:CtrlPTag*
* Tag mode:~
- Name: 'tag'
- Command: ':CtrlPTag'
- Search for a tag within a generated central tags file, and jump to the
definition. Use the Vims option |'tags'| to specify the names and the
locations of the tags file(s). Example: `set tags+=tags/help,doc/tags`
*:CtrlPQuickfix*
* Quickfix mode:~
- Name: 'quickfix'
- Command: ':CtrlPQuickfix'
- Search for an entry in the current quickfix errors and jump to it.
*:CtrlPDir*
* Directory mode:~
- Name: 'dir'
- Command: ':CtrlPDir'
- Search for a directory and change the working directory to it.
- Mappings:
+ <cr> change the local working directory for |CtrlP| and keep it open.
+ <c-t> change the global working directory (exit).
+ <c-v> change the local working directory for the current window (exit).
+ <c-x> change the global working directory to |CtrlP|s current local
working directory (exit).
===============================================================================
EXTENDING *ctrlp-extending*
Extending |CtrlP| is very simple. Simply create a vim file following a short
guidelines, place it in autoload/ctrlp/ and add its name to your .vimrc.
To see how it works, get the sample.vim from the extensions branch on the main
git repository (https://github.com/kien/ctrlp.vim/tree/extensions), and place
it along with the parent directories somewhere in your runtimepath. Then put
this into your .vimrc: >
let g:ctrlp_extensions = ['sample']
<
A new search type will show up the next time you open |CtrlP|.
For more details, check out the comments inside sample.vim.~
===============================================================================
CREDITS *ctrlp-credits*
Developed by Kien Nguyen <github.com/kien>, initially based on the Command-T
and the LustyExplorer plugins. No code was taken from these plugins, but I did
clone the majority of their (awesome) interfaces and the way they work.
This was originally written as a module for a would-be larger plugin called
AutoDoc.vim which Ive stopped developing because of lost of interest. I really
liked the way Command-T and LustyExplorer deal with users input, so I wrote a
pure Vimscript version of their prompt window, intended to use it for the
aforementioned plugin.
Homepage: http://kien.github.com/ctrlp.vim
Git repository: https://github.com/kien/ctrlp.vim
Mercurial repository: https://bitbucket.org/kien/ctrlp.vim
===============================================================================
THANKS *ctrlp-thanks*
Thanks to everyone that has submitted ideas, bug reports or helped debugging on
gibhub, bitbucket, and through email.
Special thanks:~
* Woojong Koh <github.com/wjkoh>
Forked and suggested the support for VCS listing commands.
* Yasuhiro Matsumoto <github.com/mattn>
Added option to use Migemo for Japanese language.
===============================================================================
CHANGELOG *ctrlp-changelog*
Before 2011/11/30~
+ New features: Tag, Quickfix and Directory extensions.
+ New commands: |:CtrlPTag|, |:CtrlPQuickfix|, |:CtrlPDir|.
+ New options: |g:ctrlp_use_migemo|,
|g:ctrlp_lazy_update|,
|g:ctrlp_follow_symlinks|
Before 2011/11/13~
+ New special input: '/' and '\' find root (section 5.e)
+ Remove ctrlp#SetWorkingPath().
+ Remove |g:ctrlp_mru_files|, make MRU permanent.
+ Extend |g:ctrlp_open_multi|, add new ways to open files.
+ New option: |g:ctrlp_dont_split|,
|g:ctrlp_mruf_case_sensitive|
Before 2011/10/30~
+ New feature: Support for custom extensions.
<F5> also removes non-existent files from MRU list.
+ New option: |g:ctrlp_jump_to_buffer|
Before 2011/10/12~
+ New features: Open multiple files.
Pass Vims |++opt| and |+cmd| to the opening file
(section 5.c)
Auto-complete each dir for |:CtrlP| [starting-directory]
+ New mappings: <c-z> mark/unmark a file to be opened with <c-o>.
<c-o> open all marked files.
+ New option: |g:ctrlp_open_multi|
+ Remove |g:ctrlp_persistent_input|, |g:ctrlp_live_update| and <c-^>.
Before 2011/09/29~
+ New mappings: <c-n>, <c-p> next/prev string in the input history.
<c-y> create a new file and its parent dirs.
+ New options: |g:ctrlp_open_new_file|,
|g:ctrlp_max_history|
+ Added a new open-in-horizontal-split mapping: <c-x>
Before 2011/09/19~
+ New command: |ResetCtrlP|
+ New options: |g:ctrlp_max_files|,
|g:ctrlp_max_depth|,
|g:ctrlp_live_update|
+ New mapping: <c-^>
Before 2011/09/12~
+ Ability to cycle through matched lines in the match window.
+ Extend the behavior of |g:ctrlp_persistent_input|
+ Extend the behavior of |:CtrlP|
+ New options: |g:ctrlp_dotfiles|,
|g:ctrlp_clear_cache_on_exit|,
|g:ctrlp_highlight_match|,
|g:ctrlp_user_command|
+ New special input: '..' (section 5.d)
+ New mapping: <F5>.
+ New commands: |:CtrlPCurWD|,
|:CtrlPCurFile|,
|:CtrlPRoot|
+ New feature: Search in most recently used (MRU) files
+ New mapping: <c-b>.
+ Extended the behavior of <c-f>.
+ New options: |g:ctrlp_mru_files|,
|g:ctrlp_mruf_max|,
|g:ctrlp_mruf_exclude|,
|g:ctrlp_mruf_include|
+ New command: |:CtrlPMRUFiles|
First public release: 2011/09/06~
===============================================================================
vim:ft=help:et:ts=2:sw=2:sts=2:norl

2
.vim/ftdetect/puppet.vim Normal file
View file

@ -0,0 +1,2 @@
" detect puppet filetype
au BufRead,BufNewFile *.pp set filetype=puppet

94
.vim/ftplugin/puppet.vim Normal file
View file

@ -0,0 +1,94 @@
" Vim filetype plugin
" Language: Puppet
" Maintainer: Todd Zullinger <tmz@pobox.com>
" Last Change: 2009 Aug 19
" vim: set sw=4 sts=4:
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
if !exists("no_plugin_maps") && !exists("no_puppet_maps")
if !hasmapto("<Plug>AlignRange")
map <buffer> <LocalLeader>= <Plug>AlignRange
endif
endif
noremap <buffer> <unique> <script> <Plug>AlignArrows :call <SID>AlignArrows()<CR>
noremap <buffer> <unique> <script> <Plug>AlignRange :call <SID>AlignRange()<CR>
iabbrev => =><C-R>=<SID>AlignArrows('=>')<CR>
iabbrev +> +><C-R>=<SID>AlignArrows('+>')<CR>
if exists('*s:AlignArrows')
finish
endif
let s:arrow_re = '[=+]>'
let s:selector_re = '[=+]>\s*\$.*\s*?\s*{\s*$'
function! s:AlignArrows(op)
let cursor_pos = getpos('.')
let lnum = line('.')
let line = getline(lnum)
if line !~ s:arrow_re
return
endif
let pos = stridx(line, a:op)
let start = lnum
let end = lnum
let pnum = lnum - 1
while 1
let pline = getline(pnum)
if pline !~ s:arrow_re || pline =~ s:selector_re
break
endif
let start = pnum
let pnum -= 1
endwhile
let cnum = end
while 1
let cline = getline(cnum)
if cline !~ s:arrow_re ||
\ (indent(cnum) != indent(cnum+1) && getline(cnum+1) !~ '\s*}')
break
endif
let end = cnum
let cnum += 1
endwhile
call s:AlignSection(start, end)
let cursor_pos[2] = stridx(getline('.'), a:op) + strlen(a:op) + 1
call setpos('.', cursor_pos)
return ''
endfunction
function! s:AlignRange() range
call s:AlignSection(a:firstline, a:lastline)
endfunction
" AlignSection and AlignLine are from the vim wiki:
" http://vim.wikia.com/wiki/Regex-based_text_alignment
function! s:AlignSection(start, end)
let extra = 1
let sep = s:arrow_re
let maxpos = 0
let section = getline(a:start, a:end)
for line in section
let pos = match(line, ' *'.sep)
if maxpos < pos
let maxpos = pos
endif
endfor
call map(section, 's:AlignLine(v:val, sep, maxpos, extra)')
call setline(a:start, section)
endfunction
function! s:AlignLine(line, sep, maxpos, extra)
let m = matchlist(a:line, '\(.\{-}\) \{-}\('.a:sep.'.*\)')
if empty(m)
return a:line
endif
let spaces = repeat(' ', a:maxpos - strlen(m[1]) + a:extra)
return m[1] . spaces . m[2]
endfunction

76
.vim/indent/puppet.vim Normal file
View file

@ -0,0 +1,76 @@
" Vim indent file
" Language: Puppet
" Maintainer: Todd Zullinger <tmz@pobox.com>
" Last Change: 2009 Aug 19
" vim: set sw=4 sts=4:
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
setlocal autoindent smartindent
setlocal indentexpr=GetPuppetIndent()
setlocal indentkeys+=0],0)
if exists("*GetPuppetIndent")
finish
endif
" Check if a line is part of an include 'block', e.g.:
" include foo,
" bar,
" baz
function! s:PartOfInclude(lnum)
let lnum = a:lnum
while lnum
let lnum = lnum - 1
let line = getline(lnum)
if line !~ ',$'
break
endif
if line =~ '^\s*include\s\+[^,]\+,$'
return 1
endif
endwhile
return 0
endfunction
function! s:OpenBrace(lnum)
call cursor(a:lnum, 1)
return searchpair('{\|\[\|(', '', '}\|\]\|)', 'nbW')
endfunction
function! GetPuppetIndent()
let pnum = prevnonblank(v:lnum - 1)
if pnum == 0
return 0
endif
let line = getline(v:lnum)
let pline = getline(pnum)
let ind = indent(pnum)
if pline =~ '^\s*#'
return ind
endif
if pline =~ '\({\|\[\|(\|:\)$'
let ind += &sw
elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*'
let ind -= &sw
elseif pline =~ '^\s*include\s\+.*,$'
let ind += &sw
endif
if pline !~ ',$' && s:PartOfInclude(pnum)
let ind -= &sw
endif
" Match } }, }; ] ]: )
if line =~ '^\s*\(}\(,\|;\)\?$\|]:\?$\|)\)'
let ind = indent(s:OpenBrace(v:lnum))
endif
return ind
endfunction

44
.vim/plugin/ctrlp.vim Normal file
View file

@ -0,0 +1,44 @@
" =============================================================================
" File: plugin/ctrlp.vim
" Description: Fuzzy file, buffer, mru and tag 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, g:ctrlp_lines, g:ctrlp_allfiles] = [1, [], []]
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
com! -na=? -comp=custom,ctrlp#cpl CtrlP cal ctrlp#init(0, <q-args>)
com! CtrlPBuffer cal ctrlp#init(1)
com! CtrlPMRUFiles cal ctrlp#init(2)
com! ClearCtrlPCache cal ctrlp#clr()
com! ClearAllCtrlPCaches cal ctrlp#clra()
com! ResetCtrlP cal ctrlp#reset()
com! CtrlPCurWD cal ctrlp#init(0, 0)
com! CtrlPCurFile cal ctrlp#init(0, 1)
com! CtrlPRoot cal ctrlp#init(0, 2)
exe 'nn <silent>' g:ctrlp_map ':<c-u>CtrlP<cr>'
cal ctrlp#mrufiles#init()
if !exists('g:ctrlp_extensions') | fini | en
if index(g:ctrlp_extensions, 'tag') >= 0
let g:ctrlp_alltags = [] | com! CtrlPTag cal ctrlp#init(ctrlp#tag#id())
en
if index(g:ctrlp_extensions, 'quickfix') >= 0
com! CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
en
if index(g:ctrlp_extensions, 'dir') >= 0
let g:ctrlp_alldirs = [] | com! CtrlPDir cal ctrlp#init(ctrlp#dir#id())
en