From e3293211e52c45ea3465187520fa3233f05abdc8 Mon Sep 17 00:00:00 2001 From: thek4n Date: Tue, 2 Jul 2024 13:36:22 +0300 Subject: [PATCH] feat(nvim): add plugin for complete from tmux panes --- .../.config/nvim/lua/plugins/nvim_cmp.lua | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/home/user/.config/nvim/lua/plugins/nvim_cmp.lua b/home/user/.config/nvim/lua/plugins/nvim_cmp.lua index bbab40c..9445fc9 100644 --- a/home/user/.config/nvim/lua/plugins/nvim_cmp.lua +++ b/home/user/.config/nvim/lua/plugins/nvim_cmp.lua @@ -56,9 +56,10 @@ local function setup_cmp() }, }, sources = cmp.config.sources({ - { name = 'nvim_lsp', priority = 1250 }, - { name = 'luasnip', priority = 1000 }, - { name = 'buffer', priority = 750 }, + { name = 'nvim_lsp', priority = 1500 }, + { name = 'luasnip', priority = 1250 }, + { name = 'buffer', priority = 1000 }, + { name = 'tmux', priority = 750 }, { name = "dotenv", priority = 500 }, { name = 'path', priority = 250 }, }), @@ -88,9 +89,17 @@ return { end local map = vim.keymap.set - map({'i', 's'}, '', jump(1)) - map({'i', 's'}, '', jump(-1)) - + map({'i', 's'}, '', jump(1), {silent = true}) + map({'i', 's'}, '', jump(-1), {silent = true}) + map({'i', 's'}, '', ls.expand(), {silent = true}) + map({"i", "s"}, "", + function() + if ls.choice_active() then + ls.change_choice(1) + end + end, + {silent = true} + ) local luasnip_loaders = require("luasnip.loaders.from_snipmate") @@ -106,7 +115,8 @@ return { 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp', 'lukas-reineke/cmp-under-comparator', - 'SergioRibera/cmp-dotenv' + 'SergioRibera/cmp-dotenv', + 'andersevenrud/cmp-tmux', }, config = setup_cmp, },