]> Sergey Matveev's repositories - dotfiles.git/blob - vim/.vim/plugin/whereami.vim
a6d53365224d2298347280a6c2f39790b9c4927e
[dotfiles.git] / vim / .vim / plugin / whereami.vim
1 if exists('*<SID>pwdLoad') | finish | endif
2
3 function! s:pwdLoad()
4     let g:mein_pwdL=trim(system("pwd -L"))
5     let g:mein_pwdP=trim(system("pwd -P"))
6 endfunction
7
8 autocmd VimEnter * call s:pwdLoad()
9
10 function! s:WhereAmI(fmt)
11     let fullpath = expand("%:p")
12     if fullpath[:len(g:mein_pwdP)-1] ==# g:mein_pwdP
13         let fullpath = g:mein_pwdL . fullpath[len(g:mein_pwdP):]
14     endif
15     if a:fmt == "gnu"
16         let where = fullpath . ":" . line(".")
17     elseif a:fmt == "lldb"
18         let where = "breakpoint set --file " . fullpath . " --line " . line(".")
19     else
20         let where = "unknown fmt"
21     endif
22     let @* = where
23     echomsg where
24 endfunction
25
26 nmap <leader>w :call <SID>WhereAmI("gnu")<CR>
27 nmap <leader>W :call <SID>WhereAmI("lldb")<CR>