From 8213801b89e9d2a27c6b1df50881b8476679b870 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Thu, 2 Dec 2021 23:02:50 +0100 Subject: LunarVim updates --- .config/nvim/lua/core/autocmds.lua | 2 +- .config/nvim/lua/core/autopairs.lua | 2 ++ .config/nvim/lua/core/bufferline.lua | 8 ++--- .config/nvim/lua/core/info.lua | 24 +++++++++++++++ .config/nvim/lua/core/lualine/components.lua | 3 +- .config/nvim/lua/core/lualine/conditions.lua | 2 +- .config/nvim/lua/core/nvimtree.lua | 46 ++++++++++++++++++++++------ .config/nvim/lua/core/which-key.lua | 10 +++--- 8 files changed, 73 insertions(+), 24 deletions(-) (limited to '.config/nvim/lua/core') diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua index ecdcf36..046b7c0 100644 --- a/.config/nvim/lua/core/autocmds.lua +++ b/.config/nvim/lua/core/autocmds.lua @@ -3,7 +3,7 @@ local Log = require "core.log" --- Load the default set of autogroups and autocommands. function M.load_augroups() - local user_config_file = vim.fn.resolve(require("config"):get_user_config_path()) + local user_config_file = require("config"):get_user_config_path() return { _general_settings = { diff --git a/.config/nvim/lua/core/autopairs.lua b/.config/nvim/lua/core/autopairs.lua index ec7f651..0759fd6 100644 --- a/.config/nvim/lua/core/autopairs.lua +++ b/.config/nvim/lua/core/autopairs.lua @@ -9,6 +9,7 @@ function M.config() all = "(", tex = "{", }, + enable_check_bracket_line = false, ---@usage check treesitter check_ts = true, ts_config = { @@ -26,6 +27,7 @@ M.setup = function() autopairs.setup { check_ts = options.builtin.autopairs.check_ts, + enable_check_bracket_line = options.builtin.autopairs.enable_check_bracket_line, ts_config = options.builtin.autopairs.ts_config, } diff --git a/.config/nvim/lua/core/bufferline.lua b/.config/nvim/lua/core/bufferline.lua index 68b08ce..ebd7a64 100644 --- a/.config/nvim/lua/core/bufferline.lua +++ b/.config/nvim/lua/core/bufferline.lua @@ -5,17 +5,13 @@ M.config = function() active = true, on_config_done = nil, keymap = { - normal_mode = { - [""] = ":BufferNext", - [""] = ":BufferPrevious", - }, + normal_mode = {}, }, } end M.setup = function() - local keymap = require "keymappings" - keymap.append_to_defaults(options.builtin.bufferline.keymap) + require("keymappings").load(options.builtin.bufferline.keymap) if options.builtin.bufferline.on_config_done then options.builtin.bufferline.on_config_done() diff --git a/.config/nvim/lua/core/info.lua b/.config/nvim/lua/core/info.lua index d448492..646cf71 100644 --- a/.config/nvim/lua/core/info.lua +++ b/.config/nvim/lua/core/info.lua @@ -34,6 +34,23 @@ local function make_formatters_info(ft) return section end +local function make_code_actions_info(ft) + local null_actions = require "lsp.null-ls.code_actions" + local registered_actions = null_actions.list_registered_providers(ft) + local supported_actions = null_actions.list_available(ft) + local section = { + "Code actions info", + fmt( + "* Active: %s%s", + table.concat(registered_actions, "  , "), + vim.tbl_count(registered_actions) > 0 and "  " or "" + ), + fmt("* Supported: %s", str_list(supported_actions)), + } + + return section +end + local function make_linters_info(ft) local null_linters = require "lsp.null-ls.linters" local supported_linters = null_linters.list_available(ft) @@ -123,6 +140,8 @@ function M.toggle_popup(ft) local linters_info = make_linters_info(ft) + local code_actions_info = make_code_actions_info(ft) + local content_provider = function(popup) local content = {} @@ -153,6 +172,7 @@ function M.toggle_popup(ft) vim.cmd [[let m=matchadd("NvimInfoHeader", "Language Server Protocol (LSP) info")]] vim.cmd [[let m=matchadd("NvimInfoHeader", "Formatters info")]] vim.cmd [[let m=matchadd("NvimInfoHeader", "Linters info")]] + vim.cmd [[let m=matchadd("NvimInfoHeader", "Code actions info")]] vim.cmd('let m=matchadd("NvimInfoIdentifier", " ' .. ft .. '$")') vim.cmd 'let m=matchadd("string", "true")' vim.cmd 'let m=matchadd("string", "active")' @@ -168,6 +188,10 @@ function M.toggle_popup(ft) require("lsp.null-ls.linters").list_available(ft), "NvimInfoIdentifier" ) + tbl_set_highlight( + require("lsp.null-ls.code_actions").list_available(ft), + "NvimInfoIdentifier" + ) end local Popup = require("interface.popup"):new { diff --git a/.config/nvim/lua/core/lualine/components.lua b/.config/nvim/lua/core/lualine/components.lua index 6ef1cff..42ec112 100644 --- a/.config/nvim/lua/core/lualine/components.lua +++ b/.config/nvim/lua/core/lualine/components.lua @@ -125,9 +125,8 @@ return { local supported_linters = linters.list_registered_providers(buf_ft) vim.list_extend(buf_client_names, supported_linters) - return table.concat(buf_client_names, ", ") + return "[" .. table.concat(buf_client_names, ", ") .. "]" end, - icon = " ", color = { fg = colors.fg, bg = colors.bg }, cond = conditions.hide_in_width, }, diff --git a/.config/nvim/lua/core/lualine/conditions.lua b/.config/nvim/lua/core/lualine/conditions.lua index 3ee4fbb..6e120b2 100644 --- a/.config/nvim/lua/core/lualine/conditions.lua +++ b/.config/nvim/lua/core/lualine/conditions.lua @@ -1,4 +1,4 @@ -local window_width_limit = 80 +local window_width_limit = 70 local conditions = { buffer_not_empty = function() diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua index 2ca2fb1..b525351 100644 --- a/.config/nvim/lua/core/nvimtree.lua +++ b/.config/nvim/lua/core/nvimtree.lua @@ -6,12 +6,22 @@ function M.config() active = true, on_config_done = nil, setup = { + disable_netrw = true, + hijack_netrw = true, open_on_setup = false, - auto_close = true, - open_on_tab = false, - update_focused_file = { + ignore_ft_on_setup = { + "startify", + "dashboard", + "alpha", + }, + update_to_buf_dir = { enable = true, + auto_open = true, }, + auto_close = true, + open_on_tab = false, + hijack_cursor = false, + update_cwd = false, diagnostics = { enable = true, icons = { @@ -21,14 +31,36 @@ function M.config() error = "", }, }, + update_focused_file = { + enable = true, + update_cwd = true, + ignore_list = {}, + }, + system_open = { + cmd = nil, + args = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 200, + }, view = { width = 30, + height = 30, side = "left", auto_resize = true, + number = false, + relativenumber = false, mappings = { custom_only = false, + list = {}, }, }, + filters = { + dotfiles = true, + custom = { ".git", "node_modules", ".cache" }, + }, }, show_icons = { git = 1, @@ -37,13 +69,10 @@ function M.config() folder_arrows = 1, tree_width = 30, }, - ignore = { ".git", "node_modules", ".cache" }, quit_on_open = 0, - hide_dotfiles = 0, git_hl = 1, + disable_window_picker = 0, root_folder_modifier = ":t", - allow_resize = 1, - auto_ignore_ft = { "startify", "dashboard" }, icons = { default = "", symlink = "", @@ -65,6 +94,7 @@ function M.config() }, }, } + options.builtin.which_key.mappings["e"] = { "NvimTreeToggle", "Explorer" } end function M.setup() @@ -98,8 +128,6 @@ function M.setup() } end - options.builtin.which_key.mappings["e"] = { "NvimTreeToggle", "Explorer" } - local tree_view = require "nvim-tree.view" -- Add nvim_tree open callback diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua index 85f766c..333ce6d 100644 --- a/.config/nvim/lua/core/which-key.lua +++ b/.config/nvim/lua/core/which-key.lua @@ -61,7 +61,10 @@ M.config = function() -- NOTE: Prefer using : over as the latter avoids going back in normal-mode. -- see https://neovim.io/doc/user/map.html#:map-cmd vmappings = { - ["k"] = { "lua ___comment_gc(vim.fn.visualmode())", "Comment" }, + ["k"] = { + "lua require('Comment.api').gc(vim.fn.visualmode())", + "Comment", + }, }, mappings = { ["w"] = { "w!", "Save" }, @@ -189,10 +192,7 @@ M.config = function() "edit " .. get_config_dir() .. "/config.lua", "Edit config.lua", }, - k = { - "lua require('keymappings').print()", - "View NeoVim's default keymappings", - }, + k = { "Telescope keymaps", "View NeoVim's keymappings" }, i = { "lua require('core.info').toggle_popup(vim.bo.filetype)", "Toggle NeoVim Info", -- cgit v1.2.3-70-g09d2