nvim: swapped async tex previewer

master
tiyn 1 year ago
parent 6a685bae7a
commit 9e9a73232d

@ -19,7 +19,7 @@ vim.filetype.add({
vim.api.nvim_create_autocmd({ 'VimLeave' }, vim.api.nvim_create_autocmd({ 'VimLeave' },
{ {
pattern = { 'c' }, pattern = { '*.c' },
command = '!cclear' command = '!cclear'
}) })
@ -105,7 +105,7 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'FileType' },
vim.api.nvim_create_autocmd({ 'VimLeave' }, vim.api.nvim_create_autocmd({ 'VimLeave' },
{ {
pattern = { 'tex' }, pattern = { '*.tex' },
command = '!texclear %' command = '!texclear %'
}) })

@ -42,8 +42,13 @@ vim.api.nvim_set_keymap('n', '<leader>ss', ':%s//gI<Left><Left><Left>', { norema
vim.api.nvim_set_keymap('n', '<leader>is', ':.w >> in<cr>dd', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>is', ':.w >> in<cr>dd', { noremap = true })
-- open corresponding file (pdf/html/...,md) -- frabjous/knap
vim.api.nvim_set_keymap('n', '<leader>p', ':!opout <c-r>%<CR><CR>', { noremap = true }) vim.api.nvim_create_autocmd('FileType', {
pattern = 'tex',
callback = function()
vim.api.nvim_set_keymap('n', '<leader>p', ':lua require("knap").toggle_autopreviewing()<CR>', { noremap = true })
end,
})
-- iamcco/markdown-preview.nvim -- iamcco/markdown-preview.nvim
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {

@ -67,15 +67,6 @@ return require("lazy").setup({
build = "cd app && yarn install" build = "cd app && yarn install"
}, },
-- latex asynchronous pdf rendering
{
'donRaphaco/neotex',
ft = { 'tex' },
config = function()
vim.g.neotex_enabled = 2
end
},
-- nim language support -- nim language support
{ {
'zah/nim.vim', 'zah/nim.vim',
@ -420,6 +411,21 @@ return require("lazy").setup({
config = {} config = {}
}, },
-- latex asynchronous pdf rendering
{
'frabjous/knap',
ft = { 'tex' },
config = function()
vim.g.knap_settings = {
texoutputext = "pdf",
textopdf = "pdflatex -synctex=1 -halt-on-error -interaction=batchmode %docroot%",
textopdfviewerlaunch = "zathura --synctex-editor-command 'nvim --headless -es --cmd \"lua require('\"'\"'knaphelper'\"'\"').relayjump('\"'\"'%servername%'\"'\"','\"'\"'%{input}'\"'\"',%{line},0)\"' %outputfile%",
textopdfviewerrefresh = "none",
textopdfforwardjump = "zathura --synctex-forward=%line%:%column%:%srcfile% %outputfile%"
}
end
},
-- colorscheme -- colorscheme
{ {
'tiyn/vim-tccs', 'tiyn/vim-tccs',
@ -427,6 +433,7 @@ return require("lazy").setup({
vim.cmd('colorscheme tccs') vim.cmd('colorscheme tccs')
end end
}, },
}, },
-- lazy.nvim configuration -- lazy.nvim configuration

@ -1,14 +0,0 @@
#!/bin/sh
# opout: "open output": A general handler for opening a file's intended output,
# usually the pdf of a compiled document. I find this useful especially
# running from vim.
# by lukesmithxyz, checkout github.com/lukesmithxyz/voidrice
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
case "$1" in
*.tex|*.m[dse]|*.[rR]md|*.mom|*.[0-9]) setsid xdg-open "$basename".pdf >/dev/null 2>&1 & ;;
*.html) setsid "$BROWSER" "$basename".html >/dev/null 2>&1 & ;;
*.sent) setsid sent "$1" >/dev/null 2>&1 & ;;
esac

@ -10,8 +10,7 @@ case "$1" in
dir=$(dirname "$file") dir=$(dirname "$file")
base="${file%.*}" base="${file%.*}"
if [ -f "$dir/indent.log" ]; then rm "$dir/indent.log"; fi if [ -f "$dir/indent.log" ]; then rm "$dir/indent.log"; fi
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl|glg|glo|gls|glsdefs|ilg|ist|acn|acr|alg|toc)" -delete ; find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|loa|bcf|run\\.xml|synctex\\.gz|blg|bbl|glg|glo|gls|glsdefs|ilg|ist|acn|acr|alg|toc)" -delete ;
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex ".*\\.aux" -delete ;; find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex ".*\\.aux" -delete ;;
*) printf "Give .tex file as argument.\\n" ;; *) printf "Give .tex file as argument.\\n" ;;
esac esac

Loading…
Cancel
Save