Browse Source

Add ctrl+p and nerdtree to dotfiles.

Ian Adam Naval 6 years ago
parent
commit
21ba1ccb38

+ 6
- 0
.gitmodules View File

@@ -1,3 +1,9 @@
1 1
 [submodule "zprezto/.zprezto"]
2 2
 	path = zprezto/.zprezto
3 3
 	url = git@git.ianonavy.com:ianonavy/prezto.git
4
+[submodule "vim/vim.dotfile/bundle/ctrlp.vim"]
5
+	path = vim/vim.dotfile/bundle/ctrlp.vim
6
+	url = https://github.com/kien/ctrlp.vim
7
+[submodule "vim/vim.dotfile/bundle/nerdtree"]
8
+	path = vim/vim.dotfile/bundle/nerdtree
9
+	url = https://github.com/scrooloose/nerdtree

+ 347
- 0
vim/vim.dotfile/autoload/pathogen.vim View File

@@ -0,0 +1,347 @@
1
+" pathogen.vim - path option manipulation
2
+" Maintainer:   Tim Pope <http://tpo.pe/>
3
+" Version:      2.3
4
+
5
+" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
6
+"
7
+" For management of individually installed plugins in ~/.vim/bundle (or
8
+" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
9
+" .vimrc is the only other setup necessary.
10
+"
11
+" The API is documented inline below.
12
+
13
+if exists("g:loaded_pathogen") || &cp
14
+  finish
15
+endif
16
+let g:loaded_pathogen = 1
17
+
18
+" Point of entry for basic default usage.  Give a relative path to invoke
19
+" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
20
+" pathogen#surround().  Curly braces are expanded with pathogen#expand():
21
+" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
22
+" in the runtime path.
23
+function! pathogen#infect(...) abort
24
+  for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
25
+    if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
26
+      call pathogen#surround(path)
27
+    elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
28
+      call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
29
+      call pathogen#surround(path . '/{}')
30
+    elseif path =~# '[{}*]'
31
+      call pathogen#interpose(path)
32
+    else
33
+      call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
34
+      call pathogen#interpose(path . '/{}')
35
+    endif
36
+  endfor
37
+  call pathogen#cycle_filetype()
38
+  if pathogen#is_disabled($MYVIMRC)
39
+    return 'finish'
40
+  endif
41
+  return ''
42
+endfunction
43
+
44
+" Split a path into a list.
45
+function! pathogen#split(path) abort
46
+  if type(a:path) == type([]) | return a:path | endif
47
+  if empty(a:path) | return [] | endif
48
+  let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
49
+  return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
50
+endfunction
51
+
52
+" Convert a list to a path.
53
+function! pathogen#join(...) abort
54
+  if type(a:1) == type(1) && a:1
55
+    let i = 1
56
+    let space = ' '
57
+  else
58
+    let i = 0
59
+    let space = ''
60
+  endif
61
+  let path = ""
62
+  while i < a:0
63
+    if type(a:000[i]) == type([])
64
+      let list = a:000[i]
65
+      let j = 0
66
+      while j < len(list)
67
+        let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
68
+        let path .= ',' . escaped
69
+        let j += 1
70
+      endwhile
71
+    else
72
+      let path .= "," . a:000[i]
73
+    endif
74
+    let i += 1
75
+  endwhile
76
+  return substitute(path,'^,','','')
77
+endfunction
78
+
79
+" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
80
+function! pathogen#legacyjoin(...) abort
81
+  return call('pathogen#join',[1] + a:000)
82
+endfunction
83
+
84
+" Turn filetype detection off and back on again if it was already enabled.
85
+function! pathogen#cycle_filetype() abort
86
+  if exists('g:did_load_filetypes')
87
+    filetype off
88
+    filetype on
89
+  endif
90
+endfunction
91
+
92
+" Check if a bundle is disabled.  A bundle is considered disabled if its
93
+" basename or full name is included in the list g:pathogen_disabled.
94
+function! pathogen#is_disabled(path) abort
95
+  if a:path =~# '\~$'
96
+    return 1
97
+  endif
98
+  let sep = pathogen#slash()
99
+  let blacklist = map(
100
+        \ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
101
+        \ pathogen#split($VIMBLACKLIST),
102
+        \ 'substitute(v:val, "[\\/]$", "", "")')
103
+  return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
104
+endfunction "}}}1
105
+
106
+" Prepend the given directory to the runtime path and append its corresponding
107
+" after directory.  Curly braces are expanded with pathogen#expand().
108
+function! pathogen#surround(path) abort
109
+  let sep = pathogen#slash()
110
+  let rtp = pathogen#split(&rtp)
111
+  let path = fnamemodify(a:path, ':p:?[\\/]\=$??')
112
+  let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
113
+  let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
114
+  call filter(rtp, 'index(before + after, v:val) == -1')
115
+  let &rtp = pathogen#join(before, rtp, after)
116
+  return &rtp
117
+endfunction
118
+
119
+" For each directory in the runtime path, add a second entry with the given
120
+" argument appended.  Curly braces are expanded with pathogen#expand().
121
+function! pathogen#interpose(name) abort
122
+  let sep = pathogen#slash()
123
+  let name = a:name
124
+  if has_key(s:done_bundles, name)
125
+    return ""
126
+  endif
127
+  let s:done_bundles[name] = 1
128
+  let list = []
129
+  for dir in pathogen#split(&rtp)
130
+    if dir =~# '\<after$'
131
+      let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
132
+    else
133
+      let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
134
+    endif
135
+  endfor
136
+  let &rtp = pathogen#join(pathogen#uniq(list))
137
+  return 1
138
+endfunction
139
+
140
+let s:done_bundles = {}
141
+
142
+" Invoke :helptags on all non-$VIM doc directories in runtimepath.
143
+function! pathogen#helptags() abort
144
+  let sep = pathogen#slash()
145
+  for glob in pathogen#split(&rtp)
146
+    for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
147
+      if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
148
+        silent! execute 'helptags' pathogen#fnameescape(dir)
149
+      endif
150
+    endfor
151
+  endfor
152
+endfunction
153
+
154
+command! -bar Helptags :call pathogen#helptags()
155
+
156
+" Execute the given command.  This is basically a backdoor for --remote-expr.
157
+function! pathogen#execute(...) abort
158
+  for command in a:000
159
+    execute command
160
+  endfor
161
+  return ''
162
+endfunction
163
+
164
+" Section: Unofficial
165
+
166
+function! pathogen#is_absolute(path) abort
167
+  return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
168
+endfunction
169
+
170
+" Given a string, returns all possible permutations of comma delimited braced
171
+" alternatives of that string.  pathogen#expand('/{a,b}/{c,d}') yields
172
+" ['/a/c', '/a/d', '/b/c', '/b/d'].  Empty braces are treated as a wildcard
173
+" and globbed.  Actual globs are preserved.
174
+function! pathogen#expand(pattern) abort
175
+  if a:pattern =~# '{[^{}]\+}'
176
+    let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
177
+    let found = map(split(pat, ',', 1), 'pre.v:val.post')
178
+    let results = []
179
+    for pattern in found
180
+      call extend(results, pathogen#expand(pattern))
181
+    endfor
182
+    return results
183
+  elseif a:pattern =~# '{}'
184
+    let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
185
+    let post = a:pattern[strlen(pat) : -1]
186
+    return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
187
+  else
188
+    return [a:pattern]
189
+  endif
190
+endfunction
191
+
192
+" \ on Windows unless shellslash is set, / everywhere else.
193
+function! pathogen#slash() abort
194
+  return !exists("+shellslash") || &shellslash ? '/' : '\'
195
+endfunction
196
+
197
+function! pathogen#separator() abort
198
+  return pathogen#slash()
199
+endfunction
200
+
201
+" Convenience wrapper around glob() which returns a list.
202
+function! pathogen#glob(pattern) abort
203
+  let files = split(glob(a:pattern),"\n")
204
+  return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
205
+endfunction "}}}1
206
+
207
+" Like pathogen#glob(), only limit the results to directories.
208
+function! pathogen#glob_directories(pattern) abort
209
+  return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
210
+endfunction "}}}1
211
+
212
+" Remove duplicates from a list.
213
+function! pathogen#uniq(list) abort
214
+  let i = 0
215
+  let seen = {}
216
+  while i < len(a:list)
217
+    if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
218
+      call remove(a:list,i)
219
+    elseif a:list[i] ==# ''
220
+      let i += 1
221
+      let empty = 1
222
+    else
223
+      let seen[a:list[i]] = 1
224
+      let i += 1
225
+    endif
226
+  endwhile
227
+  return a:list
228
+endfunction
229
+
230
+" Backport of fnameescape().
231
+function! pathogen#fnameescape(string) abort
232
+  if exists('*fnameescape')
233
+    return fnameescape(a:string)
234
+  elseif a:string ==# '-'
235
+    return '\-'
236
+  else
237
+    return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
238
+  endif
239
+endfunction
240
+
241
+" Like findfile(), but hardcoded to use the runtimepath.
242
+function! pathogen#runtime_findfile(file,count) abort "{{{1
243
+  let rtp = pathogen#join(1,pathogen#split(&rtp))
244
+  let file = findfile(a:file,rtp,a:count)
245
+  if file ==# ''
246
+    return ''
247
+  else
248
+    return fnamemodify(file,':p')
249
+  endif
250
+endfunction
251
+
252
+" Section: Deprecated
253
+
254
+function! s:warn(msg) abort
255
+  echohl WarningMsg
256
+  echomsg a:msg
257
+  echohl NONE
258
+endfunction
259
+
260
+" Prepend all subdirectories of path to the rtp, and append all 'after'
261
+" directories in those subdirectories.  Deprecated.
262
+function! pathogen#runtime_prepend_subdirectories(path) abort
263
+  call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
264
+  return pathogen#surround(a:path . pathogen#slash() . '{}')
265
+endfunction
266
+
267
+function! pathogen#incubate(...) abort
268
+  let name = a:0 ? a:1 : 'bundle/{}'
269
+  call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
270
+  return pathogen#interpose(name)
271
+endfunction
272
+
273
+" Deprecated alias for pathogen#interpose().
274
+function! pathogen#runtime_append_all_bundles(...) abort
275
+  if a:0
276
+    call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
277
+  else
278
+    call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
279
+  endif
280
+  return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
281
+endfunction
282
+
283
+if exists(':Vedit')
284
+  finish
285
+endif
286
+
287
+let s:vopen_warning = 0
288
+
289
+function! s:find(count,cmd,file,lcd)
290
+  let rtp = pathogen#join(1,pathogen#split(&runtimepath))
291
+  let file = pathogen#runtime_findfile(a:file,a:count)
292
+  if file ==# ''
293
+    return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
294
+  endif
295
+  if !s:vopen_warning
296
+    let s:vopen_warning = 1
297
+    let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
298
+  else
299
+    let warning = ''
300
+  endif
301
+  if a:lcd
302
+    let path = file[0:-strlen(a:file)-2]
303
+    execute 'lcd `=path`'
304
+    return a:cmd.' '.pathogen#fnameescape(a:file) . warning
305
+  else
306
+    return a:cmd.' '.pathogen#fnameescape(file) . warning
307
+  endif
308
+endfunction
309
+
310
+function! s:Findcomplete(A,L,P)
311
+  let sep = pathogen#slash()
312
+  let cheats = {
313
+        \'a': 'autoload',
314
+        \'d': 'doc',
315
+        \'f': 'ftplugin',
316
+        \'i': 'indent',
317
+        \'p': 'plugin',
318
+        \'s': 'syntax'}
319
+  if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
320
+    let request = cheats[a:A[0]].a:A[1:-1]
321
+  else
322
+    let request = a:A
323
+  endif
324
+  let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
325
+  let found = {}
326
+  for path in pathogen#split(&runtimepath)
327
+    let path = expand(path, ':p')
328
+    let matches = split(glob(path.sep.pattern),"\n")
329
+    call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
330
+    call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
331
+    for match in matches
332
+      let found[match] = 1
333
+    endfor
334
+  endfor
335
+  return sort(keys(found))
336
+endfunction
337
+
338
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve       :execute s:find(<count>,'edit<bang>',<q-args>,0)
339
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit    :execute s:find(<count>,'edit<bang>',<q-args>,0)
340
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen    :execute s:find(<count>,'edit<bang>',<q-args>,1)
341
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit   :execute s:find(<count>,'split',<q-args>,<bang>1)
342
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit  :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
343
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
344
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit   :execute s:find(<count>,'pedit',<q-args>,<bang>1)
345
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread    :execute s:find(<count>,'read',<q-args>,<bang>1)
346
+
347
+" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':

+ 1
- 0
vim/vim.dotfile/bundle/ctrlp.vim

@@ -0,0 +1 @@
1
+Subproject commit b5d3fe66a58a13d2ff8b6391f4387608496a030f

+ 1
- 0
vim/vim.dotfile/bundle/nerdtree

@@ -0,0 +1 @@
1
+Subproject commit a47c6caf80510d05b9c022bec354ffea006ef840

+ 8
- 0
vim/vimrc.dotfile View File

@@ -1,3 +1,5 @@
1
+execute pathogen#infect()
2
+
1 3
 autocmd FileType python source ~/.vim/python.vim
2 4
 autocmd FileType html source ~/.vim/html.vim
3 5
 autocmd FileType css source ~/.vim/css.vim
@@ -6,8 +8,14 @@ autocmd FileType javascript source ~/.vim/js.vim
6 8
 autocmd FileType c source ~/.vim/c.vim
7 9
 autocmd FileType cpp source ~/.vim/c.vim
8 10
 
11
+au BufRead,BufNewFile *.md setlocal textwidth=80
12
+
9 13
 filetype plugin on
10 14
 
15
+let mapleader = ","
16
+nmap <leader>ne :NERDTree<cr>
17
+
18
+set wildmode=longest,list,full
11 19
 set wildmenu
12 20
 set mousehide
13 21
 set mousemodel=popup

Loading…
Cancel
Save