Wikia

Vim Tips Wiki

Fritzophrenic/Fast find

Talk0
1,610pages on
this wiki

< User:Fritzophrenic

" store default path
let s:default_path = escape(&path, '\ ') " store default value of 'path'

" initialize path to frequently used directories, in order of most frequently used to least for speed.
set path+=/some/frequent/dir
set path+=/some/less/frequent/dir
set path+=/least/frequent/common/dir

    " Always add the current file's directory to the path and tags list if not
    " already there. Add it to the beginning to speed up searches.
    autocmd BufRead *
      \ let s:tempPath=escape(escape(expand("%:p:h"), ' '), '\ ') |
      \ exec "set path-=".s:tempPath |
      \ exec "set path-=".s:default_path |
      \ exec "set path^=".s:tempPath |
      \ exec "set path^=".s:default_path |
      \ if filereadable(escape(expand("%:p:h"), ' ').'/tags') |
      \   exec "set tags-=".s:tempPath."/tags" |
      \   exec "set tags-=".s:default_tags |
      \   exec "set tags^=".s:tempPath."/tags" |
      \   exec "set tags^=".s:default_tags |
      \ endif

Around Wikia's network

Random Wiki