]> Sergey Matveev's repositories - dotfiles.git/blobdiff - vim/.vim/plugin/whereami.vim
Vim scripts refactoring
[dotfiles.git] / vim / .vim / plugin / whereami.vim
index a6d53365224d2298347280a6c2f39790b9c4927e..33981349176e2fd2643be57d23443db67b86bc86 100644 (file)
@@ -1,27 +1,4 @@
-if exists('*<SID>pwdLoad') | finish | endif
-
-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"
-        let where = "breakpoint set --file " . fullpath . " --line " . line(".")
-    else
-        let where = "unknown fmt"
-    endif
-    let @* = where
-    echomsg where
-endfunction
-
-nmap <leader>w :call <SID>WhereAmI("gnu")<CR>
-nmap <leader>W :call <SID>WhereAmI("lldb")<CR>
+if exists("*whereami#pwdLoad") | finish | endif
+autocmd VimEnter * call whereami#pwdLoad()
+nmap <leader>w :call whereami#do("%s:%d")<CR>
+nmap <leader>W :call whereami#do("breakpoint set --file %s --line %d")<CR>