diff options
author | Camil Staps | 2021-06-15 14:41:37 +0200 |
---|---|---|
committer | Camil Staps | 2021-06-15 14:41:37 +0200 |
commit | 3d9c2336b24a17c5d80012abb2bfbc159a8b14db (patch) | |
tree | 23f4ffb556963d28540bad8bcbe585515e9782d7 /vim/.vimrc | |
parent | Add neovim aliases vi and vim (diff) |
Fix synctex setup in .latexmkrc for neovim, which does not have --servername
Diffstat (limited to 'vim/.vimrc')
-rw-r--r-- | vim/.vimrc | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -174,6 +174,25 @@ augroup gitgutter autocmd gitgutter BufEnter * call s:reset_gitgutter_highlights() augroup END +" Switch to a window that has a buffer open, or open a new window if no window +" exists for that filename. +function! s:switch_to_file_or_open(filename, in_tab) + let id=bufwinid('^' . a:filename . '$') + if id < 0 + if a:in_tab + tabnew + else + new + endif + exe 'edit ' . fnameescape(a:filename) + else + call win_gotoid(id) + endif +endfunction + +" NB: this is used in ~/.latexmkrc, don't change without checking there +command! -nargs=1 -complete=file SwitchToFileOrOpen call s:switch_to_file_or_open(<f-args>, 1) + " Move through long lines as they were short multiple lines map <down> gj map <up> gk |