aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
authorCamil Staps2021-06-18 20:02:08 +0200
committerCamil Staps2021-06-18 20:02:08 +0200
commitba38bf6df2aea788272cf298abac62839af88c2b (patch)
tree72cef728eb17336adb2ae498038ab6551402bd84 /vim
parentFix vim SwitchToFileOrOpen; take current directory into account (diff)
Simplify synctex; use vim drop command instead of custom switch_to_file_or_open function
Diffstat (limited to 'vim')
-rw-r--r--vim/.latexmkrc3
-rw-r--r--vim/.vimrc20
2 files changed, 1 insertions, 22 deletions
diff --git a/vim/.latexmkrc b/vim/.latexmkrc
index a36a2ce..8ee0b76 100644
--- a/vim/.latexmkrc
+++ b/vim/.latexmkrc
@@ -13,8 +13,7 @@ $pdf_previewer .= 'zathura';
# -x for synctex: connect to the rpc socket, switch to the file and jump to the line
$pdf_previewer .= ' -x "nvim --headless --cmd';
$pdf_previewer .= ' \'let skt=sockconnect(\\"pipe\\",\\"$SERVER\\",{\\"rpc\\":1})';
-# SwitchToFileOrOpen switches to a file or opens it if there is no window yet; see .vimrc
-$pdf_previewer .= ' | call rpcrequest(skt,\\"nvim_command\\",\\"SwitchToFileOrOpen %{input}\\")';
+$pdf_previewer .= ' | call rpcrequest(skt,\\"nvim_command\\",\\"tab drop %{input}\\")';
$pdf_previewer .= ' | call rpcrequest(skt,\\"nvim_command\\",\\"%{line}\\")';
# mysteriously, we need `cd .` to fix the file name in the tabline
$pdf_previewer .= ' | call rpcrequest(skt,\\"nvim_command\\",\\"cd .\\")';
diff --git a/vim/.vimrc b/vim/.vimrc
index ff39615..77753d5 100644
--- a/vim/.vimrc
+++ b/vim/.vimrc
@@ -180,26 +180,6 @@ 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 fname = filenamemodify(a:filename, ':~:.')
- 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