vim,zathura: Setup LaTeX file development

LaTeX files can now be automatically compiled in vim and jumping into
the relevant lines from PDF to code or the other way around is possible
too.
Add the LaTeX coc-language server as well.

Thanks to @AurelWeinhold
This commit is contained in:
2020-11-23 01:49:19 +01:00
parent 526fd993f7
commit d85607e143
5 changed files with 38 additions and 1 deletions

View File

@@ -1,11 +1,13 @@
" Set leader key " Set leader key
let mapleader = "\<Space>" let mapleader = "\<Space>"
let maplocalleader = mapleader
" Plugins ###################################################################### " Plugins ######################################################################
" Auto completion " Auto completion
" needs vim >= 8.1.1719 to support features like popup and text property. " needs vim >= 8.1.1719 to support features like popup and text property.
if (has('patch-8.1.1719') || has('nvim')) if (has('patch-8.1.1719') || has('nvim'))
let g:coc_global_extensions = ['coc-clangd', 'coc-sh', 'coc-python'] let g:coc_global_extensions =
\ ['coc-clangd', 'coc-sh', 'coc-python', 'coc-vimtex']
packadd! coc.nvim packadd! coc.nvim
source $XDG_CONFIG_HOME/vim/coc.nvim.vim source $XDG_CONFIG_HOME/vim/coc.nvim.vim
endif endif
@@ -17,6 +19,9 @@ packadd! fzf.vim
nmap <leader>f :Files<CR> nmap <leader>f :Files<CR>
" Theme " Theme
packadd! onedark.vim packadd! onedark.vim
" LaTeX
packadd! vimtex
source $XDG_CONFIG_HOME/vim/vimtex.vim
" Git information " Git information
packadd! vim-gitgutter packadd! vim-gitgutter
" Surround text with parentheses, brackets, quotes, tags, etc. " Surround text with parentheses, brackets, quotes, tags, etc.

24
.config/vim/vimtex.vim Normal file
View File

@@ -0,0 +1,24 @@
let g:tex_flavor = "latex"
let g:vimtex_compiler_progname = 'nvr'
" Setup latexmk and make callback possible with synctex
" (Click into PDF to land in code)
let g:vimtex_compiler_latexmk = {
\ 'build_dir' : 'build',
\ 'callback' : 1,
\ 'continuous' : 1,
\ 'executable' : 'latexmk',
\ 'hooks' : [],
\ 'options' : [
\ '-verbose',
\ '-file-line-error',
\ '-synctex=1',
\ '-interaction=nonstopmode',
\ '-shell-escape',
\ ],
\}
" synctex needs to be activated in zathurarc as well
let g:vimtex_context_pdf_viewer='zathura'
let g:vimtex_view_general_viewer = 'zathura'
let g:vimtex_view_method='zathura'

View File

@@ -16,3 +16,7 @@ set recolor-reverse-video true
# Search while typing # Search while typing
set incremental-search true set incremental-search true
# vimtex
set synctex true
set synctex-editor-command "nvr --remote +%{line} %{input}"

3
.gitmodules vendored
View File

@@ -58,3 +58,6 @@
[submodule ".local/bin/fzf-repo"] [submodule ".local/bin/fzf-repo"]
path = .local/bin/fzf-repo path = .local/bin/fzf-repo
url = https://github.com/junegunn/fzf url = https://github.com/junegunn/fzf
[submodule ".config/vim/pack/plugins/opt/vimtex"]
path = .config/vim/pack/plugins/opt/vimtex
url = https://github.com/lervag/vimtex