neovim

Personal neovim configuration files
git clone git://gtms.dev:neovim
Log | Files | Refs

commit 10dd0cefae3c744f90de2e0861d5a55c8adb3b82
parent 2bfb5ef12f604d1e1bfa48e9ac82db02b31ba8ac
Author: Tomas Nemec <nemi@skaut.cz>
Date:   Thu,  2 Mar 2023 09:06:36 +0100

update

Diffstat:
Mafter/plugin/cmp.lua | 17+++++++----------
Mafter/plugin/luasnip.lua | 34++++++++++++++++++++++++++++------
Mlua/plugins.lua | 1-
3 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua @@ -122,26 +122,23 @@ cmp.setup({ experimental = { ghost_text = true }, }) -cmp.setup.cmdline('/', { -- +cmp.setup.cmdline('/', { + -- mapping = { ['<c-e>'] = { c = cmp.mapping.close() }, - ['<c-y>'] = cmp.mapping.confirm({ select = true }), - ['<c-space>'] = cmp.mapping { i = doOrOpen(cmp.confirm, { select = true }) }, + ['<c-y>'] = { c = cmp.mapping.confirm({ select = true }) }, + ['<c-space>'] = cmp.mapping { c = doOrOpen(cmp.confirm, { select = true }) }, ['<c-p>'] = cmp.mapping({ c = doOrOpen(cmp.select_prev_item, { behavior = cmp.SelectBehavior.Select }) }), ['<c-n>'] = cmp.mapping({ c = doOrOpen(cmp.select_next_item, { behavior = cmp.SelectBehavior.Select }) }), }, - sources = cmp.config.sources({ -- - { name = 'nvim_lsp_document_symbol' }, - }, { -- - { name = 'buffer' }, - }), + sources = cmp.config.sources({ { name = 'buffer' } }), }) cmp.setup.cmdline(':', { mapping = { ['<c-e>'] = { c = cmp.mapping.close() }, - ['<c-y>'] = cmp.mapping.confirm({ select = true }), - ['<c-space>'] = cmp.mapping { i = doOrOpen(cmp.confirm, { select = true }) }, + ['<c-y>'] = { c = cmp.mapping.confirm({ select = true }) }, + ['<c-space>'] = cmp.mapping { c = doOrOpen(cmp.confirm, { select = true }) }, ['<c-p>'] = cmp.mapping({ c = doOrOpen(cmp.select_prev_item, { behavior = cmp.SelectBehavior.Select }) }), ['<c-n>'] = cmp.mapping({ c = doOrOpen(cmp.select_next_item, { behavior = cmp.SelectBehavior.Select }) }), }, diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua @@ -1,4 +1,6 @@ -if not pcall(require, 'luasnip') then return end +if not pcall(require, 'luasnip') then + return +end local ls = require('luasnip') local types = require('luasnip.util.types') @@ -10,9 +12,21 @@ ls.config.set_config({ }) local opts = { silent = true } -vim.keymap.set({ 'i', 's' }, '<c-l>', function() if ls.expand_or_jumpable() then ls.expand_or_jump() end end, opts) -vim.keymap.set({ 'i', 's' }, '<c-h>', function() if ls.jumpable(-1) then ls.jump(-1) end end, opts) -vim.keymap.set({ 'i' }, '<c-e>', function() if ls.choice_active() then ls.change_choice(1) end end, opts) +vim.keymap.set({ 'i', 's' }, '<c-l>', function() + if ls.expand_or_jumpable() then + ls.expand_or_jump() + end +end, opts) +vim.keymap.set({ 'i', 's' }, '<c-h>', function() + if ls.jumpable(-1) then + ls.jump(-1) + end +end, opts) +vim.keymap.set({ 'i' }, '<c-e>', function() + if ls.choice_active() then + ls.change_choice(1) + end +end, opts) vim.keymap.set({ 'i' }, '<c-u>', require('luasnip.extras.select_choice'), opts) local s = ls.snippet @@ -34,11 +48,15 @@ local shell = function(command) return function() local file = io.popen(command, 'r') local res = {} - for line in file:lines() do table.insert(res, line) end + for line in file:lines() do + table.insert(res, line) + end return res[1] end end -local cmt = function() return require('luasnip.util.util').buffer_comment_chars()[1] end +local cmt = function() + return require('luasnip.util.util').buffer_comment_chars()[1] +end ls.cleanup() @@ -78,6 +96,8 @@ ls.add_snippets('dart', { Stream<{}> get {}; ]], { i(1), i(2) })), s('c', fmt([[ + import 'package:ngdart/angular.dart'; + @Component( selector: '{}', template: '{}' @@ -88,6 +108,8 @@ ls.add_snippets('dart', { }} ]], { i(1), i(2), i(3), i(4) })), s('d', fmt([[ + import 'package:ngdart/angular.dart'; + @Directive(selector: '{}') class {} {{ {} diff --git a/lua/plugins.lua b/lua/plugins.lua @@ -100,7 +100,6 @@ return packer.startup({ 'hrsh7th/cmp-calc', 'hrsh7th/cmp-cmdline', 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-nvim-lsp-document-symbol', 'hrsh7th/cmp-nvim-lsp-signature-help', 'hrsh7th/cmp-nvim-lua', 'hrsh7th/cmp-path',