" pathogen.vim - path option manipulation
" Maintainer: Tim Pope
" Version: 2.3
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
" .vimrc is the only other setup necessary.
"
" The API is documented inline below.
" si ya se cargó este archivo o la compatibilidad con Vi está activada
if exists("g:loaded_pathogen") || &cp
" termina la carga acá
finish
endif
let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a relative path to invoke pathogen#interpose()
" (defaults to "bundle/{}"), or an absolute path to invoke pathogen#surround(). Curly braces are
" expanded with pathogen#expand(): "bundle/{}" finds all subdirectories inside "bundle" inside all
" directories in the runtime path.
" !: si hay una función definida con el mismo identificador, la reemplaza
" ...: acepta 0 o más argumentos
" abort: termina la ejecución de la función al primer error
function! pathogen#infect(...) abort
" para cada elemento en
" si hay argumentos
" se realiza una copia de la lista de los argumentos
" se invierten los elementos de la lista
" se eliminan los argumentos que no sean de tipo string
" sino
" una lista con un elemento = 'bundle/{}'
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
" si el elemento es igual (case sensitive) a
" 1. ^: principio de línea
" 2. \%(: comienzo de grupo
" 3. "{"
" 4. \=: encuentra 0 o 1 vez el elemento anterior
" 5. [: comienzo de colección
" 6. "$"
" 7. "~"
" 8. \\: "\"
" 9. "/"
" 10. ]: fin de la colección que comenzó en (5.)
" 11. \|: OR
" 12. "{"
" 13. \=: encuentra 0 o 1 vez el elemento anterior
" 14. \w: igual a [0-9A-Za-z_]
" 15. ":"
" 16. [: comienzo de colección
" 17. \\: "\"
" 18. "/"
" 19. ]: fin de colección (16.)
" 20. \): fin de grupo (2.)
" 21. .: cualquier carácter menos fin de línea
" 22. *: encuentra 0 o más veces el elemento anterior
" 23. [: comienzo de colección
" 24. "{"
" 25. "}"
" 26. "*"
" 27. ]: fin de colección (23.)
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
call pathogen#surround(path)
" si el elemento es igual (case sensitive) a
" 1. ^: comienzo de línea
" 2. \%(: inicio de grupo
" 3. [: inicio de colección
" 4. "$"
" 5. "~"
" 6. \\: "\"
" 7. "/"
" 8. ]: fin de colección
" 9. \|: OR
" 10. \w: igual a [0-9A-Za-z_]
" 11. ":"
" 12. [: inicio de colección
" 13. \\: "\"
" 14. "/"
" 15. ]: fin de colección
" 16. \): fin de grupo
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
" parámetro: un texto que avisa que al parámetro de pathogen#infect se le agrega '/{}'
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#surround(path . '/{}')
elseif path =~# '[{}*]'
call pathogen#interpose(path)
else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#interpose(path . '/{}')
endif
endfor
call pathogen#cycle_filetype()
if pathogen#is_disabled($MYVIMRC)
return 'finish'
endif
return ''
endfunction
" Split a path into a list.
function! pathogen#split(path) abort
" |: se utiliza para separar comandos en una misma línea
" si path es una lista, entonces devuelve path
if type(a:path) == type([]) | return a:path | endif
" si path no contiene elementos, devuelve una lista vacía
if empty(a:path) | return [] | endif
" la variable 'split' =
let split = split(a:path,'\\\@]','\\&','')
endif
endfunction
" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) abort "{{{1
let rtp = pathogen#join(1,pathogen#split(&rtp))
let file = findfile(a:file,rtp,a:count)
if file ==# ''
return ''
else
return fnamemodify(file,':p')
endif
endfunction
" Section: Deprecated
function! s:warn(msg) abort
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories. Deprecated.
function! pathogen#runtime_prepend_subdirectories(path) abort
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
return pathogen#surround(a:path . pathogen#slash() . '{}')
endfunction
function! pathogen#incubate(...) abort
let name = a:0 ? a:1 : 'bundle/{}'
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
return pathogen#interpose(name)
endfunction
" Deprecated alias for pathogen#interpose().
function! pathogen#runtime_append_all_bundles(...) abort
if a:0
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
else
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
endif
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
endfunction
if exists(':Vedit')
finish
endif
let s:vopen_warning = 0
function! s:find(count,cmd,file,lcd)
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
let file = pathogen#runtime_findfile(a:file,a:count)
if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
endif
if !s:vopen_warning
let s:vopen_warning = 1
let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
else
let warning = ''
endif
if a:lcd
let path = file[0:-strlen(a:file)-2]
execute 'lcd `=path`'
return a:cmd.' '.pathogen#fnameescape(a:file) . warning
else
return a:cmd.' '.pathogen#fnameescape(file) . warning
endif
endfunction
function! s:Findcomplete(A,L,P)
let sep = pathogen#slash()
let cheats = {
\'a': 'autoload',
\'d': 'doc',
\'f': 'ftplugin',
\'i': 'indent',
\'p': 'plugin',
\'s': 'syntax'}
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
let request = cheats[a:A[0]].a:A[1:-1]
else
let request = a:A
endif
let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
let found = {}
for path in pathogen#split(&runtimepath)
let path = expand(path, ':p')
let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
for match in matches
let found[match] = 1
endfor
endfor
return sort(keys(found))
endfunction
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(,'edit',,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(,'edit',,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(,'edit',,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(,'split',,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(,'vsplit',,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(,'tabedit',,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(,'pedit',,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(,'read',,1)
" vim:set et sw=2 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':