]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
Switch plugins with more than one file to pathogen.
authorSimon Ruderich <simon@ruderich.org>
Tue, 10 May 2011 20:11:06 +0000 (22:11 +0200)
committerSimon Ruderich <simon@ruderich.org>
Tue, 10 May 2011 20:11:06 +0000 (22:11 +0200)
This stores them in dedicated directory per plugin in vim/bundle/.

13 files changed:
vim/autoload/pathogen.vim [new file with mode: 0644]
vim/bundle/deb/autoload/deb.vim [moved from vim/autoload/deb.vim with 100% similarity]
vim/bundle/deb/plugin/debPlugin.vim [moved from vim/plugin/debPlugin.vim with 100% similarity]
vim/bundle/deb/syntax/deb.vim [moved from vim/syntax/deb.vim with 100% similarity]
vim/bundle/matchit/doc/matchit.txt [moved from vim/doc/matchit.txt with 100% similarity]
vim/bundle/matchit/plugin/matchit.vim [moved from vim/plugin/matchit.vim with 100% similarity]
vim/bundle/nerdcommenter/doc/NERD_commenter.txt [moved from vim/doc/NERD_commenter.txt with 100% similarity]
vim/bundle/nerdcommenter/plugin/NERD_commenter.vim [moved from vim/plugin/NERD_commenter.vim with 100% similarity]
vim/bundle/screenpaste/doc/screenpaste.txt [moved from vim/doc/screenpaste.txt with 100% similarity]
vim/bundle/screenpaste/plugin/screenpaste.vim [moved from vim/plugin/screenpaste.vim with 100% similarity]
vim/bundle/surround/doc/surround.txt [moved from vim/doc/surround.txt with 100% similarity]
vim/bundle/surround/plugin/surround.vim [moved from vim/plugin/surround.vim with 100% similarity]
vimrc

diff --git a/vim/autoload/pathogen.vim b/vim/autoload/pathogen.vim
new file mode 100644 (file)
index 0000000..e10fac9
--- /dev/null
@@ -0,0 +1,142 @@
+" pathogen.vim - path option manipulation
+" Maintainer:   Tim Pope <vimNOSPAM@tpope.org>
+" Version:      1.3
+
+" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
+"
+" API is documented below.
+
+if exists("g:loaded_pathogen") || &cp
+  finish
+endif
+let g:loaded_pathogen = 1
+
+" Split a path into a list.
+function! pathogen#split(path) abort " {{{1
+  if type(a:path) == type([]) | return a:path | endif
+  let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
+  return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
+endfunction " }}}1
+
+" Convert a list to a path.
+function! pathogen#join(...) abort " {{{1
+  if type(a:1) == type(1) && a:1
+    let i = 1
+    let space = ' '
+  else
+    let i = 0
+    let space = ''
+  endif
+  let path = ""
+  while i < a:0
+    if type(a:000[i]) == type([])
+      let list = a:000[i]
+      let j = 0
+      while j < len(list)
+        let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
+        let path .= ',' . escaped
+        let j += 1
+      endwhile
+    else
+      let path .= "," . a:000[i]
+    endif
+    let i += 1
+  endwhile
+  return substitute(path,'^,','','')
+endfunction " }}}1
+
+" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
+function! pathogen#legacyjoin(...) abort " {{{1
+  return call('pathogen#join',[1] + a:000)
+endfunction " }}}1
+
+" Remove duplicates from a list.
+function! pathogen#uniq(list) abort " {{{1
+  let i = 0
+  let seen = {}
+  while i < len(a:list)
+    if has_key(seen,a:list[i])
+      call remove(a:list,i)
+    else
+      let seen[a:list[i]] = 1
+      let i += 1
+    endif
+  endwhile
+  return a:list
+endfunction " }}}1
+
+" \ on Windows unless shellslash is set, / everywhere else.
+function! pathogen#separator() abort " {{{1
+  return !exists("+shellslash") || &shellslash ? '/' : '\'
+endfunction " }}}1
+
+" Convenience wrapper around glob() which returns a list.
+function! pathogen#glob(pattern) abort " {{{1
+  let files = split(glob(a:pattern),"\n")
+  return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
+endfunction "}}}1
+
+" Like pathogen#glob(), only limit the results to directories.
+function! pathogen#glob_directories(pattern) abort " {{{1
+  return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
+endfunction "}}}1
+
+" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
+" its 'basename()' is included in g:pathogen_disabled[]'.
+function! pathogen#is_disabled(path) " {{{1
+  if !exists("g:pathogen_disabled")
+    return 0
+  endif
+  let sep = pathogen#separator()
+  return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
+endfunction "}}}1
+
+" Prepend all subdirectories of path to the rtp, and append all 'after'
+" directories in those subdirectories.
+function! pathogen#runtime_prepend_subdirectories(path) " {{{1
+  let sep    = pathogen#separator()
+  let before = filter(pathogen#glob_directories(a:path.sep."*[^~]"), '!pathogen#is_disabled(v:val)')
+  let after  = filter(pathogen#glob_directories(a:path.sep."*[^~]".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
+  let rtp = pathogen#split(&rtp)
+  let path = expand(a:path)
+  call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
+  let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
+  return &rtp
+endfunction " }}}1
+
+" For each directory in rtp, check for a subdirectory named dir.  If it
+" exists, add all subdirectories of that subdirectory to the rtp, immediately
+" after the original directory.  If no argument is given, 'bundle' is used.
+" Repeated calls with the same arguments are ignored.
+function! pathogen#runtime_append_all_bundles(...) " {{{1
+  let sep = pathogen#separator()
+  let name = a:0 ? a:1 : 'bundle'
+  if "\n".s:done_bundles =~# "\\M\n".name."\n"
+    return ""
+  endif
+  let s:done_bundles .= name . "\n"
+  let list = []
+  for dir in pathogen#split(&rtp)
+    if dir =~# '\<after$'
+      let list +=  filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
+    else
+      let list +=  [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
+    endif
+  endfor
+  let &rtp = pathogen#join(pathogen#uniq(list))
+  return 1
+endfunction
+
+let s:done_bundles = ''
+" }}}1
+
+" Invoke :helptags on all non-$VIM doc directories in runtimepath.
+function! pathogen#helptags() " {{{1
+  for dir in pathogen#split(&rtp)
+    if dir[0 : strlen($VIM)-1] !=# $VIM && isdirectory(dir.'/doc') && !empty(glob(dir.'/doc/*')) && (!filereadable(dir.'/doc/tags') || filewritable(dir.'/doc/tags'))
+      helptags `=dir.'/doc'`
+    endif
+  endfor
+endfunction " }}}1
+
+" vim:set ft=vim ts=8 sw=2 sts=2:
diff --git a/vimrc b/vimrc
index b4e44dcb487bd3f6017a9f289189abb6c5359f4b..97d0c371cfdce3393c500537e02bc7e53cf31200 100644 (file)
--- a/vimrc
+++ b/vimrc
@@ -60,6 +60,7 @@ endif
 
 " Enable automatic file detection, plugin and indention support.
 if has('autocmd')
+    filetype off " necessary for pathogen to force a reload of ftplugins
     filetype plugin indent on
 endif
 
@@ -359,6 +360,13 @@ endif
 
 " PLUGIN SETTINGS
 
+" Use pathogen which allows one 'runtimepath' entry per plugin. This makes
+" installing/removing/updating plugins simple. (Used for plugins with more
+" than one file.)
+if has('eval')
+    call pathogen#runtime_append_all_bundles()
+endif
+
 " Settings for the NERD commenter.
 " Don't create any mappings I don't want to use.
 if has('eval')