X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=vim%2F.vim%2Fplugin%2Fwhereami.vim;h=a6d53365224d2298347280a6c2f39790b9c4927e;hb=c87a6c5de579ab6ae0e5d27b233b83bab85e17f6;hp=8c55eded5f032db1fed06e8819392f70a01c70a3;hpb=50295e8d1d1b2ab4d5514d441ba28e45e7699c55;p=dotfiles.git diff --git a/vim/.vim/plugin/whereami.vim b/vim/.vim/plugin/whereami.vim index 8c55ede..a6d5336 100644 --- a/vim/.vim/plugin/whereami.vim +++ b/vim/.vim/plugin/whereami.vim @@ -1,8 +1,17 @@ -if exists("g:loaded_mein_whereami") | finish | endif -let g:loaded_mein_whereami = 1 +if exists('*pwdLoad') | finish | endif -function! WhereAmI(fmt) +function! s:pwdLoad() + let g:mein_pwdL=trim(system("pwd -L")) + let g:mein_pwdP=trim(system("pwd -P")) +endfunction + +autocmd VimEnter * call s:pwdLoad() + +function! s:WhereAmI(fmt) let fullpath = expand("%:p") + if fullpath[:len(g:mein_pwdP)-1] ==# g:mein_pwdP + let fullpath = g:mein_pwdL . fullpath[len(g:mein_pwdP):] + endif if a:fmt == "gnu" let where = fullpath . ":" . line(".") elseif a:fmt == "lldb" @@ -14,5 +23,5 @@ function! WhereAmI(fmt) echomsg where endfunction -nmap w :call WhereAmI("gnu") -nmap W :call WhereAmI("lldb") +nmap w :call WhereAmI("gnu") +nmap W :call WhereAmI("lldb")