diff options
author | Luc Sinet <[email protected]> | 2021-06-26 20:18:14 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-26 14:18:14 -0400 |
commit | 15d194ce0982f270a56807b06572e9c55233bce6 (patch) | |
tree | 6f345debf8327e7f57622007d621919e7eb132d1 | |
parent | 1c869402c1413341fead39d5aa3688b25cffe4f1 (diff) |
Add Vimtex for Latex support (#512)
* Add vimtex plugin
Vimtex provides a full integration for latex files, see: https://github.com/lervag/vimtex.
Zathura is used as default pdf viewer as it allows live reloading.
* Provide the <leader>L shortcut for Latex operations.
* Move vimtex into the extra plugins section
Add a short comment above extra plugins to introduce their functionality
* Only define whcihKey mapping for Vimtex if O.extras is true
Co-authored-by: Christian Chiarulli <[email protected]>
-rw-r--r-- | init.lua | 1 | ||||
-rw-r--r-- | lua/lv-vimtex/init.lua | 15 | ||||
-rw-r--r-- | lua/lv-which-key/init.lua | 11 | ||||
-rw-r--r-- | lua/plugins.lua | 20 |
4 files changed, 45 insertions, 2 deletions
@@ -31,6 +31,7 @@ if O.extras then require('lv-colorizer') require('lv-spectre') require('lv-symbols-outline') + require('lv-vimtex') end diff --git a/lua/lv-vimtex/init.lua b/lua/lv-vimtex/init.lua new file mode 100644 index 00000000..f4d1cc0c --- /dev/null +++ b/lua/lv-vimtex/init.lua @@ -0,0 +1,15 @@ +vim.g.vimtex_compiler_method='latexmk' +vim.g.vimtex_view_method='zathura' +vim.g.vimtex_fold_enabled=0 + +-- Compile on initialization, cleanup on quit +vim.api.nvim_exec( + [[ + augroup vimtex_event_1 + au! + au User VimtexEventQuit call vimtex#compiler#clean(0) + au User VimtexEventInitPost call vimtex#compiler#compile() + augroup END + ]], false +) + diff --git a/lua/lv-which-key/init.lua b/lua/lv-which-key/init.lua index 6920c29c..2f60e0d5 100644 --- a/lua/lv-which-key/init.lua +++ b/lua/lv-which-key/init.lua @@ -184,6 +184,17 @@ local mappings = { } } +if O.extras then + mappings["L"] = { + name = "+Latex", + c = {"<cmd>VimtexCompile<cr>", "Toggle Compilation Mode"}, + f = {"<cmd>call vimtex#fzf#run()<cr>", "Fzf Find"}, + i = {"<cmd>VimtexInfo<cr>", "Project Information"}, + s = {"<cmd>VimtexStop<cr>", "Stop Project Compilation"}, + t = {"<cmd>VimtexTocToggle<cr>", "Toggle Table Of Content"}, + v = {"<cmd>VimtexView<cr>", "View PDF"} + } +end -- TODO come back and fix visual mappings -- local visualOpts = { -- mode = "v", -- Visual mode diff --git a/lua/plugins.lua b/lua/plugins.lua index 5488b3e7..959a71bf 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -89,8 +89,10 @@ return require("packer").startup(function(use) -- Zen Mode use {"Pocco81/TrueZen.nvim", opt = true} - -- Sane gx for netrw_gx bug - -- use {"felipec/vim-sanegx"} + + -- Sane gx for netrw_gx bug + use {"felipec/vim-sanegx"} + require_plugin("nvim-lspconfig") require_plugin("lspsaga.nvim") @@ -125,28 +127,42 @@ return require("packer").startup(function(use) -- Extras if O.extras then + -- Interactive scratchpad use {'metakirby5/codi.vim', opt = true} require_plugin('codi.vim') + -- Markdown preview use {'iamcco/markdown-preview.nvim', run = 'cd app && npm install', opt = true} require_plugin('markdown-preview.nvim') + -- Floating terminal use {'numToStr/FTerm.nvim', opt = true} require_plugin('FTerm.nvim') + -- Enhanced increment/decrement use {'monaqa/dial.nvim', opt = true} require_plugin('dial.nvim') + -- Peek lines use {'nacro90/numb.nvim', opt = true} require_plugin('numb.nvim') + -- HTML preview use {'turbio/bracey.vim', run = 'npm install --prefix server', opt = true} require_plugin('bracey.vim') + -- Better motions use {'phaazon/hop.nvim', opt = true} require_plugin('hop.nvim') + -- Colorizer use {'norcalli/nvim-colorizer.lua', opt = true} require_plugin('nvim-colorizer.lua') + -- Search & Replace use {'windwp/nvim-spectre', opt = true} require_plugin('nvim-spectre') use {'simrat39/symbols-outline.nvim', opt = true} require_plugin('symbols-outline.nvim') + -- Treesitter playground use {'nvim-treesitter/playground', opt = true} require_plugin('playground') + -- Latex + use {"lervag/vimtex", opt = true} + require_plugin("vimtex") + -- folke/todo-comments.nvim -- gennaro-tedesco/nvim-jqx -- TimUntersberger/neogit |