]> Sergey Matveev's repositories - dotfiles.git/commitdiff
Symbolic links friendly WhereAmI
authorSergey Matveev <stargrave@stargrave.org>
Thu, 13 May 2021 11:48:35 +0000 (14:48 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 13 May 2021 11:48:35 +0000 (14:48 +0300)
vim/.vim/plugin/whereami.vim

index 8c55eded5f032db1fed06e8819392f70a01c70a3..f3a4f3c94d94c1b80b20f0f7e998e4163598f189 100644 (file)
@@ -1,8 +1,18 @@
 if exists("g:loaded_mein_whereami") | finish | endif
 let g:loaded_mein_whereami = 1
 
+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! 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"