" openrel.vim - Open relatively-described files under the cursor " Author: Ryo Shibayama " Last Change: 2011 Nov 15 " Version: 0.1 " DESCRIPTION: " This plugin enables vim to open relatively-described files under the cursor. " " If :call GotoRelTargetFile(), jump to the file " Ctrl-O : You can go back to source file " let g:openrel_root_dirs = ['/var/www/'] " " Please add following setting to your .vimrc " ================================================== " nnoremap gaf :call GotoRelTargetFile() " ================================================== if !exists('g:openrel_root_dirs') let g:openrel_root_dirs = ['/var/www/'] endif function! GotoRelTargetFile() let filename = expand('') let filepath = filename for dir in g:openrel_root_dirs if isdirectory(dir) == 1 let filepath = dir . filename break endif endfor if filereadable(filepath) execute 'edit ' . filepath else echohl ErrorMsg echo 'no such file ' . filename echohl None endif endfunction