58 lines
1.8 KiB
Lua
58 lines
1.8 KiB
Lua
-- File: ~/.config/nvim/lua/plugins/vimtex.lua
|
|
|
|
-- VimTeX Configuration
|
|
vim.g.vimtex_view_method = 'skim' -- Use Skim as the PDF viewer
|
|
vim.g.vimtex_view_skim_sync = 1 -- Enable forward search with Skim
|
|
vim.g.vimtex_view_skim_activate = 1 -- Activate Skim on compilation
|
|
|
|
vim.g.vimtex_compiler_method = 'latexmk' -- Use latexmk for LaTeX compilation
|
|
vim.g.vimtex_quickfix_mode = 0 -- Disable automatic quickfix window
|
|
vim.g.vimtex_syntax_enabled = 1 -- Enable VimTeX syntax highlighting
|
|
|
|
-- Custom TeX Engine Commands
|
|
vim.api.nvim_create_user_command(
|
|
'LuaTeX',
|
|
'!lualatex %',
|
|
{ nargs = 0 }
|
|
)
|
|
|
|
vim.api.nvim_create_user_command(
|
|
'XeTeX',
|
|
'!xelatex %',
|
|
{ nargs = 0 }
|
|
)
|
|
|
|
vim.api.nvim_create_user_command(
|
|
'PdfLaTeX',
|
|
'!pdflatex %',
|
|
{ nargs = 0 }
|
|
)
|
|
|
|
-- View PDF Command
|
|
vim.api.nvim_create_user_command(
|
|
'ViewPDF',
|
|
'!open -a Skim ' .. vim.fn.expand('%:r') .. '.pdf',
|
|
{ nargs = 0 }
|
|
)
|
|
|
|
-- Check for Errors in Log File
|
|
vim.api.nvim_create_user_command(
|
|
'CheckErrors',
|
|
'!grep -i error %.log || echo "No errors found!"',
|
|
{ nargs = 0 }
|
|
)
|
|
vim.api.nvim_create_user_command(
|
|
'CleanAuxFiles',
|
|
'!rm -f *.aux *.log *.out *.toc *.bbl *.blg *.synctex.gz *.fls *.fdb_latexmk',
|
|
{ nargs = 0 }
|
|
)
|
|
|
|
|
|
-- Keybindings for TeX Workflow
|
|
vim.keymap.set('n', '<leader>ll', ':LuaTeX<CR>', { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>lx', ':XeTeX<CR>', { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>lp', ':PdfLaTeX<CR>', { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>lv', ':ViewPDF<CR>', { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>le', ':CheckErrors<CR>', { noremap = true, silent = true })
|
|
vim.keymap.set('n', '<leader>lc', ':CleanAuxFiles<CR>', { noremap = true, silent = true })
|