From e6aceea12e2a685f458b0a351d4191fdb0ad21ef Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 29 Jul 2021 21:40:10 -0400 Subject: add packerstatus --- lua/core/which-key.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 9d4e7744..595e076e 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -97,6 +97,7 @@ M.config = function() i = { "PackerInstall", "Install" }, r = { "lua require('utils').reload_lv_config()", "Reload" }, s = { "PackerSync", "Sync" }, + S = { "PackerStatus", "Status" }, u = { "PackerUpdate", "Update" }, }, @@ -151,7 +152,6 @@ M.config = function() "lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})", "Prev Diagnostic", }, - l = { "silent lua require('lint').try_lint()", "Lint" }, q = { "Telescope quickfix", "Quickfix" }, r = { "lua vim.lsp.buf.rename()", "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, -- cgit v1.2.3 From ce8c63c6bf99bc5d8be5fc6c8db6023318791ac2 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Fri, 30 Jul 2021 23:14:25 +0430 Subject: Fix the galaxyline null pointer issue (#1179) --- lua/core/galaxyline.lua | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'lua/core') diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index aafe99bc..cf7d35d0 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -200,19 +200,38 @@ table.insert(gls.right, { }, }) +-- TODO: this function doesn't need to be this complicated local function get_attached_provider_name(msg) msg = msg or "LSP Inactive" - local buf_ft = vim.bo.filetype local buf_clients = vim.lsp.buf_get_clients() if next(buf_clients) == nil then return msg end + + local utils = require "utils" + local config = require("null-ls.config").get() + local builtins = require "null-ls.builtins" + -- concat all the builtin formatters and linters from null-ls + local all_things = builtins.formatting + for k, v in pairs(builtins.diagnostics) do + all_things[k] = v + end + + -- if we open multiple filetypes in the same session + -- null-ls will register multiple formatter/linters + -- but only use the ones that support vim.bo.filetype + -- so we need to filter them local buf_client_names = {} for _, client in pairs(buf_clients) do if client.name == "null-ls" then - table.insert(buf_client_names, lvim.lang[buf_ft].linters[1]) - table.insert(buf_client_names, lvim.lang[buf_ft].formatter.exe) + -- for every registered formatter/linter in the current buffer + for _, v in pairs(config._names) do + -- show only the ones that are being used for the current filetype + if utils.has_value(all_things[v].filetypes, buf_ft) then + table.insert(buf_client_names, v) + end + end else table.insert(buf_client_names, client.name) end -- cgit v1.2.3 From 9d89929d9bb47d1f78c2d3945b761da2f24a5643 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 31 Jul 2021 06:06:08 +0200 Subject: Enable querying lang-server formatting capabilities (#1078) --- lua/core/galaxyline.lua | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'lua/core') diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index cf7d35d0..2aae0242 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -6,6 +6,8 @@ if not status_ok then return end +local utils = require "utils" + -- NOTE: if someone defines colors but doesn't have them then this will break local palette_status_ok, colors = pcall(require, lvim.colorscheme .. ".palette") if not palette_status_ok then @@ -200,36 +202,22 @@ table.insert(gls.right, { }, }) --- TODO: this function doesn't need to be this complicated local function get_attached_provider_name(msg) msg = msg or "LSP Inactive" - local buf_ft = vim.bo.filetype local buf_clients = vim.lsp.buf_get_clients() if next(buf_clients) == nil then return msg end - - local utils = require "utils" - local config = require("null-ls.config").get() - local builtins = require "null-ls.builtins" - -- concat all the builtin formatters and linters from null-ls - local all_things = builtins.formatting - for k, v in pairs(builtins.diagnostics) do - all_things[k] = v - end - - -- if we open multiple filetypes in the same session - -- null-ls will register multiple formatter/linters - -- but only use the ones that support vim.bo.filetype - -- so we need to filter them + local buf_ft = vim.bo.filetype local buf_client_names = {} + local null_ls_providers = require("lsp.null-ls").requested_providers for _, client in pairs(buf_clients) do if client.name == "null-ls" then - -- for every registered formatter/linter in the current buffer - for _, v in pairs(config._names) do - -- show only the ones that are being used for the current filetype - if utils.has_value(all_things[v].filetypes, buf_ft) then - table.insert(buf_client_names, v) + for _, provider in pairs(null_ls_providers) do + if vim.tbl_contains(provider.filetypes, buf_ft) then + if not vim.tbl_contains(buf_client_names, provider.name) then + table.insert(buf_client_names, provider.name) + end end end else -- cgit v1.2.3 From b9ca4a157e5b2f2b34ca3800c79fc5b0f993e7d1 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sat, 31 Jul 2021 09:03:23 +0430 Subject: make telescope keybindings more sane (#1154) --- lua/core/telescope.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lua/core') diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua index 65760d6c..37d59982 100644 --- a/lua/core/telescope.lua +++ b/lua/core/telescope.lua @@ -40,11 +40,11 @@ M.config = function() -- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker, mappings = { i = { - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, [""] = actions.close, - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, + [""] = actions.cycle_history_next, + [""] = actions.cycle_history_prev, [""] = actions.smart_send_to_qflist + actions.open_qflist, [""] = actions.select_default + actions.center, -- To disable a keymap, put [map] = false -- cgit v1.2.3 From 2db171eee417de8916237c053244d7a44deac5c1 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sat, 31 Jul 2021 12:15:01 +0430 Subject: fix luacheck issues (#1184) --- lua/core/galaxyline.lua | 2 -- 1 file changed, 2 deletions(-) (limited to 'lua/core') diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index 2aae0242..63cffcf9 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -6,8 +6,6 @@ if not status_ok then return end -local utils = require "utils" - -- NOTE: if someone defines colors but doesn't have them then this will break local palette_status_ok, colors = pcall(require, lvim.colorscheme .. ".palette") if not palette_status_ok then -- cgit v1.2.3 From 8157f50d1308f42f3db1c7f69c226eb2e5c0b796 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 31 Jul 2021 15:04:22 +0200 Subject: feat: get null-ls registered providers by filetype (#1186) --- lua/core/galaxyline.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'lua/core') diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index 63cffcf9..b2325b19 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -203,25 +203,19 @@ table.insert(gls.right, { local function get_attached_provider_name(msg) msg = msg or "LSP Inactive" local buf_clients = vim.lsp.buf_get_clients() + local utils = require "utils" if next(buf_clients) == nil then return msg end local buf_ft = vim.bo.filetype local buf_client_names = {} - local null_ls_providers = require("lsp.null-ls").requested_providers + local null_ls_providers = require("lsp.null-ls").get_registered_providers_by_filetype(buf_ft) for _, client in pairs(buf_clients) do - if client.name == "null-ls" then - for _, provider in pairs(null_ls_providers) do - if vim.tbl_contains(provider.filetypes, buf_ft) then - if not vim.tbl_contains(buf_client_names, provider.name) then - table.insert(buf_client_names, provider.name) - end - end - end - else + if client.name ~= "null-ls" then table.insert(buf_client_names, client.name) end end + utils.list_extend_unique(buf_client_names, null_ls_providers) return table.concat(buf_client_names, ", ") end -- cgit v1.2.3 From cf16a2e826774e89d1bfe5812b6f73c3dd049db2 Mon Sep 17 00:00:00 2001 From: Geet Sethi <65440103+sethigeet@users.noreply.github.com> Date: Sat, 31 Jul 2021 19:14:08 +0530 Subject: Add the better peek functions (#1172) --- lua/core/which-key.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lua/core') diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 595e076e..17995e87 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -152,6 +152,12 @@ M.config = function() "lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = lvim.lsp.popup_border}})", "Prev Diagnostic", }, + p = { + name = "Peek", + d = { "lua require('lsp.peek').Peek('definition')", "Definition" }, + t = { "lua require('lsp.peek').Peek('typeDefinition')", "Type Definition" }, + i = { "lua require('lsp.peek').Peek('implementation')", "Implementation" }, + }, q = { "Telescope quickfix", "Quickfix" }, r = { "lua vim.lsp.buf.rename()", "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, -- cgit v1.2.3 From 213e3961fa637e4dbe4ef1ea5fceadcb372e020e Mon Sep 17 00:00:00 2001 From: chaeing Date: Sat, 31 Jul 2021 11:28:59 -0700 Subject: [Feature] Rename lv-config.lua to config.lua (#1193) * Rename example config files * Update user config path in installer * Update user config path with a variable * Update default user config file to config.lua * Add fallback to lv-config if config.lua not found * Add global variable USER_CONFIG_PATH --- lua/core/autocmds.lua | 2 +- lua/core/dashboard.lua | 3 +-- lua/core/terminal.lua | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'lua/core') diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index 89590454..1bc49d37 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -27,7 +27,7 @@ lvim.autocommands = { "*", "setlocal formatoptions-=c formatoptions-=r formatoptions-=o", }, - { "BufWritePost", "lv-config.lua", "lua require('utils').reload_lv_config()" }, + { "BufWritePost", USER_CONFIG_PATH, "lua require('utils').reload_lv_config()" }, { "FileType", "qf", diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua index 8d196458..2f14b9f1 100644 --- a/lua/core/dashboard.lua +++ b/lua/core/dashboard.lua @@ -43,8 +43,7 @@ M.config = function() }, d = { description = { " Settings " }, - -- command = ":e " .. CONFIG_PATH .. "/lv-config.lua", - command = ":e ~/.config/lvim/lv-config.lua", + command = ":e " .. USER_CONFIG_PATH, }, }, diff --git a/lua/core/terminal.lua b/lua/core/terminal.lua index 015341df..bd7815aa 100644 --- a/lua/core/terminal.lua +++ b/lua/core/terminal.lua @@ -32,7 +32,7 @@ M.config = function() background = "Normal", }, }, - -- Add executables on the lv-config file + -- Add executables on the config.lua -- { exec, keymap, name} -- lvim.builtin.terminal.execs = {{}} to overwrite -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"} -- cgit v1.2.3 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') 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') 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/autocmds.lua | 3 --- lua/core/compe.lua | 20 -------------------- 2 files changed, 23 deletions(-) (limited to 'lua/core') diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index 1bc49d37..d9884073 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -55,9 +55,6 @@ lvim.autocommands = { { "FileType", "markdown", "setlocal wrap" }, { "FileType", "markdown", "setlocal spell" }, }, - _tab_bindings = { - { "FileType", "*", "lua require'core.compe'.set_tab_keybindings()" }, - }, _buffer_bindings = { { "FileType", "floaterm", "nnoremap q :q" }, }, 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') 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/bufferline.lua | 18 ++++++++++++++++-- lua/core/compe.lua | 29 ++++++++++++++++++----------- 2 files changed, 34 insertions(+), 13 deletions(-) (limited to 'lua/core') diff --git a/lua/core/bufferline.lua b/lua/core/bufferline.lua index c5677580..1957226e 100644 --- a/lua/core/bufferline.lua +++ b/lua/core/bufferline.lua @@ -1,2 +1,16 @@ -vim.api.nvim_set_keymap("n", "", ":BufferNext", { noremap = true, silent = true }) -vim.api.nvim_set_keymap("n", "", ":BufferPrevious", { noremap = true, silent = true }) +lvim.builtin.bufferline = { + keymap = { + values = { + normal_mode = { + { "", ":BufferNext" }, + { "", ":BufferPrevious" }, + }, + }, + opts = { + normal_mode = { noremap = true, silent = true }, + }, + }, +} + +local keymap = require "utils.keymap" +keymap.load(lvim.builtin.bufferline.keymap.values, lvim.builtin.bufferline.keymap.opts) 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 8e88bf52587c99d1070258f03500cbbdb9b1420c Mon Sep 17 00:00:00 2001 From: Gauravsingh Sisodia <65955464+grvxs@users.noreply.github.com> Date: Mon, 2 Aug 2021 16:26:03 +0530 Subject: fix: comment typo (#1211) --- lua/core/autocmds.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index d9884073..62c05802 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -63,7 +63,7 @@ lvim.autocommands = { { "VimResized", "*", "wincmd =" }, }, _packer_compile = { - -- will cause split windows to be resized evenly if main window is resized + -- will run PackerCompile after writing plugins.lua { "BufWritePost", "plugins.lua", "PackerCompile" }, }, _general_lsp = { -- 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/bufferline.lua | 4 ++-- lua/core/compe.lua | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'lua/core') diff --git a/lua/core/bufferline.lua b/lua/core/bufferline.lua index 1957226e..35831d03 100644 --- a/lua/core/bufferline.lua +++ b/lua/core/bufferline.lua @@ -2,8 +2,8 @@ lvim.builtin.bufferline = { keymap = { values = { normal_mode = { - { "", ":BufferNext" }, - { "", ":BufferPrevious" }, + [""] = { ":BufferNext" }, + [""] = { ":BufferPrevious" }, }, }, opts = { 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/bufferline.lua | 15 +++++---------- lua/core/compe.lua | 14 +++++++------- lua/core/which-key.lua | 4 ++++ 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'lua/core') diff --git a/lua/core/bufferline.lua b/lua/core/bufferline.lua index 35831d03..68030c81 100644 --- a/lua/core/bufferline.lua +++ b/lua/core/bufferline.lua @@ -1,16 +1,11 @@ lvim.builtin.bufferline = { keymap = { - values = { - normal_mode = { - [""] = { ":BufferNext" }, - [""] = { ":BufferPrevious" }, - }, - }, - opts = { - normal_mode = { noremap = true, silent = true }, + normal_mode = { + [""] = ":BufferNext", + [""] = ":BufferPrevious", }, }, } -local keymap = require "utils.keymap" -keymap.load(lvim.builtin.bufferline.keymap.values, lvim.builtin.bufferline.keymap.opts) +local keymap = require "keymappings" +keymap.append_to_defaults(lvim.builtin.bufferline.keymap) 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 diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 17995e87..eab9266a 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -166,6 +166,10 @@ M.config = function() "Workspace Symbols", }, }, + L = { + name = "+LunarVim", + k = { "lua require('keymappings').print()", "View LunarVim's default keymappings" }, + }, s = { name = "Search", -- cgit v1.2.3 From dc3b47b7e7d015a8f47c5dae5d50e4d50f9e1cfb Mon Sep 17 00:00:00 2001 From: William Goulois <37271970+williamgoulois@users.noreply.github.com> Date: Tue, 3 Aug 2021 06:54:57 +0200 Subject: [Feature]: Add possibility to focus nvimtree instead of toggle (#1074) --- lua/core/nvimtree.lua | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'lua/core') diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index dd1f4f36..4e3c0ef6 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -3,6 +3,7 @@ local M = {} M.config = function() lvim.builtin.nvimtree = { side = "left", + width = 30, show_icons = { git = 1, folders = 1, @@ -65,6 +66,35 @@ M.setup = function() } end -- +M.focus_or_close = function() + local view_status_ok, view = pcall(require, "nvim-tree.view") + if not view_status_ok then + return + end + local a = vim.api + + local curwin = a.nvim_get_current_win() + local curbuf = a.nvim_win_get_buf(curwin) + local bufnr = view.View.bufnr + local winnr = view.get_winnr() + + if view.win_open() then + if curwin == winnr and curbuf == bufnr then + view.close() + if package.loaded["bufferline.state"] then + require("bufferline.state").set_offset(0) + end + else + view.focus() + end + else + view.open() + if package.loaded["bufferline.state"] and lvim.builtin.nvimtree.side == "left" then + -- require'bufferline.state'.set_offset(lvim.builtin.nvimtree.width + 1, 'File Explorer') + require("bufferline.state").set_offset(lvim.builtin.nvimtree.width + 1, "") + end + end +end -- M.toggle_tree = function() local view_status_ok, view = pcall(require, "nvim-tree.view") @@ -78,8 +108,8 @@ M.toggle_tree = function() end else if package.loaded["bufferline.state"] and lvim.builtin.nvimtree.side == "left" then - -- require'bufferline.state'.set_offset(31, 'File Explorer') - require("bufferline.state").set_offset(31, "") + -- require'bufferline.state'.set_offset(lvim.builtin.nvimtree.width + 1, 'File Explorer') + require("bufferline.state").set_offset(lvim.builtin.nvimtree.width + 1, "") end require("nvim-tree").toggle() end -- cgit v1.2.3 From c0a653a0cf5ef1842b086149b9e79a79cc62583d Mon Sep 17 00:00:00 2001 From: tafryn Date: Mon, 2 Aug 2021 22:43:57 -0700 Subject: Allow user's to define their own nvim-tree bindings (#1181) --- lua/core/nvimtree.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lua/core') diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index 4e3c0ef6..e29168e9 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -59,11 +59,13 @@ M.setup = function() local tree_cb = nvim_tree_config.nvim_tree_callback - g.nvim_tree_bindings = { - { key = { "l", "", "o" }, cb = tree_cb "edit" }, - { key = "h", cb = tree_cb "close_node" }, - { key = "v", cb = tree_cb "vsplit" }, - } + if not g.nvim_tree_bindings then + g.nvim_tree_bindings = { + { key = { "l", "", "o" }, cb = tree_cb "edit" }, + { key = "h", cb = tree_cb "close_node" }, + { key = "v", cb = tree_cb "vsplit" }, + } + end end -- M.focus_or_close = function() -- 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') 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 4c3c3f388557a182794bffdbf923129c66af885a Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:10:54 +0200 Subject: feat: add lvim.lsp.smart_cwd (#1218) - Enable querying the language-server for the `root_dir` - Use `root_dir` to set the current working-directory (CWD) - Make vim-rooter configurable and add an option to disable it Inspired by "ahmedkhalf/lsp-rooter.nvim" --- lua/core/nvimtree.lua | 6 ++++++ lua/core/rooter.lua | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 lua/core/rooter.lua (limited to 'lua/core') diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index e29168e9..1a0de0b8 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -117,4 +117,10 @@ M.toggle_tree = function() end end -- +function M.change_tree_dir(dir) + if vim.g.loaded_tree then + require("nvim-tree.lib").change_dir(dir) + end +end +-- return M diff --git a/lua/core/rooter.lua b/lua/core/rooter.lua new file mode 100644 index 00000000..8ebdf7cc --- /dev/null +++ b/lua/core/rooter.lua @@ -0,0 +1,15 @@ +local M = {} +function M.config() + lvim.builtin.rooter = { + --- This is on by default since it's currently the expected behavior. + ---@usage set to false to disable vim-rooter. + active = true, + silent_chdir = 1, + manual_only = 0, + } +end +function M.setup() + vim.g.rooter_silent_chdir = lvim.builtin.rooter.silent_chdir + vim.g.rooter_manual_only = lvim.builtin.rooter.manual_only +end +return M -- cgit v1.2.3 From 97fa3d9ec9e7d2416ed2d169eea757096db4581b Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 4 Aug 2021 15:20:09 -0400 Subject: update for lunarvim org --- lua/core/dashboard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua index 2f14b9f1..87741523 100644 --- a/lua/core/dashboard.lua +++ b/lua/core/dashboard.lua @@ -47,7 +47,7 @@ M.config = function() }, }, - footer = { "chrisatmachine.com" }, + footer = { "lunarvim.org" }, } end -- cgit v1.2.3 From 00d4ebc1657f4121e9f3d03f1b2c26fdd29a4247 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Thu, 5 Aug 2021 12:26:29 -0400 Subject: lq opens quickfix --- lua/core/which-key.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index eab9266a..6e0cbd8e 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -158,7 +158,7 @@ M.config = function() t = { "lua require('lsp.peek').Peek('typeDefinition')", "Type Definition" }, i = { "lua require('lsp.peek').Peek('implementation')", "Implementation" }, }, - q = { "Telescope quickfix", "Quickfix" }, + q = { "lua vim.lsp.diagnostic.set_loclist()", "Quickfix" }, r = { "lua vim.lsp.buf.rename()", "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, S = { -- cgit v1.2.3 From 106c9cad0d27ea9de4bf8576fe6f498a302f9d9d Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Thu, 5 Aug 2021 23:42:16 +0430 Subject: use_decoration_api has been removed from gitsigns (#1245) --- lua/core/gitsigns.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/gitsigns.lua b/lua/core/gitsigns.lua index 2a5060be..f2c98f7c 100644 --- a/lua/core/gitsigns.lua +++ b/lua/core/gitsigns.lua @@ -44,7 +44,6 @@ M.config = function() sign_priority = 6, update_debounce = 200, status_formatter = nil, -- Use default - use_decoration_api = false, } end -- cgit v1.2.3 From 20a4da558335a64a7cf7a6bd1d3500827e138635 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Thu, 5 Aug 2021 15:50:09 -0400 Subject: ability to toggle bufferline --- lua/core/bufferline.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'lua/core') diff --git a/lua/core/bufferline.lua b/lua/core/bufferline.lua index 68030c81..a51cff47 100644 --- a/lua/core/bufferline.lua +++ b/lua/core/bufferline.lua @@ -1,4 +1,5 @@ lvim.builtin.bufferline = { + active = true, keymap = { normal_mode = { [""] = ":BufferNext", -- cgit v1.2.3 From 9f3510286423ed700f3a2e04be02b95d93158a5c Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Fri, 6 Aug 2021 00:57:51 +0430 Subject: dap.stop is deprecated, use dap.close instead (#1247) --- lua/core/dap.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/dap.lua b/lua/core/dap.lua index 30e3aef9..f2ed5795 100644 --- a/lua/core/dap.lua +++ b/lua/core/dap.lua @@ -34,7 +34,7 @@ M.setup = function() p = { "lua require'dap'.pause.toggle()", "Pause" }, r = { "lua require'dap'.repl.toggle()", "Toggle Repl" }, s = { "lua require'dap'.continue()", "Start" }, - q = { "lua require'dap'.stop()", "Quit" }, + q = { "lua require'dap'.close()", "Quit" }, } end -- cgit v1.2.3 From 3ccd5dbc8c56495d8424ff41cdfdb4d0d8ff39af Mon Sep 17 00:00:00 2001 From: rebuilt Date: Fri, 6 Aug 2021 04:04:21 +0200 Subject: bufferline broke because the added active toggle will always be false. Set it in default_config to fix behavior --- lua/core/bufferline.lua | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'lua/core') diff --git a/lua/core/bufferline.lua b/lua/core/bufferline.lua index a51cff47..8989ce21 100644 --- a/lua/core/bufferline.lua +++ b/lua/core/bufferline.lua @@ -1,12 +1,20 @@ -lvim.builtin.bufferline = { - active = true, - keymap = { - normal_mode = { - [""] = ":BufferNext", - [""] = ":BufferPrevious", +local M = {} + +M.config = function() + lvim.builtin.bufferline = { + active = true, + keymap = { + normal_mode = { + [""] = ":BufferNext", + [""] = ":BufferPrevious", + }, }, - }, -} + } +end + +M.setup = function() + local keymap = require "keymappings" + keymap.append_to_defaults(lvim.builtin.bufferline.keymap) +end -local keymap = require "keymappings" -keymap.append_to_defaults(lvim.builtin.bufferline.keymap) +return M -- cgit v1.2.3 From 990bb622e0a7f90881a6016570c6f205499b1c0d Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 6 Aug 2021 10:39:08 +0200 Subject: chore: remove now-redundant utility function --- lua/core/galaxyline.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lua/core') diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index b2325b19..d3f9342b 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -203,7 +203,6 @@ table.insert(gls.right, { local function get_attached_provider_name(msg) msg = msg or "LSP Inactive" local buf_clients = vim.lsp.buf_get_clients() - local utils = require "utils" if next(buf_clients) == nil then return msg end @@ -215,7 +214,7 @@ local function get_attached_provider_name(msg) table.insert(buf_client_names, client.name) end end - utils.list_extend_unique(buf_client_names, null_ls_providers) + vim.list_extend(buf_client_names, null_ls_providers) return table.concat(buf_client_names, ", ") end -- cgit v1.2.3 From 9fc6a2e1cdac513c8ff09069263ff102852be86a Mon Sep 17 00:00:00 2001 From: grvxs Date: Fri, 6 Aug 2021 16:50:25 +0530 Subject: fix: typos in lua/ --- lua/core/dashboard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua index 87741523..27d4efd1 100644 --- a/lua/core/dashboard.lua +++ b/lua/core/dashboard.lua @@ -84,7 +84,7 @@ M.setup = function() require("core.autocmds").define_augroups { _dashboard = { - -- seems to be nobuflisted that makes my stuff disapear will do more testing + -- seems to be nobuflisted that makes my stuff disappear will do more testing { "FileType", "dashboard", -- cgit v1.2.3 From 47ebd70817c99c657271e399c0b98b920f765f29 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 6 Aug 2021 16:27:19 +0200 Subject: Add LunarVim info panel (Experimental) (#1241) * feat: lunarvim info (Experimental) * Add missing providers info * Use nvim api directly to create the popup * width tweaks --- lua/core/info.lua | 180 +++++++++++++++++++++++++++++++++++++++++++++++++ lua/core/which-key.lua | 4 ++ 2 files changed, 184 insertions(+) create mode 100644 lua/core/info.lua (limited to 'lua/core') diff --git a/lua/core/info.lua b/lua/core/info.lua new file mode 100644 index 00000000..7f8a0a33 --- /dev/null +++ b/lua/core/info.lua @@ -0,0 +1,180 @@ +local M = {} +local u = require "utils" +local null_ls_handler = require "lsp.null-ls" +local indent = " " + +M.banner = { + "", + "", + "⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀ ⠀⠀⠀ ⠀⠀ ⣺⡿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀", + "⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀.⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀ ⣿⣯ ⣿⡟⠀ ⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤", + "⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿", + "⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏", + "⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃", + "⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀", + "", + "", +} + +local function str_list(list) + return "[ " .. table.concat(list, ", ") .. " ]" +end + +local function get_formatter_suggestion_msg(ft) + local supported_formatters = u.get_supported_formatters_by_filetype(ft) + return { + "-------------------------------------------------------------------", + "", + "  HINT ", + "", + indent .. "* List of supported formatters: " .. str_list(supported_formatters), + "", + indent .. "You can enable a supported formatter by adding this to your config.lua", + "", + indent + .. "lvim.lang." + .. tostring(ft) + .. [[.formatting = { { exe = ']] + .. table.concat(supported_formatters, "|") + .. [[' } }]], + "", + "-------------------------------------------------------------------", + } +end + +local function get_linter_suggestion_msg(ft) + local supported_linters = u.get_supported_linters_by_filetype(ft) + return { + "-------------------------------------------------------------------", + "", + "  HINT ", + "", + indent .. "* List of supported linters: " .. str_list(supported_linters), + "", + indent .. "You can enable a supported linter by adding this to your config.lua", + "", + indent + .. "lvim.lang." + .. tostring(ft) + .. [[.linters = { { exe = ']] + .. table.concat(supported_linters, "|") + .. [[' } }]], + "", + "-------------------------------------------------------------------", + } +end + +---creates an average size popup +---@param buf_lines a list of lines to print +---@param callback could be used to set syntax highlighting rules for example +---@return bufnr buffer number of the created buffer +---@return win_id window ID of the created popup +function M.create_simple_popup(buf_lines, callback) + -- runtime/lua/vim/lsp/util.lua + local bufnr = vim.api.nvim_create_buf(false, true) + local height_percentage = 0.7 + local width_percentage = 0.8 + local row_start_percentage = (1 - height_percentage) / 2 + local col_start_percentage = (1 - width_percentage) / 2 + local opts = {} + opts.relative = "editor" + opts.height = math.ceil(vim.o.lines * height_percentage) + opts.row = math.ceil(vim.o.lines * row_start_percentage) + opts.col = math.floor(vim.o.columns * col_start_percentage) + opts.width = math.floor(vim.o.columns * width_percentage) + opts.border = { + "┌", + "-", + "┐", + "|", + "┘", + "-", + "└", + "|", + } + + local win_id = vim.api.nvim_open_win(bufnr, true, opts) + + vim.api.nvim_win_set_buf(win_id, bufnr) + -- this needs to be window option! + vim.api.nvim_win_set_option(win_id, "number", false) + vim.cmd "setlocal nocursorcolumn" + vim.cmd "setlocal wrap" + -- set buffer options + vim.api.nvim_buf_set_option(bufnr, "filetype", "lspinfo") + vim.lsp.util.close_preview_autocmd({ "BufHidden", "BufLeave" }, win_id) + buf_lines = vim.lsp.util._trim(buf_lines, {}) + vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, buf_lines) + vim.api.nvim_buf_set_option(bufnr, "modifiable", false) + if type(callback) == "function" then + callback() + end + return bufnr, win_id +end + +function M.toggle_popup(ft) + local client = u.get_active_client_by_ft(ft) + local is_client_active = not client.is_stopped() + local client_enabled_caps = require("lsp").get_ls_capabilities(client.id) + local num_caps = vim.tbl_count(client_enabled_caps) + local null_ls_providers = null_ls_handler.get_registered_providers_by_filetype(ft) + + local missing_linters = lvim.lang[ft].linters._failed_requests or {} + local missing_formatters = lvim.lang[ft].formatters._failed_requests or {} + + local buf_lines = {} + vim.list_extend(buf_lines, M.banner) + + local header = { + "Detected filetype is: " .. tostring(ft), + "", + "Treesitter active: " .. tostring(next(vim.treesitter.highlighter.active) ~= nil), + "", + "", + } + vim.list_extend(buf_lines, header) + + local lsp_info = { + "Associated language-server: " .. client.name, + indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(client.id), + indent .. "* Formatting support: " .. tostring(client.resolved_capabilities.document_formatting), + indent .. "* Capabilities list: " .. table.concat(vim.list_slice(client_enabled_caps, 1, num_caps / 2), ", "), + indent .. indent .. indent .. table.concat(vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)), ", "), + "", + } + vim.list_extend(buf_lines, lsp_info) + + local null_ls_info = { + "Configured providers: " .. table.concat(null_ls_providers, "  , ") .. "  ", + "", + } + vim.list_extend(buf_lines, null_ls_info) + + local missing_formatters_status + if vim.tbl_count(missing_formatters) > 0 then + missing_formatters_status = { "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ", "" } + vim.list_extend(buf_lines, missing_formatters_status) + end + + local missing_linters_status + if vim.tbl_count(missing_linters) > 0 then + missing_linters_status = { "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ", "" } + vim.list_extend(buf_lines, missing_linters_status) + end + + vim.list_extend(buf_lines, get_formatter_suggestion_msg(ft)) + + vim.list_extend(buf_lines, get_linter_suggestion_msg(ft)) + + local function set_syntax_hl() + --TODO: highlighting is either inconsistent or not working :\ + vim.cmd("syntax match Identifier /filetype is: .*\\zs\\<" .. ft .. "\\>/") + vim.cmd("syntax match Identifier /server: .*\\zs\\<" .. client.name .. "\\>/") + vim.cmd("syntax match Identifier /providers: .*\\zs\\<" .. table.concat(null_ls_providers, ", ") .. "\\>/") + vim.cmd("syntax match Identifier /formatters: .*\\zs\\<" .. table.concat(missing_formatters, ", ") .. "\\>/") + vim.cmd("syntax match Identifier /linters: .*\\zs\\<" .. table.concat(missing_linters, ", ") .. "\\>/") + end + + return M.create_simple_popup(buf_lines, set_syntax_hl) +end +return M diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 6e0cbd8e..268243e4 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -169,6 +169,10 @@ M.config = function() L = { name = "+LunarVim", k = { "lua require('keymappings').print()", "View LunarVim's default keymappings" }, + i = { + "lua require('core.info').toggle_popup(vim.bo.filetype)", + "Toggle LunarVim Info", + }, }, s = { -- cgit v1.2.3 From 730542a47da8e2dbb7e0a800c425f210a0325b1b Mon Sep 17 00:00:00 2001 From: ashincoder <83629316+ashincoder@users.noreply.github.com> Date: Sat, 7 Aug 2021 14:53:25 +0530 Subject: Added space after plug icon (#1252) --- lua/core/dashboard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua index 27d4efd1..d5e5bfe9 100644 --- a/lua/core/dashboard.lua +++ b/lua/core/dashboard.lua @@ -72,7 +72,7 @@ M.setup = function() vim.api.nvim_exec( [[ - let g:dashboard_custom_footer = ['LunarVim loaded '..packages..' plugins '] + let g:dashboard_custom_footer = ['LunarVim loaded '..packages..' plugins  '] ]], false ) -- cgit v1.2.3 From 6aab0ea8ac6948fb75dd1a68c0aa07e8ccf2b8ff Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sun, 8 Aug 2021 13:26:33 +0430 Subject: fix compe for latex --- lua/core/autopairs.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/autopairs.lua b/lua/core/autopairs.lua index f0111db6..751e47df 100644 --- a/lua/core/autopairs.lua +++ b/lua/core/autopairs.lua @@ -24,7 +24,7 @@ MUtils.completion_confirm = function() end end -if package.loaded["compe"] then +if package.loaded["compe"] and vim.bo.filetype ~= "tex" then require("nvim-autopairs.completion.compe").setup { map_cr = true, -- map on insert mode map_complete = true, -- it will auto insert `(` after select function or method item -- cgit v1.2.3 From 1484e056827080ed7946e7e664e11eedccd8a6f9 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sun, 8 Aug 2021 20:51:24 +0430 Subject: better compe support for latex --- lua/core/autopairs.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lua/core') diff --git a/lua/core/autopairs.lua b/lua/core/autopairs.lua index 751e47df..f989864f 100644 --- a/lua/core/autopairs.lua +++ b/lua/core/autopairs.lua @@ -24,10 +24,11 @@ MUtils.completion_confirm = function() end end -if package.loaded["compe"] and vim.bo.filetype ~= "tex" then +if package.loaded["compe"] then + local map_complete_optional = vim.bo.filetype ~= "tex" require("nvim-autopairs.completion.compe").setup { map_cr = true, -- map on insert mode - map_complete = true, -- it will auto insert `(` after select function or method item + map_complete = map_complete_optional, -- it will auto insert `(` after select function or method item } end -- 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') 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') 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') 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 625df947dcacf3804f4ec7335478535ecd8219af Mon Sep 17 00:00:00 2001 From: Pasi Bergman Date: Mon, 9 Aug 2021 17:59:27 +0300 Subject: [Feature] Add LvimInfo command (#1269) * feature: add LvimInfo command * Move :LvimInfo to core/commands.lua --- lua/core/commands.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lua/core') diff --git a/lua/core/commands.lua b/lua/core/commands.lua index c42b385d..22170c85 100644 --- a/lua/core/commands.lua +++ b/lua/core/commands.lua @@ -10,6 +10,8 @@ M.defaults = { endif endfunction ]], + -- :LvimInfo + [[command! LvimInfo lua require('core.info').toggle_popup(vim.bo.filetype)]], } M.load = function(commands) -- 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/autopairs.lua | 2 ++ lua/core/compe.lua | 2 ++ lua/core/dap.lua | 2 ++ lua/core/galaxyline.lua | 2 ++ lua/core/gitsigns.lua | 2 ++ lua/core/log.lua | 29 +++++++++++++++++++++++++++++ lua/core/nvimtree.lua | 2 ++ lua/core/telescope.lua | 2 ++ lua/core/terminal.lua | 48 +++++++++++++++++++++++++++++++++++++++++++++--- lua/core/treesitter.lua | 2 ++ lua/core/which-key.lua | 20 +++++++++++++++++++- 11 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 lua/core/log.lua (limited to 'lua/core') diff --git a/lua/core/autopairs.lua b/lua/core/autopairs.lua index f989864f..a5f21a1b 100644 --- a/lua/core/autopairs.lua +++ b/lua/core/autopairs.lua @@ -1,8 +1,10 @@ -- if not package.loaded['nvim-autopairs'] then -- return -- end +local Log = require "core.log" local status_ok, _ = pcall(require, "nvim-autopairs") if not status_ok then + Log:get_default().error "Failed to load autopairs" return end local npairs = require "nvim-autopairs" 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 diff --git a/lua/core/dap.lua b/lua/core/dap.lua index f2ed5795..4e21cc4c 100644 --- a/lua/core/dap.lua +++ b/lua/core/dap.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" M.config = function() lvim.builtin.dap = { active = false, @@ -14,6 +15,7 @@ end M.setup = function() local status_ok, dap = pcall(require, "dap") if not status_ok then + Log:get_default().error "Failed to load dap" return end diff --git a/lua/core/galaxyline.lua b/lua/core/galaxyline.lua index d3f9342b..ee0a317d 100644 --- a/lua/core/galaxyline.lua +++ b/lua/core/galaxyline.lua @@ -1,8 +1,10 @@ -- if not package.loaded['galaxyline'] then -- return -- end +local Log = require "core.log" local status_ok, gl = pcall(require, "galaxyline") if not status_ok then + Log:get_default().error "Failed to load galaxyline" return end diff --git a/lua/core/gitsigns.lua b/lua/core/gitsigns.lua index f2c98f7c..9e023762 100644 --- a/lua/core/gitsigns.lua +++ b/lua/core/gitsigns.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" M.config = function() lvim.builtin.gitsigns = { signs = { @@ -50,6 +51,7 @@ end M.setup = function() local status_ok, gitsigns = pcall(require, "gitsigns") if not status_ok then + Log:get_default().error "Failed to load gitsigns" return end gitsigns.setup(lvim.builtin.gitsigns) diff --git a/lua/core/log.lua b/lua/core/log.lua new file mode 100644 index 00000000..5dd5622e --- /dev/null +++ b/lua/core/log.lua @@ -0,0 +1,29 @@ +local Log = {} + +--- Creates a log handle based on Plenary.log +---@param opts these are passed verbatim to Plenary.log +---@return log handle +function Log:new(opts) + local status_ok, _ = pcall(require, "plenary.log") + if not status_ok then + return nil + end + + local obj = require("plenary.log").new(opts) + local path = string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), opts.plugin) + + obj.get_path = function() + return path + end + + return obj +end + +--- Creates or retrieves a log handle for the default logfile +--- based on Plenary.log +---@return log handle +function Log:get_default() + return Log:new { plugin = "lunarvim", level = lvim.log.level } +end + +return Log diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index 1a0de0b8..4d15b1b5 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" -- M.config = function() lvim.builtin.nvimtree = { @@ -49,6 +50,7 @@ end M.setup = function() local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") if not status_ok then + Log:get_default().error "Failed to load nvim-tree.config" return end local g = vim.g diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua index 37d59982..f4d154b0 100644 --- a/lua/core/telescope.lua +++ b/lua/core/telescope.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" M.config = function() local status_ok, actions = pcall(require, "telescope.actions") if not status_ok then @@ -79,6 +80,7 @@ end M.setup = function() local status_ok, telescope = pcall(require, "telescope") if not status_ok then + Log:get_default().error "Failed to load telescope" return end telescope.setup(lvim.builtin.telescope) diff --git a/lua/core/terminal.lua b/lua/core/terminal.lua index bd7815aa..818038fd 100644 --- a/lua/core/terminal.lua +++ b/lua/core/terminal.lua @@ -1,8 +1,11 @@ local M = {} +local Log = require "core.log" +local utils = require "utils" + M.config = function() lvim.builtin["terminal"] = { -- size can be a number or function which is passed the current terminal - size = 5, + size = 20, -- open_mapping = [[]], open_mapping = [[]], hide_numbers = true, -- hide the number column in toggleterm buffers @@ -11,7 +14,7 @@ M.config = function() shading_factor = 2, -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light start_in_insert = true, insert_mappings = true, -- whether or not the open mapping applies in insert mode - persist_size = true, + persist_size = false, -- direction = 'vertical' | 'horizontal' | 'window' | 'float', direction = "float", close_on_exit = true, -- close the terminal window when the process exits @@ -36,13 +39,16 @@ M.config = function() -- { exec, keymap, name} -- lvim.builtin.terminal.execs = {{}} to overwrite -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"} - execs = { { "lazygit", "gg", "LazyGit" } }, + execs = { + { "lazygit", "gg", "LazyGit" }, + }, } end M.setup = function() local status_ok, terminal = pcall(require, "toggleterm") if not status_ok then + Log:get_default().error "Failed to load toggleterm" print(terminal) return end @@ -88,4 +94,40 @@ M._exec_toggle = function(exec) exec_term:toggle() end +local function get_log_path(name) + --handle custom paths not managed by Plenary.log + local logger = require "core.log" + local file + if name == "nvim" then + file = CACHE_PATH .. "/log" + else + file = logger:new({ plugin = name }):get_path() + end + if utils.is_file(file) then + return file + end +end + +---Toggles a log viewer according to log.viewer.layout_config +---@param name can be the name of any of the managed logs, e,g. "lunarvim" or the default ones {"nvim", "lsp", "packer.nvim"} +M.toggle_log_view = function(name) + local logfile = get_log_path(name) + if not logfile then + return + end + local term_opts = vim.tbl_deep_extend("force", lvim.builtin.terminal, { + cmd = lvim.log.viewer.cmd .. " " .. logfile, + open_mapping = lvim.log.viewer.layout_config.open_mapping, + direction = lvim.log.viewer.layout_config.direction, + -- TODO: this might not be working as expected + size = lvim.log.viewer.layout_config.size, + float_opts = lvim.log.viewer.layout_config.float_opts, + }) + + local Terminal = require("toggleterm.terminal").Terminal + local log_view = Terminal:new(term_opts) + -- require("core.log"):get_default().debug("term", vim.inspect(term_opts)) + log_view:toggle() +end + return M diff --git a/lua/core/treesitter.lua b/lua/core/treesitter.lua index cfc58bb7..0a8a2ff2 100644 --- a/lua/core/treesitter.lua +++ b/lua/core/treesitter.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" M.config = function() lvim.builtin.treesitter = { ensure_installed = {}, -- one of "all", "maintained" (parsers with maintainers), or a list of languages @@ -64,6 +65,7 @@ end M.setup = function() local status_ok, treesitter_configs = pcall(require, "nvim-treesitter.configs") if not status_ok then + Log:get_default().error "Failed to load nvim-treesitter.configs" return end diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 268243e4..90bf1ace 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -1,4 +1,5 @@ local M = {} +local Log = require "core.log" M.config = function() lvim.builtin.which_key = { active = false, @@ -173,8 +174,24 @@ M.config = function() "lua require('core.info').toggle_popup(vim.bo.filetype)", "Toggle LunarVim Info", }, + l = { + name = "+logs", + d = { + "lua require('core.terminal').toggle_log_view('lunarvim')", + "view default log", + }, + D = { "edit ~/.cache/nvim/lunarvim.log", "Open the default logfile" }, + n = { "lua require('core.terminal').toggle_log_view('lsp')", "view lsp log" }, + N = { "edit ~/.cache/nvim/log", "Open the Neovim logfile" }, + l = { "lua require('core.terminal').toggle_log_view('nvim')", "view neovim log" }, + L = { "edit ~/.cache/nvim/lsp.log", "Open the LSP logfile" }, + p = { + "lua require('core.terminal').toggle_log_view('packer.nvim')", + "view packer log", + }, + P = { "edit ~/.cache/nvim/packer.nvim.log", "Open the Packer logfile" }, + }, }, - s = { name = "Search", b = { "Telescope git_branches", "Checkout branch" }, @@ -206,6 +223,7 @@ M.setup = function() -- end local status_ok, which_key = pcall(require, "which-key") if not status_ok then + Log:get_default "Failed to load whichkey" return end -- cgit v1.2.3 From 68287877806e1931f4c6f342c3ee0ba47b634737 Mon Sep 17 00:00:00 2001 From: Ahmed Khalf Date: Tue, 10 Aug 2021 18:59:05 +0400 Subject: Fix window borders for lunarvim info (#1280) --- lua/core/info.lua | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lua/core') diff --git a/lua/core/info.lua b/lua/core/info.lua index 7f8a0a33..501f786e 100644 --- a/lua/core/info.lua +++ b/lua/core/info.lua @@ -23,7 +23,7 @@ end local function get_formatter_suggestion_msg(ft) local supported_formatters = u.get_supported_formatters_by_filetype(ft) return { - "-------------------------------------------------------------------", + "───────────────────────────────────────────────────────────────────", "", "  HINT ", "", @@ -35,17 +35,17 @@ local function get_formatter_suggestion_msg(ft) .. "lvim.lang." .. tostring(ft) .. [[.formatting = { { exe = ']] - .. table.concat(supported_formatters, "|") + .. table.concat(supported_formatters, "│") .. [[' } }]], "", - "-------------------------------------------------------------------", + "───────────────────────────────────────────────────────────────────", } end local function get_linter_suggestion_msg(ft) local supported_linters = u.get_supported_linters_by_filetype(ft) return { - "-------------------------------------------------------------------", + "───────────────────────────────────────────────────────────────────", "", "  HINT ", "", @@ -57,10 +57,10 @@ local function get_linter_suggestion_msg(ft) .. "lvim.lang." .. tostring(ft) .. [[.linters = { { exe = ']] - .. table.concat(supported_linters, "|") + .. table.concat(supported_linters, "│") .. [[' } }]], "", - "-------------------------------------------------------------------", + "───────────────────────────────────────────────────────────────────", } end @@ -83,14 +83,14 @@ function M.create_simple_popup(buf_lines, callback) opts.col = math.floor(vim.o.columns * col_start_percentage) opts.width = math.floor(vim.o.columns * width_percentage) opts.border = { - "┌", - "-", - "┐", - "|", - "┘", - "-", - "└", - "|", + "╭", + "─", + "╮", + "│", + "╯", + "─", + "╰", + "│", } local win_id = vim.api.nvim_open_win(bufnr, true, opts) -- cgit v1.2.3 From a6a10e3fdbcfea9d8600772b91e45fb19084a390 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 10 Aug 2021 15:01:26 -0400 Subject: bring back behavior we used to get from astronauta --- lua/core/autocmds.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lua/core') diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index 62c05802..c00e4ba7 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -2,6 +2,11 @@ local autocommands = {} lvim.autocommands = { _general_settings = { + { + "Filetype", + "*", + "lua require('utils.ft').do_filetype(vim.fn.expand(\"\"))", + }, { "TextYankPost", "*", -- cgit v1.2.3 From 2fcb64ac561b2860ccac2e28dcaed51d00337f85 Mon Sep 17 00:00:00 2001 From: tuxflo Date: Wed, 11 Aug 2021 04:56:25 +0200 Subject: change no highlight behavior (#1285) with `let @/=""` its not possible to use `n`,`N` or stuff like `gcn` anymore because the last search is overwritten. With `:nohlsearch` this is not the case. --- lua/core/which-key.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 90bf1ace..67a553ff 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -68,7 +68,7 @@ M.config = function() ["c"] = { "BufferClose!", "Close Buffer" }, ["e"] = { "lua require'core.nvimtree'.toggle_tree()", "Explorer" }, ["f"] = { "Telescope find_files", "Find File" }, - ["h"] = { 'let @/=""', "No Highlight" }, + ["h"] = { 'nohlsearch', "No Highlight" }, b = { name = "Buffers", j = { "BufferPick", "jump to buffer" }, -- cgit v1.2.3 From e7c6275879dfceeedb99b74e3cce9f41e3e22625 Mon Sep 17 00:00:00 2001 From: Pasi Bergman Date: Wed, 11 Aug 2021 08:54:53 +0300 Subject: [Refactor] LunarVim Info UI (#1281) * refactor: lunarvim info ui * refactor: lunarvim info ui - remove close hint, add highlighting * refactor: lunarvim info ui - remove TODO --- lua/core/info.lua | 137 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 83 insertions(+), 54 deletions(-) (limited to 'lua/core') diff --git a/lua/core/info.lua b/lua/core/info.lua index 501f786e..e4c787a2 100644 --- a/lua/core/info.lua +++ b/lua/core/info.lua @@ -4,15 +4,19 @@ local null_ls_handler = require "lsp.null-ls" local indent = " " M.banner = { - "", - "", - "⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀ ⠀⠀⠀ ⠀⠀ ⣺⡿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀", - "⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀.⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀ ⣿⣯ ⣿⡟⠀ ⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤", - "⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿", - "⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏", - "⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃", - "⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀", - "", + " ", + indent + .. "⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀ ⠀⠀⠀ ⠀⠀ ⣺⡿⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀", + indent + .. "⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀.⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀ ⣿⣯ ⣿⡟⠀ ⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤", + indent + .. "⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿", + indent + .. "⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏", + indent + .. "⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃", + indent + .. "⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀", "", } @@ -23,44 +27,42 @@ end local function get_formatter_suggestion_msg(ft) local supported_formatters = u.get_supported_formatters_by_filetype(ft) return { - "───────────────────────────────────────────────────────────────────", + indent + .. "───────────────────────────────────────────────────────────────────", "", - "  HINT ", + indent .. " HINT ", "", indent .. "* List of supported formatters: " .. str_list(supported_formatters), + indent .. "* Configured formatter needs to be installed and executable.", + indent .. "* Enable installed formatter(s) with following config in ~/.config/lvim/config.lua", "", - indent .. "You can enable a supported formatter by adding this to your config.lua", - "", - indent - .. "lvim.lang." - .. tostring(ft) - .. [[.formatting = { { exe = ']] - .. table.concat(supported_formatters, "│") - .. [[' } }]], + indent .. " lvim.lang." .. tostring(ft) .. [[.formatting = { { exe = ']] .. table.concat( + supported_formatters, + "│" + ) .. [[' } }]], "", - "───────────────────────────────────────────────────────────────────", } end local function get_linter_suggestion_msg(ft) local supported_linters = u.get_supported_linters_by_filetype(ft) return { - "───────────────────────────────────────────────────────────────────", + indent + .. "───────────────────────────────────────────────────────────────────", "", - "  HINT ", + indent .. " HINT ", "", indent .. "* List of supported linters: " .. str_list(supported_linters), - "", - indent .. "You can enable a supported linter by adding this to your config.lua", + indent .. "* Configured linter needs to be installed and executable.", + indent .. "* Enable installed linter(s) with following config in ~/.config/lvim/config.lua", "", indent - .. "lvim.lang." + .. " lvim.lang." .. tostring(ft) .. [[.linters = { { exe = ']] .. table.concat(supported_linters, "│") .. [[' } }]], "", - "───────────────────────────────────────────────────────────────────", } end @@ -72,26 +74,30 @@ end function M.create_simple_popup(buf_lines, callback) -- runtime/lua/vim/lsp/util.lua local bufnr = vim.api.nvim_create_buf(false, true) - local height_percentage = 0.7 + local height_percentage = 0.9 local width_percentage = 0.8 local row_start_percentage = (1 - height_percentage) / 2 local col_start_percentage = (1 - width_percentage) / 2 local opts = {} opts.relative = "editor" - opts.height = math.ceil(vim.o.lines * height_percentage) + opts.height = math.min(math.ceil(vim.o.lines * height_percentage), #buf_lines) opts.row = math.ceil(vim.o.lines * row_start_percentage) opts.col = math.floor(vim.o.columns * col_start_percentage) opts.width = math.floor(vim.o.columns * width_percentage) + opts.style = "minimal" + opts.border = "rounded" + --[[ opts.border = { - "╭", - "─", - "╮", - "│", - "╯", - "─", - "╰", - "│", + lvim.builtin.telescope.defaults.borderchars[5], -- "┌", + lvim.builtin.telescope.defaults.borderchars[3], -- "-", + lvim.builtin.telescope.defaults.borderchars[6], -- "┐", + lvim.builtin.telescope.defaults.borderchars[2], -- "|", + lvim.builtin.telescope.defaults.borderchars[7], -- "┘", + lvim.builtin.telescope.defaults.borderchars[3], -- "-", + lvim.builtin.telescope.defaults.borderchars[8], -- "└", + lvim.builtin.telescope.defaults.borderchars[4], -- "|", } + --]] local win_id = vim.api.nvim_open_win(bufnr, true, opts) @@ -112,6 +118,17 @@ function M.create_simple_popup(buf_lines, callback) return bufnr, win_id end +local function tbl_set_highlight(terms, highlight_group) + if type(terms) ~= "table" then + return + end + + for _, v in pairs(terms) do + print("Add highlight for word: " .. v) + vim.cmd('let m=matchadd("' .. highlight_group .. '", "' .. v .. '")') + end +end + function M.toggle_popup(ft) local client = u.get_active_client_by_ft(ft) local is_client_active = not client.is_stopped() @@ -126,53 +143,65 @@ function M.toggle_popup(ft) vim.list_extend(buf_lines, M.banner) local header = { - "Detected filetype is: " .. tostring(ft), - "", - "Treesitter active: " .. tostring(next(vim.treesitter.highlighter.active) ~= nil), - "", + indent .. "Detected filetype: " .. tostring(ft), + indent .. "Treesitter active: " .. tostring(next(vim.treesitter.highlighter.active) ~= nil), "", } vim.list_extend(buf_lines, header) local lsp_info = { - "Associated language-server: " .. client.name, - indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(client.id), - indent .. "* Formatting support: " .. tostring(client.resolved_capabilities.document_formatting), - indent .. "* Capabilities list: " .. table.concat(vim.list_slice(client_enabled_caps, 1, num_caps / 2), ", "), + indent .. "Language Server Protocol (LSP) info", + indent .. "* Associated server: " .. client.name, + indent .. "* Active: " .. tostring(is_client_active) .. " (id: " .. tostring(client.id) .. ")", + indent .. "* Supports formatting: " .. tostring(client.resolved_capabilities.document_formatting), + indent .. "* Capabilities list: " .. table.concat(vim.list_slice(client_enabled_caps, 1, num_caps / 2), ", "), indent .. indent .. indent .. table.concat(vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)), ", "), "", } vim.list_extend(buf_lines, lsp_info) local null_ls_info = { - "Configured providers: " .. table.concat(null_ls_providers, "  , ") .. "  ", - "", + indent .. "Formatters and linters", + indent .. "* Configured providers: " .. table.concat(null_ls_providers, "  , ") .. "  ", } vim.list_extend(buf_lines, null_ls_info) local missing_formatters_status if vim.tbl_count(missing_formatters) > 0 then - missing_formatters_status = { "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ", "" } + missing_formatters_status = { + indent .. "* Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ", + } vim.list_extend(buf_lines, missing_formatters_status) end local missing_linters_status if vim.tbl_count(missing_linters) > 0 then - missing_linters_status = { "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ", "" } + missing_linters_status = { + indent .. "* Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ", + } vim.list_extend(buf_lines, missing_linters_status) end + vim.list_extend(buf_lines, { "" }) + vim.list_extend(buf_lines, get_formatter_suggestion_msg(ft)) vim.list_extend(buf_lines, get_linter_suggestion_msg(ft)) local function set_syntax_hl() - --TODO: highlighting is either inconsistent or not working :\ - vim.cmd("syntax match Identifier /filetype is: .*\\zs\\<" .. ft .. "\\>/") - vim.cmd("syntax match Identifier /server: .*\\zs\\<" .. client.name .. "\\>/") - vim.cmd("syntax match Identifier /providers: .*\\zs\\<" .. table.concat(null_ls_providers, ", ") .. "\\>/") - vim.cmd("syntax match Identifier /formatters: .*\\zs\\<" .. table.concat(missing_formatters, ", ") .. "\\>/") - vim.cmd("syntax match Identifier /linters: .*\\zs\\<" .. table.concat(missing_linters, ", ") .. "\\>/") + vim.cmd [[highlight LvimInfoIdentifier gui=bold]] + vim.cmd [[highlight link LvimInfoHeader Type]] + vim.cmd [[let m=matchadd("DashboardHeader", "Language Server Protocol (LSP) info")]] + vim.cmd [[let m=matchadd("DashboardHeader", "Formatters and linters")]] + vim.cmd('let m=matchadd("LvimInfoIdentifier", " ' .. ft .. '$")') + vim.cmd 'let m=matchadd("luaString", "true")' + vim.cmd 'let m=matchadd("luaError", "false")' + tbl_set_highlight(null_ls_providers, "LvimInfoIdentifier") + tbl_set_highlight(missing_formatters, "LvimInfoIdentifier") + tbl_set_highlight(missing_linters, "LvimInfoIdentifier") + -- tbl_set_highlight(u.get_supported_formatters_by_filetype(ft), "LvimInfoIdentifier") + -- tbl_set_highlight(u.get_supported_linters_by_filetype(ft), "LvimInfoIdentifier") + vim.cmd('let m=matchadd("LvimInfoIdentifier", "' .. client.name .. '")') end return M.create_simple_popup(buf_lines, set_syntax_hl) -- cgit v1.2.3 From 0a1c76eb6a0e3bb37245943905c1f96e1615f15f Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 11 Aug 2021 11:27:10 +0430 Subject: fix formatting for which-key.lua (#1288) --- lua/core/which-key.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index 67a553ff..d75b2c70 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -68,7 +68,7 @@ M.config = function() ["c"] = { "BufferClose!", "Close Buffer" }, ["e"] = { "lua require'core.nvimtree'.toggle_tree()", "Explorer" }, ["f"] = { "Telescope find_files", "Find File" }, - ["h"] = { 'nohlsearch', "No Highlight" }, + ["h"] = { "nohlsearch", "No Highlight" }, b = { name = "Buffers", j = { "BufferPick", "jump to buffer" }, -- cgit v1.2.3 From abbde6c138cebe17b354544395525a8e27673565 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 11 Aug 2021 11:32:33 +0430 Subject: remove useless print for LunarVim info --- lua/core/info.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/info.lua b/lua/core/info.lua index e4c787a2..825f8fa7 100644 --- a/lua/core/info.lua +++ b/lua/core/info.lua @@ -124,7 +124,6 @@ local function tbl_set_highlight(terms, highlight_group) end for _, v in pairs(terms) do - print("Add highlight for word: " .. v) vim.cmd('let m=matchadd("' .. highlight_group .. '", "' .. v .. '")') end end -- cgit v1.2.3 From cbbaf010f6d872187e08473350ae0ad43d8cad84 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 11 Aug 2021 11:36:32 +0430 Subject: luaString highlight group is not always available --- lua/core/info.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lua/core') diff --git a/lua/core/info.lua b/lua/core/info.lua index 825f8fa7..087157c4 100644 --- a/lua/core/info.lua +++ b/lua/core/info.lua @@ -193,8 +193,8 @@ function M.toggle_popup(ft) vim.cmd [[let m=matchadd("DashboardHeader", "Language Server Protocol (LSP) info")]] vim.cmd [[let m=matchadd("DashboardHeader", "Formatters and linters")]] vim.cmd('let m=matchadd("LvimInfoIdentifier", " ' .. ft .. '$")') - vim.cmd 'let m=matchadd("luaString", "true")' - vim.cmd 'let m=matchadd("luaError", "false")' + vim.cmd 'let m=matchadd("string", "true")' + vim.cmd 'let m=matchadd("error", "false")' tbl_set_highlight(null_ls_providers, "LvimInfoIdentifier") tbl_set_highlight(missing_formatters, "LvimInfoIdentifier") tbl_set_highlight(missing_linters, "LvimInfoIdentifier") -- cgit v1.2.3 From 47915dd33ef3ed4cc662c5f68b16d68f4f230ec2 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 11 Aug 2021 12:03:58 +0430 Subject: `` mapping must end with `` --- lua/core/which-key.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/core') diff --git a/lua/core/which-key.lua b/lua/core/which-key.lua index d75b2c70..96f3a8f7 100644 --- a/lua/core/which-key.lua +++ b/lua/core/which-key.lua @@ -68,7 +68,7 @@ M.config = function() ["c"] = { "BufferClose!", "Close Buffer" }, ["e"] = { "lua require'core.nvimtree'.toggle_tree()", "Explorer" }, ["f"] = { "Telescope find_files", "Find File" }, - ["h"] = { "nohlsearch", "No Highlight" }, + ["h"] = { "nohlsearch", "No Highlight" }, b = { name = "Buffers", j = { "BufferPick", "jump to buffer" }, -- cgit v1.2.3 From 333b1034255e0ac38124d814cebaf32ed5cbba8d Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 11 Aug 2021 14:41:36 +0430 Subject: Fix lunarvim info nil issue (#1289) * fix lunarvim info nil issue * fix num_caps counting issue --- lua/core/info.lua | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'lua/core') diff --git a/lua/core/info.lua b/lua/core/info.lua index 087157c4..56fc3ca2 100644 --- a/lua/core/info.lua +++ b/lua/core/info.lua @@ -130,13 +130,27 @@ end function M.toggle_popup(ft) local client = u.get_active_client_by_ft(ft) - local is_client_active = not client.is_stopped() - local client_enabled_caps = require("lsp").get_ls_capabilities(client.id) - local num_caps = vim.tbl_count(client_enabled_caps) + local is_client_active = false + local client_enabled_caps = {} + local client_name = "" + local client_id = 0 + local document_formatting = false + local missing_linters = {} + local missing_formatters = {} + local num_caps = 0 local null_ls_providers = null_ls_handler.get_registered_providers_by_filetype(ft) - - local missing_linters = lvim.lang[ft].linters._failed_requests or {} - local missing_formatters = lvim.lang[ft].formatters._failed_requests or {} + if client ~= nil then + is_client_active = not client.is_stopped() + client_enabled_caps = require("lsp").get_ls_capabilities(client.id) + num_caps = vim.tbl_count(client_enabled_caps) + client_name = client.name + client_id = client.id + document_formatting = client.resolved_capabilities.document_formatting + end + if lvim.lang[ft] ~= nil then + missing_linters = lvim.lang[ft].linters._failed_requests or {} + missing_formatters = lvim.lang[ft].formatters._failed_requests or {} + end local buf_lines = {} vim.list_extend(buf_lines, M.banner) @@ -150,9 +164,9 @@ function M.toggle_popup(ft) local lsp_info = { indent .. "Language Server Protocol (LSP) info", - indent .. "* Associated server: " .. client.name, - indent .. "* Active: " .. tostring(is_client_active) .. " (id: " .. tostring(client.id) .. ")", - indent .. "* Supports formatting: " .. tostring(client.resolved_capabilities.document_formatting), + indent .. "* Associated server: " .. client_name, + indent .. "* Active: " .. tostring(is_client_active) .. " (id: " .. tostring(client_id) .. ")", + indent .. "* Supports formatting: " .. tostring(document_formatting), indent .. "* Capabilities list: " .. table.concat(vim.list_slice(client_enabled_caps, 1, num_caps / 2), ", "), indent .. indent .. indent .. table.concat(vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)), ", "), "", @@ -200,7 +214,7 @@ function M.toggle_popup(ft) tbl_set_highlight(missing_linters, "LvimInfoIdentifier") -- tbl_set_highlight(u.get_supported_formatters_by_filetype(ft), "LvimInfoIdentifier") -- tbl_set_highlight(u.get_supported_linters_by_filetype(ft), "LvimInfoIdentifier") - vim.cmd('let m=matchadd("LvimInfoIdentifier", "' .. client.name .. '")') + vim.cmd('let m=matchadd("LvimInfoIdentifier", "' .. client_name .. '")') end return M.create_simple_popup(buf_lines, set_syntax_hl) -- cgit v1.2.3 From 5a7630cac761e91335d2f25cb07a81271569c791 Mon Sep 17 00:00:00 2001 From: Ahmed Khalf Date: Wed, 11 Aug 2021 16:00:41 +0400 Subject: Add spell checking to git commit filetype (#1291) --- lua/core/autocmds.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lua/core') diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index c00e4ba7..91278544 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -56,6 +56,10 @@ lvim.autocommands = { -- {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'}, -- {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'} -- }, + _git = { + { "FileType", "gitcommit", "setlocal wrap" }, + { "FileType", "gitcommit", "setlocal spell" }, + }, _markdown = { { "FileType", "markdown", "setlocal wrap" }, { "FileType", "markdown", "setlocal spell" }, -- cgit v1.2.3