From d7595fbb6a1eeef1edb56589cc376ba17ce175b9 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 31 Jul 2021 15:22:15 -0400 Subject: tab complete is more consistent --- lua/core/compe.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 801e2dd8..82d27717 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -58,6 +58,12 @@ M.setup = function() end end + local remap = vim.api.nvim_set_keymap + + remap("i", "", 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true }) + + remap("i", "", 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true }) + -- Use (s-)tab to: --- move to prev/next item in completion menuone --- jump to prev/next snippet's placeholder @@ -101,11 +107,11 @@ end M.set_tab_keybindings = function() local file_type = vim.fn.expand "%:e" - if is_excluded(file_type) == false then - vim.api.nvim_buf_set_keymap(0, "i", "", "v:lua.tab_complete()", { expr = true }) - vim.api.nvim_buf_set_keymap(0, "s", "", "v:lua.tab_complete()", { expr = true }) - vim.api.nvim_buf_set_keymap(0, "i", "", "v:lua.s_tab_complete()", { expr = true }) - vim.api.nvim_buf_set_keymap(0, "s", "", "v:lua.s_tab_complete()", { expr = true }) - end + -- if is_excluded(file_type) == false then + -- vim.api.nvim_buf_set_keymap(0, "i", "", "v:lua.tab_complete()", { expr = true }) + -- vim.api.nvim_buf_set_keymap(0, "s", "", "v:lua.tab_complete()", { expr = true }) + -- vim.api.nvim_buf_set_keymap(0, "i", "", "v:lua.s_tab_complete()", { expr = true }) + -- vim.api.nvim_buf_set_keymap(0, "s", "", "v:lua.s_tab_complete()", { expr = true }) + -- end end return M -- cgit v1.2.3 From db9adf2fb880a012bb3b8aac3c53eb75f204a050 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 31 Jul 2021 15:47:08 -0400 Subject: borders on docs --- lua/core/compe.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 82d27717..dc83ff09 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -12,7 +12,11 @@ M.config = function() max_abbr_width = 100, max_kind_width = 100, max_menu_width = 100, - documentation = true, + documentation = { + border = "single", + winhighlight = "NormalFloat:CompeDocumentation,FloatBorder:CompeDocumentationBorder", + }, + -- documentation = true, source = { path = { kind = "  (Path)" }, -- cgit v1.2.3 From 2b09dbf0984e836255a294d746159a68bdeb9be8 Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 31 Jul 2021 15:53:00 -0400 Subject: cleanup old tab filetype specific code --- lua/core/compe.lua | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index dc83ff09..08d8b8bd 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -34,8 +34,6 @@ M.config = function() emoji = { kind = " ﲃ (Emoji)", filetypes = { "markdown", "text" } }, -- for emoji press : (idk if that in compe tho) }, - -- FileTypes in this list won't trigger auto-complete when TAB is pressed. Hitting TAB will insert a tab character - exclude_filetypes = { "md", "markdown", "mdown", "mkd", "mkdn", "mdwn", "text", "txt" }, } end @@ -100,22 +98,4 @@ M.setup = function() vim.api.nvim_set_keymap("i", "", "compe#scroll({ 'delta': -4 })", { noremap = true, silent = true, expr = true }) end -local is_excluded = function(file_type) - for _, type in ipairs(lvim.builtin.compe.exclude_filetypes) do - if type == file_type then - return true - end - end - return false -end - -M.set_tab_keybindings = function() - local file_type = vim.fn.expand "%:e" - -- if is_excluded(file_type) == false then - -- vim.api.nvim_buf_set_keymap(0, "i", "", "v:lua.tab_complete()", { expr = true }) - -- vim.api.nvim_buf_set_keymap(0, "s", "", "v:lua.tab_complete()", { expr = true }) - -- vim.api.nvim_buf_set_keymap(0, "i", "", "v:lua.s_tab_complete()", { expr = true }) - -- vim.api.nvim_buf_set_keymap(0, "s", "", "v:lua.s_tab_complete()", { expr = true }) - -- end -end return M -- cgit v1.2.3 From 72f5a54ec2129148aa67da0d86fc8c7c58dedbed Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 1 Aug 2021 12:21:06 -0400 Subject: compe doc options --- lua/core/compe.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 08d8b8bd..155c7874 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -15,6 +15,10 @@ M.config = function() documentation = { border = "single", winhighlight = "NormalFloat:CompeDocumentation,FloatBorder:CompeDocumentationBorder", + max_width = 120, + min_width = 60, + max_height = math.floor(vim.o.lines * 0.3), + min_height = 1, }, -- documentation = true, -- cgit v1.2.3 From d5557f56c808f75f58c4d42e300e9a0a6baa43c1 Mon Sep 17 00:00:00 2001 From: Luc Sinet Date: Mon, 2 Aug 2021 08:05:46 +0200 Subject: Make keymaps of bufferline and compe configurable (#1205) --- lua/core/compe.lua | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 155c7874..e18147fc 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -38,6 +38,22 @@ M.config = function() emoji = { kind = " ﲃ (Emoji)", filetypes = { "markdown", "text" } }, -- for emoji press : (idk if that in compe tho) }, + + keymap = { + values = { + insert_mode = { + { "", 'pumvisible() ? "" : ""' }, + { "", 'pumvisible() ? "" : ""' }, + { "", "compe#complete()" }, + { "", "compe#close('')" }, + { "", "compe#scroll({ 'delta': +4 })" }, + { "", "compe#scroll({ 'delta': -4 })" }, + }, + }, + opts = { + insert_mode = { noremap = true, silent = true, expr = true }, + }, + }, } end @@ -64,12 +80,6 @@ M.setup = function() end end - local remap = vim.api.nvim_set_keymap - - remap("i", "", 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true }) - - remap("i", "", 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true }) - -- Use (s-)tab to: --- move to prev/next item in completion menuone --- jump to prev/next snippet's placeholder @@ -95,11 +105,8 @@ M.setup = function() end end - vim.api.nvim_set_keymap("i", "", "compe#complete()", { noremap = true, silent = true, expr = true }) - -- vim.api.nvim_set_keymap("i", "", "compe#confirm('')", { noremap = true, silent = true, expr = true }) - vim.api.nvim_set_keymap("i", "", "compe#close('')", { noremap = true, silent = true, expr = true }) - vim.api.nvim_set_keymap("i", "", "compe#scroll({ 'delta': +4 })", { noremap = true, silent = true, expr = true }) - vim.api.nvim_set_keymap("i", "", "compe#scroll({ 'delta': -4 })", { noremap = true, silent = true, expr = true }) + local keymap = require "utils.keymap" + keymap.load(lvim.builtin.compe.keymap.values, lvim.builtin.compe.keymap.opts) end return M -- cgit v1.2.3 From 6d14d7b5da54fffabfec18b2b09a488d3661d7f9 Mon Sep 17 00:00:00 2001 From: Luc Sinet Date: Mon, 2 Aug 2021 17:19:44 +0200 Subject: [Refactor] Adopt which key mapping style (#1210) * Refactor keymappings to match which-key style * Update confif example + remove redundant way of registering mappings --- lua/core/compe.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index e18147fc..5f1632f9 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -42,12 +42,12 @@ M.config = function() keymap = { values = { insert_mode = { - { "", 'pumvisible() ? "" : ""' }, - { "", 'pumvisible() ? "" : ""' }, - { "", "compe#complete()" }, - { "", "compe#close('')" }, - { "", "compe#scroll({ 'delta': +4 })" }, - { "", "compe#scroll({ 'delta': -4 })" }, + [""] = { 'pumvisible() ? "" : ""' }, + [""] = { 'pumvisible() ? "" : ""' }, + [""] = { "compe#complete()" }, + [""] = { "compe#close('')" }, + [""] = { "compe#scroll({ 'delta': +4 })" }, + [""] = { "compe#scroll({ 'delta': -4 })" }, }, }, opts = { -- cgit v1.2.3 From 77e283bd9c33166937756250918b12e349caf050 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 2 Aug 2021 23:42:56 +0200 Subject: [Refactor] Allow editing default keymaps (#1213) --- lua/core/compe.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 5f1632f9..2d183683 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -42,12 +42,12 @@ M.config = function() keymap = { values = { insert_mode = { - [""] = { 'pumvisible() ? "" : ""' }, - [""] = { 'pumvisible() ? "" : ""' }, - [""] = { "compe#complete()" }, - [""] = { "compe#close('')" }, - [""] = { "compe#scroll({ 'delta': +4 })" }, - [""] = { "compe#scroll({ 'delta': -4 })" }, + [""] = 'pumvisible() ? "" : ""', + [""] = 'pumvisible() ? "" : ""', + [""] = "compe#complete()", + [""] = "compe#close('')", + [""] = "compe#scroll({ 'delta': +4 })", + [""] = "compe#scroll({ 'delta': -4 })", }, }, opts = { @@ -105,7 +105,7 @@ M.setup = function() end end - local keymap = require "utils.keymap" + local keymap = require "keymappings" keymap.load(lvim.builtin.compe.keymap.values, lvim.builtin.compe.keymap.opts) end -- cgit v1.2.3 From b608b08ff3a5f28e7c57bc7bd7a30cfe2ab5c111 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 3 Aug 2021 12:54:23 +0430 Subject: fix compe tab completion issue (#1217) --- lua/core/compe.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 2d183683..e8cb857d 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -42,12 +42,12 @@ M.config = function() keymap = { values = { insert_mode = { - [""] = 'pumvisible() ? "" : ""', - [""] = 'pumvisible() ? "" : ""', - [""] = "compe#complete()", - [""] = "compe#close('')", - [""] = "compe#scroll({ 'delta': +4 })", - [""] = "compe#scroll({ 'delta': -4 })", + [""] = { 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true } }, + [""] = { 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true } }, + [""] = { "compe#complete()", { silent = true, noremap = true, expr = true } }, + [""] = { "compe#close('')", { silent = true, noremap = true, expr = true } }, + [""] = { "compe#scroll({ 'delta': +4 })", { silent = true, noremap = true, expr = true } }, + [""] = { "compe#scroll({ 'delta': -4 })", { silent = true, noremap = true, expr = true } }, }, }, opts = { -- cgit v1.2.3 From 3da49e4be455d72d2a69fb76472c1f022815681b Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 8 Aug 2021 13:34:59 -0400 Subject: tab can cycle through pum, insert a tab, and jump through snippets, what more could you want? --- lua/core/compe.lua | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index e8cb857d..830cc415 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -42,8 +42,8 @@ M.config = function() keymap = { values = { insert_mode = { - [""] = { 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true } }, - [""] = { 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true } }, + -- [""] = { 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true } }, + -- [""] = { 'pumvisible() ? "" : ""', { silent = true, noremap = true, expr = true } }, [""] = { "compe#complete()", { silent = true, noremap = true, expr = true } }, [""] = { "compe#close('')", { silent = true, noremap = true, expr = true } }, [""] = { "compe#scroll({ 'delta': +4 })", { silent = true, noremap = true, expr = true } }, @@ -86,12 +86,13 @@ M.setup = function() _G.tab_complete = function() if vim.fn.pumvisible() == 1 then return t "" - elseif vim.fn.call("vsnip#available", { 1 }) == 1 then - return t "(vsnip-expand-or-jump)" + elseif vim.fn.call("vsnip#jumpable", { 1 }) == 1 then + return t "(vsnip-jump-next)" elseif check_back_space() then return t "" else - return vim.fn["compe#complete"]() + -- return vim.fn["compe#complete"]() -- < use this if you want to always offer completion + return t "" end end @@ -107,6 +108,18 @@ M.setup = function() local keymap = require "keymappings" keymap.load(lvim.builtin.compe.keymap.values, lvim.builtin.compe.keymap.opts) + + vim.api.nvim_set_keymap("i", "", "v:lua.tab_complete()", { expr = true }) + vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", { expr = true }) + vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", { expr = true }) + vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", { expr = true }) + +-- vim.cmd[[ +-- imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' +-- smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' +-- imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' +-- smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' +-- ]] end return M -- cgit v1.2.3 From f3064248a0ba02b973fbd81f4eb93e18131d2fbc Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 8 Aug 2021 13:38:26 -0400 Subject: new event for vsnip --- lua/core/compe.lua | 6 ------ 1 file changed, 6 deletions(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 830cc415..fe41c6e6 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -114,12 +114,6 @@ M.setup = function() vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", { expr = true }) vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", { expr = true }) --- vim.cmd[[ --- imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' --- smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' --- imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' --- smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' --- ]] end return M -- cgit v1.2.3 From 93b37d6e8697ec07038f31b3d479c5f1c38777d8 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sun, 8 Aug 2021 22:51:09 +0430 Subject: fix formatting for compe (#1266) --- lua/core/compe.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index fe41c6e6..742fd07a 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -113,7 +113,6 @@ M.setup = function() vim.api.nvim_set_keymap("s", "", "v:lua.tab_complete()", { expr = true }) vim.api.nvim_set_keymap("i", "", "v:lua.s_tab_complete()", { expr = true }) vim.api.nvim_set_keymap("s", "", "v:lua.s_tab_complete()", { expr = true }) - end return M -- cgit v1.2.3 From 405423108fc31981c40116a827e845a1179c9053 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 9 Aug 2021 19:02:37 +0200 Subject: feat: Add an async logger using plenary (#1207) Co-authored-by: rebuilt --- lua/core/compe.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lua/core/compe.lua') diff --git a/lua/core/compe.lua b/lua/core/compe.lua index 742fd07a..c2f97e27 100644 --- a/lua/core/compe.lua +++ b/lua/core/compe.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" M.config = function() lvim.builtin.compe = { enabled = true, @@ -62,6 +63,7 @@ M.setup = function() local status_ok, compe = pcall(require, "compe") if not status_ok then + Log:get_default().error "Failed to load compe" return end -- cgit v1.2.3