From 66fd13ec259370719b63ea9c3b7d9ab7ce558471 Mon Sep 17 00:00:00 2001 From: Ruslan Date: Tue, 18 Feb 2025 17:31:23 +0200 Subject: [PATCH] update completion --- lua/crentist/autocmd.lua | 8 ++++++++ lua/crentist/lazy/completion.lua | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lua/crentist/autocmd.lua b/lua/crentist/autocmd.lua index 3ce134b..32fd2f1 100644 --- a/lua/crentist/autocmd.lua +++ b/lua/crentist/autocmd.lua @@ -49,3 +49,11 @@ autocmd({ 'BufWritePre' }, { end, }) +autocmd({'FileType'}, { + group = CrentistGroup, + pattern = { 'json' }, + callback = function (e) + vim.keymap.set("n", "", function() vim.cmd('silent %!jq .') end, {buffer = e.buf}) + end +}) + diff --git a/lua/crentist/lazy/completion.lua b/lua/crentist/lazy/completion.lua index 641e7c4..97889e0 100644 --- a/lua/crentist/lazy/completion.lua +++ b/lua/crentist/lazy/completion.lua @@ -10,6 +10,7 @@ return { opts = { snippets = { + preset = 'luasnip', expand = function(snippet) require('luasnip').lsp_expand(snippet) end, active = function(filter) if filter and filter.direction then @@ -20,7 +21,7 @@ return { jump = function(direction) require('luasnip').jump(direction) end, }, - completion = { list = { selection = "auto_insert" } }, + completion = { list = { selection = { preselect = false, auto_insert = true } } }, keymap = { preset = 'enter', [''] = { 'select_next', 'snippet_forward', 'fallback' }, @@ -32,9 +33,12 @@ return { nerd_font_variant = 'mono' }, + cmdline = { + sources = {}, + }, + sources = { - default = { 'lsp', 'luasnip', 'path', 'buffer' }, - cmdline = {}, + default = { 'lsp', 'snippets', 'path', 'buffer' }, }, signature = { enabled = true }