summaryrefslogtreecommitdiffstats
path: root/lua/plugins
diff options
context:
space:
mode:
authorNanderty <psopka@sopka.ch>2023-03-25 18:16:24 +0100
committerNanderty <psopka@sopka.ch>2023-03-25 18:16:24 +0100
commit063c2d97218cdabe0634054a8038cd6b5c9a9a12 (patch)
tree768cb00820e92f577fe59253ba07e58f606ced4e /lua/plugins
parentaf7c85ef9daaf702a179a9b3d66d03eff71db7a6 (diff)
downloadneovim-config-063c2d97218cdabe0634054a8038cd6b5c9a9a12.tar.gz
neovim-config-063c2d97218cdabe0634054a8038cd6b5c9a9a12.tar.bz2
neovim-config-063c2d97218cdabe0634054a8038cd6b5c9a9a12.zip
cleanup, snippets
Diffstat (limited to 'lua/plugins')
-rw-r--r--lua/plugins/cmp.lua46
-rw-r--r--lua/plugins/general.lua10
-rw-r--r--lua/plugins/tex.lua2
3 files changed, 15 insertions, 43 deletions
diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua
index b2ec2e5..76e8101 100644
--- a/lua/plugins/cmp.lua
+++ b/lua/plugins/cmp.lua
@@ -1,17 +1,20 @@
return {
{
'L3MON4D3/LuaSnip',
- dependencies = {
- 'iurimateus/luasnip-latex-snippets.nvim',
- 'rafamadriz/friendly-snippets',
+ event = 'InsertEnter',
+ keys = {
+ { 'jj', function() require('luasnip').jump(1) end, mode = 'i' },
+ { 'kk', function() require('luasnip').jump(-1) end, mode = 'i' },
},
opts = {
history = true,
- delete_check_events = "TextChanged",
+ enable_autosnippets = true,
+ delete_check_events = 'TextChanged',
+ update_events = { 'TextChanged', 'TextChangedI' },
},
- config = function()
- require('luasnip-latex-snippets').setup()
- require('luasnip.loaders.from_vscode').lazy_load()
+ config = function(_, opts)
+ require('luasnip').config.set_config(opts)
+ require('luasnip.loaders.from_lua').lazy_load({ paths = vim.fn.stdpath('config') .. '/Snippets/' })
end
},
{
@@ -36,10 +39,6 @@ return {
local luasnip = require('luasnip')
local cmp = require('cmp')
- luasnip.config.set_config({
- history = true,
- enable_autosnippets = true,
- })
return {
snippet = {
expand = function(args)
@@ -48,31 +47,14 @@ return {
},
mapping = cmp.mapping.preset.insert({
['<Space>'] = cmp.mapping.confirm({ select = false }),
- ['<Tab>'] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_next_item()
- elseif luasnip.expand_or_jumpable() then
- luasnip.expand_or_jump()
- elseif has_words_before() then
- cmp.complete()
- else
- fallback()
- end
- end, { 'i', 's' }),
- ['<S-Tab>'] = cmp.mapping(function(fallback)
- if cmp.visible() then
- cmp.select_prev_item()
- elseif luasnip.jumpable(-1) then
- luasnip.jump(-1)
- else
- fallback()
- end
- end, { 'i', 's' }),
+ ['<Tab>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
+ ['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
+ ['jk'] = cmp.mapping.abort(),
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
- {name = 'buffer' },
+ { name = 'buffer' },
{ name = 'path' },
{ name = 'calc' },
}),
diff --git a/lua/plugins/general.lua b/lua/plugins/general.lua
index ddcacea..436d534 100644
--- a/lua/plugins/general.lua
+++ b/lua/plugins/general.lua
@@ -29,14 +29,4 @@ return {
'BufNewFile'
},
},
- {
- 'max397574/better-escape.nvim',
- lazy = false,
- config = function()
- require('better_escape').setup {
- mapping = { 'jk' },
- timeout = 0.2 * vim.o.timeoutlen,
- }
- end,
- },
}
diff --git a/lua/plugins/tex.lua b/lua/plugins/tex.lua
index 383e166..f8d4849 100644
--- a/lua/plugins/tex.lua
+++ b/lua/plugins/tex.lua
@@ -4,7 +4,7 @@ return {
lazy = false,
config = function()
vim.g.vimtex_quickfix_open_on_warning = 0
- vim.keymap.set('n', '<leader>ll', '<Cmd>VimtexCompileSS<CR>')
+ vim.keymap.set('n', '<leader>ll', '<Cmd>VimtexCompile<CR>')
end,
},
}