summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorVito G. Graffagnino <vito@graffagnino.xyz>2022-08-30 16:06:22 +0100
committerVito G. Graffagnino <vito@graffagnino.xyz>2022-08-30 16:06:22 +0100
commitf1eabbaa1b4ff1836d0ee8335b31d009203f3775 (patch)
treebbe77eacaef8ab8a5999e517c3006973c9e3e44c /lua
parent823302458ec6c53455a3f34674415c43ce6a3187 (diff)
fixed zathura integration with texlab using nvim-texlabconfig
Diffstat (limited to 'lua')
-rw-r--r--lua/user/cmp.lua17
-rw-r--r--lua/user/keymaps.lua2
-rw-r--r--lua/user/nvim-texlabconfig.lua15
-rw-r--r--lua/user/options.lua1
-rw-r--r--lua/user/plugins.lua7
-rw-r--r--lua/user/snippet-converter.lua34
6 files changed, 74 insertions, 2 deletions
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", "<S-h>", ":bprevious<CR>", opts)
-- Insert --
-- Press jk fast to enter normal mode
keymap("i", "jk", "<ESC>", opts)
+-- Spellcheck in insert_mode
+keymap("i", "<C-l>", "<C-g>u<ESC>[s1z=`]a<C-g>u", 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