From f1eabbaa1b4ff1836d0ee8335b31d009203f3775 Mon Sep 17 00:00:00 2001 From: "Vito G. Graffagnino" Date: Tue, 30 Aug 2022 16:06:22 +0100 Subject: fixed zathura integration with texlab using nvim-texlabconfig --- lua/user/cmp.lua | 17 ++++++++++++++++- lua/user/keymaps.lua | 2 ++ lua/user/nvim-texlabconfig.lua | 15 +++++++++++++++ lua/user/options.lua | 1 + lua/user/plugins.lua | 7 ++++++- lua/user/snippet-converter.lua | 34 ++++++++++++++++++++++++++++++++++ 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 lua/user/nvim-texlabconfig.lua create mode 100644 lua/user/snippet-converter.lua (limited to 'lua') diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index b8e3c14..9f115e7 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -8,7 +8,22 @@ if not snip_status_ok then return end -require("luasnip/loaders/from_vscode").lazy_load() +-- [[ Split a string into lines. ]] +-- local function split_lines(txt) +-- return vim.fn.split(txt,'\n') +-- end + +-- [[ Find files in the runtime path. ]] +-- local function glob_runtimepath(pattern) +-- local runtime_path = vim.fn.escape(vim.o.runtimepath, ' ') +-- local search_result = vim.fn.globpath(runtime_path, pattern) +-- return split_lines(search_result) +-- end + +require("luasnip/loaders/from_vscode").lazy_load({ +-- paths = glob_runtimepath('luasnip_snippets/*.json') + paths = "~/.config/nvim/luasnip_snippets/*.json" +}) local check_backspace = function() local col = vim.fn.col "." - 1 diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 10a8ee8..19fbe85 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -38,6 +38,8 @@ keymap("n", "", ":bprevious", opts) -- Insert -- -- Press jk fast to enter normal mode keymap("i", "jk", "", opts) +-- Spellcheck in insert_mode +keymap("i", "", "u[s1z=`]au", opts) -- Visual -- -- Stay in indent mode diff --git a/lua/user/nvim-texlabconfig.lua b/lua/user/nvim-texlabconfig.lua new file mode 100644 index 0000000..e89b910 --- /dev/null +++ b/lua/user/nvim-texlabconfig.lua @@ -0,0 +1,15 @@ +local nvim_texlabconfig_status_ok = pcall(require, "nvim-texlabconfig") +if not nvim_texlabconfig_status_ok then + return +end + +-- local config = { +-- cache_activate = true, +-- cache_filetypes = { 'tex', 'bib' }, +-- cache_root = vim.fn.stdpath('cache'), +-- reverse_search_edit_cmd = 'edit', +-- file_permission_mode = 438, +-- } +config = function () + require('nvim-texlabconfig').setup(config) +end diff --git a/lua/user/options.lua b/lua/user/options.lua index 52e63ab..6a5449d 100644 --- a/lua/user/options.lua +++ b/lua/user/options.lua @@ -13,6 +13,7 @@ local options = { showtabline = 2, -- always show tabs smartcase = true, -- smart case smartindent = true, -- make indenting smarter again + spell = true, -- spell check. splitbelow = true, -- force all horizontal splits to go below current window splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 1db7da4..a3c9884 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -95,6 +95,11 @@ return packer.startup(function(use) -- snippets use {"L3MON4D3/LuaSnip", commit = ""} --snippet engine use {"rafamadriz/friendly-snippets", commit = ""} -- a bunch of snippets to use + use {"smjonas/snippet-converter.nvim", commit = ""} + + use {"SirVer/ultisnips", commit = ""} --snippet engine + use {"honza/vim-snippets", commit = ""} --snippets to use +-- use {"molleweide/LuaSnip-snippets.nvim", commit = ""} -- a bunch of snippets to use -- LSP use {"jose-elias-alvarez/null-ls.nvim", commit = ""} -- for formatters and linters @@ -125,7 +130,7 @@ return packer.startup(function(use) -- Tex -- use {"lervag/vimtex", commit = ""} - use {"f3fora/nvim-texlabconfig", commit = "", run ="go build"} + use {"f3fora/nvim-texlabconfig", run = 'go build ~/.local/bin/nvim-texlabconfig'} -- use {"emakman/nvim-latex-previewer", LatexViewer = "zathura"} -- use {"xuhdev/vim-latex-live-preview"} diff --git a/lua/user/snippet-converter.lua b/lua/user/snippet-converter.lua new file mode 100644 index 0000000..6835593 --- /dev/null +++ b/lua/user/snippet-converter.lua @@ -0,0 +1,34 @@ +local snipconv_status_ok, snippet_converter = pcall(require, "snippet-converter") +if not snipconv_status_ok then + return +end + +config = function() + local template = { + -- name = "t1", (optionally give your template a name to refer to it in the `ConvertSnippets` command) + sources = { + ultisnips = { + -- Add snippets from (plugin) folders or individual files on your runtimepath... + "./vim-snippets/UltiSnips", + "./latex-snippets/tex.snippets", + }, + snipmate = { + }, + }, + output = { + -- Specify the output formats and paths + vscode_luasnip = { + vim.fn.stdpath("config") .. "/luasnip_snippets", + opts = { + generate_package_json = false, + } + }, + }, + } + + require("snippet_converter").setup { + templates = { template }, + -- To change the default settings (see configuration section in the documentation) + -- settings = {}, + } +end -- cgit v1.2.3