From 564cfe8f3c6e4e28b124f92d08489bc81dcead44 Mon Sep 17 00:00:00 2001 From: lvimuser <109605931+lvimuser@users.noreply.github.com> Date: Thu, 15 Sep 2022 07:13:46 -0300 Subject: [PATCH 001/138] fix(lsp/utils): do not register duplicate autocommands (#3004) --- lua/lvim/lsp/utils.lua | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index b92ef11c..3be7e52f 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -88,19 +88,27 @@ function M.setup_document_highlight(client, bufnr) if not status_ok or not highlight_supported then return end - local augroup_exist, _ = pcall(vim.api.nvim_get_autocmds, { - group = "lsp_document_highlight", + local group = "lsp_document_highlight" + local hl_events = { "CursorHold", "CursorHoldI" } + + local ok, hl_autocmds = pcall(vim.api.nvim_get_autocmds, { + group = group, + buffer = bufnr, + event = hl_events, }) - if not augroup_exist then - vim.api.nvim_create_augroup("lsp_document_highlight", {}) + + if ok and #hl_autocmds > 0 then + return end - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - group = "lsp_document_highlight", + + vim.api.nvim_create_augroup(group, { clear = false }) + vim.api.nvim_create_autocmd(hl_events, { + group = group, buffer = bufnr, callback = vim.lsp.buf.document_highlight, }) vim.api.nvim_create_autocmd("CursorMoved", { - group = "lsp_document_highlight", + group = group, buffer = bufnr, callback = vim.lsp.buf.clear_references, }) @@ -113,14 +121,20 @@ function M.setup_codelens_refresh(client, bufnr) if not status_ok or not codelens_supported then return end - local augroup_exist, _ = pcall(vim.api.nvim_get_autocmds, { - group = "lsp_code_lens_refresh", + local group = "lsp_code_lens_refresh" + local cl_events = { "BufEnter", "InsertLeave" } + local ok, cl_autocmds = pcall(vim.api.nvim_get_autocmds, { + group = group, + buffer = bufnr, + event = cl_events, }) - if not augroup_exist then - vim.api.nvim_create_augroup("lsp_code_lens_refresh", {}) + + if ok and #cl_autocmds > 0 then + return end - vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave" }, { - group = "lsp_code_lens_refresh", + vim.api.nvim_create_augroup(group, { clear = false }) + vim.api.nvim_create_autocmd(cl_events, { + group = group, buffer = bufnr, callback = vim.lsp.codelens.refresh, }) From 464ad8b0035cbcaf4864d14da598b77a939026d8 Mon Sep 17 00:00:00 2001 From: yangbinji <1139040653@qq.com> Date: Thu, 15 Sep 2022 20:41:51 +0800 Subject: [PATCH 002/138] fix(example config): fix config for treesitter (#3016) --- utils/installer/config.example.lua | 2 +- utils/installer/config_win.example.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 26a50edc..f5d50709 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -82,7 +82,7 @@ lvim.builtin.treesitter.ensure_installed = { } lvim.builtin.treesitter.ignore_install = { "haskell" } -lvim.builtin.treesitter.highlight.enabled = true +lvim.builtin.treesitter.highlight.enable = true -- generic LSP settings diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index 872e6270..8fe03d69 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -97,7 +97,7 @@ lvim.builtin.treesitter.ensure_installed = { } lvim.builtin.treesitter.ignore_install = { "haskell" } -lvim.builtin.treesitter.highlight.enabled = true +lvim.builtin.treesitter.highlight.enable = true -- generic LSP settings From a4c2dc4d0b638a50c3219f247b09e6238a44ec50 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Thu, 15 Sep 2022 23:33:08 -0400 Subject: [PATCH 003/138] refactor: small improvements (#3021) --- lua/lvim/config/settings.lua | 8 +- lua/lvim/core/alpha/dashboard.lua | 12 +-- lua/lvim/core/autocmds.lua | 2 +- lua/lvim/core/autopairs.lua | 5 +- lua/lvim/core/bufferline.lua | 8 +- lua/lvim/core/builtins/init.lua | 1 + lua/lvim/core/cmp.lua | 2 +- lua/lvim/core/lir.lua | 90 +++++++++++++++++ lua/lvim/core/nvimtree.lua | 15 +-- lua/lvim/core/terminal.lua | 4 +- lua/lvim/core/which-key.lua | 14 +-- lua/lvim/keymappings.lua | 6 -- lua/lvim/lsp/config.lua | 11 --- lua/lvim/lsp/peek.lua | 157 ------------------------------ lua/lvim/plugins.lua | 10 +- 15 files changed, 129 insertions(+), 216 deletions(-) create mode 100644 lua/lvim/core/lir.lua delete mode 100644 lua/lvim/lsp/peek.lua diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua index faa28641..421d739b 100644 --- a/lua/lvim/config/settings.lua +++ b/lua/lvim/config/settings.lua @@ -13,8 +13,7 @@ M.load_default_options = function() local default_options = { backup = false, -- creates a backup file clipboard = "unnamedplus", -- allows neovim to access the system clipboard - cmdheight = 2, -- more space in the neovim command line for displaying messages - colorcolumn = "99999", -- fixes indentline for now + cmdheight = 1, -- more space in the neovim command line for displaying messages completeopt = { "menuone", "noselect" }, conceallevel = 0, -- so that `` is visible in markdown files fileencoding = "utf-8", -- the encoding written to a file @@ -34,19 +33,18 @@ M.load_default_options = function() splitright = true, -- force all vertical splits to go to the right of current window swapfile = false, -- creates a swapfile termguicolors = true, -- set term gui colors (most terminals support this) - timeoutlen = 250, -- time to wait for a mapped sequence to complete (in milliseconds) + timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) title = true, -- set the title of window to the value of the titlestring -- opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to undodir = undodir, -- set an undo directory undofile = true, -- enable persistent undo - updatetime = 300, -- faster completion + updatetime = 100, -- faster completion writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited expandtab = true, -- convert tabs to spaces shiftwidth = 2, -- the number of spaces inserted for each indentation tabstop = 2, -- insert 2 spaces for a tab cursorline = true, -- highlight the current line number = true, -- set numbered lines - relativenumber = false, -- set relative numbered lines numberwidth = 4, -- set number column width to 2 {default 4} signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time wrap = false, -- display lines as one long line diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index d65980fb..9f235ce0 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -51,13 +51,13 @@ function M.get_sections() local buttons = { entries = { - { "SPC f", " Find File", "Telescope find_files" }, - { "SPC n", " New File", "ene!" }, - { "SPC P", " Recent Projects ", "Telescope projects" }, - { "SPC s r", " Recently Used Files", "Telescope oldfiles" }, - { "SPC s t", " Find Word", "Telescope live_grep" }, + { "f", " Find File", "Telescope find_files" }, + { "n", " New File", "ene!" }, + { "p", " Recent Projects ", "Telescope projects" }, + { "r", " Recently Used Files", "Telescope oldfiles" }, + { "t", " Find Word", "Telescope live_grep" }, { - "SPC L c", + "c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " ", }, diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index f5c63588..ef7122e5 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -18,7 +18,7 @@ function M.load_defaults() pattern = "*", desc = "Highlight text on yank", callback = function() - require("vim.highlight").on_yank { higroup = "Search", timeout = 200 } + require("vim.highlight").on_yank { higroup = "Search", timeout = 100 } end, }, }, diff --git a/lua/lvim/core/autopairs.lua b/lua/lvim/core/autopairs.lua index 469a38a4..5daffba5 100644 --- a/lua/lvim/core/autopairs.lua +++ b/lua/lvim/core/autopairs.lua @@ -47,7 +47,10 @@ function M.config() end M.setup = function() - local autopairs = require "nvim-autopairs" + local status_ok, autopairs = pcall(require, "nvim-autopairs") + if not status_ok then + return + end local Rule = require "nvim-autopairs.rule" autopairs.setup { diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua index 36e5ff54..6ae0d6c6 100644 --- a/lua/lvim/core/bufferline.lua +++ b/lua/lvim/core/bufferline.lua @@ -140,7 +140,13 @@ end M.setup = function() require("lvim.keymappings").load(lvim.builtin.bufferline.keymap) - require("bufferline").setup { + + local status_ok, bufferline = pcall(require, "bufferline") + if not status_ok then + return + end + + bufferline.setup { options = lvim.builtin.bufferline.options, highlights = lvim.builtin.bufferline.highlights, } diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 5cad2a00..03ee8aec 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -9,6 +9,7 @@ local builtins = { "lvim.core.telescope", "lvim.core.treesitter", "lvim.core.nvimtree", + "lvim.core.lir", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 408691a6..8e954335 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -135,7 +135,7 @@ M.config = function() keyword_length = 1, }, experimental = { - ghost_text = true, + ghost_text = false, native_menu = false, }, formatting = { diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..e14e01cd --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,90 @@ +local M = {} + +M.config = function() + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + local actions = require "lir.actions" + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" + + lir.setup { + show_hidden_files = false, + devicons_enable = true, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["h"] = actions.up, + ["q"] = actions.quit, + + ["A"] = actions.mkdir, + ["a"] = actions.newfile, + ["r"] = actions.rename, + ["@"] = actions.cd, + ["Y"] = actions.yank_path, + ["i"] = actions.toggle_show_hidden, + ["d"] = actions.delete, + + ["J"] = function() + mark_actions.toggle_mark() + vim.cmd "normal! j" + end, + ["c"] = clipboard_actions.copy, + ["x"] = clipboard_actions.cut, + ["p"] = clipboard_actions.paste, + }, + float = { + winblend = 0, + curdir_window = { + enable = false, + highlight_dirname = true, + }, + + -- -- You can define a function that returns a table to be passed as the third + -- -- argument of nvim_open_win(). + win_opts = function() + local width = math.floor(vim.o.columns * 0.7) + local height = math.floor(vim.o.lines * 0.7) + return { + border = "rounded", + width = width, + height = height, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) + end, + } + + -- custom folder icon + require("nvim-web-devicons").set_icon { + lir_folder_icon = { + icon = "", + -- color = "#7ebae4", + -- color = "#569CD6", + color = "#42A5F5", + name = "LirFolderNode", + }, + } +end +return M diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 15e80e85..372cd00f 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -6,26 +6,16 @@ function M.config() active = true, on_config_done = nil, setup = { - disable_netrw = true, - hijack_netrw = true, - open_on_setup = false, - open_on_setup_file = false, - sort_by = "name", - ignore_buffer_on_setup = false, ignore_ft_on_setup = { "startify", "dashboard", "alpha", }, auto_reload_on_write = true, - hijack_unnamed_buffer_when_opening = false, hijack_directories = { - enable = true, - auto_open = true, + enable = false, }, - open_on_tab = false, - hijack_cursor = false, - update_cwd = false, + update_cwd = true, diagnostics = { enable = lvim.use_icons, show_on_dirs = false, @@ -55,7 +45,6 @@ function M.config() height = 30, hide_root_folder = false, side = "left", - preserve_window_proportions = false, mappings = { custom_only = false, list = {}, diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 6f543d06..ac844b11 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -6,8 +6,8 @@ M.config = function() on_config_done = nil, -- size can be a number or function which is passed the current terminal size = 20, - -- open_mapping = [[]], - open_mapping = [[]], + open_mapping = [[]], + -- open_mapping = [[]], hide_numbers = true, -- hide the number column in toggleterm buffers shade_filetypes = {}, shade_terminals = true, diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 2301943f..7d75dee1 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -6,8 +6,8 @@ M.config = function() on_config_done = nil, setup = { plugins = { - marks = true, -- shows a list of your marks on ' and ` - registers = true, -- shows your registers on " in NORMAL or in INSERT mode + marks = false, -- shows a list of your marks on ' and ` + registers = false, -- shows your registers on " in NORMAL or in INSERT mode -- the presets plugin, adds help for a bunch of default keybindings in Neovim -- No actual key bindings are created presets = { @@ -16,8 +16,8 @@ M.config = function() text_objects = false, -- help for text objects triggered after entering an operator windows = false, -- default bindings on nav = true, -- misc bindings to work with windows - z = true, -- bindings for folds, spelling and others prefixed with z - g = true, -- bindings for prefixed with g + z = false, -- bindings for folds, spelling and others prefixed with z + g = false, -- bindings for prefixed with g }, spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints }, @@ -170,12 +170,6 @@ M.config = function() "Prev Diagnostic", }, l = { vim.lsp.codelens.run, "CodeLens Action" }, - p = { - name = "Peek", - d = { "lua require('lvim.lsp.peek').Peek('definition')", "Definition" }, - t = { "lua require('lvim.lsp.peek').Peek('typeDefinition')", "Type Definition" }, - i = { "lua require('lvim.lsp.peek').Peek('implementation')", "Implementation" }, - }, q = { vim.diagnostic.setloclist, "Quickfix" }, r = { vim.lsp.buf.rename, "Rename" }, s = { "Telescope lsp_document_symbols", "Document Symbols" }, diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua index 63835f75..8c182682 100644 --- a/lua/lvim/keymappings.lua +++ b/lua/lvim/keymappings.lua @@ -31,12 +31,6 @@ local mode_adapters = { local defaults = { insert_mode = { - -- 'jk' for quitting insert mode - ["jk"] = "", - -- 'kj' for quitting insert mode - ["kj"] = "", - -- 'jj' for quitting insert mode - ["jj"] = "", -- Move current line / block with Alt-j/k ala vscode. [""] = ":m .+1==gi", -- Move current line / block with Alt-j/k ala vscode. diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 96a1b823..7e91db52 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -79,11 +79,6 @@ return { style = "minimal", border = "rounded", }, - peek = { - max_height = 15, - max_width = 30, - context = 10, - }, on_attach_callback = nil, on_init_callback = nil, automatic_configuration = { @@ -100,12 +95,6 @@ return { ["gr"] = { vim.lsp.buf.references, "Goto references" }, ["gI"] = { vim.lsp.buf.implementation, "Goto Implementation" }, ["gs"] = { vim.lsp.buf.signature_help, "show signature help" }, - ["gp"] = { - function() - require("lvim.lsp.peek").Peek "definition" - end, - "Peek definition", - }, ["gl"] = { function() local config = lvim.lsp.diagnostics.float diff --git a/lua/lvim/lsp/peek.lua b/lua/lvim/lsp/peek.lua deleted file mode 100644 index 65c67e92..00000000 --- a/lua/lvim/lsp/peek.lua +++ /dev/null @@ -1,157 +0,0 @@ -local M = { - floating_buf = nil, - floating_win = nil, - prev_result = nil, -} - -local function create_floating_file(location, opts) - vim.validate { - location = { location, "t" }, - opts = { opts, "t", true }, - } - - -- Set some defaults - opts = opts or {} - local close_events = opts.close_events or { "CursorMoved", "CursorMovedI", "BufHidden", "InsertCharPre" } - - -- location may be LocationLink or Location - local uri = location.targetUri or location.uri - if uri == nil then - return - end - local bufnr = vim.uri_to_bufnr(uri) - if not vim.api.nvim_buf_is_loaded(bufnr) then - vim.fn.bufload(bufnr) - end - - local range = location.targetRange or location.range - - local contents = vim.api.nvim_buf_get_lines( - bufnr, - range.start.line, - math.min( - range["end"].line + 1 + (opts.context or lvim.lsp.peek.max_height), - range.start.line + (opts.max_height or lvim.lsp.peek.max_height) - ), - false - ) - if next(contents) == nil then - vim.notify("peek: Unable to get contents of the file!", vim.log.levels.WARN) - return - end - local width, height = vim.lsp.util._make_floating_popup_size(contents, opts) - local if_nil = vim.F.if_nil - opts = vim.lsp.util.make_floating_popup_options( - if_nil(width, lvim.lsp.peek.max_width), - if_nil(height, lvim.lsp.peek.max_height), - opts - ) - -- Don't make it minimal as it is meant to be fully featured - opts["style"] = nil - - vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe") - - local winnr = vim.api.nvim_open_win(bufnr, false, opts) - vim.api.nvim_win_set_option(winnr, "winblend", 0) - - vim.api.nvim_win_set_cursor(winnr, { range.start.line + 1, range.start.character }) - vim.api.nvim_buf_set_var(bufnr, "lsp_floating_window", winnr) - - -- Set some autocmds to close the window - vim.api.nvim_command( - string.format("autocmd %s ++once lua pcall(vim.api.nvim_win_close, %d, true)", unpack(close_events), winnr) - ) - - return bufnr, winnr -end - -local function preview_location_callback(result) - if result == nil or vim.tbl_isempty(result) then - return nil - end - - local opts = { - border = "rounded", - context = lvim.lsp.peek.context, - } - - if vim.tbl_islist(result) then - M.prev_result = result[1] - M.floating_buf, M.floating_win = create_floating_file(result[1], opts) - else - M.prev_result = result - M.floating_buf, M.floating_win = create_floating_file(result, opts) - end -end - -local function preview_location_callback_new_signature(_, result) - return preview_location_callback(result) -end - -function M.open_file() - -- Get the file currently open in the floating window - local filepath = vim.fn.expand "%:." - - if not filepath then - vim.notify("peek: Unable to open the file!", vim.log.levels.ERROR) - return - end - - -- Close the floating window - pcall(vim.api.nvim_win_close, M.floating_win, true) - - -- Edit the file - vim.cmd("edit " .. filepath) - - local winnr = vim.api.nvim_get_current_win() - - -- Set the cursor at the right position - M.set_cursor_to_prev_pos(winnr) -end - -function M.set_cursor_to_prev_pos(winnr) - -- Get position of the thing to peek at - local location = M.prev_result - local range = location.targetRange or location.range - local cursor_pos = { range.start.line + 1, range.start.character } - - -- Set the winnr to the floating window if none was passed in - winnr = winnr or M.floating_win - -- Set the cursor at the correct position in the floating window - vim.api.nvim_win_set_cursor(winnr, cursor_pos) -end - -function M.Peek(what) - -- If a window already exists, focus it at the right position! - if vim.tbl_contains(vim.api.nvim_list_wins(), M.floating_win) then - local success_1, _ = pcall(vim.api.nvim_set_current_win, M.floating_win) - if not success_1 then - vim.notify("peek: You cannot edit the current file in a preview!", vim.log.levels.ERROR) - return - end - - -- Set the cursor at the correct position in the floating window - M.set_cursor_to_prev_pos() - - vim.api.nvim_buf_set_keymap( - M.floating_buf, - "n", - "", - ":lua require('lvim.lsp.peek').open_file()", - { noremap = true, silent = true } - ) - else - -- Make a new request and then create the new window in the callback - local params = vim.lsp.util.make_position_params() - local preview_callback = preview_location_callback_new_signature - local success, _ = pcall(vim.lsp.buf_request, 0, "textDocument/" .. what, params, preview_callback) - if not success then - vim.notify( - 'peek: Error calling LSP method "textDocument/' .. what .. '". The current language lsp might not support it.', - vim.log.levels.ERROR - ) - end - end -end - -return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index bfe76bb8..0b3b51fc 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -132,13 +132,19 @@ local core_plugins = { -- NvimTree { "kyazdani42/nvim-tree.lua", - -- event = "BufWinOpen", - -- cmd = "NvimTreeToggle", config = function() require("lvim.core.nvimtree").setup() end, disable = not lvim.builtin.nvimtree.active, }, + { + + "christianchiarulli/lir.nvim", + config = function() + require("lvim.core.lir").setup() + end, + disable = not lvim.builtin.nvimtree.active, + }, { "lewis6991/gitsigns.nvim", From 62d9a4ea9df1828af2cbc6c5f42774f1662aaab4 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 16 Sep 2022 11:15:18 +0200 Subject: [PATCH 004/138] revert: remove incomplete lir integration (#3030) --- lua/lvim/core/builtins/init.lua | 1 - lua/lvim/core/lir.lua | 90 --------------------------------- lua/lvim/plugins.lua | 10 +--- 3 files changed, 2 insertions(+), 99 deletions(-) delete mode 100644 lua/lvim/core/lir.lua diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 03ee8aec..5cad2a00 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -9,7 +9,6 @@ local builtins = { "lvim.core.telescope", "lvim.core.treesitter", "lvim.core.nvimtree", - "lvim.core.lir", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua deleted file mode 100644 index e14e01cd..00000000 --- a/lua/lvim/core/lir.lua +++ /dev/null @@ -1,90 +0,0 @@ -local M = {} - -M.config = function() - local status_ok, lir = pcall(require, "lir") - if not status_ok then - return - end - - local actions = require "lir.actions" - local mark_actions = require "lir.mark.actions" - local clipboard_actions = require "lir.clipboard.actions" - - lir.setup { - show_hidden_files = false, - devicons_enable = true, - mappings = { - ["l"] = actions.edit, - [""] = actions.edit, - [""] = actions.split, - ["v"] = actions.vsplit, - [""] = actions.tabedit, - - ["h"] = actions.up, - ["q"] = actions.quit, - - ["A"] = actions.mkdir, - ["a"] = actions.newfile, - ["r"] = actions.rename, - ["@"] = actions.cd, - ["Y"] = actions.yank_path, - ["i"] = actions.toggle_show_hidden, - ["d"] = actions.delete, - - ["J"] = function() - mark_actions.toggle_mark() - vim.cmd "normal! j" - end, - ["c"] = clipboard_actions.copy, - ["x"] = clipboard_actions.cut, - ["p"] = clipboard_actions.paste, - }, - float = { - winblend = 0, - curdir_window = { - enable = false, - highlight_dirname = true, - }, - - -- -- You can define a function that returns a table to be passed as the third - -- -- argument of nvim_open_win(). - win_opts = function() - local width = math.floor(vim.o.columns * 0.7) - local height = math.floor(vim.o.lines * 0.7) - return { - border = "rounded", - width = width, - height = height, - -- row = 1, - -- col = math.floor((vim.o.columns - width) / 2), - } - end, - }, - hide_cursor = false, - on_init = function() - -- use visual mode - vim.api.nvim_buf_set_keymap( - 0, - "x", - "J", - ':lua require"lir.mark.actions".toggle_mark("v")', - { noremap = true, silent = true } - ) - - -- echo cwd - -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) - end, - } - - -- custom folder icon - require("nvim-web-devicons").set_icon { - lir_folder_icon = { - icon = "", - -- color = "#7ebae4", - -- color = "#569CD6", - color = "#42A5F5", - name = "LirFolderNode", - }, - } -end -return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 0b3b51fc..bfe76bb8 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -132,19 +132,13 @@ local core_plugins = { -- NvimTree { "kyazdani42/nvim-tree.lua", + -- event = "BufWinOpen", + -- cmd = "NvimTreeToggle", config = function() require("lvim.core.nvimtree").setup() end, disable = not lvim.builtin.nvimtree.active, }, - { - - "christianchiarulli/lir.nvim", - config = function() - require("lvim.core.lir").setup() - end, - disable = not lvim.builtin.nvimtree.active, - }, { "lewis6991/gitsigns.nvim", From 77fdcd43cb77b50fc925487132f6aabd31760337 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 16 Sep 2022 17:47:40 +0200 Subject: [PATCH 005/138] feat: add lir.nvim (#3031) --- lua/lvim/core/builtins/init.lua | 1 + lua/lvim/core/lir.lua | 107 ++++++++++++++++++++++++++++++++ lua/lvim/plugins.lua | 7 +++ 3 files changed, 115 insertions(+) create mode 100644 lua/lvim/core/lir.lua diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 5cad2a00..03ee8aec 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -9,6 +9,7 @@ local builtins = { "lvim.core.telescope", "lvim.core.treesitter", "lvim.core.nvimtree", + "lvim.core.lir", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..38b05b9c --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,107 @@ +local M = {} + +local Log = require "lvim.core.log" +M.config = function() + lvim.builtin.lir = { + active = false, + on_config_done = nil, + } + + local status_ok, actions = pcall(require, "lir.actions") + if not status_ok then + return + end + + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" + lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, { + setup = { + show_hidden_files = false, + devicons_enable = true, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["h"] = actions.up, + ["q"] = actions.quit, + + ["A"] = actions.mkdir, + ["a"] = actions.newfile, + ["r"] = actions.rename, + ["@"] = actions.cd, + ["Y"] = actions.yank_path, + ["i"] = actions.toggle_show_hidden, + ["d"] = actions.delete, + + ["J"] = function() + mark_actions.toggle_mark() + vim.cmd "normal! j" + end, + ["c"] = clipboard_actions.copy, + ["x"] = clipboard_actions.cut, + ["p"] = clipboard_actions.paste, + }, + float = { + winblend = 0, + curdir_window = { + enable = false, + highlight_dirname = true, + }, + + -- You can define a function that returns a table to be passed as the third + -- argument of nvim_open_win(). + win_opts = function() + local width = math.floor(vim.o.columns * 0.7) + local height = math.floor(vim.o.lines * 0.7) + return { + border = "rounded", + width = width, + height = height, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) + end, + }, + icons = { + lir_folder_icon = { + icon = "", + -- color = "#7ebae4", + -- color = "#569CD6", + color = "#42A5F5", + name = "LirFolderNode", + }, + }, + }) +end + +function M.setup() + if lvim.builtin.nvimtree.active then + Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" + return + end + local lir = require "lir" + lir.setup(lvim.builtin.lir.setup) + require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) + + if lvim.builtin.lir.on_config_done then + lvim.builtin.lir.on_config_done(lir) + end +end +return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index bfe76bb8..106403ac 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -139,6 +139,13 @@ local core_plugins = { end, disable = not lvim.builtin.nvimtree.active, }, + { + "christianchiarulli/lir.nvim", + config = function() + require("lvim.core.lir").setup() + end, + disable = not lvim.builtin.lir.active, + }, { "lewis6991/gitsigns.nvim", From 1b179a8586e72ab5334e62ddf541e9ca972e8fd3 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sat, 17 Sep 2022 02:57:41 -0400 Subject: [PATCH 006/138] docs(readme): recommend rolling for 0.8, remove old breaking changes (#3028) --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8b8a9cdc..eb238ba8 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,20 @@ Make sure you have the release version of Neovim (0.7+). -### Linux: +### Linux/MacOS: + +If you are running Neovim 0.7+ ```bash bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh) ``` +If you are running Neovim 0.8+ + +```bash +bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh) +``` + To run the install script without any interaction you can pass the `-y` flag to automatically install all dependencies and have no prompts. This is particularly useful in automated installations. In the same way, you can use `--no-install-dependencies` to skip the dependency installation. @@ -134,12 +142,6 @@ lvim.plugins = { - inside LunarVim `:PackerUpdate` -## Breaking changes - -- `lvim.lang.FOO` is no longer supported. Refer to for up-to-date instructions. -- `lvim.lsp.popup_border` has been deprecated in favor of `lvim.lsp.float.border` and `lvim.lsp.diagnostics.float.border`. -- `lvim.builtin.dashboard` has been replaced with `lvim.builtin.alpha`, see - ## Resources - [Documentation](https://www.lunarvim.org) From 26d493419af23244fe6ca3daf3477c7b5d95c36e Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 17 Sep 2022 13:42:46 +0200 Subject: [PATCH 007/138] revert: lir.nvim is still broken (#3036) --- lua/lvim/core/builtins/init.lua | 1 - lua/lvim/core/lir.lua | 107 -------------------------------- lua/lvim/plugins.lua | 7 --- 3 files changed, 115 deletions(-) delete mode 100644 lua/lvim/core/lir.lua diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 03ee8aec..5cad2a00 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -9,7 +9,6 @@ local builtins = { "lvim.core.telescope", "lvim.core.treesitter", "lvim.core.nvimtree", - "lvim.core.lir", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua deleted file mode 100644 index 38b05b9c..00000000 --- a/lua/lvim/core/lir.lua +++ /dev/null @@ -1,107 +0,0 @@ -local M = {} - -local Log = require "lvim.core.log" -M.config = function() - lvim.builtin.lir = { - active = false, - on_config_done = nil, - } - - local status_ok, actions = pcall(require, "lir.actions") - if not status_ok then - return - end - - local mark_actions = require "lir.mark.actions" - local clipboard_actions = require "lir.clipboard.actions" - lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, { - setup = { - show_hidden_files = false, - devicons_enable = true, - mappings = { - ["l"] = actions.edit, - [""] = actions.edit, - [""] = actions.split, - ["v"] = actions.vsplit, - [""] = actions.tabedit, - - ["h"] = actions.up, - ["q"] = actions.quit, - - ["A"] = actions.mkdir, - ["a"] = actions.newfile, - ["r"] = actions.rename, - ["@"] = actions.cd, - ["Y"] = actions.yank_path, - ["i"] = actions.toggle_show_hidden, - ["d"] = actions.delete, - - ["J"] = function() - mark_actions.toggle_mark() - vim.cmd "normal! j" - end, - ["c"] = clipboard_actions.copy, - ["x"] = clipboard_actions.cut, - ["p"] = clipboard_actions.paste, - }, - float = { - winblend = 0, - curdir_window = { - enable = false, - highlight_dirname = true, - }, - - -- You can define a function that returns a table to be passed as the third - -- argument of nvim_open_win(). - win_opts = function() - local width = math.floor(vim.o.columns * 0.7) - local height = math.floor(vim.o.lines * 0.7) - return { - border = "rounded", - width = width, - height = height, - -- row = 1, - -- col = math.floor((vim.o.columns - width) / 2), - } - end, - }, - hide_cursor = false, - on_init = function() - -- use visual mode - vim.api.nvim_buf_set_keymap( - 0, - "x", - "J", - ':lua require"lir.mark.actions".toggle_mark("v")', - { noremap = true, silent = true } - ) - -- echo cwd - -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) - end, - }, - icons = { - lir_folder_icon = { - icon = "", - -- color = "#7ebae4", - -- color = "#569CD6", - color = "#42A5F5", - name = "LirFolderNode", - }, - }, - }) -end - -function M.setup() - if lvim.builtin.nvimtree.active then - Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" - return - end - local lir = require "lir" - lir.setup(lvim.builtin.lir.setup) - require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) - - if lvim.builtin.lir.on_config_done then - lvim.builtin.lir.on_config_done(lir) - end -end -return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 106403ac..bfe76bb8 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -139,13 +139,6 @@ local core_plugins = { end, disable = not lvim.builtin.nvimtree.active, }, - { - "christianchiarulli/lir.nvim", - config = function() - require("lvim.core.lir").setup() - end, - disable = not lvim.builtin.lir.active, - }, { "lewis6991/gitsigns.nvim", From 68fdbaa51d658899d4405b2660bfbe360e9dfed4 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Mon, 19 Sep 2022 13:10:07 +0200 Subject: [PATCH 008/138] fix(lsp): enforce lvim completion for lua-server (#3035) --- .luarc.json | 9 +++++ lua/lvim/lsp/providers/sumneko_lua.lua | 55 ++++++++++++++++++-------- 2 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 .luarc.json diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 00000000..a95ef0a2 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", + "Lua.diagnostics.disable": [ + "redundant-parameter", + "param-type-mismatch", + "missing-parameter" + ], + "diagnostics.libraryFiles": "Disable" +} diff --git a/lua/lvim/lsp/providers/sumneko_lua.lua b/lua/lvim/lsp/providers/sumneko_lua.lua index 6cd78157..ef159e1c 100644 --- a/lua/lvim/lsp/providers/sumneko_lua.lua +++ b/lua/lvim/lsp/providers/sumneko_lua.lua @@ -1,32 +1,53 @@ -local dev_opts = { +local default_workspace = { library = { - vimruntime = true, -- runtime path - types = true, -- full signature, docs and completion of vim.api, vim.treesitter, vim.lsp and others - -- plugins = true, -- installed opt or start plugins in packpath - -- you can also specify the list of plugins to make available as a workspace library - plugins = { "plenary.nvim" }, + vim.fn.expand "$VIMRUNTIME", + get_lvim_base_dir(), + require("lua-dev.sumneko").types(), }, - override = nil, -- function(root_dir, options) end, + + maxPreload = 1000, + preloadFileSize = 10000, } -local lua_dev_loaded, lua_dev = pcall(require, "lua-dev") -if lua_dev_loaded then - lua_dev.setup(dev_opts) +local add_packages_to_workspace = function(packages, config) + -- config.settings.Lua = config.settings.Lua or { workspace = default_workspace } + local runtimedirs = vim.api.nvim__get_runtime({ "lua" }, true, { is_lua = true }) + local workspace = config.settings.Lua.workspace + for _, v in pairs(runtimedirs) do + for _, pack in ipairs(packages) do + if v:match(pack) and not vim.tbl_contains(workspace.library, v) then + table.insert(workspace.library, v) + end + end + end end +local lspconfig = require "lspconfig" + +local make_on_new_config = function(on_new_config, _) + return lspconfig.util.add_hook_before(on_new_config, function(new_config, _) + local server_name = new_config.name + + if server_name ~= "sumneko_lua" then + return + end + local plugins = { "plenary.nvim", "telescope.nvim", "nvim-treesitter", "LuaSnip" } + add_packages_to_workspace(plugins, new_config) + end) +end + +lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, { + on_new_config = make_on_new_config(lspconfig.util.default_config.on_new_config), +}) + local opts = { settings = { Lua = { + telemetry = { enable = false }, diagnostics = { globals = { "vim", "lvim", "packer_plugins" }, }, - workspace = { - library = { - [require("lvim.utils").join_paths(get_runtime_dir(), "lvim", "lua")] = true, - }, - maxPreload = 100000, - preloadFileSize = 10000, - }, + workspace = default_workspace, }, }, } From a331ef711bc6c73e78535e9b4fa44d54c937aa88 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 11:44:04 -0400 Subject: [PATCH 009/138] feat: add lir.nvim again (#3038) --- lua/lvim/core/autocmds.lua | 30 ++++++++ lua/lvim/core/builtins/init.lua | 1 + lua/lvim/core/lir.lua | 117 ++++++++++++++++++++++++++++++++ lua/lvim/core/which-key.lua | 2 +- lua/lvim/plugin-loader.lua | 2 +- lua/lvim/plugins.lua | 9 ++- snapshots/default.json | 3 + 7 files changed, 161 insertions(+), 3 deletions(-) create mode 100644 lua/lvim/core/lir.lua diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index ef7122e5..525d2338 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -10,6 +10,36 @@ function M.load_defaults() user_config_file = user_config_file:gsub("\\", "/") end + vim.api.nvim_create_autocmd({ "FileType" }, { + pattern = { + "Jaq", + "qf", + "help", + "man", + "lspinfo", + "spectre_panel", + "lir", + "DressingSelect", + "tsplayground", + "Markdown", + }, + callback = function() + vim.cmd [[ + nnoremap q :close + nnoremap :close + set nobuflisted + ]] + end, + }) + + vim.api.nvim_create_autocmd({ "FileType" }, { + pattern = { "lir" }, + callback = function() + vim.opt_local.number = false + vim.opt_local.relativenumber = false + end, + }) + local definitions = { { "TextYankPost", diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 5cad2a00..03ee8aec 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -9,6 +9,7 @@ local builtins = { "lvim.core.telescope", "lvim.core.treesitter", "lvim.core.nvimtree", + "lvim.core.lir", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua new file mode 100644 index 00000000..694ea4eb --- /dev/null +++ b/lua/lvim/core/lir.lua @@ -0,0 +1,117 @@ +local M = {} + +local Log = require "lvim.core.log" + +M.config = function() + lvim.builtin.lir = { + active = true, + on_config_done = nil, + } + + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + local actions = require "lir.actions" + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" + + lir.setup { + show_hidden_files = false, + devicons_enable = true, + mappings = { + ["l"] = actions.edit, + [""] = actions.edit, + [""] = actions.split, + ["v"] = actions.vsplit, + [""] = actions.tabedit, + + ["h"] = actions.up, + ["q"] = actions.quit, + + ["A"] = actions.mkdir, + ["a"] = actions.newfile, + ["r"] = actions.rename, + ["@"] = actions.cd, + ["Y"] = actions.yank_path, + ["i"] = actions.toggle_show_hidden, + ["d"] = actions.delete, + + ["J"] = function() + mark_actions.toggle_mark() + vim.cmd "normal! j" + end, + ["c"] = clipboard_actions.copy, + ["x"] = clipboard_actions.cut, + ["p"] = clipboard_actions.paste, + }, + float = { + winblend = 0, + curdir_window = { + enable = false, + highlight_dirname = true, + }, + + -- -- You can define a function that returns a table to be passed as the third + -- -- argument of nvim_open_win(). + win_opts = function() + local width = math.floor(vim.o.columns * 0.7) + local height = math.floor(vim.o.lines * 0.7) + return { + border = "rounded", + width = width, + height = height, + -- row = 1, + -- col = math.floor((vim.o.columns - width) / 2), + } + end, + }, + hide_cursor = false, + on_init = function() + -- use visual mode + vim.api.nvim_buf_set_keymap( + 0, + "x", + "J", + ':lua require"lir.mark.actions".toggle_mark("v")', + { noremap = true, silent = true } + ) + + -- echo cwd + -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) + end, + } + + -- custom folder icon + require("nvim-web-devicons").set_icon { + lir_folder_icon = { + icon = "", + -- color = "#7ebae4", + -- color = "#569CD6", + color = "#42A5F5", + name = "LirFolderNode", + }, + } +end + +function M.setup() + if lvim.builtin.nvimtree.active then + Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" + return + end + + local status_ok, lir = pcall(require, "lir") + if not status_ok then + return + end + + lir.setup(lvim.builtin.lir.setup) + require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) + + if lvim.builtin.lir.on_config_done then + lvim.builtin.lir.on_config_done(lir) + end +end + +return M diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 7d75dee1..8b4f7b8b 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -15,7 +15,7 @@ M.config = function() motions = false, -- adds help for motions text_objects = false, -- help for text objects triggered after entering an operator windows = false, -- default bindings on - nav = true, -- misc bindings to work with windows + nav = false, -- misc bindings to work with windows z = false, -- bindings for folds, spelling and others prefixed with z g = false, -- bindings for prefixed with g }, diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index c10fe75e..5c4e6cb2 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -20,7 +20,7 @@ function plugin_loader.init(opts) package_root = opts.package_root or join_paths(vim.fn.stdpath "data", "site", "pack"), compile_path = compile_path, snapshot_path = snapshot_path, - max_jobs = 40, + max_jobs = 100, log = { level = "warn" }, git = { clone_timeout = 300, diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index bfe76bb8..a483dbc0 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -139,7 +139,14 @@ local core_plugins = { end, disable = not lvim.builtin.nvimtree.active, }, - + -- Lir + { + "christianchiarulli/lir.nvim", + config = function() + require("lvim.core.lir").setup() + end, + disable = not lvim.builtin.lir.active, + }, { "lewis6991/gitsigns.nvim", diff --git a/snapshots/default.json b/snapshots/default.json index b57c4fba..8aaa576e 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -35,6 +35,9 @@ "gitsigns.nvim": { "commit": "d7e0bcb" }, + "lir.nvim": { + "commit": "7d8c6c4" + }, "lua-dev.nvim": { "commit": "fd7a18e" }, From d44da34e92f92bbe59d2fca5965aa9c35c64374c Mon Sep 17 00:00:00 2001 From: Vladimir Koch Date: Mon, 19 Sep 2022 18:40:01 +0200 Subject: [PATCH 010/138] recognizing maven projects by default added (#3037) --- lua/lvim/core/project.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/project.lua b/lua/lvim/core/project.lua index e33d8720..c3734a16 100644 --- a/lua/lvim/core/project.lua +++ b/lua/lvim/core/project.lua @@ -22,7 +22,7 @@ function M.config() detection_methods = { "pattern" }, ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods - patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" }, + patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" }, ---@ Show hidden files in telescope when searching for files in a project show_hidden = false, From 352147158bb696e4b8fcb236d2cb477955b26dcf Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 13:12:52 -0400 Subject: [PATCH 011/138] feat(document highlight): use illuminate rather than autocommand to avoid flashing (#3029) --- lua/lvim/core/builtins/init.lua | 1 + lua/lvim/core/illuminate.lua | 53 +++++++++++++++++++++++++++++++++ lua/lvim/lsp/handlers.lua | 1 - lua/lvim/plugins.lua | 4 +++ snapshots/default.json | 3 ++ 5 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 lua/lvim/core/illuminate.lua diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 03ee8aec..afb19b63 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -10,6 +10,7 @@ local builtins = { "lvim.core.treesitter", "lvim.core.nvimtree", "lvim.core.lir", + "lvim.core.illuminate", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua new file mode 100644 index 00000000..e29b091a --- /dev/null +++ b/lua/lvim/core/illuminate.lua @@ -0,0 +1,53 @@ +local M = {} + +M.config = function() + local status_ok, illuminate = pcall(require, "illuminate") + if not status_ok then + return + end + -- default configuration + illuminate.configure { + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 120, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + "alpha", + "NvimTree", + "packer", + "neogitstatus", + "Trouble", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + } +end + +return M diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 84f2ba5f..45b1989d 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -12,7 +12,6 @@ function M.setup() float = lvim.lsp.diagnostics.float, } vim.diagnostic.config(config) - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float) end diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index a483dbc0..bd8f787d 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -256,6 +256,10 @@ local core_plugins = { { "b0o/schemastore.nvim", }, + + { + "RRethy/vim-illuminate", + }, } local default_snapshot_path = join_paths(get_lvim_base_dir(), "snapshots", "default.json") diff --git a/snapshots/default.json b/snapshots/default.json index 8aaa576e..f7880e02 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -115,5 +115,8 @@ }, "which-key.nvim": { "commit": "d5f0c63" + }, + "vim-illuminate": { + "commit": "b545262" } } From 58280f30adc06423c5b4972257d19b7d33921d26 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 19:03:53 -0400 Subject: [PATCH 012/138] feat: new colorscheme tokyonight (#3041) --- lua/lvim/plugins.lua | 11 +++++------ snapshots/default.json | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index bd8f787d..3d2a2b83 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -15,17 +15,16 @@ local core_plugins = { end, }, { - "lunarvim/onedarker.nvim", - branch = "freeze", + "lunarvim/tokyonight.nvim", config = function() pcall(function() - if lvim and lvim.colorscheme == "onedarker" then - require("onedarker").setup() - lvim.builtin.lualine.options.theme = "onedarker" + if lvim and lvim.colorscheme == "tokyonight-night" then + require("tokyonight-night").setup() + lvim.builtin.lualine.options.theme = "tokyonight-night" end end) end, - disable = lvim.colorscheme ~= "onedarker", + disable = lvim.colorscheme ~= "tokyonight-night", }, { "rcarriga/nvim-notify", diff --git a/snapshots/default.json b/snapshots/default.json index f7880e02..2a28e147 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -83,8 +83,8 @@ "nvim-web-devicons": { "commit": "2d02a56" }, - "onedarker.nvim": { - "commit": "b00dd21" + "tokyonight.nvim": { + "commit": "48fc163" }, "packer.nvim": { "commit": "6afb674" From bb4a3769f9ac52cafb44de54cd5745467f0d7c15 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 19:06:30 -0400 Subject: [PATCH 013/138] fix: remove warning message --- lua/lvim/core/lir.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index 694ea4eb..25f3820f 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -97,7 +97,7 @@ end function M.setup() if lvim.builtin.nvimtree.active then - Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" + -- Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" return end From 2190dba4c7e297568549743476b8f76c620ae4cc Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 19:35:57 -0400 Subject: [PATCH 014/138] feat: a less noisy tree (#3042) --- lua/lvim/core/lir.lua | 2 +- lua/lvim/core/nvimtree.lua | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index 25f3820f..e65d45dd 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -1,6 +1,6 @@ local M = {} -local Log = require "lvim.core.log" +-- local Log = require "lvim.core.log" M.config = function() lvim.builtin.lir = { diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 372cd00f..ad326f91 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -147,6 +147,24 @@ function M.setup() return end + local status_ok_1, utils = pcall(require, "nvim-tree.utils") + if not status_ok_1 then + return + end + + local function notify_level() + return function(msg) + vim.schedule(function() + vim.api.nvim_echo({ { msg, "WarningMsg" } }, false, {}) + end) + end + end + + utils.notify.warn = notify_level(vim.log.levels.WARN) + utils.notify.error = notify_level(vim.log.levels.ERROR) + utils.notify.info = notify_level(vim.log.levels.INFO) + utils.notify.debug = notify_level(vim.log.levels.DEBUG) + if lvim.builtin.nvimtree._setup_called then Log:debug "ignoring repeated setup call for nvim-tree, see kyazdani42/nvim-tree.lua#1308" return From f11909b5649f6169fe48b61a40def4924754c38e Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 19 Sep 2022 22:14:32 -0400 Subject: [PATCH 015/138] feat: breadcrumbs (#3043) --- lua/lvim/core/breadcrumbs.lua | 204 ++++++++++++++++++++++++++++++++ lua/lvim/core/builtins/init.lua | 1 + lua/lvim/lsp/init.lua | 10 ++ lua/lvim/plugins.lua | 9 ++ lua/lvim/utils/functions.lua | 13 ++ snapshots/default.json | 5 +- 6 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 lua/lvim/core/breadcrumbs.lua diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua new file mode 100644 index 00000000..3b038473 --- /dev/null +++ b/lua/lvim/core/breadcrumbs.lua @@ -0,0 +1,204 @@ +local M = {} + +-- local Log = require "lvim.core.log" + +M.config = function() + local status_ok, navic = pcall(require, "nvim-navic") + if not status_ok then + return + end + + navic.setup { + icons = { + Text = " ", + -- Method = "m", + -- Function = "", + -- Constructor = "", + Method = " ", + Function = " ", + Constructor = " ", + Field = " ", + -- Variable = "", + Variable = " ", + Class = " ", + Interface = " ", + -- Module = "", + Module = " ", + Property = " ", + Unit = " ", + Value = " ", + Enum = " ", + -- Keyword = "", + Keyword = " ", + -- Snippet = "", + Snippet = " ", + Color = " ", + File = " ", + Reference = " ", + Folder = " ", + EnumMember = " ", + Constant = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + Array = " ", + Number = " ", + String = " ", + Boolean = "蘒", + Object = " ", + Package = " ", + Namespace = "", + Key = "", + Null = "ﳠ", + }, + highlight = true, + separator = " " .. ">" .. " ", + depth_limit = 0, + depth_limit_indicator = "..", + } +end + +M.winbar_filetype_exclude = { + "help", + "startify", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "Trouble", + "alpha", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "Jaq", + "harpoon", + "dapui_scopes", + "dapui_breakpoints", + "dapui_stacks", + "dapui_watches", + "dap-repl", + "dap-terminal", + "dapui_console", + "lab", + "Markdown", + "", +} + +M.get_filename = function() + local filename = vim.fn.expand "%:t" + local extension = vim.fn.expand "%:e" + local f = require "lvim.utils.functions" + + if not f.isempty(filename) then + local file_icon, file_icon_color = + require("nvim-web-devicons").get_icon_color(filename, extension, { default = true }) + + local hl_group = "FileIconColor" .. extension + + vim.api.nvim_set_hl(0, hl_group, { fg = file_icon_color }) + if f.isempty(file_icon) then + file_icon = "" + end + + local navic_text = vim.api.nvim_get_hl_by_name("Normal", true) + vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text.foreground }) + + return " " .. "%#" .. hl_group .. "#" .. file_icon .. "%*" .. " " .. "%#Winbar#" .. filename .. "%*" + end +end + +local get_gps = function() + local status_gps_ok, gps = pcall(require, "nvim-navic") + if not status_gps_ok then + return "" + end + + local status_ok, gps_location = pcall(gps.get_location, {}) + if not status_ok then + return "" + end + + if not gps.is_available() or gps_location == "error" then + return "" + end + + if not require("lvim.utils.functions").isempty(gps_location) then + -- TODO: replace with chevron + return ">" .. " " .. gps_location + else + return "" + end +end + +local excludes = function() + if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) then + vim.opt_local.winbar = nil + return true + end + return false +end + +M.get_winbar = function() + if excludes() then + return + end + local f = require "lvim.utils.functions" + local value = M.get_filename() + + local gps_added = false + if not f.isempty(value) then + local gps_value = get_gps() + value = value .. " " .. gps_value + if not f.isempty(gps_value) then + gps_added = true + end + end + + if not f.isempty(value) and f.get_buf_option "mod" then + -- TODO: replace with circle + local mod = "%#LspCodeLens#" .. "" .. "%*" + if gps_added then + value = value .. " " .. mod + else + value = value .. mod + end + end + + local num_tabs = #vim.api.nvim_list_tabpages() + + if num_tabs > 1 and not f.isempty(value) then + local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0)) + value = value .. "%=" .. tabpage_number .. "/" .. tostring(num_tabs) + end + + local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", value, { scope = "local" }) + if not status_ok then + return + end +end + +M.create_winbar = function() + vim.api.nvim_create_augroup("_winbar", {}) + if vim.fn.has "nvim-0.8" == 1 then + vim.api.nvim_create_autocmd( + { "CursorMoved", "CursorHold", "BufWinEnter", "BufFilePost", "InsertEnter", "BufWritePost", "TabClosed" }, + { + group = "_winbar", + callback = function() + local status_ok, _ = pcall(vim.api.nvim_buf_get_var, 0, "lsp_floating_window") + if not status_ok then + -- TODO: + require("lvim.core.breadcrumbs").get_winbar() + end + end, + } + ) + end +end + +M.create_winbar() + +return M diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index afb19b63..14afe4ea 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -11,6 +11,7 @@ local builtins = { "lvim.core.nvimtree", "lvim.core.lir", "lvim.core.illuminate", + "lvim.core.breadcrumbs", "lvim.core.project", "lvim.core.bufferline", "lvim.core.autopairs", diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index 0b361972..ac3f6925 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -60,6 +60,15 @@ function M.common_on_init(client, bufnr) end end +local function attach_navic(client, bufnr) + vim.g.navic_silence = true + local status_ok, navic = pcall(require, "nvim-navic") + if not status_ok then + return + end + navic.attach(client, bufnr) +end + function M.common_on_attach(client, bufnr) if lvim.lsp.on_attach_callback then lvim.lsp.on_attach_callback(client, bufnr) @@ -74,6 +83,7 @@ function M.common_on_attach(client, bufnr) end add_lsp_buffer_keybindings(bufnr) add_lsp_buffer_options(bufnr) + attach_navic(client, bufnr) end function M.get_common_opts() diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 3d2a2b83..85c1e80e 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -202,6 +202,15 @@ local core_plugins = { disable = not lvim.builtin.lualine.active, }, + -- breadcrumbs + { + "SmiteshP/nvim-navic", + config = function() + require("lvim.core.breadcrumbs").setup() + end, + -- disable = not lvim.builtin.breadcrumbs.active, + }, + { "akinsho/bufferline.nvim", config = function() diff --git a/lua/lvim/utils/functions.lua b/lua/lvim/utils/functions.lua index de46bc8a..1cb8ec8e 100644 --- a/lua/lvim/utils/functions.lua +++ b/lua/lvim/utils/functions.lua @@ -16,4 +16,17 @@ function M.smart_quit() end end +function M.isempty(s) + return s == nil or s == "" +end + +function M.get_buf_option(opt) + local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt) + if not status_ok then + return nil + else + return buf_option + end +end + return M diff --git a/snapshots/default.json b/snapshots/default.json index 2a28e147..aae5e387 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -84,7 +84,7 @@ "commit": "2d02a56" }, "tokyonight.nvim": { - "commit": "48fc163" + "commit": "4bd6ba8" }, "packer.nvim": { "commit": "6afb674" @@ -118,5 +118,8 @@ }, "vim-illuminate": { "commit": "b545262" + }, + "nvim-navic": { + "commit": "202312e" } } From 03ec31253fc868b3ab5a8217640ec04248ae0046 Mon Sep 17 00:00:00 2001 From: Philipp Schmitt Date: Tue, 20 Sep 2022 08:02:35 +0200 Subject: [PATCH 016/138] feat(telecope): set show_untracked by default (#2984) * feat: optionally show untracked files with find_project_files * feat(telecope): set show_untracked by default Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- lua/lvim/core/telescope.lua | 3 +++ lua/lvim/core/telescope/custom-finders.lua | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index f556913b..a743bfa4 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -79,6 +79,9 @@ function M.config() --@usage don't include the filename in the search results only_sort_text = true, }, + git_files = { + show_untracked = true, + }, }, extensions = { fzf = { diff --git a/lua/lvim/core/telescope/custom-finders.lua b/lua/lvim/core/telescope/custom-finders.lua index 69428a44..9ab06326 100644 --- a/lua/lvim/core/telescope/custom-finders.lua +++ b/lua/lvim/core/telescope/custom-finders.lua @@ -88,11 +88,12 @@ end -- Smartly opens either git_files or find_files, depending on whether the working directory is -- contained in a Git repo. -function M.find_project_files() - local ok = pcall(builtin.git_files) +function M.find_project_files(opts) + opts = opts or {} + local ok = pcall(builtin.git_files, opts) if not ok then - builtin.find_files() + builtin.find_files(opts) end end From 518b1d4167162a54a6e76784038d30191613b76d Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Tue, 20 Sep 2022 14:11:58 +0430 Subject: [PATCH 017/138] Fix: make sure latest plugins are customizable (#3044) * fix: make navim-navic configurable * fix: make sure vim-illuminate is configurable * fix: make sure theme is configurable * fix(ci): don't verify uninstalled plugins * refactor(lsp): add setup_document_symbols util * revert: keep onedarker on freeze branch * refactor(lsp): avoid duplicate hl autocmds Co-authored-by: kylo252 <59826753+kylo252@users.noreply.github.com> --- README.md | 4 +- lua/lvim/config/defaults.lua | 2 +- lua/lvim/core/breadcrumbs.lua | 106 +++++++++++++------------ lua/lvim/core/builtins/init.lua | 1 + lua/lvim/core/illuminate.lua | 98 +++++++++++++---------- lua/lvim/core/theme.lua | 50 ++++++++++++ lua/lvim/lsp/config.lua | 2 +- lua/lvim/lsp/handlers.lua | 3 + lua/lvim/lsp/init.lua | 11 +-- lua/lvim/lsp/utils.lua | 18 +++++ lua/lvim/plugins.lua | 30 ++++--- snapshots/default.json | 15 ++-- utils/ci/verify_plugins.lua | 8 +- utils/installer/config.example.lua | 7 +- utils/installer/config_win.example.lua | 7 +- 15 files changed, 231 insertions(+), 131 deletions(-) create mode 100644 lua/lvim/core/theme.lua diff --git a/README.md b/README.md index eb238ba8..c5f8dc17 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Example: ```lua -- general lvim.format_on_save = true -lvim.colorscheme = "onedarker" +lvim.colorscheme = "tokyonight" lvim.leader = "space" -- add your own keymapping @@ -125,7 +125,7 @@ linters.setup { -- Additional Plugins lvim.plugins = { {"lunarvim/colorschemes"}, - {"folke/tokyonight.nvim"}, { + { "ray-x/lsp_signature.nvim", config = function() require"lsp_signature".on_attach() end, event = "BufRead" diff --git a/lua/lvim/config/defaults.lua b/lua/lvim/config/defaults.lua index 7546644f..91bc1130 100644 --- a/lua/lvim/config/defaults.lua +++ b/lua/lvim/config/defaults.lua @@ -1,6 +1,6 @@ return { leader = "space", - colorscheme = "onedarker", + colorscheme = "tokyonight", transparent_window = false, format_on_save = { ---@usage pattern string pattern used for the autocommand (Default: '*') diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 3b038473..9289cb03 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -3,60 +3,66 @@ local M = {} -- local Log = require "lvim.core.log" M.config = function() + lvim.builtin.breadcrumbs = { + active = false, + on_config_done = nil, + options = { + icons = { + Text = " ", + Method = " ", + Function = " ", + Constructor = " ", + Field = " ", + Variable = " ", + Class = " ", + Interface = " ", + Module = " ", + Property = " ", + Unit = " ", + Value = " ", + Enum = " ", + Keyword = " ", + Snippet = " ", + Color = " ", + File = " ", + Reference = " ", + Folder = " ", + EnumMember = " ", + Constant = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + Array = " ", + Number = " ", + String = " ", + Boolean = "蘒", + Object = " ", + Package = " ", + Namespace = "", + Key = "", + Null = "ﳠ", + }, + highlight = true, + separator = " " .. ">" .. " ", + depth_limit = 0, + depth_limit_indicator = "..", + }, + } +end + +M.setup = function() local status_ok, navic = pcall(require, "nvim-navic") if not status_ok then return end - navic.setup { - icons = { - Text = " ", - -- Method = "m", - -- Function = "", - -- Constructor = "", - Method = " ", - Function = " ", - Constructor = " ", - Field = " ", - -- Variable = "", - Variable = " ", - Class = " ", - Interface = " ", - -- Module = "", - Module = " ", - Property = " ", - Unit = " ", - Value = " ", - Enum = " ", - -- Keyword = "", - Keyword = " ", - -- Snippet = "", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - Array = " ", - Number = " ", - String = " ", - Boolean = "蘒", - Object = " ", - Package = " ", - Namespace = "", - Key = "", - Null = "ﳠ", - }, - highlight = true, - separator = " " .. ">" .. " ", - depth_limit = 0, - depth_limit_indicator = "..", - } + M.create_winbar() + navic.setup(lvim.builtin.breadcrumbs.options) + + if lvim.builtin.breadcrumbs.on_config_done then + lvim.builtin.breadcrumbs.on_config_done() + end end M.winbar_filetype_exclude = { @@ -199,6 +205,4 @@ M.create_winbar = function() end end -M.create_winbar() - return M diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 14afe4ea..36d09d2e 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -1,6 +1,7 @@ local M = {} local builtins = { + "lvim.core.theme", "lvim.core.which-key", "lvim.core.gitsigns", "lvim.core.cmp", diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index e29b091a..e0c8c775 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -1,53 +1,65 @@ local M = {} M.config = function() + lvim.builtin.illuminate = { + active = true, + on_config_done = nil, + options = { + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 120, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + "alpha", + "NvimTree", + "packer", + "neogitstatus", + "Trouble", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + }, + } +end + +M.setup = function() local status_ok, illuminate = pcall(require, "illuminate") if not status_ok then return end - -- default configuration - illuminate.configure { - -- providers: provider used to get references in the buffer, ordered by priority - providers = { - "lsp", - "treesitter", - "regex", - }, - -- delay: delay in milliseconds - delay = 120, - -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist - filetypes_denylist = { - "dirvish", - "fugitive", - "alpha", - "NvimTree", - "packer", - "neogitstatus", - "Trouble", - "lir", - "Outline", - "spectre_panel", - "toggleterm", - "DressingSelect", - "TelescopePrompt", - }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist - filetypes_allowlist = {}, - -- modes_denylist: modes to not illuminate, this overrides modes_allowlist - modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist - modes_allowlist = {}, - -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_allowlist = {}, - -- under_cursor: whether or not to illuminate under the cursor - under_cursor = true, - } + + illuminate.configure(lvim.builtin.illuminate.options) + + if lvim.builtin.illuminate.on_config_done then + lvim.builtin.illuminate.on_config_done() + end end return M diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua new file mode 100644 index 00000000..c02aaa7e --- /dev/null +++ b/lua/lvim/core/theme.lua @@ -0,0 +1,50 @@ +local M = {} + +M.config = function() + lvim.builtin.theme = { + name = "tokyonight", + options = { + style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day` + transparent = lvim.transparent_window, -- Enable this to disable setting the background color + terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim + styles = { + -- Style to be applied to different syntax groups + -- Value is any valid attr-list value for `:help nvim_set_hl` + comments = { italic = true }, + keywords = { italic = true }, + functions = {}, + variables = {}, + -- Background styles. Can be "dark", "transparent" or "normal" + sidebars = "dark", -- style for sidebars, see below + floats = "dark", -- style for floating windows + }, + -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` + sidebars = { + "qf", + "vista_kind", + "terminal", + "packer", + "spectre_panel", + "NeogitStatus", + "help", + }, + day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors + hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. + dim_inactive = false, -- dims inactive windows + lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold + use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background + }, + } +end + +M.setup = function() + local status_ok, theme = pcall(require, "tokyonight") + if not status_ok then + return + end + + theme.setup(lvim.builtin.theme.options) + lvim.builtin.lualine.options.theme = "tokyonight" +end + +return M diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 7e91db52..d842f099 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -72,7 +72,7 @@ return { end, }, }, - document_highlight = true, + document_highlight = false, code_lens_refresh = true, float = { focusable = true, diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 45b1989d..81342885 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -12,6 +12,9 @@ function M.setup() float = lvim.lsp.diagnostics.float, } vim.diagnostic.config(config) + if not lvim.builtin.illuminate.active then + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float) + end vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float) end diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index ac3f6925..1072329b 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -60,15 +60,6 @@ function M.common_on_init(client, bufnr) end end -local function attach_navic(client, bufnr) - vim.g.navic_silence = true - local status_ok, navic = pcall(require, "nvim-navic") - if not status_ok then - return - end - navic.attach(client, bufnr) -end - function M.common_on_attach(client, bufnr) if lvim.lsp.on_attach_callback then lvim.lsp.on_attach_callback(client, bufnr) @@ -83,7 +74,7 @@ function M.common_on_attach(client, bufnr) end add_lsp_buffer_keybindings(bufnr) add_lsp_buffer_options(bufnr) - attach_navic(client, bufnr) + lu.setup_document_symbols(client, bufnr) end function M.get_common_opts() diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 3be7e52f..c2ffe3fa 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -1,6 +1,7 @@ local M = {} local tbl = require "lvim.utils.table" +local Log = require "lvim.core.log" function M.is_client_active(name) local clients = vim.lsp.get_active_clients() @@ -82,6 +83,10 @@ function M.get_all_supported_filetypes() end function M.setup_document_highlight(client, bufnr) + if lvim.builtin.illuminate.active then + Log:debug "skipping setup for document_highlight, illuminate already active" + return + end local status_ok, highlight_supported = pcall(function() return client.supports_method "textDocument/documentHighlight" end) @@ -114,6 +119,19 @@ function M.setup_document_highlight(client, bufnr) }) end +function M.setup_document_symbols(client, bufnr) + vim.g.navic_silence = false -- can be set to true to supress error + local symbols_supported = client.supports_method "textDocument/documentSymbol" + if not symbols_supported then + Log:debug("skipping setup for document_symbols, method not supported by " .. client.name) + return + end + local status_ok, navic = pcall(require, "nvim-navic") + if status_ok then + navic.attach(client, bufnr) + end +end + function M.setup_codelens_refresh(client, bufnr) local status_ok, codelens_supported = pcall(function() return client.supports_method "textDocument/codeLens" diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 85c1e80e..e84049dc 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -15,16 +15,11 @@ local core_plugins = { end, }, { - "lunarvim/tokyonight.nvim", + "folke/tokyonight.nvim", config = function() - pcall(function() - if lvim and lvim.colorscheme == "tokyonight-night" then - require("tokyonight-night").setup() - lvim.builtin.lualine.options.theme = "tokyonight-night" - end - end) + require("lvim.core.theme").setup() end, - disable = lvim.colorscheme ~= "tokyonight-night", + disable = not vim.startswith(lvim.colorscheme, "tokyonight"), }, { "rcarriga/nvim-notify", @@ -208,7 +203,7 @@ local core_plugins = { config = function() require("lvim.core.breadcrumbs").setup() end, - -- disable = not lvim.builtin.breadcrumbs.active, + disable = not lvim.builtin.breadcrumbs.active, }, { @@ -267,6 +262,23 @@ local core_plugins = { { "RRethy/vim-illuminate", + setup = function() + require("lvim.core.illuminate").setup() + end, + disable = not lvim.builtin.illuminate.active, + }, + { + "lunarvim/onedarker.nvim", + branch = "freeze", + config = function() + pcall(function() + if lvim and lvim.colorscheme == "onedarker" then + require("onedarker").setup() + lvim.builtin.lualine.options.theme = "onedarker" + end + end) + end, + disable = lvim.colorscheme ~= "onedarker", }, } diff --git a/snapshots/default.json b/snapshots/default.json index aae5e387..dc19f496 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -68,6 +68,9 @@ "nvim-lspconfig": { "commit": "f8b3c24" }, + "nvim-navic": { + "commit": "202312e" + }, "nvim-notify": { "commit": "7076ce8" }, @@ -83,8 +86,8 @@ "nvim-web-devicons": { "commit": "2d02a56" }, - "tokyonight.nvim": { - "commit": "4bd6ba8" + "onedarker.nvim": { + "commit": "b00dd21" }, "packer.nvim": { "commit": "6afb674" @@ -113,13 +116,13 @@ "toggleterm.nvim": { "commit": "5e393e5" }, - "which-key.nvim": { - "commit": "d5f0c63" + "tokyonight.nvim": { + "commit": "e0bdba5" }, "vim-illuminate": { "commit": "b545262" }, - "nvim-navic": { - "commit": "202312e" + "which-key.nvim": { + "commit": "d5f0c63" } } diff --git a/utils/ci/verify_plugins.lua b/utils/ci/verify_plugins.lua index 3cc5dd82..cecb01db 100644 --- a/utils/ci/verify_plugins.lua +++ b/utils/ci/verify_plugins.lua @@ -33,8 +33,7 @@ end local get_install_path = function(spec) local prefix = is_optional(spec) and packer_config.opt_dir or packer_config.start_dir local path = join_paths(prefix, get_short_name(spec)) - assert(is_directory(path)) - return path + return is_directory(path) and path end local function call_proc(process, opts, cb) @@ -92,11 +91,12 @@ end local function verify_core_plugins(verbose) for _, spec in pairs(core_plugins) do - if not spec.disable then + local path = get_install_path(spec) + if not spec.disable and path then table.insert(collection, { name = get_short_name(spec), commit = get_default_sha1(spec), - path = get_install_path(spec), + path = path, }) end end diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index f5d50709..8f490f77 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -11,7 +11,7 @@ an executable -- general lvim.log.level = "warn" lvim.format_on_save = true -lvim.colorscheme = "onedarker" +lvim.colorscheme = "tokyonight" -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false @@ -44,6 +44,10 @@ lvim.keys.normal_mode[""] = ":w" -- }, -- } +-- Change theme settings +-- lvim.builtin.theme.options.dim_inactive = true +-- lvim.builtin.theme.options.style = "storm" + -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } -- lvim.builtin.which_key.mappings["t"] = { @@ -161,7 +165,6 @@ lvim.builtin.treesitter.highlight.enable = true -- Additional Plugins -- lvim.plugins = { --- {"folke/tokyonight.nvim"}, -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index 8fe03d69..bc83aab7 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -28,7 +28,7 @@ vim.g.clipboard = { -- general lvim.log.level = "warn" lvim.format_on_save = true -lvim.colorscheme = "onedarker" +lvim.colorscheme = "tokyonight" -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false @@ -61,6 +61,10 @@ lvim.keys.normal_mode[""] = ":w" -- }, -- } +-- Change theme settings +-- lvim.builtin.theme.options.dim_inactive = true +-- lvim.builtin.theme.options.style = "storm" + -- Use which-key to add extra bindings with the leader-key prefix -- lvim.builtin.which_key.mappings["P"] = { "Telescope projects", "Projects" } -- lvim.builtin.which_key.mappings["t"] = { @@ -176,7 +180,6 @@ lvim.builtin.treesitter.highlight.enable = true -- Additional Plugins -- lvim.plugins = { --- {"folke/tokyonight.nvim"}, -- { -- "folke/trouble.nvim", -- cmd = "TroubleToggle", From 975d1ffcd3660c970d5bb8e4644b88daee17ac5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Vank=C3=B3?= Date: Tue, 20 Sep 2022 12:07:45 +0200 Subject: [PATCH 018/138] fix(installer): small fix in help message of install.sh (#3032) --- utils/installer/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 620d46f5..98faa6f0 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -51,7 +51,7 @@ function usage() { echo " -l, --local Install local copy of LunarVim" echo " -y, --yes Disable confirmation prompts (answer yes to all questions)" echo " --overwrite Overwrite previous LunarVim configuration (a backup is always performed first)" - echo " --[no]-install-dependencies Whether to automatically install external dependencies (will prompt by default)" + echo " --[no-]install-dependencies Whether to automatically install external dependencies (will prompt by default)" } function parse_arguments() { From 28ae8f558b1dca4ab9619c25576352f79b73e0cc Mon Sep 17 00:00:00 2001 From: sambergo <46346606+sambergo@users.noreply.github.com> Date: Tue, 20 Sep 2022 13:27:38 +0300 Subject: [PATCH 019/138] feat: use a shorter dashboard banner when needed (#3047) --- lua/lvim/core/alpha/dashboard.lua | 54 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index 9f235ce0..193a0061 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -1,32 +1,38 @@ local M = {} +local banner = { + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣶⣶⣶⣶⣶⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⣿⠿⠛⠛⠉⠉⠉⠉⠉⠉⠉⠙⠛⠻⢿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⢿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠈⠉⠉⠉⠉⠉⣹⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⣰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⢰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⡀⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢺⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠉⠑⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠀⠀⠈⠑⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠉⠐⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⡟⠀⠈⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠒⠠⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⠁⠀⠀⢀⣼⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠒⠂⠤⠤⠀⣀⡀⠀⠀⠀⣼⣿⠇⠀⠀⢀⣸⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠀⣿⡟⠀⠀⠀⠀⠀⠀⣤⡄⠀⠀⠀⣠⣤⠀⠀⢠⣭⣀⣤⣤⣤⡀⠀⠀⠀⢀⣤⣤⣤⣤⡀⠀⠀⠀⢠⣤⢀⣤⣤⣄⠀⠀⣿⣿⠀⠉⣹⣿⠏⠉⠉⢱⣶⣶⣶⡦⠀⠀⠀⢠⣶⣦⣴⣦⣠⣴⣦⡀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⢠⣿⠇⠀⠀⠀⣿⡇⠀⠀⣿⡿⠉⠀⠈⣿⣧⠀⠀⠰⠿⠋⠀⠀⢹⣿⠀⠀⠀⣿⡿⠋⠀⠹⠿⠀⠀⢻⣿⡇⢠⣿⡟⠀⠀⠀⠈⠉⢹⣿⡇⠀⠀⠀⢸⣿⡏⢹⣿⡏⢹⣿⡇⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⢰⣿⠃⠀⢠⣿⡇⠀⠀⠀⣿⡇⠀⠀⣠⣴⡶⠶⠶⣿⣿⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⠀⢸⣿⣇⣿⡿⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⠀⣿⣿⠀⣾⣿⠀⣾⣿⠁⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⣿⣟⠀⠀⠀⠀⠀⠀⢻⣿⡀⠀⢀⣼⣿⠀⠀⢸⣿⠀⠀⠀⢰⣿⠇⠀⢰⣿⣇⠀⠀⣠⣿⡏⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⠁⠀⠀⠀⣀⣀⣠⣿⣿⣀⡀⠀⢠⣿⡟⢠⣿⡟⢀⣿⡿⠀⠀⠀⠀⠀", + "⠀⠀⠀⠀⠀⠛⠛⠛⠛⠛⠛⠁⠀⠈⠛⠿⠟⠋⠛⠃⠀⠀⠛⠛⠀⠀⠀⠘⠛⠀⠀⠀⠙⠿⠿⠛⠙⠛⠃⠀⠀⠚⠛⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠃⠀⠀⠀⠀⠿⠿⠿⠿⠿⠿⠿⠀⠸⠿⠇⠸⠿⠇⠸⠿⠇⠀⠀⠀⠀⠀", + " ", +} + +if vim.o.lines < 36 then + banner = vim.list_slice(banner, 16, 22) +end + function M.get_sections() local header = { type = "text", - val = { - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣶⣶⣶⣶⣶⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⣿⠿⠛⠛⠉⠉⠉⠉⠉⠉⠉⠙⠛⠻⢿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⢿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠈⠉⠉⠉⠉⠉⣹⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⣰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⢰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⡀⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢺⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠉⠑⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠀⠀⠈⠑⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠉⠐⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⡟⠀⠈⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠒⠠⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⠁⠀⠀⢀⣼⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠒⠂⠤⠤⠀⣀⡀⠀⠀⠀⣼⣿⠇⠀⠀⢀⣸⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠀⣿⡟⠀⠀⠀⠀⠀⠀⣤⡄⠀⠀⠀⣠⣤⠀⠀⢠⣭⣀⣤⣤⣤⡀⠀⠀⠀⢀⣤⣤⣤⣤⡀⠀⠀⠀⢠⣤⢀⣤⣤⣄⠀⠀⣿⣿⠀⠉⣹⣿⠏⠉⠉⢱⣶⣶⣶⡦⠀⠀⠀⢠⣶⣦⣴⣦⣠⣴⣦⡀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⢠⣿⠇⠀⠀⠀⣿⡇⠀⠀⣿⡿⠉⠀⠈⣿⣧⠀⠀⠰⠿⠋⠀⠀⢹⣿⠀⠀⠀⣿⡿⠋⠀⠹⠿⠀⠀⢻⣿⡇⢠⣿⡟⠀⠀⠀⠈⠉⢹⣿⡇⠀⠀⠀⢸⣿⡏⢹⣿⡏⢹⣿⡇⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⢰⣿⠃⠀⢠⣿⡇⠀⠀⠀⣿⡇⠀⠀⣠⣴⡶⠶⠶⣿⣿⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⠀⢸⣿⣇⣿⡿⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⠀⣿⣿⠀⣾⣿⠀⣾⣿⠁⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⣿⣟⠀⠀⠀⠀⠀⠀⢻⣿⡀⠀⢀⣼⣿⠀⠀⢸⣿⠀⠀⠀⢰⣿⠇⠀⢰⣿⣇⠀⠀⣠⣿⡏⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⠁⠀⠀⠀⣀⣀⣠⣿⣿⣀⡀⠀⢠⣿⡟⢠⣿⡟⢀⣿⡿⠀⠀⠀⠀⠀", - "⠀⠀⠀⠀⠀⠛⠛⠛⠛⠛⠛⠁⠀⠈⠛⠿⠟⠋⠛⠃⠀⠀⠛⠛⠀⠀⠀⠘⠛⠀⠀⠀⠙⠿⠿⠛⠙⠛⠃⠀⠀⠚⠛⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠃⠀⠀⠀⠀⠿⠿⠿⠿⠿⠿⠿⠀⠸⠿⠇⠸⠿⠇⠸⠿⠇⠀⠀⠀⠀⠀", - " ", - }, + val = banner, opts = { position = "center", hl = "Label", From 293f4369aee4c66a48534e81a36e5ed41e74a031 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 20 Sep 2022 08:11:36 -0400 Subject: [PATCH 020/138] feat: illuminate works again --- lua/lvim/core/illuminate.lua | 89 ++++++++++++++++++------------------ lua/lvim/plugins.lua | 4 +- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index e0c8c775..bad0be94 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -4,59 +4,58 @@ M.config = function() lvim.builtin.illuminate = { active = true, on_config_done = nil, - options = { - -- providers: provider used to get references in the buffer, ordered by priority - providers = { - "lsp", - "treesitter", - "regex", - }, - -- delay: delay in milliseconds - delay = 120, - -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist - filetypes_denylist = { - "dirvish", - "fugitive", - "alpha", - "NvimTree", - "packer", - "neogitstatus", - "Trouble", - "lir", - "Outline", - "spectre_panel", - "toggleterm", - "DressingSelect", - "TelescopePrompt", - }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist - filetypes_allowlist = {}, - -- modes_denylist: modes to not illuminate, this overrides modes_allowlist - modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist - modes_allowlist = {}, - -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_allowlist = {}, - -- under_cursor: whether or not to illuminate under the cursor - under_cursor = true, - }, } -end -M.setup = function() local status_ok, illuminate = pcall(require, "illuminate") if not status_ok then return end - illuminate.configure(lvim.builtin.illuminate.options) + illuminate.configure { + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 120, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + "alpha", + "NvimTree", + "packer", + "neogitstatus", + "Trouble", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + } +end +M.setup = function() if lvim.builtin.illuminate.on_config_done then lvim.builtin.illuminate.on_config_done() end diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index e84049dc..8fabd9d2 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -262,10 +262,10 @@ local core_plugins = { { "RRethy/vim-illuminate", - setup = function() + config = function() require("lvim.core.illuminate").setup() end, - disable = not lvim.builtin.illuminate.active, + -- disable = not lvim.builtin.illuminate.active, }, { "lunarvim/onedarker.nvim", From 0608ee584c8bfad5795cbdd849fc545ceaf5ec1a Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 20 Sep 2022 08:35:48 -0400 Subject: [PATCH 021/138] feat: breadcrumbs work again --- lua/lvim/core/breadcrumbs.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 9289cb03..78c44622 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -49,6 +49,13 @@ M.config = function() depth_limit_indicator = "..", }, } + local status_ok, navic = pcall(require, "nvim-navic") + if not status_ok then + return + end + + navic.setup(lvim.builtin.breadcrumbs.options) + M.create_winbar() end M.setup = function() @@ -57,7 +64,6 @@ M.setup = function() return end - M.create_winbar() navic.setup(lvim.builtin.breadcrumbs.options) if lvim.builtin.breadcrumbs.on_config_done then From 4bd26928e506f6eebbdc3acc813b24faca351371 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 20 Sep 2022 11:18:21 -0400 Subject: [PATCH 022/138] feat: new dashboard logo --- lua/lvim/core/alpha/dashboard.lua | 52 +++++++++++++++++++++++++++++-- lua/lvim/core/autocmds.lua | 13 ++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index 193a0061..6bcb74cb 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -1,6 +1,29 @@ local M = {} local banner = { + " ⢀⣀⣤⣤⣤⣶⣶⣶⣶⣶⣶⣤⣤⣤⣀⡀ ", + " ⣀⣤⣶⣿⠿⠟⠛⠉⠉⠉⠁⠈⠉⠉⠉⠛⠛⠿⣿⣷⣦⣀ ", + " ⢀⣤⣾⡿⠛⠉ ⠉⠛⢿⣷⣤⡀ ", + " ⣴⣿⡿⠃ ⠙⠻⣿⣦ ", + " ⢀⣠⣤⣤⣤⣤⣤⣾⣿⣉⣀⡀ ⠙⢻⣷⡄ ", + "⣼⠋⠁ ⢠⣿⡟ ⠉⠉⠉⠛⠛⠶⠶⣤⣄⣀ ⣀⣀ ⢠⣤⣤⡄ ⢻⣿⣆ ", + "⢻⡄ ⢰⣿⡟ ⢠⣿⣿⣿⠉⠛⠲⣾⣿⣿⣷ ⢀⣾⣿⣿⠁ ⢻⣿⡆ ", + " ⠹⣦⡀ ⣿⣿⠁ ⢸⣿⣿⡇ ⠻⣿⣿⠟⠳⠶⣤⣀⣸⣿⣿⠇ ⣿⣷ ", + " ⠙⢷⣿⡇ ⣸⣿⣿⠃ ⢸⣿⣿⢷⣤⡀ ⢸⣿⡆ ", + " ⢸⣿⠇ ⣿⣿⣿ ⣿⣿⣷ ⢠⣿⣿⡏ ⠈⠙⠳⢦⣄ ⠈⣿⡇ ", + " ⢸⣿⡆ ⢸⣿⣿⡇ ⣿⣿⣿ ⢀⣿⣿⡟ ⠈⠙⠷⣤⣿⡇ ", + " ⠘⣿⡇ ⣼⣿⣿⠁ ⣿⣿⣿ ⣼⣿⣿⠃ ⢸⣿⠷⣄⡀ ", + " ⣿⣿ ⣿⣿⡿ ⣿⣿⣿⢸⣿⣿⠃ ⣾⡿ ⠈⠻⣆ ", + " ⠸⣿⣧ ⢸⣿⣿⣇⣀⣀⣀⣀⣀⣀⣸⣿⣿⣿⣿⠇ ⣼⣿⠇ ⠘⣧", + " ⠹⣿⣧ ⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏ ⣼⣿⠏ ⣠⡿", + " ⠘⢿⣷⣄ ⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉ ⢠⣼⡿⠛⠛⠛⠛⠛⠛⠉ ", + " ⠻⣿⣦⣄ ⣀⣴⣿⠟ ", + " ⠈⠛⢿⣶⣤⣀ ⣀⣤⣶⡿⠛⠁ ", + " ⠉⠻⢿⣿⣶⣤⣤⣀⣀⡀ ⢀⣀⣀⣠⣤⣶⣿⡿⠟⠋ ", + " ⠈⠉⠙⠛⠻⠿⠿⠿⠿⠿⠿⠟⠛⠋⠉⠁ ", +} + +M.banner_alt_1 = { "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣶⣶⣶⣶⣶⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀", @@ -25,6 +48,31 @@ local banner = { " ", } +M.banner_alt_2 = { + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⠛⠛⠉⠉⠉⠉⠉⠉⠛⠛⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⠉⠀⣀⣤⣴⣶⣶⣾⣿⣿⣷⣶⣶⣦⣤⣀⠀⠉⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⢀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⠿⠟⠛⠛⠛⠛⠛⠁⠀⠾⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠈⢻⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⠁⣴⣾⣿⣿⣿⡟⠀⣰⣿⣶⣶⣶⣤⣤⣉⣉⠛⠛⠿⠿⣿⣿⡿⠿⠿⣿⣿⣿⣿⣿⣿⡟⠛⠛⢛⣿⣿⣿⣆⠀⢻⣿⣿⣿⣿⣿⣿⣿", + "⣿⡄⠻⣿⣿⣿⡟⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⣦⣤⡈⠀⠀⠀⠈⣿⣿⣿⣿⡿⠁⠀⠀⣾⣿⣿⣿⣿⡄⠀⢻⣿⣿⣿⣿⣿⣿", + "⣿⣿⣄⠙⠿⣿⠁⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣄⠀⠀⣠⣄⣉⠛⠻⠃⠀⠀⣼⣿⣿⣿⣿⣿⣿⡀⠈⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣷⣦⡈⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠆⠀⠀⡀⠛⠿⣿⣿⣿⣿⣿⡇⠀⢻⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⡇⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⢀⣿⣿⣿⣿⡇⠀⠀⠘⣿⣿⡟⠀⠀⢰⣿⣷⣦⣌⡙⠻⢿⣿⣷⠀⢸⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⡇⠀⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⢸⣿⣿⣿⣿⣿⠀⠀⠀⣿⡿⠀⠀⢀⣿⣿⣿⣿⣿⣿⣷⣤⣈⠛⠀⢸⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣧⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⠁⠀⠀⣾⣿⣿⣿⣿⣿⠀⠀⠀⣿⠁⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⡈⠻⢿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⡀⠈⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⢀⣿⣿⣿⣿⣿⣿⠀⠀⠀⠃⠀⠀⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠁⢀⣿⣶⣄⠙⣿⣿", + "⣿⣿⣿⣿⣿⣿⣧⠀⠘⣿⣿⣿⣿⣿⣿⡇⠀⠀⠸⠿⠿⠿⠿⠿⠿⠇⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠀⣼⣿⣿⣿⣦⠘⣿", + "⣿⣿⣿⣿⣿⣿⣿⣧⠀⠹⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⣼⣿⣿⣿⡿⠟⢀⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠈⢿⣿⣿⣿⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⢀⣤⣤⣤⣤⣤⣴⣶⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁⢀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣤⣀⠀⠉⠛⠻⠿⠿⢿⣿⣿⡿⠿⠿⠟⠛⠉⠀⣀⣤⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣤⣤⣀⣀⣀⣀⣀⣀⣤⣤⣴⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", + "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿", +} + if vim.o.lines < 36 then banner = vim.list_slice(banner, 16, 22) end @@ -59,8 +107,8 @@ function M.get_sections() entries = { { "f", " Find File", "Telescope find_files" }, { "n", " New File", "ene!" }, - { "p", " Recent Projects ", "Telescope projects" }, - { "r", " Recently Used Files", "Telescope oldfiles" }, + { "p", " Projects ", "Telescope projects" }, + { "r", " Recent Files", "Telescope oldfiles" }, { "t", " Find Word", "Telescope live_grep" }, { "c", diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 525d2338..9eb07bea 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -32,6 +32,19 @@ function M.load_defaults() end, }) + vim.api.nvim_create_autocmd({ "FileType" }, { + pattern = { + "alpha", + }, + callback = function() + vim.cmd [[ + nnoremap q :qa + nnoremap :qa + set nobuflisted + ]] + end, + }) + vim.api.nvim_create_autocmd({ "FileType" }, { pattern = { "lir" }, callback = function() From 31af25f6a19006cad1c38ffd2c63e73d914aded7 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 20 Sep 2022 17:26:57 +0200 Subject: [PATCH 023/138] revert: fix Packer instead of hard-coding config (#3049) --- lua/lvim/core/breadcrumbs.lua | 8 +--- lua/lvim/core/illuminate.lua | 89 ++++++++++++++++++----------------- lua/lvim/plugins.lua | 2 +- utils/installer/install.sh | 2 +- 4 files changed, 48 insertions(+), 53 deletions(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 78c44622..9289cb03 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -49,13 +49,6 @@ M.config = function() depth_limit_indicator = "..", }, } - local status_ok, navic = pcall(require, "nvim-navic") - if not status_ok then - return - end - - navic.setup(lvim.builtin.breadcrumbs.options) - M.create_winbar() end M.setup = function() @@ -64,6 +57,7 @@ M.setup = function() return end + M.create_winbar() navic.setup(lvim.builtin.breadcrumbs.options) if lvim.builtin.breadcrumbs.on_config_done then diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index bad0be94..e0c8c775 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -4,58 +4,59 @@ M.config = function() lvim.builtin.illuminate = { active = true, on_config_done = nil, + options = { + -- providers: provider used to get references in the buffer, ordered by priority + providers = { + "lsp", + "treesitter", + "regex", + }, + -- delay: delay in milliseconds + delay = 120, + -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist + filetypes_denylist = { + "dirvish", + "fugitive", + "alpha", + "NvimTree", + "packer", + "neogitstatus", + "Trouble", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "TelescopePrompt", + }, + -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + filetypes_allowlist = {}, + -- modes_denylist: modes to not illuminate, this overrides modes_allowlist + modes_denylist = {}, + -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + modes_allowlist = {}, + -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_denylist = {}, + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- Only applies to the 'regex' provider + -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + providers_regex_syntax_allowlist = {}, + -- under_cursor: whether or not to illuminate under the cursor + under_cursor = true, + }, } +end +M.setup = function() local status_ok, illuminate = pcall(require, "illuminate") if not status_ok then return end - illuminate.configure { - -- providers: provider used to get references in the buffer, ordered by priority - providers = { - "lsp", - "treesitter", - "regex", - }, - -- delay: delay in milliseconds - delay = 120, - -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist - filetypes_denylist = { - "dirvish", - "fugitive", - "alpha", - "NvimTree", - "packer", - "neogitstatus", - "Trouble", - "lir", - "Outline", - "spectre_panel", - "toggleterm", - "DressingSelect", - "TelescopePrompt", - }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist - filetypes_allowlist = {}, - -- modes_denylist: modes to not illuminate, this overrides modes_allowlist - modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist - modes_allowlist = {}, - -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist - -- Only applies to the 'regex' provider - -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') - providers_regex_syntax_allowlist = {}, - -- under_cursor: whether or not to illuminate under the cursor - under_cursor = true, - } -end + illuminate.configure(lvim.builtin.illuminate.options) -M.setup = function() if lvim.builtin.illuminate.on_config_done then lvim.builtin.illuminate.on_config_done() end diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 8fabd9d2..b2825006 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -265,7 +265,7 @@ local core_plugins = { config = function() require("lvim.core.illuminate").setup() end, - -- disable = not lvim.builtin.illuminate.active, + disable = not lvim.builtin.illuminate.active, }, { "lunarvim/onedarker.nvim", diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 98faa6f0..0fc17ab2 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -395,7 +395,7 @@ function backup_old_config() { function clone_lvim() { msg "Cloning LunarVim configuration" if ! git clone --branch "$LV_BRANCH" \ - --depth 1 "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then + "https://github.com/${LV_REMOTE}" "$LUNARVIM_BASE_DIR"; then echo "Failed to clone repository. Installation failed." exit 1 fi From 845c6a4fe72df8d3b599ca52a5f8b0b084386ba6 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 20 Sep 2022 16:03:27 -0400 Subject: [PATCH 024/138] feat(lualine): update statusline --- lua/lvim/core/lualine/components.lua | 35 ++++++++++++++++++++++------ lua/lvim/core/lualine/styles.lua | 6 ++--- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index c88bf82b..d7e6cd59 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -12,10 +12,26 @@ local function diff_source() end end +local statusline_hl = vim.api.nvim_get_hl_by_name("StatusLine", true) +local cursorline_hl = vim.api.nvim_get_hl_by_name("CursorLine", true) +local normal_hl = vim.api.nvim_get_hl_by_name("Normal", true) + +vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = cursorline_hl.background }) +vim.api.nvim_set_hl(0, "SLBranchName", { fg = normal_hl.foreground, bg = cursorline_hl.background }) +vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.background }) + +local location_color = nil +local branch = "" + +if lvim.colorscheme == "tokyonight-night" then + location_color = "SLBranchName" + branch = "%#SLGitIcon#" .. "" .. "%*" .. "%#SLBranchName#" +end + return { mode = { function() - return " " + return "  " end, padding = { left = 0, right = 0 }, color = {}, @@ -23,9 +39,8 @@ return { }, branch = { "b:gitsigns_head", - icon = " ", + icon = branch, color = { gui = "bold" }, - cond = conditions.hide_in_width, }, filename = { "filename", @@ -61,7 +76,7 @@ return { "diagnostics", sources = { "nvim_diagnostic" }, symbols = { error = " ", warn = " ", info = " ", hint = " " }, - cond = conditions.hide_in_width, + -- cond = conditions.hide_in_width, }, treesitter = { function() @@ -111,8 +126,14 @@ return { color = { gui = "bold" }, cond = conditions.hide_in_width, }, - location = { "location", cond = conditions.hide_in_width, color = {} }, - progress = { "progress", cond = conditions.hide_in_width, color = {} }, + location = { "location", color = location_color }, + progress = { + "progress", + fmt = function() + return "%P/%L" + end, + color = {}, + }, spaces = { function() if not vim.api.nvim_buf_get_option(0, "expandtab") then @@ -144,7 +165,7 @@ return { return chars[index] end, padding = { left = 0, right = 0 }, - color = { fg = colors.yellow, bg = colors.bg }, + color = "SLProgress", cond = nil, }, } diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 8991d9d9..49ad6312 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -80,7 +80,6 @@ styles.lvim = { }, lualine_b = { components.branch, - components.filename, }, lualine_c = { components.diff, @@ -88,13 +87,12 @@ styles.lvim = { }, lualine_x = { components.diagnostics, - components.treesitter, components.lsp, components.filetype, }, - lualine_y = {}, + lualine_y = { components.location }, lualine_z = { - components.scrollbar, + components.progress, }, }, inactive_sections = { From 4c4f08469e8e18034825c90e9558bf06712a4081 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 20 Sep 2022 16:25:58 -0400 Subject: [PATCH 025/138] feat: set options to remove some noise --- lua/lvim/config/settings.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua index 421d739b..8ead7632 100644 --- a/lua/lvim/config/settings.lua +++ b/lua/lvim/config/settings.lua @@ -51,6 +51,8 @@ M.load_default_options = function() shadafile = join_paths(get_cache_dir(), "lvim.shada"), scrolloff = 8, -- minimal number of screen lines to keep above and below the cursor. sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor. + showcmd = false, + ruler = false, } --- SETTINGS --- From e5c723b7015d2614cfca0f014f4678ae5fc56a81 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 19:36:15 -0400 Subject: [PATCH 026/138] feat: laststatus=3 global statusline --- lua/lvim/config/settings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua index 8ead7632..e94f9dae 100644 --- a/lua/lvim/config/settings.lua +++ b/lua/lvim/config/settings.lua @@ -53,6 +53,7 @@ M.load_default_options = function() sidescrolloff = 8, -- minimal number of screen lines to keep left and right of the cursor. showcmd = false, ruler = false, + laststatus = 3, } --- SETTINGS --- From f34dbc94c27bb33ea1895419434771db17412038 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 20:13:37 -0400 Subject: [PATCH 027/138] feat: better telescopic experience (#3052) --- lua/lvim/core/telescope.lua | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index a743bfa4..861eaa7b 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -56,15 +56,17 @@ function M.config() [""] = actions.cycle_history_prev, [""] = actions.smart_send_to_qflist + actions.open_qflist, [""] = actions.select_default, + [""] = require("telescope.actions").delete_buffer, }, n = { [""] = actions.move_selection_next, [""] = actions.move_selection_previous, [""] = actions.smart_send_to_qflist + actions.open_qflist, + ["dd"] = require("telescope.actions").delete_buffer, }, }, file_ignore_patterns = {}, - path_display = { shorten = 5 }, + path_display = { "smart" }, winblend = 0, border = {}, borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, @@ -73,15 +75,50 @@ function M.config() }, pickers = { find_files = { + theme = "dropdown", hidden = true, + previewer = false, }, live_grep = { --@usage don't include the filename in the search results only_sort_text = true, + theme = "dropdown", + }, + grep_string = { + only_sort_text = true, + theme = "dropdown", + }, + buffers = { + theme = "dropdown", + previewer = false, + initial_mode = "normal", + }, + planets = { + show_pluto = true, + show_moon = true, }, git_files = { + theme = "dropdown", + hidden = true, + previewer = false, show_untracked = true, }, + lsp_references = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_definitions = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_declarations = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_implementations = { + theme = "dropdown", + initial_mode = "normal", + }, }, extensions = { fzf = { From 552197499cb1ca0b858d24c8d035bc6404f41148 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 20:34:51 -0400 Subject: [PATCH 028/138] feat: pickers (#3053) --- lua/lvim/core/telescope.lua | 99 +++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 47 deletions(-) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index 861eaa7b..b08aaddb 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -1,5 +1,53 @@ local M = {} +local pickers = { + find_files = { + theme = "dropdown", + hidden = true, + previewer = false, + }, + live_grep = { + --@usage don't include the filename in the search results + only_sort_text = true, + theme = "dropdown", + }, + grep_string = { + only_sort_text = true, + theme = "dropdown", + }, + buffers = { + theme = "dropdown", + previewer = false, + initial_mode = "normal", + }, + planets = { + show_pluto = true, + show_moon = true, + }, + git_files = { + theme = "dropdown", + hidden = true, + previewer = false, + show_untracked = true, + }, + lsp_references = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_definitions = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_declarations = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_implementations = { + theme = "dropdown", + initial_mode = "normal", + }, +} + function M.config() -- Define this minimal config so that it's available if telescope is not yet available. @@ -65,6 +113,7 @@ function M.config() ["dd"] = require("telescope.actions").delete_buffer, }, }, + pickers = pickers, file_ignore_patterns = {}, path_display = { "smart" }, winblend = 0, @@ -73,53 +122,7 @@ function M.config() color_devicons = true, set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, }, - pickers = { - find_files = { - theme = "dropdown", - hidden = true, - previewer = false, - }, - live_grep = { - --@usage don't include the filename in the search results - only_sort_text = true, - theme = "dropdown", - }, - grep_string = { - only_sort_text = true, - theme = "dropdown", - }, - buffers = { - theme = "dropdown", - previewer = false, - initial_mode = "normal", - }, - planets = { - show_pluto = true, - show_moon = true, - }, - git_files = { - theme = "dropdown", - hidden = true, - previewer = false, - show_untracked = true, - }, - lsp_references = { - theme = "dropdown", - initial_mode = "normal", - }, - lsp_definitions = { - theme = "dropdown", - initial_mode = "normal", - }, - lsp_declarations = { - theme = "dropdown", - initial_mode = "normal", - }, - lsp_implementations = { - theme = "dropdown", - initial_mode = "normal", - }, - }, + pickers = pickers, extensions = { fzf = { fuzzy = true, -- false will only do exact matching @@ -157,8 +160,10 @@ function M.setup() [""] = actions.move_selection_next, [""] = actions.move_selection_previous, [""] = actions.smart_send_to_qflist + actions.open_qflist, + ["dd"] = require("telescope.actions").delete_buffer, }, }, + pickers = pickers, }, lvim.builtin.telescope) local telescope = require "telescope" From 2b60f233d979a8ec5b2e44be186e8b1b9b829bea Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 20:52:11 -0400 Subject: [PATCH 029/138] fix: quick and dirty fix for global statusline --- lua/lvim/core/builtins/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 36d09d2e..de78884b 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -30,4 +30,6 @@ function M.config(config) end end +vim.opt.laststatus = 3 + return M From bcfb980d204cdff012a555050245060eebdb608c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuna=20Alika=C5=9Fifo=C4=9Flu?= Date: Wed, 21 Sep 2022 03:52:33 +0300 Subject: [PATCH 030/138] fix: add branch export for rolling installation (#3054) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5f8dc17..02462e83 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/ If you are running Neovim 0.8+ ```bash -bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh) +export LV_BRANCH="rolling"; bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/rolling/utils/installer/install.sh) ``` To run the install script without any interaction you can pass the `-y` flag to automatically install all dependencies and have no prompts. This is particularly useful in automated installations. From 3cb939bf2fa01769a556ebf5876fe5a84354a8da Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 21:34:03 -0400 Subject: [PATCH 031/138] fix: lag in space when in terminal insert --- lua/lvim/core/terminal.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index ac844b11..8b44ec19 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -39,6 +39,7 @@ 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"} + -- TODO: pls add mappings in which key and refactor this execs = { { "lazygit", "gg", "LazyGit", "float" }, }, @@ -75,7 +76,7 @@ M.add_exec = function(opts) return end - vim.keymap.set({ "n", "t" }, opts.keymap, function() + vim.keymap.set({ "n" }, opts.keymap, function() M._exec_toggle { cmd = opts.cmd, count = opts.count, direction = opts.direction } end, { desc = opts.label, noremap = true, silent = true }) end From b954329f98189bf4efec48ab0169964ad6722cf7 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 22:15:03 -0400 Subject: [PATCH 032/138] fix: fixing laststatus harder --- init.lua | 2 ++ lua/lvim/core/builtins/init.lua | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index cd7c6598..97a1780c 100644 --- a/init.lua +++ b/init.lua @@ -19,3 +19,5 @@ local commands = require "lvim.core.commands" commands.load(commands.defaults) require("lvim.lsp").setup() + +vim.opt.laststatus = 3 diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index de78884b..36d09d2e 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -30,6 +30,4 @@ function M.config(config) end end -vim.opt.laststatus = 3 - return M From 5948c30362ea947d1e66aa8ebb8c85845907b5b7 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 20 Sep 2022 23:03:34 -0400 Subject: [PATCH 033/138] fix: make sure to use global in lualine --- lua/lvim/core/lualine/styles.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 49ad6312..5e6f3864 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -11,6 +11,7 @@ styles.none = { style = "none", options = { theme = "auto", + globalstatus = true, icons_enabled = lvim.use_icons, component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, @@ -40,6 +41,7 @@ styles.default = { style = "default", options = { theme = "auto", + globalstatus = true, icons_enabled = lvim.use_icons, component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, From 8e1d3a2b47abf0d8fd8ef9007f2d6b2b979d9eff Mon Sep 17 00:00:00 2001 From: sambergo <46346606+sambergo@users.noreply.github.com> Date: Wed, 21 Sep 2022 17:42:35 +0300 Subject: [PATCH 034/138] fix: more consistent dashboard description (#3055) --- lua/lvim/core/alpha/dashboard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index 6bcb74cb..e92f12bb 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -109,7 +109,7 @@ function M.get_sections() { "n", " New File", "ene!" }, { "p", " Projects ", "Telescope projects" }, { "r", " Recent Files", "Telescope oldfiles" }, - { "t", " Find Word", "Telescope live_grep" }, + { "t", " Find Text", "Telescope live_grep" }, { "c", " Configuration", From 2ba566b0d820977323f48cbdcc2b3b307b882204 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 10:48:15 -0400 Subject: [PATCH 035/138] feat: add indentlines (#3056) --- lua/lvim/core/builtins/init.lua | 1 + lua/lvim/core/indentlines.lua | 43 +++++++++++++++++++++++++++++++++ lua/lvim/plugins.lua | 9 +++++++ snapshots/default.json | 3 +++ 4 files changed, 56 insertions(+) create mode 100644 lua/lvim/core/indentlines.lua diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 36d09d2e..1dd2494a 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -12,6 +12,7 @@ local builtins = { "lvim.core.nvimtree", "lvim.core.lir", "lvim.core.illuminate", + "lvim.core.indentlines", "lvim.core.breadcrumbs", "lvim.core.project", "lvim.core.bufferline", diff --git a/lua/lvim/core/indentlines.lua b/lua/lvim/core/indentlines.lua new file mode 100644 index 00000000..5d51a313 --- /dev/null +++ b/lua/lvim/core/indentlines.lua @@ -0,0 +1,43 @@ +local M = {} + +M.config = function() + vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" } + vim.g.indent_blankline_filetype_exclude = { + "help", + "startify", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "Trouble", + "text", + } + vim.g.indentLine_enabled = 1 + vim.g.indent_blankline_char = "▏" + vim.g.indent_blankline_show_trailing_blankline_indent = false + vim.g.indent_blankline_show_first_indent_level = true + vim.g.indent_blankline_use_treesitter = false + vim.g.indent_blankline_show_current_context = true + lvim.builtin.indentlines = { + active = true, + on_config_done = nil, + options = { + show_current_context = true, + }, + } +end + +M.setup = function() + local status_ok, indent_blankline = pcall(require, "indent_blankline") + if not status_ok then + return + end + + indent_blankline.configure(lvim.builtin.indentlines.options) + + if lvim.builtin.indentlines.on_config_done then + lvim.builtin.indentlines.on_config_done() + end +end + +return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index b2825006..625f3ad1 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -267,6 +267,15 @@ local core_plugins = { end, disable = not lvim.builtin.illuminate.active, }, + + { + "lukas-reineke/indent-blankline.nvim", + config = function() + require("lvim.core.indent-blankline").setup() + end, + disable = not lvim.builtin.indentlines.active, + }, + { "lunarvim/onedarker.nvim", branch = "freeze", diff --git a/snapshots/default.json b/snapshots/default.json index dc19f496..94e6771c 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -124,5 +124,8 @@ }, "which-key.nvim": { "commit": "d5f0c63" + }, + "indent-blankline.nvim": { + "commit": "db7cbcb" } } From 03156e42acde5b2e40c5245b8720450a4c5d25ba Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 11:09:11 -0400 Subject: [PATCH 036/138] Indentlines (#3057) --- lua/lvim/core/indentlines.lua | 2 +- lua/lvim/core/theme.lua | 5 +++++ lua/lvim/plugins.lua | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/indentlines.lua b/lua/lvim/core/indentlines.lua index 5d51a313..3039dd77 100644 --- a/lua/lvim/core/indentlines.lua +++ b/lua/lvim/core/indentlines.lua @@ -33,7 +33,7 @@ M.setup = function() return end - indent_blankline.configure(lvim.builtin.indentlines.options) + indent_blankline.setup(lvim.builtin.indentlines.options) if lvim.builtin.indentlines.on_config_done then lvim.builtin.indentlines.on_config_done() diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index c02aaa7e..ad3c84cd 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -4,6 +4,11 @@ M.config = function() lvim.builtin.theme = { name = "tokyonight", options = { + on_highlights = function(hl, c) + hl.IndentBlanklineContextChar = { + fg = c.dark5, + } + end, style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day` transparent = lvim.transparent_window, -- Enable this to disable setting the background color terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 625f3ad1..2140636b 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -271,7 +271,7 @@ local core_plugins = { { "lukas-reineke/indent-blankline.nvim", config = function() - require("lvim.core.indent-blankline").setup() + require("lvim.core.indentlines").setup() end, disable = not lvim.builtin.indentlines.active, }, From 64615ae626f2932529b236c3c5f99090dbf9faad Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 21 Sep 2022 11:21:01 -0400 Subject: [PATCH 037/138] fix: always load base theme --- lua/lvim/core/theme.lua | 6 ++++++ lua/lvim/plugins.lua | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index ad3c84cd..886045c9 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -40,6 +40,12 @@ M.config = function() use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background }, } + local status_ok, theme = pcall(require, "tokyonight") + if not status_ok then + return + end + + theme.setup(lvim.builtin.theme.options) end M.setup = function() diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 2140636b..fbafb17a 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -19,7 +19,7 @@ local core_plugins = { config = function() require("lvim.core.theme").setup() end, - disable = not vim.startswith(lvim.colorscheme, "tokyonight"), + -- disable = not vim.startswith(lvim.colorscheme, "tokyonight"), }, { "rcarriga/nvim-notify", From 21311b54a52c13dfe687f22c1d7bee0a163525f2 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 21 Sep 2022 14:00:44 -0400 Subject: [PATCH 038/138] fix: plain tokyonight --- lua/lvim/core/lualine/components.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index d7e6cd59..f52502dc 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -23,7 +23,7 @@ vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.backgr local location_color = nil local branch = "" -if lvim.colorscheme == "tokyonight-night" then +if lvim.colorscheme == "tokyonight" then location_color = "SLBranchName" branch = "%#SLGitIcon#" .. "" .. "%*" .. "%#SLBranchName#" end From 82f4b353b3c8ecb4f6cb216b00486643f1c07e67 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 21 Sep 2022 14:01:39 -0400 Subject: [PATCH 039/138] feat: only show reloaded config on debug log level to decrease noise --- lua/lvim/utils/hooks.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index f15f6729..00b07afb 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -19,7 +19,7 @@ function M.run_on_packer_complete() pcall(vim.cmd, "colorscheme " .. lvim.colorscheme) if M._reload_triggered then - Log:info "Reloaded configuration" + Log:debug "Reloaded configuration" M._reload_triggered = nil end end From efa466a99add5fad498e4868ca4b37294e4d8307 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 21 Sep 2022 14:05:19 -0400 Subject: [PATCH 040/138] fix: lualine filetype padding --- lua/lvim/core/lualine/components.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index f52502dc..75de300a 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -154,7 +154,7 @@ return { color = {}, cond = conditions.hide_in_width, }, - filetype = { "filetype", cond = conditions.hide_in_width }, + filetype = { "filetype", cond = conditions.hide_in_width, padding = { left = 0, right = 1 } }, scrollbar = { function() local current_line = vim.fn.line "." From 4a48232ee064fd1340a78fdbc2582de6503f9489 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 21 Sep 2022 14:07:31 -0400 Subject: [PATCH 041/138] fix(lualine): little more padding --- lua/lvim/core/lualine/components.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 75de300a..690462cc 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -154,7 +154,7 @@ return { color = {}, cond = conditions.hide_in_width, }, - filetype = { "filetype", cond = conditions.hide_in_width, padding = { left = 0, right = 1 } }, + filetype = { "filetype", cond = conditions.hide_in_width, padding = { left = 1, right = 2 } }, scrollbar = { function() local current_line = vim.fn.line "." From 526c010c80de00815f3fb53e1461fcbeabc55f12 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 14:41:48 -0400 Subject: [PATCH 042/138] fix: lualine git signs padding --- lua/lvim/core/lualine/components.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 690462cc..0a58e415 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -50,7 +50,8 @@ return { diff = { "diff", source = diff_source, - symbols = { added = "  ", modified = " ", removed = " " }, + symbols = { added = " ", modified = " ", removed = " " }, + padding = { left = 2, right = 1 }, diff_color = { added = { fg = colors.green }, modified = { fg = colors.yellow }, From 538fbd6f686905547c3fa26354611221429715f8 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 21 Sep 2022 23:14:08 +0430 Subject: [PATCH 043/138] fix(indentblankline): make sure to use the new syntax for all options (#3058) --- lua/lvim/core/indentlines.lua | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lua/lvim/core/indentlines.lua b/lua/lvim/core/indentlines.lua index 3039dd77..37be1e22 100644 --- a/lua/lvim/core/indentlines.lua +++ b/lua/lvim/core/indentlines.lua @@ -1,27 +1,26 @@ local M = {} M.config = function() - vim.g.indent_blankline_buftype_exclude = { "terminal", "nofile" } - vim.g.indent_blankline_filetype_exclude = { - "help", - "startify", - "dashboard", - "packer", - "neogitstatus", - "NvimTree", - "Trouble", - "text", - } - vim.g.indentLine_enabled = 1 - vim.g.indent_blankline_char = "▏" - vim.g.indent_blankline_show_trailing_blankline_indent = false - vim.g.indent_blankline_show_first_indent_level = true - vim.g.indent_blankline_use_treesitter = false - vim.g.indent_blankline_show_current_context = true lvim.builtin.indentlines = { active = true, on_config_done = nil, options = { + enabled = true, + buftype_exclude = { "terminal", "nofile" }, + filetype_exclude = { + "help", + "startify", + "dashboard", + "packer", + "neogitstatus", + "NvimTree", + "Trouble", + "text", + }, + char = "▏", + show_trailing_blankline_indent = false, + show_first_indent_level = false, + use_treesitter = true, show_current_context = true, }, } From 4b0a60e23c0554b1dfa14e80f1e19feffd0204a5 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 14:47:50 -0400 Subject: [PATCH 044/138] feat(indentblankline): show first indent level --- lua/lvim/core/indentlines.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/indentlines.lua b/lua/lvim/core/indentlines.lua index 37be1e22..3485f348 100644 --- a/lua/lvim/core/indentlines.lua +++ b/lua/lvim/core/indentlines.lua @@ -19,7 +19,7 @@ M.config = function() }, char = "▏", show_trailing_blankline_indent = false, - show_first_indent_level = false, + show_first_indent_level = true, use_treesitter = true, show_current_context = true, }, From 2cfb55ddb628e135a95f669d9f393ed3a2b1d950 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 17:58:52 -0400 Subject: [PATCH 045/138] feat(lualine): improvements --- lua/lvim/core/lualine/components.lua | 26 +++++++++++++++----------- lua/lvim/core/lualine/conditions.lua | 2 +- lua/lvim/core/lualine/styles.lua | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 0a58e415..5f29d4ef 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -22,10 +22,18 @@ vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.backgr local location_color = nil local branch = "" +local separator = "│" if lvim.colorscheme == "tokyonight" then location_color = "SLBranchName" branch = "%#SLGitIcon#" .. "" .. "%*" .. "%#SLBranchName#" + + local status_ok, tnc = pcall(require, "tokyonight.colors") + if status_ok then + local tncolors = tnc.setup { transform = true } + vim.api.nvim_set_hl(0, "SLSeparator", { fg = cursorline_hl.background, bg = tncolors.black }) + separator = "%#SLSeparator#" .. "│" .. "%*" + end end return { @@ -124,6 +132,7 @@ return { local unique_client_names = vim.fn.uniq(buf_client_names) return "[" .. table.concat(unique_client_names, ", ") .. "]" end, + separator = separator, color = { gui = "bold" }, cond = conditions.hide_in_width, }, @@ -135,19 +144,14 @@ return { end, color = {}, }, + spaces = { function() - if not vim.api.nvim_buf_get_option(0, "expandtab") then - return "Tab size: " .. vim.api.nvim_buf_get_option(0, "tabstop") .. " " - end - local size = vim.api.nvim_buf_get_option(0, "shiftwidth") - if size == 0 then - size = vim.api.nvim_buf_get_option(0, "tabstop") - end - return "Spaces: " .. size .. " " + local shiftwidth = vim.api.nvim_buf_get_option(0, "shiftwidth") + return " " .. shiftwidth end, - cond = conditions.hide_in_width, - color = {}, + separator = separator, + padding = 1, }, encoding = { "o:encoding", @@ -155,7 +159,7 @@ return { color = {}, cond = conditions.hide_in_width, }, - filetype = { "filetype", cond = conditions.hide_in_width, padding = { left = 1, right = 2 } }, + filetype = { "filetype", cond = nil, padding = { left = 1, right = 1 } }, scrollbar = { function() local current_line = vim.fn.line "." diff --git a/lua/lvim/core/lualine/conditions.lua b/lua/lvim/core/lualine/conditions.lua index 6e120b26..8a89c0bd 100644 --- a/lua/lvim/core/lualine/conditions.lua +++ b/lua/lvim/core/lualine/conditions.lua @@ -1,4 +1,4 @@ -local window_width_limit = 70 +local window_width_limit = 100 local conditions = { buffer_not_empty = function() diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 5e6f3864..7e576855 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -90,6 +90,7 @@ styles.lvim = { lualine_x = { components.diagnostics, components.lsp, + components.spaces, components.filetype, }, lualine_y = { components.location }, From 59043c6629fa742dab5550ef31cef7a944887544 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 19:21:14 -0400 Subject: [PATCH 046/138] docs: update images --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 02462e83..f8875025 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,12 @@ ## Showcase -![intro1](https://user-images.githubusercontent.com/59826753/159939936-3a9a8e94-05ea-48fa-8c46-69378276451b.png) -![info](https://user-images.githubusercontent.com/59826753/159939984-ac0190d7-a3fb-46c0-95ca-a6fec626bbac.png) +![intro1](https://user-images.githubusercontent.com/29136904/191624232-a7b13f11-cc9f-495e-879e-67ea0444c568.png) +![info](https://user-images.githubusercontent.com/29136904/191624942-3d75ef87-35cf-434d-850e-3e7cd5ce2ad0.png) -![demo1](https://user-images.githubusercontent.com/59826753/159940004-84975294-5703-4bf1-aa98-2cc97cb38d96.png) -![demo2](https://user-images.githubusercontent.com/59826753/159940040-375a0a28-4c81-4fdf-80f2-62853edf9b4f.png) +![demo1](https://user-images.githubusercontent.com/29136904/191625579-ce9efb1f-1e23-4a05-aebc-915a0f614d72.png) +![demo2](https://user-images.githubusercontent.com/29136904/191626018-2e9ee682-043c-4ce5-a5dd-c11b94759782.png) +![demo3](https://user-images.githubusercontent.com/29136904/191626246-ce0cc0c5-4b41-49e3-9cb7-4b1867ab0dcb.png) ## Install In One Command! From 2ecdc8ecbff0f8b15eca46d7f51ba1eab873a8a8 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 21:12:15 -0400 Subject: [PATCH 047/138] fix: improve lualine inactive --- lua/lvim/core/lualine/styles.lua | 25 +++++++++++++++++++------ lua/lvim/core/theme.lua | 28 ++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 7e576855..57bd7260 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -71,6 +71,7 @@ styles.lvim = { style = "lvim", options = { theme = "auto", + globalstatus = true, icons_enabled = lvim.use_icons, component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, @@ -100,13 +101,25 @@ styles.lvim = { }, inactive_sections = { lualine_a = { - "filename", + components.mode, + }, + lualine_b = { + components.branch, + }, + lualine_c = { + components.diff, + components.python_env, + }, + lualine_x = { + components.diagnostics, + components.lsp, + components.spaces, + components.filetype, + }, + lualine_y = { components.location }, + lualine_z = { + components.progress, }, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {}, }, tabline = {}, extensions = { "nvim-tree" }, diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index 886045c9..b1fce081 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -8,6 +8,34 @@ M.config = function() hl.IndentBlanklineContextChar = { fg = c.dark5, } + local prompt = "#2d3149" + -- hl.TelescopeNormal = { + -- bg = c.bg_dark, + -- fg = c.fg_dark, + -- } + -- hl.TelescopeBorder = { + -- bg = c.bg_dark, + -- fg = c.bg_dark, + -- } + -- hl.TelescopePromptNormal = { + -- bg = prompt, + -- } + -- hl.TelescopePromptBorder = { + -- bg = prompt, + -- fg = prompt, + -- } + -- hl.TelescopePromptTitle = { + -- bg = prompt, + -- fg = prompt, + -- } + -- hl.TelescopePreviewTitle = { + -- bg = c.bg_dark, + -- fg = c.bg_dark, + -- } + -- hl.TelescopeResultsTitle = { + -- bg = c.bg_dark, + -- fg = c.bg_dark, + -- } end, style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day` transparent = lvim.transparent_window, -- Enable this to disable setting the background color From 3803fff75846089f5c4aac70bbed7b58c77561e3 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 21:18:44 -0400 Subject: [PATCH 048/138] fix: lualine slightly better --- lua/lvim/core/lualine/styles.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 57bd7260..0d759c95 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -75,7 +75,7 @@ styles.lvim = { icons_enabled = lvim.use_icons, component_separators = { left = "", right = "" }, section_separators = { left = "", right = "" }, - disabled_filetypes = { "alpha", "NvimTree", "Outline" }, + disabled_filetypes = { "alpha" }, }, sections = { lualine_a = { @@ -122,7 +122,7 @@ styles.lvim = { }, }, tabline = {}, - extensions = { "nvim-tree" }, + extensions = {}, } function M.get_style(style) From bea690fc16e3e23e8644c61b1d2e140fb8851d1b Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 21 Sep 2022 21:21:00 -0400 Subject: [PATCH 049/138] fix: use columns instead of winwidth --- lua/lvim/core/lualine/conditions.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/conditions.lua b/lua/lvim/core/lualine/conditions.lua index 8a89c0bd..42d52a83 100644 --- a/lua/lvim/core/lualine/conditions.lua +++ b/lua/lvim/core/lualine/conditions.lua @@ -5,7 +5,7 @@ local conditions = { return vim.fn.empty(vim.fn.expand "%:t") ~= 1 end, hide_in_width = function() - return vim.fn.winwidth(0) > window_width_limit + return vim.o.columns > window_width_limit end, -- check_git_workspace = function() -- local filepath = vim.fn.expand "%:p:h" From 8aab0f792535d5f172b6f3210f0c123d8ce05e39 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 21 Sep 2022 23:39:18 -0400 Subject: [PATCH 050/138] fix(alpha): can't set button hl without doing this --- lua/lvim/core/alpha/dashboard.lua | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index e92f12bb..51338554 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -103,18 +103,22 @@ function M.get_sections() }, } + local dashboard = require "alpha.themes.dashboard" + + local function button(sc, txt, keybind, keybind_opts) + local b = dashboard.button(sc, txt, keybind, keybind_opts) + b.opts.hl_shortcut = "Macro" + return b + end + local buttons = { - entries = { - { "f", " Find File", "Telescope find_files" }, - { "n", " New File", "ene!" }, - { "p", " Projects ", "Telescope projects" }, - { "r", " Recent Files", "Telescope oldfiles" }, - { "t", " Find Text", "Telescope live_grep" }, - { - "c", - " Configuration", - "edit " .. require("lvim.config"):get_user_config_path() .. " ", - }, + val = { + button("f", " Find File", "Telescope find_files"), + button("n", " New File", "ene!"), + button("p", " Projects ", "Telescope projects"), + button("r", " Recent files", ":Telescope oldfiles "), + button("t", " Find Text", "Telescope live_grep"), + button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), }, } From 6511e997c5b8d3a357abd87f3a644e3fad2ffcfd Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Thu, 22 Sep 2022 01:57:27 -0400 Subject: [PATCH 051/138] fix: lualine laststatus nuclear option --- lua/lvim/core/autocmds.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 9eb07bea..acacc1b4 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -53,6 +53,14 @@ function M.load_defaults() end, }) + -- TODO: figure out what keeps overriding laststatus + vim.api.nvim_create_autocmd({ "BufWinEnter" }, { + pattern = { "*" }, + callback = function() + vim.opt.laststatus = 3 + end, + }) + local definitions = { { "TextYankPost", From 223ab2a679e086f1690744edf9f6a2b851c37593 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Thu, 22 Sep 2022 09:18:18 -0400 Subject: [PATCH 052/138] fix: pcall for dashboard --- lua/lvim/core/alpha/dashboard.lua | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index 51338554..ac80c03a 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -102,26 +102,27 @@ function M.get_sections() hl = "Number", }, } + local buttons = {} - local dashboard = require "alpha.themes.dashboard" - - local function button(sc, txt, keybind, keybind_opts) - local b = dashboard.button(sc, txt, keybind, keybind_opts) - b.opts.hl_shortcut = "Macro" - return b + local status_ok, dashboard = pcall(require, "alpha.themes.dashboard") + if status_ok then + local function button(sc, txt, keybind, keybind_opts) + local b = dashboard.button(sc, txt, keybind, keybind_opts) + b.opts.hl_shortcut = "Macro" + return b + end + buttons = { + val = { + button("f", " Find File", "Telescope find_files"), + button("n", " New File", "ene!"), + button("p", " Projects ", "Telescope projects"), + button("r", " Recent files", ":Telescope oldfiles "), + button("t", " Find Text", "Telescope live_grep"), + button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), + }, + } end - local buttons = { - val = { - button("f", " Find File", "Telescope find_files"), - button("n", " New File", "ene!"), - button("p", " Projects ", "Telescope projects"), - button("r", " Recent files", ":Telescope oldfiles "), - button("t", " Find Text", "Telescope live_grep"), - button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), - }, - } - return { header = header, buttons = buttons, From d06030105064ae630687728c1f112fe447b81afd Mon Sep 17 00:00:00 2001 From: Philipp Bokatius Date: Thu, 22 Sep 2022 19:16:05 +0200 Subject: [PATCH 053/138] fix(dashboard): add missing space (#3063) --- lua/lvim/core/alpha/dashboard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index ac80c03a..debf88a7 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -116,7 +116,7 @@ function M.get_sections() button("f", " Find File", "Telescope find_files"), button("n", " New File", "ene!"), button("p", " Projects ", "Telescope projects"), - button("r", " Recent files", ":Telescope oldfiles "), + button("r", " Recent files", ":Telescope oldfiles "), button("t", " Find Text", "Telescope live_grep"), button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), }, From 817337b17efd99fa8cdd581b173eaab0122caf10 Mon Sep 17 00:00:00 2001 From: Latif Sulistyo Date: Fri, 23 Sep 2022 00:16:38 +0700 Subject: [PATCH 054/138] fix: small fixes on telescope pickers & breadcrumbs (#3060) --- lua/lvim/core/breadcrumbs.lua | 2 +- lua/lvim/core/telescope.lua | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 9289cb03..23b516db 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -70,6 +70,7 @@ M.winbar_filetype_exclude = { "startify", "dashboard", "packer", + "neo-tree", "neogitstatus", "NvimTree", "Trouble", @@ -141,7 +142,6 @@ end local excludes = function() if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) then - vim.opt_local.winbar = nil return true end return false diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index b08aaddb..c1cfd043 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -163,7 +163,6 @@ function M.setup() ["dd"] = require("telescope.actions").delete_buffer, }, }, - pickers = pickers, }, lvim.builtin.telescope) local telescope = require "telescope" From da41d27da82b367eef7676cbb6200dcc7a586b30 Mon Sep 17 00:00:00 2001 From: Latif Sulistyo Date: Fri, 23 Sep 2022 13:23:52 +0700 Subject: [PATCH 055/138] fix(ci): resolve stylua ci rare error (#3065) --- .github/workflows/format.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index b63b89d7..52103a54 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v2 - name: Lint with stylua - uses: JohnnyMorganz/stylua-action@1.0.0 + uses: JohnnyMorganz/stylua-action@v1 with: token: ${{ secrets.GITHUB_TOKEN }} # CLI arguments From 26aab3a4c4c234eba9bd0d57ede5c16ecd63db7d Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Fri, 23 Sep 2022 12:57:54 -0400 Subject: [PATCH 056/138] chore: custom funding paypal & buymeacoffee --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 255497d6..6f00609f 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,4 @@ github: christianchiarulli patreon: chrisatmachine - +custom: ["https://www.buymeacoffee.com/chrisatmachine", "https://www.paypal.com/paypalme/chrisatmachine"] From 099b38cae9a8bf462b73821d9fcd758e5001c443 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Fri, 23 Sep 2022 13:07:53 -0400 Subject: [PATCH 057/138] chore: funding add strike --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 6f00609f..2599a46a 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,4 @@ github: christianchiarulli patreon: chrisatmachine -custom: ["https://www.buymeacoffee.com/chrisatmachine", "https://www.paypal.com/paypalme/chrisatmachine"] +custom: ["https://www.buymeacoffee.com/chrisatmachine", "https://www.paypal.com/paypalme/chrisatmachine", "https://strike.me/chrisatmachine"] From 65777d858f75079cb12125ee1aa45f51e10dcb11 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sun, 25 Sep 2022 15:45:19 +0330 Subject: [PATCH 058/138] fix(nvimtree): remove view height Fixes #3076 --- lua/lvim/core/nvimtree.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index ad326f91..b861cb59 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -42,7 +42,6 @@ function M.config() }, view = { width = 30, - height = 30, hide_root_folder = false, side = "left", mappings = { From 90b4b55bf439385c287adbed8f7210d2e8d098be Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sun, 25 Sep 2022 16:53:23 -0400 Subject: [PATCH 059/138] fix: supertab should tab if menu is not available (#3079) --- lua/lvim/core/cmp.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 8e954335..a6362aa7 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -247,7 +247,8 @@ M.config = function() elseif jumpable(1) then luasnip.jump(1) elseif has_words_before() then - cmp.complete() + -- cmp.complete() + fallback() else fallback() end From 7acb8d9e34a9f277956bbcca5d3ea2d1432206dc Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sun, 25 Sep 2022 17:18:32 -0400 Subject: [PATCH 060/138] feat: add border for mason (#3080) --- lua/lvim/core/mason.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/core/mason.lua b/lua/lvim/core/mason.lua index 39be4f42..36daab1f 100644 --- a/lua/lvim/core/mason.lua +++ b/lua/lvim/core/mason.lua @@ -3,6 +3,7 @@ local M = {} function M.config() lvim.builtin.mason = { ui = { + border = "rounded", keymaps = { toggle_package_expand = "", install_package = "i", From 67234b748abc7089591c2b6b5f7b1a96a98c5c91 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Sun, 25 Sep 2022 20:50:57 -0400 Subject: [PATCH 061/138] feat: colorscheme tweaks --- lua/lvim/core/theme.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index b1fce081..43ba3a07 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -8,7 +8,13 @@ M.config = function() hl.IndentBlanklineContextChar = { fg = c.dark5, } - local prompt = "#2d3149" + hl.TSConstructor = { + fg = c.blue1, + } + hl.TSTagDelimiter = { + fg = c.dark5, + } + -- local prompt = "#2d3149" -- hl.TelescopeNormal = { -- bg = c.bg_dark, -- fg = c.fg_dark, From a05365a48e9376e2c421f874c928ade8eb7f136d Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Tue, 27 Sep 2022 02:46:41 -0400 Subject: [PATCH 062/138] chore: add kofi --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 2599a46a..88a6b71e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,4 +2,5 @@ github: christianchiarulli patreon: chrisatmachine +ko_fi: chrisatmachine custom: ["https://www.buymeacoffee.com/chrisatmachine", "https://www.paypal.com/paypalme/chrisatmachine", "https://strike.me/chrisatmachine"] From de5691f2d56c79a9f630c27e6bb623a1638de949 Mon Sep 17 00:00:00 2001 From: Mateusz Hawrus <48822818+nieomylnieja@users.noreply.github.com> Date: Tue, 27 Sep 2022 12:56:57 +0200 Subject: [PATCH 063/138] fix(log): correct add_entry code documentation (#3081) --- lua/lvim/core/log.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/log.lua b/lua/lvim/core/log.lua index 48891139..5047ff4c 100644 --- a/lua/lvim/core/log.lua +++ b/lua/lvim/core/log.lua @@ -145,8 +145,9 @@ function Log:configure_notifications(notif_handle) end --- Adds a log entry using Plenary.log +---@param level integer [same as vim.log.levels] ---@param msg any ----@param level string [same as vim.log.log_levels] +---@param event any function Log:add_entry(level, msg, event) local logger = self:get_logger() if not logger then From d37fdc5cf245e0f444665d7f031681dfc520f97c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:14:19 +0330 Subject: [PATCH 064/138] chore: bump plugins version (#2988) * chore: bump plugins version * chore(plugins): update * chore(plugins): ignore solc Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Abouzar Parvan --- lua/lvim/lsp/config.lua | 1 + snapshots/default.json | 60 ++++++++++++++++++++--------------------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index d842f099..d6f970e8 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -22,6 +22,7 @@ local skipped_servers = { "reason_ls", "scry", "solang", + "solc", "solidity_ls", "sorbet", "sourcekit", diff --git a/snapshots/default.json b/snapshots/default.json index 94e6771c..0a138caf 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -1,18 +1,18 @@ { "Comment.nvim": { - "commit": "30d23aa" + "commit": "3e1ec27" }, "FixCursorHold.nvim": { - "commit": "5aa5ff1" + "commit": "70a9516" }, "LuaSnip": { - "commit": "6e506ce" + "commit": "d36c063" }, "alpha-nvim": { "commit": "0bb6fc0" }, "bufferline.nvim": { - "commit": "ffa1d00" + "commit": "83bf4dc" }, "cmp-buffer": { "commit": "3022dbc" @@ -30,61 +30,64 @@ "commit": "3679132" }, "friendly-snippets": { - "commit": "22a9975" + "commit": "2be79d8" }, "gitsigns.nvim": { - "commit": "d7e0bcb" + "commit": "f98c85e" + }, + "indent-blankline.nvim": { + "commit": "db7cbcb" }, "lir.nvim": { "commit": "7d8c6c4" }, "lua-dev.nvim": { - "commit": "fd7a18e" + "commit": "e18c4ce" }, "lualine.nvim": { "commit": "a52f078" }, "mason-lspconfig.nvim": { - "commit": "1534b61" + "commit": "0051870" }, "mason.nvim": { - "commit": "b56ea0b" + "commit": "7e5aa40" }, "nlsp-settings.nvim": { - "commit": "e1fcc6e" + "commit": "79d3882" }, "null-ls.nvim": { - "commit": "bf02782" + "commit": "8af89c5" }, "nvim-autopairs": { - "commit": "5fe2441" + "commit": "14cc2a4" }, "nvim-cmp": { - "commit": "913eb85" + "commit": "2427d06" }, "nvim-dap": { - "commit": "d9b315a" + "commit": "764899d" }, "nvim-lspconfig": { - "commit": "f8b3c24" + "commit": "dc4dac8" }, "nvim-navic": { - "commit": "202312e" + "commit": "e0cfb25" }, "nvim-notify": { - "commit": "7076ce8" + "commit": "3a8ec89" }, "nvim-tree.lua": { - "commit": "fb8735e" + "commit": "9914780" }, "nvim-treesitter": { - "commit": "2eaf188" + "commit": "0289160" }, "nvim-ts-context-commentstring": { "commit": "4d3a68c" }, "nvim-web-devicons": { - "commit": "2d02a56" + "commit": "9697285" }, "onedarker.nvim": { "commit": "b00dd21" @@ -93,16 +96,16 @@ "commit": "6afb674" }, "plenary.nvim": { - "commit": "4b66054" + "commit": "62dc2a7" }, "popup.nvim": { "commit": "b7404d3" }, "project.nvim": { - "commit": "090bb11" + "commit": "628de7e" }, "schemastore.nvim": { - "commit": "92efc7c" + "commit": "687fc5a" }, "structlog.nvim": { "commit": "232a8e2" @@ -114,18 +117,15 @@ "commit": "0b1c41a" }, "toggleterm.nvim": { - "commit": "5e393e5" + "commit": "2a787c4" }, "tokyonight.nvim": { - "commit": "e0bdba5" + "commit": "81f0db1" }, "vim-illuminate": { - "commit": "b545262" + "commit": "a2e8476" }, "which-key.nvim": { - "commit": "d5f0c63" - }, - "indent-blankline.nvim": { - "commit": "db7cbcb" + "commit": "6885b66" } } From 58b0684f7edc91503bc774af840a9a5021214781 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 27 Sep 2022 13:18:26 -0400 Subject: [PATCH 065/138] chore: format on save false by default in default config --- utils/installer/config.example.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 8f490f77..9f54c2a4 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -10,7 +10,7 @@ an executable -- general lvim.log.level = "warn" -lvim.format_on_save = true +lvim.format_on_save = false lvim.colorscheme = "tokyonight" -- to disable icons and use a minimalist setup, uncomment the following -- lvim.use_icons = false From ae5c20abf1cabfa598a382830214a4904ec275d5 Mon Sep 17 00:00:00 2001 From: Guido <38738725+guidomodarelli@users.noreply.github.com> Date: Wed, 28 Sep 2022 01:59:18 -0300 Subject: [PATCH 066/138] fix: update minimal_lsp.lua (#3090) --- tests/minimal_lsp.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/minimal_lsp.lua b/tests/minimal_lsp.lua index 09224f94..01e814be 100644 --- a/tests/minimal_lsp.lua +++ b/tests/minimal_lsp.lua @@ -71,7 +71,7 @@ _G.load_config = function() vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) vim.keymap.set("n", "q", vim.diagnostic.setloclist, opts) vim.keymap.set("n", "li", "LspInfo", opts) - vim.keymap.set("n", "lI", "MasonCR>", opts) + vim.keymap.set("n", "lI", "Mason", opts) end -- Add the server that troubles you here, e.g. "clangd", "pyright", "tsserver" From 257e3ff3697a55e7a17eab876fb8d0b85fd203de Mon Sep 17 00:00:00 2001 From: Vinicius Brasil Date: Wed, 28 Sep 2022 02:00:12 -0300 Subject: [PATCH 067/138] doc: Replace Tree-sitter `maintained` with `all` in README (#3088) `maintained` option is not supported anymore https://github.com/nvim-treesitter/nvim-treesitter/issues/2887 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f8875025..2127ffd3 100644 --- a/README.md +++ b/README.md @@ -92,7 +92,7 @@ lvim.builtin.notify.active = true lvim.builtin.terminal.active = true -- Treesitter parsers change this to a table of the languages you want i.e. {"java", "python", javascript} -lvim.builtin.treesitter.ensure_installed = "maintained" +lvim.builtin.treesitter.ensure_installed = "all" lvim.builtin.treesitter.ignore_install = { "haskell" } -- Disable virtual text From 08e9115d9e99f8bce1ac76e0656d3a30f0c133f3 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 28 Sep 2022 21:20:20 +0330 Subject: [PATCH 068/138] feat(autocmds): make sure all autocmds are modifiable (#3087) --- init.lua | 2 -- lua/lvim/core/autocmds.lua | 65 +++++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/init.lua b/init.lua index 97a1780c..cd7c6598 100644 --- a/init.lua +++ b/init.lua @@ -19,5 +19,3 @@ local commands = require "lvim.core.commands" commands.load(commands.defaults) require("lvim.lsp").setup() - -vim.opt.laststatus = 3 diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index acacc1b4..e8135fc4 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -32,35 +32,6 @@ function M.load_defaults() end, }) - vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { - "alpha", - }, - callback = function() - vim.cmd [[ - nnoremap q :qa - nnoremap :qa - set nobuflisted - ]] - end, - }) - - vim.api.nvim_create_autocmd({ "FileType" }, { - pattern = { "lir" }, - callback = function() - vim.opt_local.number = false - vim.opt_local.relativenumber = false - end, - }) - - -- TODO: figure out what keeps overriding laststatus - vim.api.nvim_create_autocmd({ "BufWinEnter" }, { - pattern = { "*" }, - callback = function() - vim.opt.laststatus = 3 - end, - }) - local definitions = { { "TextYankPost", @@ -124,6 +95,42 @@ function M.load_defaults() command = "tabdo wincmd =", }, }, + { + "FileType", + { + group = "_filetype_settings", + pattern = "alpha", + callback = function() + vim.cmd [[ + nnoremap q :qa + nnoremap :qa + set nobuflisted + ]] + end, + }, + }, + { + "FileType", + { + group = "_filetype_settings", + pattern = "lir", + callback = function() + vim.opt_local.number = false + vim.opt_local.relativenumber = false + end, + }, + }, + -- TODO: figure out what keeps overriding laststatus + { + "BufWinEnter", + { + group = "_last_status", + pattern = "*", + callback = function() + vim.opt.laststatus = 3 + end, + }, + }, } M.define_autocmds(definitions) From d565c6b862d92b1e5e46eca7fa010a28270edfec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 28 Sep 2022 13:53:28 -0400 Subject: [PATCH 069/138] chore: bump plugins version (#3094) --- snapshots/default.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/snapshots/default.json b/snapshots/default.json index 0a138caf..7c0c8916 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -1,6 +1,6 @@ { "Comment.nvim": { - "commit": "3e1ec27" + "commit": "0860b5f" }, "FixCursorHold.nvim": { "commit": "70a9516" @@ -42,7 +42,7 @@ "commit": "7d8c6c4" }, "lua-dev.nvim": { - "commit": "e18c4ce" + "commit": "6ff40c0" }, "lualine.nvim": { "commit": "a52f078" @@ -51,10 +51,10 @@ "commit": "0051870" }, "mason.nvim": { - "commit": "7e5aa40" + "commit": "b36bdad" }, "nlsp-settings.nvim": { - "commit": "79d3882" + "commit": "65d6c1d" }, "null-ls.nvim": { "commit": "8af89c5" @@ -75,13 +75,13 @@ "commit": "e0cfb25" }, "nvim-notify": { - "commit": "3a8ec89" + "commit": "142069b" }, "nvim-tree.lua": { "commit": "9914780" }, "nvim-treesitter": { - "commit": "0289160" + "commit": "aa736f5" }, "nvim-ts-context-commentstring": { "commit": "4d3a68c" @@ -96,7 +96,7 @@ "commit": "6afb674" }, "plenary.nvim": { - "commit": "62dc2a7" + "commit": "9e7c628" }, "popup.nvim": { "commit": "b7404d3" @@ -105,7 +105,7 @@ "commit": "628de7e" }, "schemastore.nvim": { - "commit": "687fc5a" + "commit": "b11510e" }, "structlog.nvim": { "commit": "232a8e2" @@ -120,7 +120,7 @@ "commit": "2a787c4" }, "tokyonight.nvim": { - "commit": "81f0db1" + "commit": "c0e7573" }, "vim-illuminate": { "commit": "a2e8476" From f4032cc43e1486a95a7bf727f7236b7602f92ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez=20Rivero?= Date: Wed, 28 Sep 2022 19:54:12 +0200 Subject: [PATCH 070/138] chore(lsp): give null-ls setup default values (#3093) --- lua/lvim/lsp/config.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index d6f970e8..f98a8851 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -133,7 +133,9 @@ return { }, }, null_ls = { - setup = {}, + setup = { + debug = false, + }, config = {}, }, ---@deprecated use lvim.lsp.automatic_configuration.skipped_servers instead From 9930fc3ae45ebd30ea491e615dd4fed3973b38ce Mon Sep 17 00:00:00 2001 From: Daniel Silva Date: Thu, 29 Sep 2022 00:15:36 +0100 Subject: [PATCH 071/138] fix: set `lua-dev.nvim` to a valid commit version (#3096) --- snapshots/default.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapshots/default.json b/snapshots/default.json index 7c0c8916..dabd1183 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -42,7 +42,7 @@ "commit": "7d8c6c4" }, "lua-dev.nvim": { - "commit": "6ff40c0" + "commit": "9da602d" }, "lualine.nvim": { "commit": "a52f078" @@ -128,4 +128,4 @@ "which-key.nvim": { "commit": "6885b66" } -} +} \ No newline at end of file From c38957538ddae0c600224cdf1e8389683a63c6d3 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Fri, 30 Sep 2022 16:21:17 +0000 Subject: [PATCH 072/138] feat(terminal): better mappings (#3104) --- lua/lvim/core/terminal.lua | 33 +++++++++++++++++++++++++++------ lua/lvim/core/which-key.lua | 1 + 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 8b44ec19..57d44c9a 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -7,7 +7,6 @@ M.config = function() -- size can be a number or function which is passed the current terminal size = 20, open_mapping = [[]], - -- open_mapping = [[]], hide_numbers = true, -- hide the number column in toggleterm buffers shade_filetypes = {}, shade_terminals = true, @@ -41,7 +40,9 @@ M.config = function() -- lvim.builtin.terminal.execs[#lvim.builtin.terminal.execs+1] = {"gdb", "tg", "GNU Debugger"} -- TODO: pls add mappings in which key and refactor this execs = { - { "lazygit", "gg", "LazyGit", "float" }, + { vim.o.shell, "", "Horizontal Terminal", "horizontal", 10 }, + { vim.o.shell, "", "Vertical Terminal", "vertical", 60 }, + { vim.o.shell, "", "Float Terminal", "float", nil }, }, } end @@ -58,7 +59,7 @@ M.setup = function() -- NOTE: unable to consistently bind id/count <= 9, see #2146 count = i + 100, direction = exec[4] or lvim.builtin.terminal.direction, - size = lvim.builtin.terminal.size, + size = exec[5] or lvim.builtin.terminal.size, } M.add_exec(opts) @@ -76,15 +77,15 @@ M.add_exec = function(opts) return end - vim.keymap.set({ "n" }, opts.keymap, function() - M._exec_toggle { cmd = opts.cmd, count = opts.count, direction = opts.direction } + vim.keymap.set({ "n", "t" }, opts.keymap, function() + M._exec_toggle { cmd = opts.cmd, count = opts.count, direction = opts.direction, size = opts.size } end, { desc = opts.label, noremap = true, silent = true }) end M._exec_toggle = function(opts) local Terminal = require("toggleterm.terminal").Terminal local term = Terminal:new { cmd = opts.cmd, count = opts.count, direction = opts.direction } - term:toggle(lvim.builtin.terminal.size, opts.direction) + term:toggle(opts.size, opts.direction) end ---Toggles a log viewer according to log.viewer.layout_config @@ -110,4 +111,24 @@ M.toggle_log_view = function(logfile) log_view:toggle() end +M.lazygit_toggle = function() + local Terminal = require("toggleterm.terminal").Terminal + local lazygit = Terminal:new { + cmd = "lazygit", + hidden = true, + direction = "float", + float_opts = { + border = "none", + width = 100000, + height = 100000, + }, + on_open = function(_) + vim.cmd "startinsert!" + end, + on_close = function(_) end, + count = 99, + } + lazygit:toggle() +end + return M diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 8b4f7b8b..588ecce5 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -130,6 +130,7 @@ M.config = function() -- " Debugging g = { name = "Git", + g = { "lua require 'lvim.core.terminal'.lazygit_toggle()", "Lazygit" }, j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, k = { "lua require 'gitsigns'.prev_hunk()", "Prev Hunk" }, l = { "lua require 'gitsigns'.blame_line()", "Blame" }, From 5a5e5cd0d95cc5434cf0283054ac3ba7504bb965 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Sep 2022 22:40:07 +0000 Subject: [PATCH 073/138] chore: bump plugins version (#3100) --- snapshots/default.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/snapshots/default.json b/snapshots/default.json index dabd1183..0045a514 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -1,12 +1,12 @@ { "Comment.nvim": { - "commit": "0860b5f" + "commit": "d9cfae1" }, "FixCursorHold.nvim": { "commit": "70a9516" }, "LuaSnip": { - "commit": "d36c063" + "commit": "8f8d493" }, "alpha-nvim": { "commit": "0bb6fc0" @@ -42,7 +42,7 @@ "commit": "7d8c6c4" }, "lua-dev.nvim": { - "commit": "9da602d" + "commit": "ef1d211" }, "lualine.nvim": { "commit": "a52f078" @@ -51,13 +51,13 @@ "commit": "0051870" }, "mason.nvim": { - "commit": "b36bdad" + "commit": "a3a243c" }, "nlsp-settings.nvim": { - "commit": "65d6c1d" + "commit": "aabd318" }, "null-ls.nvim": { - "commit": "8af89c5" + "commit": "c862432" }, "nvim-autopairs": { "commit": "14cc2a4" @@ -66,10 +66,10 @@ "commit": "2427d06" }, "nvim-dap": { - "commit": "764899d" + "commit": "5d57c40" }, "nvim-lspconfig": { - "commit": "dc4dac8" + "commit": "af43c30" }, "nvim-navic": { "commit": "e0cfb25" @@ -78,16 +78,16 @@ "commit": "142069b" }, "nvim-tree.lua": { - "commit": "9914780" + "commit": "45d386a" }, "nvim-treesitter": { - "commit": "aa736f5" + "commit": "aebc6cf" }, "nvim-ts-context-commentstring": { "commit": "4d3a68c" }, "nvim-web-devicons": { - "commit": "9697285" + "commit": "563f363" }, "onedarker.nvim": { "commit": "b00dd21" @@ -105,7 +105,7 @@ "commit": "628de7e" }, "schemastore.nvim": { - "commit": "b11510e" + "commit": "33873c7" }, "structlog.nvim": { "commit": "232a8e2" @@ -120,7 +120,7 @@ "commit": "2a787c4" }, "tokyonight.nvim": { - "commit": "c0e7573" + "commit": "4092905" }, "vim-illuminate": { "commit": "a2e8476" @@ -128,4 +128,4 @@ "which-key.nvim": { "commit": "6885b66" } -} \ No newline at end of file +} From 699849a731d61fe8996b42f37a4905c984d92686 Mon Sep 17 00:00:00 2001 From: lvimuser <109605931+lvimuser@users.noreply.github.com> Date: Sat, 1 Oct 2022 03:10:47 -0300 Subject: [PATCH 074/138] chore(plugins): remove deprecated FixCursorHold.nvim (#3107) --- lua/lvim/plugins.lua | 1 - snapshots/default.json | 3 --- 2 files changed, 4 deletions(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index fbafb17a..13568770 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -6,7 +6,6 @@ local core_plugins = { { "jose-elias-alvarez/null-ls.nvim", }, - { "antoinemadec/FixCursorHold.nvim" }, -- Needed while issue https://github.com/neovim/neovim/issues/12587 is still open { "williamboman/mason-lspconfig.nvim" }, { "williamboman/mason.nvim", diff --git a/snapshots/default.json b/snapshots/default.json index 0045a514..dffe47f1 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -2,9 +2,6 @@ "Comment.nvim": { "commit": "d9cfae1" }, - "FixCursorHold.nvim": { - "commit": "70a9516" - }, "LuaSnip": { "commit": "8f8d493" }, From a77fcf6e90a20f285e222c3631ace67548aca4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez=20Rivero?= Date: Sat, 1 Oct 2022 08:11:18 +0200 Subject: [PATCH 075/138] refactor: smaller timeout for packer (#2910) --- lua/lvim/plugin-loader.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 5c4e6cb2..d09c722b 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -23,7 +23,7 @@ function plugin_loader.init(opts) max_jobs = 100, log = { level = "warn" }, git = { - clone_timeout = 300, + clone_timeout = 120, }, display = { open_fn = function() From 488d95b3b84879a178692557cb7a9c683bc8c36b Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sun, 2 Oct 2022 20:22:59 -0400 Subject: [PATCH 076/138] fix: add lunarvim/lvim/after to rtp --- lua/lvim/bootstrap.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index f637c144..113c3f71 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -90,6 +90,7 @@ function M:init(base_dir) vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site")) vim.opt.rtp:remove(join_paths(vim.call("stdpath", "data"), "site", "after")) vim.opt.rtp:prepend(join_paths(self.runtime_dir, "site")) + vim.opt.rtp:append(join_paths(self.runtime_dir, "lvim", "after")) vim.opt.rtp:append(join_paths(self.runtime_dir, "site", "after")) vim.opt.rtp:remove(vim.call("stdpath", "config")) From 1c03ac80529d90c7a824a581172b6e41e6ae237b Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 3 Oct 2022 00:56:23 +0000 Subject: [PATCH 077/138] feat: reload and lir color update (#3123) --- .luacheckrc | 1 + init.lua | 17 +++--- lua/lvim/core/builtins/init.lua | 3 +- lua/lvim/core/indentlines.lua | 2 +- lua/lvim/core/lir.lua | 41 ++++++++----- lua/lvim/core/nvimtree.lua | 2 +- lua/lvim/lsp/providers/sumneko_lua.lua | 8 ++- lua/lvim/plugins.lua | 55 +++++++++--------- lua/lvim/utils/reload.lua | 80 ++++++++++++++++++++++++++ 9 files changed, 157 insertions(+), 52 deletions(-) create mode 100644 lua/lvim/utils/reload.lua diff --git a/.luacheckrc b/.luacheckrc index 136e2326..7c592693 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -3,6 +3,7 @@ stds.nvim = { globals = { "lvim", + "reload", vim = { fields = { "g" } }, "TERMINAL", "USER", diff --git a/init.lua b/init.lua index cd7c6598..6f78b021 100644 --- a/init.lua +++ b/init.lua @@ -5,17 +5,20 @@ if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then vim.opt.rtp:append(base_dir) end -require("lvim.bootstrap"):init(base_dir) +reload = require("lvim.utils.reload").reload -require("lvim.config"):load() +reload("lvim.bootstrap"):init(base_dir) -local plugins = require "lvim.plugins" -require("lvim.plugin-loader").load { plugins, lvim.plugins } +reload("lvim.config"):load() -local Log = require "lvim.core.log" +local plugins = reload "lvim.plugins" + +reload("lvim.plugin-loader").load { plugins, lvim.plugins } + +local Log = reload "lvim.core.log" Log:debug "Starting LunarVim" -local commands = require "lvim.core.commands" +local commands = reload "lvim.core.commands" commands.load(commands.defaults) -require("lvim.lsp").setup() +reload("lvim.lsp").setup() diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 1dd2494a..84e37655 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -26,7 +26,8 @@ local builtins = { function M.config(config) for _, builtin_path in ipairs(builtins) do - local builtin = require(builtin_path) + local builtin = require("lvim.utils.reload").reload(builtin_path) + builtin.config(config) end end diff --git a/lua/lvim/core/indentlines.lua b/lua/lvim/core/indentlines.lua index 3485f348..ab316a9b 100644 --- a/lua/lvim/core/indentlines.lua +++ b/lua/lvim/core/indentlines.lua @@ -27,7 +27,7 @@ M.config = function() end M.setup = function() - local status_ok, indent_blankline = pcall(require, "indent_blankline") + local status_ok, indent_blankline = pcall(reload, "indent_blankline") if not status_ok then return end diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index e65d45dd..a47c40b6 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -1,21 +1,20 @@ local M = {} --- local Log = require "lvim.core.log" - M.config = function() lvim.builtin.lir = { active = true, on_config_done = nil, + icon = "", } - local status_ok, lir = pcall(require, "lir") + local status_ok, lir = pcall(reload, "lir") if not status_ok then return end - local actions = require "lir.actions" - local mark_actions = require "lir.mark.actions" - local clipboard_actions = require "lir.clipboard.actions" + local actions = reload "lir.actions" + local mark_actions = reload "lir.mark.actions" + local clipboard_actions = reload "lir.clipboard.actions" lir.setup { show_hidden_files = false, @@ -84,31 +83,45 @@ M.config = function() } -- custom folder icon - require("nvim-web-devicons").set_icon { + reload("nvim-web-devicons").set_icon { lir_folder_icon = { icon = "", - -- color = "#7ebae4", - -- color = "#569CD6", color = "#42A5F5", name = "LirFolderNode", }, } end +function M.icon_setup() + local function get_hl_by_name(name) + local ret = vim.api.nvim_get_hl_by_name(name.group, true) + return string.format("#%06x", ret[name.property]) + end + + local found, icon_hl = pcall(get_hl_by_name, { group = "NvimTreeFolderIcon", property = "foreground" }) + if not found then + icon_hl = "#42A5F5" + end + + reload("nvim-web-devicons").set_icon { + lir_folder_icon = { + icon = lvim.builtin.lir.icon, + color = icon_hl, + name = "LirFolderNode", + }, + } +end + function M.setup() if lvim.builtin.nvimtree.active then - -- Log:warn "Unable to configure lir while nvimtree is active! Please set 'lvim.builtin.nvimtree.active=false'" return end - local status_ok, lir = pcall(require, "lir") + local status_ok, lir = pcall(reload, "lir") if not status_ok then return end - lir.setup(lvim.builtin.lir.setup) - require("nvim-web-devicons").set_icon(lvim.builtin.lir.icons) - if lvim.builtin.lir.on_config_done then lvim.builtin.lir.on_config_done(lir) end diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index b861cb59..2d186829 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -11,7 +11,7 @@ function M.config() "dashboard", "alpha", }, - auto_reload_on_write = true, + auto_reload_on_write = false, hijack_directories = { enable = false, }, diff --git a/lua/lvim/lsp/providers/sumneko_lua.lua b/lua/lvim/lsp/providers/sumneko_lua.lua index ef159e1c..948f1fd9 100644 --- a/lua/lvim/lsp/providers/sumneko_lua.lua +++ b/lua/lvim/lsp/providers/sumneko_lua.lua @@ -44,8 +44,14 @@ local opts = { settings = { Lua = { telemetry = { enable = false }, + runtime = { + version = "LuaJIT", + special = { + reload = "require", + }, + }, diagnostics = { - globals = { "vim", "lvim", "packer_plugins" }, + globals = { "vim", "lvim", "packer_plugins", "reload" }, }, workspace = default_workspace, }, diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 13568770..2a9f402e 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -1,3 +1,4 @@ +local reload = require("lvim.utils.reload").reload local core_plugins = { -- Packer can manage itself as an optional plugin { "wbthomason/packer.nvim" }, @@ -10,20 +11,20 @@ local core_plugins = { { "williamboman/mason.nvim", config = function() - require("lvim.core.mason").setup() + reload("lvim.core.mason").setup() end, }, { "folke/tokyonight.nvim", config = function() - require("lvim.core.theme").setup() + reload("lvim.core.theme").setup() end, -- disable = not vim.startswith(lvim.colorscheme, "tokyonight"), }, { "rcarriga/nvim-notify", config = function() - require("lvim.core.notify").setup() + reload("lvim.core.notify").setup() end, requires = { "nvim-telescope/telescope.nvim" }, disable = not lvim.builtin.notify.active or not lvim.builtin.telescope.active, @@ -37,7 +38,7 @@ local core_plugins = { "nvim-telescope/telescope.nvim", branch = "0.1.x", config = function() - require("lvim.core.telescope").setup() + reload("lvim.core.telescope").setup() end, disable = not lvim.builtin.telescope.active, }, @@ -52,7 +53,7 @@ local core_plugins = { "hrsh7th/nvim-cmp", config = function() if lvim.builtin.cmp then - require("lvim.core.cmp").setup() + reload("lvim.core.cmp").setup() end end, requires = { @@ -66,7 +67,7 @@ local core_plugins = { { "L3MON4D3/LuaSnip", config = function() - local utils = require "lvim.utils" + local utils = reload "lvim.utils" local paths = {} if lvim.builtin.luasnip.sources.friendly_snippets then paths[#paths + 1] = utils.join_paths(get_runtime_dir(), "site", "pack", "packer", "start", "friendly-snippets") @@ -75,11 +76,11 @@ local core_plugins = { if utils.is_directory(user_snippets) then paths[#paths + 1] = user_snippets end - require("luasnip.loaders.from_lua").lazy_load() - require("luasnip.loaders.from_vscode").lazy_load { + reload("luasnip.loaders.from_lua").lazy_load() + reload("luasnip.loaders.from_vscode").lazy_load { paths = paths, } - require("luasnip.loaders.from_snipmate").lazy_load() + reload("luasnip.loaders.from_snipmate").lazy_load() end, }, { @@ -104,7 +105,7 @@ local core_plugins = { "windwp/nvim-autopairs", -- event = "InsertEnter", config = function() - require("lvim.core.autopairs").setup() + reload("lvim.core.autopairs").setup() end, disable = not lvim.builtin.autopairs.active, }, @@ -114,7 +115,7 @@ local core_plugins = { "nvim-treesitter/nvim-treesitter", -- run = ":TSUpdate", config = function() - require("lvim.core.treesitter").setup() + reload("lvim.core.treesitter").setup() end, }, { @@ -128,7 +129,7 @@ local core_plugins = { -- event = "BufWinOpen", -- cmd = "NvimTreeToggle", config = function() - require("lvim.core.nvimtree").setup() + reload("lvim.core.nvimtree").setup() end, disable = not lvim.builtin.nvimtree.active, }, @@ -136,7 +137,7 @@ local core_plugins = { { "christianchiarulli/lir.nvim", config = function() - require("lvim.core.lir").setup() + reload("lvim.core.lir").setup() end, disable = not lvim.builtin.lir.active, }, @@ -144,7 +145,7 @@ local core_plugins = { "lewis6991/gitsigns.nvim", config = function() - require("lvim.core.gitsigns").setup() + reload("lvim.core.gitsigns").setup() end, event = "BufRead", disable = not lvim.builtin.gitsigns.active, @@ -154,7 +155,7 @@ local core_plugins = { { "folke/which-key.nvim", config = function() - require("lvim.core.which-key").setup() + reload("lvim.core.which-key").setup() end, event = "BufWinEnter", disable = not lvim.builtin.which_key.active, @@ -165,7 +166,7 @@ local core_plugins = { "numToStr/Comment.nvim", event = "BufRead", config = function() - require("lvim.core.comment").setup() + reload("lvim.core.comment").setup() end, disable = not lvim.builtin.comment.active, }, @@ -174,7 +175,7 @@ local core_plugins = { { "ahmedkhalf/project.nvim", config = function() - require("lvim.core.project").setup() + reload("lvim.core.project").setup() end, disable = not lvim.builtin.project.active, }, @@ -191,7 +192,7 @@ local core_plugins = { "nvim-lualine/lualine.nvim", -- "Lunarvim/lualine.nvim", config = function() - require("lvim.core.lualine").setup() + reload("lvim.core.lualine").setup() end, disable = not lvim.builtin.lualine.active, }, @@ -200,7 +201,7 @@ local core_plugins = { { "SmiteshP/nvim-navic", config = function() - require("lvim.core.breadcrumbs").setup() + reload("lvim.core.breadcrumbs").setup() end, disable = not lvim.builtin.breadcrumbs.active, }, @@ -208,7 +209,7 @@ local core_plugins = { { "akinsho/bufferline.nvim", config = function() - require("lvim.core.bufferline").setup() + reload("lvim.core.bufferline").setup() end, branch = "main", event = "BufWinEnter", @@ -220,7 +221,7 @@ local core_plugins = { "mfussenegger/nvim-dap", -- event = "BufWinEnter", config = function() - require("lvim.core.dap").setup() + reload("lvim.core.dap").setup() end, disable = not lvim.builtin.dap.active, }, @@ -238,7 +239,7 @@ local core_plugins = { { "goolord/alpha-nvim", config = function() - require("lvim.core.alpha").setup() + reload("lvim.core.alpha").setup() end, disable = not lvim.builtin.alpha.active, }, @@ -249,7 +250,7 @@ local core_plugins = { event = "BufWinEnter", branch = "main", config = function() - require("lvim.core.terminal").setup() + reload("lvim.core.terminal").setup() end, disable = not lvim.builtin.terminal.active, }, @@ -262,7 +263,7 @@ local core_plugins = { { "RRethy/vim-illuminate", config = function() - require("lvim.core.illuminate").setup() + reload("lvim.core.illuminate").setup() end, disable = not lvim.builtin.illuminate.active, }, @@ -270,7 +271,7 @@ local core_plugins = { { "lukas-reineke/indent-blankline.nvim", config = function() - require("lvim.core.indentlines").setup() + reload("lvim.core.indentlines").setup() end, disable = not lvim.builtin.indentlines.active, }, @@ -281,7 +282,7 @@ local core_plugins = { config = function() pcall(function() if lvim and lvim.colorscheme == "onedarker" then - require("onedarker").setup() + reload("onedarker").setup() lvim.builtin.lualine.options.theme = "onedarker" end end) @@ -295,7 +296,7 @@ local content = vim.fn.readfile(default_snapshot_path) local default_sha1 = vim.fn.json_decode(content) local get_default_sha1 = function(spec) - local short_name, _ = require("packer.util").get_plugin_short_name(spec) + local short_name, _ = reload("packer.util").get_plugin_short_name(spec) return default_sha1[short_name] and default_sha1[short_name].commit end diff --git a/lua/lvim/utils/reload.lua b/lua/lvim/utils/reload.lua new file mode 100644 index 00000000..46392349 --- /dev/null +++ b/lua/lvim/utils/reload.lua @@ -0,0 +1,80 @@ +local M = {} + +-- revisit this +-- function prequire(package) +-- local status, lib = pcall(require, package) +-- if status then +-- return lib +-- else +-- vim.notify("Failed to require '" .. package .. "' from " .. debug.getinfo(2).source) +-- return nil +-- end +-- end + +local function _assign(old, new, k) + local otype = type(old[k]) + local ntype = type(new[k]) + -- print("hi") + if (otype == "thread" or otype == "userdata") or (ntype == "thread" or ntype == "userdata") then + vim.notify(string.format("warning: old or new attr %s type be thread or userdata", k)) + end + old[k] = new[k] +end + +local function _replace(old, new, repeat_tbl) + if repeat_tbl[old] then + return + end + repeat_tbl[old] = true + + local dellist = {} + for k, _ in pairs(old) do + if not new[k] then + table.insert(dellist, k) + end + end + for _, v in ipairs(dellist) do + old[v] = nil + end + + for k, _ in pairs(new) do + if not old[k] then + old[k] = new[k] + else + if type(old[k]) ~= type(new[k]) then + vim.notify(string.format("warning: attr %s old type no equal new type!!!", k)) + _assign(old, new, k) + else + if type(old[k]) == "table" then + _replace(old[k], new[k], repeat_tbl) + else + _assign(old, new, k) + end + end + end + end +end + +M.reload = function(mod) + if not package.loaded[mod] then + local m = require(mod) + return m + end + -- vim.notify "begin reload!!!" + + local old = package.loaded[mod] + package.loaded[mod] = nil + local new = require(mod) + + if type(old) == "table" and type(new) == "table" then + -- vim.notify "pick object in new module to old module!!!" + local repeat_tbl = {} + _replace(old, new, repeat_tbl) + end + + package.loaded[mod] = old + -- vim.notify "finish reload!!!" + return old +end + +return M From 3008c752982553a25f9bc9967f5757af66c7df7e Mon Sep 17 00:00:00 2001 From: "Hashem A. Damrah" Date: Sun, 2 Oct 2022 17:56:37 -0700 Subject: [PATCH 078/138] feat: now, when you're hovering over a require('a.b.c'), you can type gf, and go to the 'c.lua' file (#3122) --- ftplugin/lua.lua | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 ftplugin/lua.lua diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua new file mode 100644 index 00000000..d6b9ced7 --- /dev/null +++ b/ftplugin/lua.lua @@ -0,0 +1,86 @@ +local fmt = string.format + +-- Iterator that splits a string o a given delimiter +local function split(str, delim) + delim = delim or "%s" + return string.gmatch(str, fmt("[^%s]+", delim)) +end + +-- Find the proper directory separator depending +-- on lua installation or OS. +local function dir_separator() + -- Look at package.config for directory separator string (it's the first line) + if package.config then + return string.match(package.config, "^[^\n]") + elseif vim.fn.has "win32" == 1 then + return "\\" + else + return "/" + end +end + +-- Search for lua traditional include paths. +-- This mimics how require internally works. +local function include_paths(fname, ext) + ext = ext or "lua" + local sep = dir_separator() + local paths = string.gsub(package.path, "%?", fname) + for path in split(paths, "%;") do + if vim.fn.filereadable(path) == 1 then + return path + end + end +end + +-- Search for nvim lua include paths +local function include_rtpaths(fname, ext) + ext = ext or "lua" + local sep = dir_separator() + local rtpaths = vim.api.nvim_list_runtime_paths() + local modfile, initfile = fmt("%s.%s", fname, ext), fmt("init.%s", ext) + for _, path in ipairs(rtpaths) do + -- Look on runtime path for 'lua/*.lua' files + local path1 = table.concat({ path, ext, modfile }, sep) + if vim.fn.filereadable(path1) == 1 then + return path1 + end + -- Look on runtime path for 'lua/*/init.lua' files + local path2 = table.concat({ path, ext, fname, initfile }, sep) + if vim.fn.filereadable(path2) == 1 then + return path2 + end + end +end + +-- Global function that searches the path for the required file +function find_required_path(module) + -- Look at package.config for directory separator string (it's the first line) + local sep = string.match(package.config, "^[^\n]") + -- Properly change '.' to separator (probably '/' on *nix and '\' on Windows) + local fname = vim.fn.substitute(module, "\\.", sep, "g") + local f + ---- First search for lua modules + f = include_paths(fname, "lua") + if f then + return f + end + -- This part is just for nvim modules + f = include_rtpaths(fname, "lua") + if f then + return f + end + ---- Now search for Fennel modules + f = include_paths(fname, "fnl") + if f then + return f + end + -- This part is just for nvim modules + f = include_rtpaths(fname, "fnl") + if f then + return f + end +end + +-- Set options to open require with gf +vim.opt_local.include = [=[\v<((do|load)file|require)\s*\(?['"]\zs[^'"]+\ze['"]]=] +vim.opt_local.includeexpr = "v:lua.find_required_path(v:fname)" From 6a72ad281e598e445d37aaa87a9ef293d974bc40 Mon Sep 17 00:00:00 2001 From: chaesngmin Date: Mon, 3 Oct 2022 10:19:59 +0900 Subject: [PATCH 079/138] Fix: correct typos (#3117) --- lua/lvim/bootstrap.lua | 2 +- lua/lvim/core/illuminate.lua | 6 +++--- lua/lvim/core/notify.lua | 2 +- lua/lvim/lsp/utils.lua | 6 +++--- lua/lvim/utils/hooks.lua | 2 +- tests/specs/plugins_load_spec.lua | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index 113c3f71..e0b781d7 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -70,7 +70,7 @@ function M:init(base_dir) self.packer_install_dir = join_paths(self.runtime_dir, "site", "pack", "packer", "start", "packer.nvim") self.packer_cache_path = join_paths(self.config_dir, "plugin", "packer_compiled.lua") - ---@meta overridden to use LUNARVIM_CACHE_DIR instead, since a lot of plugins call this function interally + ---@meta overridden to use LUNARVIM_CACHE_DIR instead, since a lot of plugins call this function internally ---NOTE: changes to "data" are currently unstable, see #2507 vim.fn.stdpath = function(what) if what == "cache" then diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index e0c8c775..b2e2880b 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -29,17 +29,17 @@ M.config = function() "DressingSelect", "TelescopePrompt", }, - -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist + -- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist filetypes_allowlist = {}, -- modes_denylist: modes to not illuminate, this overrides modes_allowlist modes_denylist = {}, - -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist + -- modes_allowlist: modes to illuminate, this is overridden by modes_denylist modes_allowlist = {}, -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist -- Only applies to the 'regex' provider -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') providers_regex_syntax_denylist = {}, - -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist + -- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist -- Only applies to the 'regex' provider -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') providers_regex_syntax_allowlist = {}, diff --git a/lua/lvim/core/notify.lua b/lua/lvim/core/notify.lua index 2db4c4d5..72133c27 100644 --- a/lua/lvim/core/notify.lua +++ b/lua/lvim/core/notify.lua @@ -43,7 +43,7 @@ function M.config() defaults.opts.icons = { ERROR = "[ERROR]", WARN = "[WARNING]", - INFO = "[INFo]", + INFO = "[INFO]", DEBUG = "[DEBUG]", TRACE = "[TRACE]", } diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index c2ffe3fa..53571f20 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -120,7 +120,7 @@ function M.setup_document_highlight(client, bufnr) end function M.setup_document_symbols(client, bufnr) - vim.g.navic_silence = false -- can be set to true to supress error + vim.g.navic_silence = false -- can be set to true to suppress error local symbols_supported = client.supports_method "textDocument/documentSymbol" if not symbols_supported then Log:debug("skipping setup for document_symbols, method not supported by " .. client.name) @@ -167,9 +167,9 @@ function M.format_filter(client) local n = require "null-ls" local s = require "null-ls.sources" local method = n.methods.FORMATTING - local avalable_formatters = s.get_available(filetype, method) + local available_formatters = s.get_available(filetype, method) - if #avalable_formatters > 0 then + if #available_formatters > 0 then return client.name == "null-ls" elseif client.supports_method "textDocument/formatting" then return true diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index 00b07afb..fd78ef19 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -63,7 +63,7 @@ function M.run_post_update() end) local ret = require_clean("lvim.utils.git").switch_lvim_branch(compat_tag) if ret then - vim.notify("Reverted to the last known compatibile version: " .. compat_tag, vim.log.levels.WARN) + vim.notify("Reverted to the last known compatible version: " .. compat_tag, vim.log.levels.WARN) end return end diff --git a/tests/specs/plugins_load_spec.lua b/tests/specs/plugins_load_spec.lua index 283d5547..5cf1c2f5 100644 --- a/tests/specs/plugins_load_spec.lua +++ b/tests/specs/plugins_load_spec.lua @@ -59,7 +59,7 @@ a.describe("plugin-loader", function() _G.completed = false _G.verify_sha = function() if _G.locked_sha ~= get_current_sha(plugin.path) then - error "unmached results!" + error "unmatched results!" else _G.completed = true end From 228658b02e083d0294b737b39275f3b62c007b94 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sun, 2 Oct 2022 22:30:38 -0400 Subject: [PATCH 080/138] fix: idk why it has an issue here but we can't use reload in the plugins file for now --- lua/lvim/plugins.lua | 56 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 2a9f402e..387bcee3 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -1,4 +1,4 @@ -local reload = require("lvim.utils.reload").reload +-- local require = require("lvim.utils.require").require local core_plugins = { -- Packer can manage itself as an optional plugin { "wbthomason/packer.nvim" }, @@ -11,20 +11,20 @@ local core_plugins = { { "williamboman/mason.nvim", config = function() - reload("lvim.core.mason").setup() + require("lvim.core.mason").setup() end, }, { "folke/tokyonight.nvim", config = function() - reload("lvim.core.theme").setup() + require("lvim.core.theme").setup() end, -- disable = not vim.startswith(lvim.colorscheme, "tokyonight"), }, { "rcarriga/nvim-notify", config = function() - reload("lvim.core.notify").setup() + require("lvim.core.notify").setup() end, requires = { "nvim-telescope/telescope.nvim" }, disable = not lvim.builtin.notify.active or not lvim.builtin.telescope.active, @@ -38,7 +38,7 @@ local core_plugins = { "nvim-telescope/telescope.nvim", branch = "0.1.x", config = function() - reload("lvim.core.telescope").setup() + require("lvim.core.telescope").setup() end, disable = not lvim.builtin.telescope.active, }, @@ -53,7 +53,7 @@ local core_plugins = { "hrsh7th/nvim-cmp", config = function() if lvim.builtin.cmp then - reload("lvim.core.cmp").setup() + require("lvim.core.cmp").setup() end end, requires = { @@ -67,7 +67,7 @@ local core_plugins = { { "L3MON4D3/LuaSnip", config = function() - local utils = reload "lvim.utils" + local utils = require "lvim.utils" local paths = {} if lvim.builtin.luasnip.sources.friendly_snippets then paths[#paths + 1] = utils.join_paths(get_runtime_dir(), "site", "pack", "packer", "start", "friendly-snippets") @@ -76,11 +76,11 @@ local core_plugins = { if utils.is_directory(user_snippets) then paths[#paths + 1] = user_snippets end - reload("luasnip.loaders.from_lua").lazy_load() - reload("luasnip.loaders.from_vscode").lazy_load { + require("luasnip.loaders.from_lua").lazy_load() + require("luasnip.loaders.from_vscode").lazy_load { paths = paths, } - reload("luasnip.loaders.from_snipmate").lazy_load() + require("luasnip.loaders.from_snipmate").lazy_load() end, }, { @@ -105,7 +105,7 @@ local core_plugins = { "windwp/nvim-autopairs", -- event = "InsertEnter", config = function() - reload("lvim.core.autopairs").setup() + require("lvim.core.autopairs").setup() end, disable = not lvim.builtin.autopairs.active, }, @@ -115,7 +115,7 @@ local core_plugins = { "nvim-treesitter/nvim-treesitter", -- run = ":TSUpdate", config = function() - reload("lvim.core.treesitter").setup() + require("lvim.core.treesitter").setup() end, }, { @@ -129,7 +129,7 @@ local core_plugins = { -- event = "BufWinOpen", -- cmd = "NvimTreeToggle", config = function() - reload("lvim.core.nvimtree").setup() + require("lvim.core.nvimtree").setup() end, disable = not lvim.builtin.nvimtree.active, }, @@ -137,7 +137,7 @@ local core_plugins = { { "christianchiarulli/lir.nvim", config = function() - reload("lvim.core.lir").setup() + require("lvim.core.lir").setup() end, disable = not lvim.builtin.lir.active, }, @@ -145,7 +145,7 @@ local core_plugins = { "lewis6991/gitsigns.nvim", config = function() - reload("lvim.core.gitsigns").setup() + require("lvim.core.gitsigns").setup() end, event = "BufRead", disable = not lvim.builtin.gitsigns.active, @@ -155,7 +155,7 @@ local core_plugins = { { "folke/which-key.nvim", config = function() - reload("lvim.core.which-key").setup() + require("lvim.core.which-key").setup() end, event = "BufWinEnter", disable = not lvim.builtin.which_key.active, @@ -166,7 +166,7 @@ local core_plugins = { "numToStr/Comment.nvim", event = "BufRead", config = function() - reload("lvim.core.comment").setup() + require("lvim.core.comment").setup() end, disable = not lvim.builtin.comment.active, }, @@ -175,7 +175,7 @@ local core_plugins = { { "ahmedkhalf/project.nvim", config = function() - reload("lvim.core.project").setup() + require("lvim.core.project").setup() end, disable = not lvim.builtin.project.active, }, @@ -192,7 +192,7 @@ local core_plugins = { "nvim-lualine/lualine.nvim", -- "Lunarvim/lualine.nvim", config = function() - reload("lvim.core.lualine").setup() + require("lvim.core.lualine").setup() end, disable = not lvim.builtin.lualine.active, }, @@ -201,7 +201,7 @@ local core_plugins = { { "SmiteshP/nvim-navic", config = function() - reload("lvim.core.breadcrumbs").setup() + require("lvim.core.breadcrumbs").setup() end, disable = not lvim.builtin.breadcrumbs.active, }, @@ -209,7 +209,7 @@ local core_plugins = { { "akinsho/bufferline.nvim", config = function() - reload("lvim.core.bufferline").setup() + require("lvim.core.bufferline").setup() end, branch = "main", event = "BufWinEnter", @@ -221,7 +221,7 @@ local core_plugins = { "mfussenegger/nvim-dap", -- event = "BufWinEnter", config = function() - reload("lvim.core.dap").setup() + require("lvim.core.dap").setup() end, disable = not lvim.builtin.dap.active, }, @@ -239,7 +239,7 @@ local core_plugins = { { "goolord/alpha-nvim", config = function() - reload("lvim.core.alpha").setup() + require("lvim.core.alpha").setup() end, disable = not lvim.builtin.alpha.active, }, @@ -250,7 +250,7 @@ local core_plugins = { event = "BufWinEnter", branch = "main", config = function() - reload("lvim.core.terminal").setup() + require("lvim.core.terminal").setup() end, disable = not lvim.builtin.terminal.active, }, @@ -263,7 +263,7 @@ local core_plugins = { { "RRethy/vim-illuminate", config = function() - reload("lvim.core.illuminate").setup() + require("lvim.core.illuminate").setup() end, disable = not lvim.builtin.illuminate.active, }, @@ -271,7 +271,7 @@ local core_plugins = { { "lukas-reineke/indent-blankline.nvim", config = function() - reload("lvim.core.indentlines").setup() + require("lvim.core.indentlines").setup() end, disable = not lvim.builtin.indentlines.active, }, @@ -282,7 +282,7 @@ local core_plugins = { config = function() pcall(function() if lvim and lvim.colorscheme == "onedarker" then - reload("onedarker").setup() + require("onedarker").setup() lvim.builtin.lualine.options.theme = "onedarker" end end) @@ -296,7 +296,7 @@ local content = vim.fn.readfile(default_snapshot_path) local default_sha1 = vim.fn.json_decode(content) local get_default_sha1 = function(spec) - local short_name, _ = reload("packer.util").get_plugin_short_name(spec) + local short_name, _ = require("packer.util").get_plugin_short_name(spec) return default_sha1[short_name] and default_sha1[short_name].commit end From 8767a17b5e6087153494a5cd30e5ae0c5165c9af Mon Sep 17 00:00:00 2001 From: Philippe Richard Date: Sun, 2 Oct 2022 23:48:23 -0400 Subject: [PATCH 081/138] feat: move icons to a single icons file (#3115) --- lua/lvim/config/defaults.lua | 1 + lua/lvim/core/alpha/dashboard.lua | 16 +-- lua/lvim/core/alpha/startify.lua | 2 +- lua/lvim/core/breadcrumbs.lua | 41 +------- lua/lvim/core/bufferline.lua | 18 ++-- lua/lvim/core/cmp.lua | 30 +----- lua/lvim/core/dap.lua | 6 +- lua/lvim/core/gitsigns.lua | 10 +- lua/lvim/core/indentlines.lua | 2 +- lua/lvim/core/info.lua | 14 +-- lua/lvim/core/lir.lua | 2 +- lua/lvim/core/lualine/components.lua | 31 ++++-- lua/lvim/core/lualine/styles.lua | 10 +- lua/lvim/core/notify.lua | 10 +- lua/lvim/core/nvimtree.lua | 36 +++---- lua/lvim/core/telescope.lua | 4 +- lua/lvim/core/which-key.lua | 6 +- lua/lvim/icons.lua | 141 +++++++++++++++++++++++++++ lua/lvim/lsp/config.lua | 8 +- 19 files changed, 247 insertions(+), 141 deletions(-) create mode 100644 lua/lvim/icons.lua diff --git a/lua/lvim/config/defaults.lua b/lua/lvim/config/defaults.lua index 91bc1130..7e111429 100644 --- a/lua/lvim/config/defaults.lua +++ b/lua/lvim/config/defaults.lua @@ -13,6 +13,7 @@ return { keys = {}, use_icons = true, + icons = require "lvim.icons", builtin = {}, diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua index debf88a7..5e73206f 100644 --- a/lua/lvim/core/alpha/dashboard.lua +++ b/lua/lvim/core/alpha/dashboard.lua @@ -113,12 +113,16 @@ function M.get_sections() end buttons = { val = { - button("f", " Find File", "Telescope find_files"), - button("n", " New File", "ene!"), - button("p", " Projects ", "Telescope projects"), - button("r", " Recent files", ":Telescope oldfiles "), - button("t", " Find Text", "Telescope live_grep"), - button("c", " Configuration", "edit " .. require("lvim.config"):get_user_config_path() .. " "), + button("f", lvim.icons.ui.FindFile .. " Find File", "Telescope find_files"), + button("n", lvim.icons.ui.NewFile .. " New File", "ene!"), + button("p", lvim.icons.ui.Project .. " Projects ", "Telescope projects"), + button("r", lvim.icons.ui.History .. " Recent files", ":Telescope oldfiles "), + button("t", lvim.icons.ui.FindText .. " Find Text", "Telescope live_grep"), + button( + "c", + lvim.icons.ui.Gear .. " Configuration", + "edit " .. require("lvim.config"):get_user_config_path() .. " " + ), }, } end diff --git a/lua/lvim/core/alpha/startify.lua b/lua/lvim/core/alpha/startify.lua index 2ea541f5..b1e83d1d 100644 --- a/lua/lvim/core/alpha/startify.lua +++ b/lua/lvim/core/alpha/startify.lua @@ -19,7 +19,7 @@ function M.get_sections() local top_buttons = { entries = { - { "e", " New File", "ene!" }, + { "e", lvim.icons.ui.NewFile .. " New File", "ene!" }, }, val = {}, } diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 23b516db..dd7f5163 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -7,42 +7,7 @@ M.config = function() active = false, on_config_done = nil, options = { - icons = { - Text = " ", - Method = " ", - Function = " ", - Constructor = " ", - Field = " ", - Variable = " ", - Class = " ", - Interface = " ", - Module = " ", - Property = " ", - Unit = " ", - Value = " ", - Enum = " ", - Keyword = " ", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - Array = " ", - Number = " ", - String = " ", - Boolean = "蘒", - Object = " ", - Package = " ", - Namespace = "", - Key = "", - Null = "ﳠ", - }, + icons = lvim.icons.kind, highlight = true, separator = " " .. ">" .. " ", depth_limit = 0, @@ -107,7 +72,7 @@ M.get_filename = function() vim.api.nvim_set_hl(0, hl_group, { fg = file_icon_color }) if f.isempty(file_icon) then - file_icon = "" + file_icon = lvim.icons.kind.File end local navic_text = vim.api.nvim_get_hl_by_name("Normal", true) @@ -165,7 +130,7 @@ M.get_winbar = function() if not f.isempty(value) and f.get_buf_option "mod" then -- TODO: replace with circle - local mod = "%#LspCodeLens#" .. "" .. "%*" + local mod = "%#LspCodeLens#" .. lvim.icons.ui.Circle .. "%*" if gps_added then value = value .. " " .. mod else diff --git a/lua/lvim/core/bufferline.lua b/lua/lvim/core/bufferline.lua index 6ae0d6c6..b8143813 100644 --- a/lua/lvim/core/bufferline.lua +++ b/lua/lvim/core/bufferline.lua @@ -6,7 +6,11 @@ end local function diagnostics_indicator(num, _, diagnostics, _) local result = {} - local symbols = { error = "", warning = "", info = "" } + local symbols = { + error = lvim.icons.diagnostics.Error, + warning = lvim.icons.diagnostics.Warning, + info = lvim.icons.diagnostics.Information, + } if not lvim.use_icons then return "(" .. num .. ")" end @@ -59,14 +63,14 @@ M.config = function() left_mouse_command = "buffer %d", -- can be a string | function, see "Mouse actions" middle_mouse_command = nil, -- can be a string | function, see "Mouse actions" indicator = { - icon = "▎", -- this should be omitted if indicator style is not 'icon' + icon = lvim.icons.ui.BoldLineLeft, -- this should be omitted if indicator style is not 'icon' style = "icon", -- can also be 'underline'|'none', }, - buffer_close_icon = "", - modified_icon = "●", - close_icon = "", - left_trunc_marker = "", - right_trunc_marker = "", + buffer_close_icon = lvim.icons.ui.Close, + modified_icon = lvim.icons.ui.Circle, + close_icon = lvim.icons.ui.BoldClose, + left_trunc_marker = lvim.icons.ui.ArrowCircleLeft, + right_trunc_marker = lvim.icons.ui.ArrowCircleRight, --- name_formatter can be used to change the buffer's label in the bufferline. --- Please note some names can/will break the --- bufferline so use this at your discretion knowing that it has diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index a6362aa7..319bdc64 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -141,33 +141,7 @@ M.config = function() formatting = { fields = { "kind", "abbr", "menu" }, max_width = 0, - kind_icons = { - Class = " ", - Color = " ", - Constant = "ﲀ ", - Constructor = " ", - Enum = "練", - EnumMember = " ", - Event = " ", - Field = " ", - File = "", - Folder = " ", - Function = " ", - Interface = "ﰮ ", - Keyword = " ", - Method = " ", - Module = " ", - Operator = "", - Property = " ", - Reference = " ", - Snippet = " ", - Struct = " ", - Text = " ", - TypeParameter = " ", - Unit = "塞", - Value = " ", - Variable = " ", - }, + kind_icons = lvim.icons.kind, source_names = { nvim_lsp = "(LSP)", emoji = "(Emoji)", @@ -189,7 +163,7 @@ M.config = function() format = function(entry, vim_item) local max_width = lvim.builtin.cmp.formatting.max_width if max_width ~= 0 and #vim_item.abbr > max_width then - vim_item.abbr = string.sub(vim_item.abbr, 1, max_width - 1) .. "…" + vim_item.abbr = string.sub(vim_item.abbr, 1, max_width - 1) .. lvim.icons.ui.Ellipsis end if lvim.use_icons then vim_item.kind = lvim.builtin.cmp.formatting.kind_icons[vim_item.kind] diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index 727e238f..9e629cda 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -5,19 +5,19 @@ M.config = function() active = false, on_config_done = nil, breakpoint = { - text = "", + text = lvim.icons.ui.Bug, texthl = "LspDiagnosticsSignError", linehl = "", numhl = "", }, breakpoint_rejected = { - text = "", + text = lvim.icons.ui.Bug, texthl = "LspDiagnosticsSignHint", linehl = "", numhl = "", }, stopped = { - text = "", + text = lvim.icons.ui.BoldArrowRight, texthl = "LspDiagnosticsSignInformation", linehl = "DiagnosticUnderlineInfo", numhl = "LspDiagnosticsSignInformation", diff --git a/lua/lvim/core/gitsigns.lua b/lua/lvim/core/gitsigns.lua index 0365fc69..43ec7504 100644 --- a/lua/lvim/core/gitsigns.lua +++ b/lua/lvim/core/gitsigns.lua @@ -8,31 +8,31 @@ M.config = function() signs = { add = { hl = "GitSignsAdd", - text = "▎", + text = lvim.icons.ui.BoldLineLeft, numhl = "GitSignsAddNr", linehl = "GitSignsAddLn", }, change = { hl = "GitSignsChange", - text = "▎", + text = lvim.icons.ui.BoldLineLeft, numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn", }, delete = { hl = "GitSignsDelete", - text = "契", + text = lvim.icons.ui.Triangle, numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn", }, topdelete = { hl = "GitSignsDelete", - text = "契", + text = lvim.icons.ui.Triangle, numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn", }, changedelete = { hl = "GitSignsChange", - text = "▎", + text = lvim.icons.ui.BoldLineLeft, numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn", }, diff --git a/lua/lvim/core/indentlines.lua b/lua/lvim/core/indentlines.lua index ab316a9b..dc4a72ba 100644 --- a/lua/lvim/core/indentlines.lua +++ b/lua/lvim/core/indentlines.lua @@ -17,7 +17,7 @@ M.config = function() "Trouble", "text", }, - char = "▏", + char = lvim.icons.ui.LineLeft, show_trailing_blankline_indent = false, show_first_indent_level = true, use_treesitter = true, diff --git a/lua/lvim/core/info.lua b/lua/lvim/core/info.lua index da9ddbe6..c413f0f1 100644 --- a/lua/lvim/core/info.lua +++ b/lua/lvim/core/info.lua @@ -25,8 +25,8 @@ local function make_formatters_info(ft) "Formatters info", fmt( "* Active: %s%s", - table.concat(registered_formatters, "  , "), - vim.tbl_count(registered_formatters) > 0 and "  " or "" + table.concat(registered_formatters, " " .. lvim.icons.ui.BoxChecked .. " , "), + vim.tbl_count(registered_formatters) > 0 and " " .. lvim.icons.ui.BoxChecked .. " " or "" ), fmt("* Supported: %s", str_list(supported_formatters)), } @@ -41,8 +41,8 @@ local function make_code_actions_info(ft) "Code actions info", fmt( "* Active: %s%s", - table.concat(registered_actions, "  , "), - vim.tbl_count(registered_actions) > 0 and "  " or "" + table.concat(registered_actions, " " .. lvim.icons.ui.BoxChecked .. " , "), + vim.tbl_count(registered_actions) > 0 and " " .. lvim.icons.ui.BoxChecked .. " " or "" ), } @@ -57,8 +57,8 @@ local function make_linters_info(ft) "Linters info", fmt( "* Active: %s%s", - table.concat(registered_linters, "  , "), - vim.tbl_count(registered_linters) > 0 and "  " or "" + table.concat(registered_linters, " " .. lvim.icons.ui.BoxChecked .. " , "), + vim.tbl_count(registered_linters) > 0 and " " .. lvim.icons.ui.BoxChecked .. " " or "" ), fmt("* Supported: %s", str_list(supported_linters)), } @@ -202,7 +202,7 @@ function M.toggle_popup(ft) vim.fn.matchadd("LvimInfoIdentifier", " " .. ft .. "$") vim.fn.matchadd("string", "true") vim.fn.matchadd("string", "active") - vim.fn.matchadd("string", "") + vim.fn.matchadd("string", lvim.icons.ui.BoxChecked) vim.fn.matchadd("boolean", "inactive") vim.fn.matchadd("error", "false") tbl_set_highlight(require("lvim.lsp.null-ls.formatters").list_registered(ft), "LvimInfoIdentifier") diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index a47c40b6..af9eb549 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -85,7 +85,7 @@ M.config = function() -- custom folder icon reload("nvim-web-devicons").set_icon { lir_folder_icon = { - icon = "", + icon = lvim.icons.ui.Folder, color = "#42A5F5", name = "LirFolderNode", }, diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 5f29d4ef..badece1e 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -21,25 +21,25 @@ vim.api.nvim_set_hl(0, "SLBranchName", { fg = normal_hl.foreground, bg = cursorl vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.background }) local location_color = nil -local branch = "" -local separator = "│" +local branch = lvim.icons.git.Branch +local separator = lvim.icons.ui.LineMiddle if lvim.colorscheme == "tokyonight" then location_color = "SLBranchName" - branch = "%#SLGitIcon#" .. "" .. "%*" .. "%#SLBranchName#" + branch = "%#SLGitIcon#" .. lvim.icons.git.Branch .. "%*" .. "%#SLBranchName#" local status_ok, tnc = pcall(require, "tokyonight.colors") if status_ok then local tncolors = tnc.setup { transform = true } vim.api.nvim_set_hl(0, "SLSeparator", { fg = cursorline_hl.background, bg = tncolors.black }) - separator = "%#SLSeparator#" .. "│" .. "%*" + separator = "%#SLSeparator#" .. lvim.icons.ui.LineMiddle .. "%*" end end return { mode = { function() - return "  " + return " " .. lvim.icons.ui.Target .. " " end, padding = { left = 0, right = 0 }, color = {}, @@ -58,7 +58,11 @@ return { diff = { "diff", source = diff_source, - symbols = { added = " ", modified = " ", removed = " " }, + symbols = { + added = lvim.icons.git.LineAdded .. " ", + modified = lvim.icons.git.LineModified .. " ", + removed = lvim.icons.git.LineRemoved .. " ", + }, padding = { left = 2, right = 1 }, diff_color = { added = { fg = colors.green }, @@ -73,7 +77,9 @@ return { if vim.bo.filetype == "python" then local venv = os.getenv "CONDA_DEFAULT_ENV" or os.getenv "VIRTUAL_ENV" if venv then - return string.format("  (%s)", utils.env_cleanup(venv)) + local icons = require "nvim-web-devicons" + local py_icon, _ = icons.get_icon ".py" + return string.format(" " .. py_icon .. " (%s)", utils.env_cleanup(venv)) end end return "" @@ -84,12 +90,17 @@ return { diagnostics = { "diagnostics", sources = { "nvim_diagnostic" }, - symbols = { error = " ", warn = " ", info = " ", hint = " " }, + symbols = { + error = lvim.icons.diagnostics.BoldError .. " ", + warn = lvim.icons.diagnostics.BoldWarning .. " ", + info = lvim.icons.diagnostics.BoldInformation .. " ", + hint = lvim.icons.diagnostics.BoldHint .. " ", + }, -- cond = conditions.hide_in_width, }, treesitter = { function() - return "" + return lvim.icons.ui.Tree end, color = function() local buf = vim.api.nvim_get_current_buf() @@ -148,7 +159,7 @@ return { spaces = { function() local shiftwidth = vim.api.nvim_buf_get_option(0, "shiftwidth") - return " " .. shiftwidth + return lvim.icons.ui.Tab .. " " .. shiftwidth end, separator = separator, padding = 1, diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 0d759c95..8cde37c4 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -43,8 +43,14 @@ styles.default = { theme = "auto", globalstatus = true, icons_enabled = lvim.use_icons, - component_separators = { left = "", right = "" }, - section_separators = { left = "", right = "" }, + component_separators = { + left = lvim.icons.ui.DividerRight, + right = lvim.icons.ui.DividerLeft, + }, + section_separators = { + left = lvim.icons.ui.BoldDividerRight, + right = lvim.icons.ui.BoldDividerLeft, + }, disabled_filetypes = {}, }, sections = { diff --git a/lua/lvim/core/notify.lua b/lua/lvim/core/notify.lua index 72133c27..272fdced 100644 --- a/lua/lvim/core/notify.lua +++ b/lua/lvim/core/notify.lua @@ -29,11 +29,11 @@ local defaults = { ---@usage Icons for the different levels icons = { - ERROR = "", - WARN = "", - INFO = "", - DEBUG = "", - TRACE = "✎", + ERROR = lvim.icons.diagnostics.Error, + WARN = lvim.icons.diagnostics.Warning, + INFO = lvim.icons.diagnostics.Information, + DEBUG = lvim.icons.diagnostics.Debug, + TRACE = lvim.icons.diagnostics.Trace, }, }, } diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index 2d186829..e4b20804 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -20,10 +20,10 @@ function M.config() enable = lvim.use_icons, show_on_dirs = false, icons = { - hint = "", - info = "", - warning = "", - error = "", + hint = lvim.icons.diagnostics.BoldHint, + info = lvim.icons.diagnostics.BoldInformation, + warning = lvim.icons.diagnostics.BoldWarning, + error = lvim.icons.diagnostics.BoldError, }, }, update_focused_file = { @@ -71,23 +71,23 @@ function M.config() folder_arrow = lvim.use_icons, }, glyphs = { - default = "", - symlink = "", + default = lvim.icons.ui.Text, + symlink = lvim.icons.ui.FileSymlink, git = { - unstaged = "", - staged = "S", - unmerged = "", - renamed = "➜", - deleted = "", - untracked = "U", - ignored = "◌", + deleted = lvim.icons.git.FileDeleted, + ignored = lvim.icons.git.FileIgnored, + renamed = lvim.icons.git.FileRenamed, + staged = lvim.icons.git.FileStaged, + unmerged = lvim.icons.git.FileUnmerged, + unstaged = lvim.icons.git.FileUnstaged, + untracked = lvim.icons.git.FileUntracked, }, folder = { - default = "", - open = "", - empty = "", - empty_open = "", - symlink = "", + default = lvim.icons.ui.Folder, + empty = lvim.icons.ui.EmptyFolder, + empty_open = lvim.icons.ui.EmptyFolderOpen, + open = lvim.icons.ui.FolderOpen, + symlink = lvim.icons.ui.FolderSymlink, }, }, }, diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index c1cfd043..6e614dd9 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -63,8 +63,8 @@ function M.config() end lvim.builtin.telescope = vim.tbl_extend("force", lvim.builtin.telescope, { defaults = { - prompt_prefix = " ", - selection_caret = " ", + prompt_prefix = lvim.icons.ui.Telescope .. " ", + selection_caret = lvim.icons.ui.Forward .. " ", entry_prefix = " ", initial_mode = "insert", selection_strategy = "reset", diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 588ecce5..16c9df5e 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -22,9 +22,9 @@ M.config = function() spelling = { enabled = true, suggestions = 20 }, -- use which-key for spelling hints }, icons = { - breadcrumb = "»", -- symbol used in the command line area that shows your active key combo - separator = "➜", -- symbol used between a key and it's label - group = "+", -- symbol prepended to a group + breadcrumb = lvim.icons.ui.DoubleChevronRight, -- symbol used in the command line area that shows your active key combo + separator = lvim.icons.ui.BoldArrowRight, -- symbol used between a key and it's label + group = lvim.icons.ui.Plus, -- symbol prepended to a group }, popup_mappings = { scroll_down = "", -- binding to scroll down inside the popup diff --git a/lua/lvim/icons.lua b/lua/lvim/icons.lua new file mode 100644 index 00000000..bfb1e4b9 --- /dev/null +++ b/lua/lvim/icons.lua @@ -0,0 +1,141 @@ +return { + kind = { + Array = "", + Boolean = "蘒", + Class = "", + Color = "", + Constant = "", + Constructor = "", + Enum = "", + EnumMember = "", + Event = "", + Field = "", + File = "", + Folder = "", + Function = "", + Interface = "", + Key = "", + Keyword = "", + Method = "", + Module = "", + Namespace = "", + Null = "ﳠ", + Number = "", + Object = "", + Operator = "", + Package = "", + Property = "", + Reference = "", + Snippet = "", + String = "", + Struct = "", + Text = "", + TypeParameter = "", + Unit = "", + Value = "", + Variable = "", + }, + git = { + LineAdded = "", + LineModified = "", + LineRemoved = "", + FileDeleted = "", + FileIgnored = "◌", + FileRenamed = "➜", + FileStaged = "S", + FileUnmerged = "", + FileUnstaged = "", + FileUntracked = "U", + Diff = "", + Repo = "", + Octoface = "", + Branch = "", + }, + ui = { + ArrowCircleDown = "", + ArrowCircleLeft = "", + ArrowCircleRight = "", + ArrowCircleUp = "", + BoldArrowDown = "", + BoldArrowLeft = "", + BoldArrowRight = "", + BoldArrowUp = "", + BoldClose = "", + BoldDividerLeft = "", + BoldDividerRight = "", + BoldLineLeft = "▎", + BookMark = "", + BoxChecked = "", + Bug = "", + Calendar = "", + Check = "", + ChevronRight = ">", + ChevronShortDown = "", + ChevronShortLeft = "", + ChevronShortRight = "", + ChevronShortUp = "", + Circle = "", + Close = "", + CloudDownload = "", + Code = "", + Comment = "", + Dashboard = "", + DividerLeft = "", + DividerRight = "", + DoubleChevronRight = "»", + Ellipsis = "…", + EmptyFolder = "", + EmptyFolderOpen = "", + File = "", + FileSymlink = "", + Files = "", + FindFile = "", + FindText = "", + Fire = "", + Folder = "", + FolderOpen = "", + FolderSymlink = "", + Forward = "", + Gear = "", + History = "", + Lightbulb = "", + LineLeft = "▏", + LineMiddle = "│", + List = "", + Lock = "", + NewFile = "", + Note = "", + Package = "", + Pencil = "", + Plus = "", + Project = "", + Search = "", + SignIn = "", + SignOut = "", + Tab = "", + Table = "", + Target = "", + Telescope = "", + Text = "", + Tree = "", + Triangle = "契", + TriangleShortArrowDown = "", + TriangleShortArrowLeft = "", + TriangleShortArrowRight = "", + TriangleShortArrowUp = "", + }, + diagnostics = { + BoldError = "", + Error = "", + BoldWarning = "", + Warning = "", + BoldInformation = "", + Information = "", + BoldQuestion = "", + Question = "", + BoldHint = "", + Hint = "", + Debug = "", + Trace = "✎", + }, +} diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index f98a8851..b1a45d5e 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -47,10 +47,10 @@ return { signs = { active = true, values = { - { name = "DiagnosticSignError", text = "" }, - { name = "DiagnosticSignWarn", text = "" }, - { name = "DiagnosticSignHint", text = "" }, - { name = "DiagnosticSignInfo", text = "" }, + { name = "DiagnosticSignError", text = lvim.icons.diagnostics.Error }, + { name = "DiagnosticSignWarn", text = lvim.icons.diagnostics.Warning }, + { name = "DiagnosticSignHint", text = lvim.icons.diagnostics.Hint }, + { name = "DiagnosticSignInfo", text = lvim.icons.diagnostics.Info }, }, }, virtual_text = true, From 51fbb86555cbca461c5c1fa1a7ec0689213173a3 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 3 Oct 2022 03:56:57 +0000 Subject: [PATCH 082/138] fix: don't ignore plugin this way (#3125) --- .gitignore | 3 +-- after/plugin/highlights.lua | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 after/plugin/highlights.lua diff --git a/.gitignore b/.gitignore index 440d01d9..49d00ade 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -plugin/ dein tags* .netrwhist @@ -28,4 +27,4 @@ lua/lv-user-config/ *.backup *.old -.luacheckcache \ No newline at end of file +.luacheckcache diff --git a/after/plugin/highlights.lua b/after/plugin/highlights.lua new file mode 100644 index 00000000..0e14c0fa --- /dev/null +++ b/after/plugin/highlights.lua @@ -0,0 +1 @@ +reload('lvim.core.lir').icon_setup() From 7534e29e19498fbe2164bf3b702dcac3d561533b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 2 Oct 2022 23:58:14 -0400 Subject: [PATCH 083/138] chore: bump plugins version (#3113) --- snapshots/default.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/snapshots/default.json b/snapshots/default.json index dffe47f1..4047d3a1 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -1,6 +1,6 @@ { "Comment.nvim": { - "commit": "d9cfae1" + "commit": "97a188a" }, "LuaSnip": { "commit": "8f8d493" @@ -39,7 +39,7 @@ "commit": "7d8c6c4" }, "lua-dev.nvim": { - "commit": "ef1d211" + "commit": "2ffe2f6" }, "lualine.nvim": { "commit": "a52f078" @@ -48,37 +48,37 @@ "commit": "0051870" }, "mason.nvim": { - "commit": "a3a243c" + "commit": "59e6fee" }, "nlsp-settings.nvim": { - "commit": "aabd318" + "commit": "019ea0b" }, "null-ls.nvim": { - "commit": "c862432" + "commit": "c0c19f3" }, "nvim-autopairs": { - "commit": "14cc2a4" + "commit": "4fc96c8" }, "nvim-cmp": { - "commit": "2427d06" + "commit": "b0dff0e" }, "nvim-dap": { - "commit": "5d57c40" + "commit": "0b320f5" }, "nvim-lspconfig": { - "commit": "af43c30" + "commit": "f11fdff" }, "nvim-navic": { - "commit": "e0cfb25" + "commit": "132b273" }, "nvim-notify": { - "commit": "142069b" + "commit": "4144654" }, "nvim-tree.lua": { - "commit": "45d386a" + "commit": "7282f7d" }, "nvim-treesitter": { - "commit": "aebc6cf" + "commit": "8e76333" }, "nvim-ts-context-commentstring": { "commit": "4d3a68c" @@ -93,7 +93,7 @@ "commit": "6afb674" }, "plenary.nvim": { - "commit": "9e7c628" + "commit": "4b7e520" }, "popup.nvim": { "commit": "b7404d3" From 3b26b04a12c4ce82e477f2be78fbb0b70a8afa3f Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 3 Oct 2022 04:17:38 +0000 Subject: [PATCH 084/138] feat: add some more reloads (#3126) --- after/plugin/highlights.lua | 2 +- lua/lvim/core/gitsigns.lua | 2 +- lua/lvim/core/illuminate.lua | 2 +- lua/lvim/core/mason.lua | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/after/plugin/highlights.lua b/after/plugin/highlights.lua index 0e14c0fa..4c343e80 100644 --- a/after/plugin/highlights.lua +++ b/after/plugin/highlights.lua @@ -1 +1 @@ -reload('lvim.core.lir').icon_setup() +reload("lvim.core.lir").icon_setup() diff --git a/lua/lvim/core/gitsigns.lua b/lua/lvim/core/gitsigns.lua index 43ec7504..cc727c8b 100644 --- a/lua/lvim/core/gitsigns.lua +++ b/lua/lvim/core/gitsigns.lua @@ -79,7 +79,7 @@ M.config = function() end M.setup = function() - local gitsigns = require "gitsigns" + local gitsigns = reload "gitsigns" gitsigns.setup(lvim.builtin.gitsigns.opts) if lvim.builtin.gitsigns.on_config_done then diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index b2e2880b..ddff195a 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -50,7 +50,7 @@ M.config = function() end M.setup = function() - local status_ok, illuminate = pcall(require, "illuminate") + local status_ok, illuminate = pcall(reload, "illuminate") if not status_ok then return end diff --git a/lua/lvim/core/mason.lua b/lua/lvim/core/mason.lua index 36daab1f..19dee633 100644 --- a/lua/lvim/core/mason.lua +++ b/lua/lvim/core/mason.lua @@ -31,7 +31,7 @@ function M.config() end function M.setup() - local status_ok, mason = pcall(require, "mason") + local status_ok, mason = pcall(reload, "mason") if not status_ok then return end From 35cea14111ce642cbb74df96bf948263b98ebd04 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 3 Oct 2022 04:50:52 +0000 Subject: [PATCH 085/138] feat: add space after breadcrumb icons (#3128) --- lua/lvim/core/breadcrumbs.lua | 39 ++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index dd7f5163..cdddd9e8 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -2,12 +2,49 @@ local M = {} -- local Log = require "lvim.core.log" +local icons = lvim.icons.kind + M.config = function() lvim.builtin.breadcrumbs = { active = false, on_config_done = nil, options = { - icons = lvim.icons.kind, + icons = { + Array = icons.Array .. " ", + Boolean = icons.Boolean, + Class = icons.Class .. " ", + Color = icons.Color .. " ", + Constant = icons.Constant .. " ", + Constructor = icons.Constructor .. " ", + Enum = icons.Enum .. " ", + EnumMember = icons.EnumMember .. " ", + Event = icons.Event .. " ", + Field = icons.Field .. " ", + File = icons.File .. " ", + Folder = icons.Folder .. " ", + Function = icons.Function .. " ", + Interface = icons.Interface .. " ", + Key = icons.Key .. " ", + Keyword = icons.Keyword .. " ", + Method = icons.Method .. " ", + Module = icons.Module .. " ", + Namespace = icons.Namespace .. " ", + Null = icons.Null .. " ", + Number = icons.Number .. " ", + Object = icons.Object .. " ", + Operator = icons.Operator .. " ", + Package = icons.Package .. " ", + Property = icons.Property .. " ", + Reference = icons.Reference .. " ", + Snippet = icons.Snippet .. " ", + String = icons.String .. " ", + Struct = icons.Struct .. " ", + Text = icons.Text .. " ", + TypeParameter = icons.TypeParameter .. " ", + Unit = icons.Unit .. " ", + Value = icons.Value .. " ", + Variable = icons.Variable .. " ", + }, highlight = true, separator = " " .. ">" .. " ", depth_limit = 0, From 9caece34e44d9dd68eb6ebb537e67371ef886e62 Mon Sep 17 00:00:00 2001 From: Nick Waywood Date: Tue, 4 Oct 2022 12:27:47 +1100 Subject: [PATCH 086/138] feat: add missing nvimtree setting (#3138) --- lua/lvim/core/nvimtree.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/core/nvimtree.lua b/lua/lvim/core/nvimtree.lua index e4b20804..199279a6 100644 --- a/lua/lvim/core/nvimtree.lua +++ b/lua/lvim/core/nvimtree.lua @@ -92,6 +92,7 @@ function M.config() }, }, highlight_git = true, + group_empty = false, root_folder_modifier = ":t", }, filters = { From 2254ce4bc43ab11a831ef39a77415de169eac040 Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Tue, 4 Oct 2022 07:38:59 +0200 Subject: [PATCH 087/138] feat: added dap ui and relative config (#3131) --- lua/lvim/core/dap.lua | 77 +++++++++++++++++++++++++++++++++---------- lua/lvim/plugins.lua | 9 +++++ 2 files changed, 69 insertions(+), 17 deletions(-) diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index 9e629cda..fb603c81 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -22,6 +22,9 @@ M.config = function() linehl = "DiagnosticUnderlineInfo", numhl = "LspDiagnosticsSignInformation", }, + ui = { + auto_open = true, + }, } end @@ -34,8 +37,6 @@ M.setup = function() vim.fn.sign_define("DapStopped", lvim.builtin.dap.stopped) end - dap.defaults.fallback.terminal_win_cmd = "50vsplit new" - lvim.builtin.which_key.mappings["d"] = { name = "Debug", t = { "lua require'dap'.toggle_breakpoint()", "Toggle Breakpoint" }, @@ -51,6 +52,7 @@ M.setup = function() r = { "lua require'dap'.repl.toggle()", "Toggle Repl" }, s = { "lua require'dap'.continue()", "Start" }, q = { "lua require'dap'.close()", "Quit" }, + U = { "lua require'dapui'.toggle()", "Toggle UI" }, } if lvim.builtin.dap.on_config_done then @@ -58,21 +60,62 @@ M.setup = function() end end --- TODO put this up there ^^^ call in ftplugin +M.setup_ui = function() + local dap = require "dap" + local dapui = require "dapui" + dapui.setup { + expand_lines = true, + icons = { expanded = "", collapsed = "", circular = "" }, + mappings = { + -- Use a table to apply multiple mappings + expand = { "", "<2-LeftMouse>" }, + open = "o", + remove = "d", + edit = "e", + repl = "r", + toggle = "t", + }, + layouts = { + { + elements = { + { id = "scopes", size = 0.33 }, + { id = "breakpoints", size = 0.17 }, + { id = "stacks", size = 0.25 }, + { id = "watches", size = 0.25 }, + }, + size = 0.33, + position = "right", + }, + { + elements = { + { id = "repl", size = 0.45 }, + { id = "console", size = 0.55 }, + }, + size = 0.27, + position = "bottom", + }, + }, + floating = { + max_height = 0.9, + max_width = 0.5, -- Floats will be treated as percentage of your screen. + border = vim.g.border_chars, -- Border style. Can be 'single', 'double' or 'rounded' + mappings = { + close = { "q", "" }, + }, + }, + } --- M.dap = function() --- if lvim.plugin.dap.active then --- local dap_install = require "dap-install" --- dap_install.config("python_dbg", {}) --- end --- end --- --- M.dap = function() --- -- gem install readapt ruby-debug-ide --- if lvim.plugin.dap.active then --- local dap_install = require "dap-install" --- dap_install.config("ruby_vsc_dbg", {}) --- end --- end + if lvim.builtin.dap.ui.auto_open then + dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() + end + -- dap.listeners.before.event_terminated["dapui_config"] = function() + -- dapui.close() + -- end + -- dap.listeners.before.event_exited["dapui_config"] = function() + -- dapui.close() + -- end + end +end return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 387bcee3..c315cdd9 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -235,6 +235,15 @@ local core_plugins = { disable = not lvim.builtin.dap.active, }, + -- Debugger user interface + { + "rcarriga/nvim-dap-ui", + config = function() + require("lvim.core.dap").setup_ui() + end, + disable = not lvim.builtin.dap.active, + }, + -- alpha { "goolord/alpha-nvim", From 560ee4d7cf4038a22a5556d79ad92cd226a792dc Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Tue, 4 Oct 2022 03:49:31 -0400 Subject: [PATCH 088/138] fix: esc exit autocommand --- lua/lvim/core/autocmds.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index e8135fc4..99c65c2e 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -21,12 +21,10 @@ function M.load_defaults() "lir", "DressingSelect", "tsplayground", - "Markdown", }, callback = function() vim.cmd [[ nnoremap q :close - nnoremap :close set nobuflisted ]] end, From e5bcf01c759e7c833d8a5f1fcf665b6ea32a7c16 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 4 Oct 2022 19:23:52 +0200 Subject: [PATCH 089/138] refactor: more deliberate reload (#3133) --- after/plugin/highlights.lua | 1 - ftplugin/lua.lua | 2 ++ init.lua | 16 +++++------ lua/lvim/bootstrap.lua | 18 ++++-------- lua/lvim/config/init.lua | 15 +++++----- lua/lvim/core/builtins/init.lua | 2 +- lua/lvim/core/lir.lua | 26 +++++------------- lua/lvim/core/lualine/init.lua | 7 ++--- lua/lvim/core/lualine/styles.lua | 8 ++++++ lua/lvim/core/theme.lua | 12 +++++++- lua/lvim/plugins.lua | 5 +--- lua/lvim/utils/hooks.lua | 2 +- lua/lvim/utils/{reload.lua => modules.lua} | 32 +++++++++++++++++----- 13 files changed, 80 insertions(+), 66 deletions(-) delete mode 100644 after/plugin/highlights.lua rename lua/lvim/utils/{reload.lua => modules.lua} (66%) diff --git a/after/plugin/highlights.lua b/after/plugin/highlights.lua deleted file mode 100644 index 4c343e80..00000000 --- a/after/plugin/highlights.lua +++ /dev/null @@ -1 +0,0 @@ -reload("lvim.core.lir").icon_setup() diff --git a/ftplugin/lua.lua b/ftplugin/lua.lua index d6b9ced7..138332e9 100644 --- a/ftplugin/lua.lua +++ b/ftplugin/lua.lua @@ -1,4 +1,6 @@ local fmt = string.format +-- luacheck: ignore +-- TODO: fix lint violations -- Iterator that splits a string o a given delimiter local function split(str, delim) diff --git a/init.lua b/init.lua index 6f78b021..a171dd53 100644 --- a/init.lua +++ b/init.lua @@ -5,20 +5,20 @@ if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then vim.opt.rtp:append(base_dir) end -reload = require("lvim.utils.reload").reload +require("lvim.bootstrap"):init(base_dir) -reload("lvim.bootstrap"):init(base_dir) +require("lvim.config"):load() -reload("lvim.config"):load() +local plugins = require "lvim.plugins" -local plugins = reload "lvim.plugins" +require("lvim.plugin-loader").load { plugins, lvim.plugins } -reload("lvim.plugin-loader").load { plugins, lvim.plugins } +require("lvim.core.theme").setup() -local Log = reload "lvim.core.log" +local Log = require "lvim.core.log" Log:debug "Starting LunarVim" -local commands = reload "lvim.core.commands" +local commands = require "lvim.core.commands" commands.load(commands.defaults) -reload("lvim.lsp").setup() +require("lvim.lsp").setup() diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index e0b781d7..b803cfa6 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -19,15 +19,9 @@ function _G.join_paths(...) return result end ----Require a module in protected mode without relying on its cached value ----@param module string ----@return any -function _G.require_clean(module) - package.loaded[module] = nil - _G[module] = nil - local _, requested = pcall(require, module) - return requested -end +_G.require_clean = require("lvim.utils.modules").require_clean +_G.require_safe = require("lvim.utils.modules").require_safe +_G.reload = require("lvim.utils.modules").reload ---Get the full path to `$LUNARVIM_RUNTIME_DIR` ---@return string @@ -121,10 +115,10 @@ end ---Update LunarVim ---pulls the latest changes from github and, resets the startup cache function M:update() - require_clean("lvim.utils.hooks").run_pre_update() - local ret = require_clean("lvim.utils.git").update_base_lvim() + reload("lvim.utils.hooks").run_pre_update() + local ret = reload("lvim.utils.git").update_base_lvim() if ret then - require_clean("lvim.utils.hooks").run_post_update() + reload("lvim.utils.hooks").run_post_update() end end diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index c6765f56..483af50d 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -111,7 +111,7 @@ end --- Override the configuration with a user provided one -- @param config_path The path to the configuration overrides function M:load(config_path) - local autocmds = require "lvim.core.autocmds" + local autocmds = reload "lvim.core.autocmds" config_path = config_path or self:get_user_config_path() local ok, err = pcall(dofile, config_path) if not ok then @@ -128,7 +128,7 @@ function M:load(config_path) vim.g.mapleader = (lvim.leader == "space" and " ") or lvim.leader - require("lvim.keymappings").load(lvim.keys) + reload("lvim.keymappings").load(lvim.keys) if lvim.transparent_window then autocmds.enable_transparent_mode() @@ -139,17 +139,18 @@ end -- @param config_path The path to the configuration overrides function M:reload() vim.schedule(function() - require_clean("lvim.utils.hooks").run_pre_reload() + reload("lvim.utils.hooks").run_pre_reload() M:load() - require("lvim.core.autocmds").configure_format_on_save() + reload("lvim.core.autocmds").configure_format_on_save() - local plugins = require "lvim.plugins" - local plugin_loader = require "lvim.plugin-loader" + local plugins = reload "lvim.plugins" + local plugin_loader = reload "lvim.plugin-loader" plugin_loader.reload { plugins, lvim.plugins } - require_clean("lvim.utils.hooks").run_post_reload() + reload("lvim.core.theme").setup() + reload("lvim.utils.hooks").run_post_reload() end) end diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 84e37655..0060c460 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -26,7 +26,7 @@ local builtins = { function M.config(config) for _, builtin_path in ipairs(builtins) do - local builtin = require("lvim.utils.reload").reload(builtin_path) + local builtin = reload(builtin_path) builtin.config(config) end diff --git a/lua/lvim/core/lir.lua b/lua/lvim/core/lir.lua index af9eb549..68445664 100644 --- a/lua/lvim/core/lir.lua +++ b/lua/lvim/core/lir.lua @@ -7,16 +7,16 @@ M.config = function() icon = "", } - local status_ok, lir = pcall(reload, "lir") + local status_ok, _ = pcall(require, "lir") if not status_ok then return end - local actions = reload "lir.actions" - local mark_actions = reload "lir.mark.actions" - local clipboard_actions = reload "lir.clipboard.actions" + local actions = require "lir.actions" + local mark_actions = require "lir.mark.actions" + local clipboard_actions = require "lir.clipboard.actions" - lir.setup { + lvim.builtin.lir = vim.tbl_extend("force", lvim.builtin.lir, { show_hidden_files = false, devicons_enable = true, mappings = { @@ -80,16 +80,7 @@ M.config = function() -- echo cwd -- vim.api.nvim_echo({ { vim.fn.expand "%:p", "Normal" } }, false, {}) end, - } - - -- custom folder icon - reload("nvim-web-devicons").set_icon { - lir_folder_icon = { - icon = lvim.icons.ui.Folder, - color = "#42A5F5", - name = "LirFolderNode", - }, - } + }) end function M.icon_setup() @@ -113,14 +104,11 @@ function M.icon_setup() end function M.setup() - if lvim.builtin.nvimtree.active then - return - end - local status_ok, lir = pcall(reload, "lir") if not status_ok then return end + lir.setup(lvim.builtin.lir) if lvim.builtin.lir.on_config_done then lvim.builtin.lir.on_config_done(lir) diff --git a/lua/lvim/core/lualine/init.lua b/lua/lvim/core/lualine/init.lua index e041e8a8..cd6237bf 100644 --- a/lua/lvim/core/lualine/init.lua +++ b/lua/lvim/core/lualine/init.lua @@ -34,16 +34,13 @@ M.config = function() end M.setup = function() - -- avoid running in headless mode since it's harder to detect failures - if #vim.api.nvim_list_uis() == 0 then - local Log = require "lvim.core.log" - Log:debug "headless mode detected, skipping running setup for lualine" + local status_ok, lualine = pcall(require, "lualine") + if not status_ok then return end require("lvim.core.lualine.styles").update() - local lualine = require "lualine" lualine.setup(lvim.builtin.lualine) if lvim.builtin.lualine.on_config_done then diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index 8cde37c4..81dbbabb 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/lua/lvim/core/lualine/styles.lua @@ -152,6 +152,14 @@ function M.update() local style = M.get_style(lvim.builtin.lualine.style) lvim.builtin.lualine = vim.tbl_deep_extend("keep", lvim.builtin.lualine, style) + + local color_template = vim.g.colors_name or lvim.colorscheme + local theme_supported, template = pcall(function() + require("lualine.utils.loader").load_theme(color_template) + end) + if theme_supported and template then + lvim.builtin.lualine.options.theme = color_template + end end return M diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index 43ba3a07..394963a0 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -83,13 +83,23 @@ M.config = function() end M.setup = function() + -- avoid running in headless mode since it's harder to detect failures + if #vim.api.nvim_list_uis() == 0 then + local Log = require "lvim.core.log" + Log:debug "headless mode detected, skipping running setup for lualine" + return + end + local status_ok, theme = pcall(require, "tokyonight") if not status_ok then return end theme.setup(lvim.builtin.theme.options) - lvim.builtin.lualine.options.theme = "tokyonight" + + require("lvim.core.lualine").setup() + + require("lvim.core.lir").icon_setup() end return M diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index c315cdd9..0b5e1c72 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -16,10 +16,6 @@ local core_plugins = { }, { "folke/tokyonight.nvim", - config = function() - require("lvim.core.theme").setup() - end, - -- disable = not vim.startswith(lvim.colorscheme, "tokyonight"), }, { "rcarriga/nvim-notify", @@ -139,6 +135,7 @@ local core_plugins = { config = function() require("lvim.core.lir").setup() end, + requires = { "kyazdani42/nvim-web-devicons" }, disable = not lvim.builtin.lir.active, }, { diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index fd78ef19..4101c573 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -61,7 +61,7 @@ function M.run_post_update() vim.wait(1000, function() return false end) - local ret = require_clean("lvim.utils.git").switch_lvim_branch(compat_tag) + local ret = reload("lvim.utils.git").switch_lvim_branch(compat_tag) if ret then vim.notify("Reverted to the last known compatible version: " .. compat_tag, vim.log.levels.WARN) end diff --git a/lua/lvim/utils/reload.lua b/lua/lvim/utils/modules.lua similarity index 66% rename from lua/lvim/utils/reload.lua rename to lua/lvim/utils/modules.lua index 46392349..d5674483 100644 --- a/lua/lvim/utils/reload.lua +++ b/lua/lvim/utils/modules.lua @@ -1,5 +1,6 @@ local M = {} +local Log = require "lvim.core.log" -- revisit this -- function prequire(package) -- local status, lib = pcall(require, package) @@ -42,7 +43,9 @@ local function _replace(old, new, repeat_tbl) old[k] = new[k] else if type(old[k]) ~= type(new[k]) then - vim.notify(string.format("warning: attr %s old type no equal new type!!!", k)) + Log:debug( + string.format("Reloader: mismatch between old [%s] and new [%s] type for [%s]", type(old[k]), type(new[k]), k) + ) _assign(old, new, k) else if type(old[k]) == "table" then @@ -55,25 +58,40 @@ local function _replace(old, new, repeat_tbl) end end +M.require_clean = function(m) + package.loaded[m] = nil + _G[m] = nil + local _, module = pcall(require, m) + return module +end + +M.require_safe = function(mod) + local status_ok, module = pcall(require, mod) + if not status_ok then + local trace = debug.getinfo(2, "SL") + local shorter_src = trace.short_src + local lineinfo = shorter_src .. ":" .. (trace.currentline or trace.linedefined) + local msg = string.format("%s : skipped loading [%s]", lineinfo, mod) + Log:debug(msg) + end + return module +end + M.reload = function(mod) if not package.loaded[mod] then - local m = require(mod) - return m + return M.require_safe(mod) end - -- vim.notify "begin reload!!!" local old = package.loaded[mod] package.loaded[mod] = nil - local new = require(mod) + local new = M.require_safe(mod) if type(old) == "table" and type(new) == "table" then - -- vim.notify "pick object in new module to old module!!!" local repeat_tbl = {} _replace(old, new, repeat_tbl) end package.loaded[mod] = old - -- vim.notify "finish reload!!!" return old end From 42e410cdb086af1415b6e263eba9b250ef3d9ac2 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Wed, 5 Oct 2022 03:25:51 -0400 Subject: [PATCH 090/138] feat(dap): red bugs and other highlight improvements --- lua/lvim/core/dap.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index fb603c81..77c2856a 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -6,21 +6,21 @@ M.config = function() on_config_done = nil, breakpoint = { text = lvim.icons.ui.Bug, - texthl = "LspDiagnosticsSignError", + texthl = "DiagnosticSignError", linehl = "", numhl = "", }, breakpoint_rejected = { text = lvim.icons.ui.Bug, - texthl = "LspDiagnosticsSignHint", + texthl = "DiagnosticSignError", linehl = "", numhl = "", }, stopped = { text = lvim.icons.ui.BoldArrowRight, - texthl = "LspDiagnosticsSignInformation", - linehl = "DiagnosticUnderlineInfo", - numhl = "LspDiagnosticsSignInformation", + texthl = "DiagnosticSignWarn", + linehl = "Visual", + numhl = "DiagnosticSignWarn", }, ui = { auto_open = true, @@ -119,3 +119,4 @@ M.setup_ui = function() end return M + From c1edf56826f507096e54400f37f2bdd9da369d26 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Wed, 5 Oct 2022 21:35:14 -0400 Subject: [PATCH 091/138] feat: terminal, dap, and notify active by default --- lua/lvim/core/dap.lua | 2 +- lua/lvim/core/notify.lua | 2 +- lua/lvim/core/terminal.lua | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index 77c2856a..6372bf6f 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -2,7 +2,7 @@ local M = {} M.config = function() lvim.builtin.dap = { - active = false, + active = true, on_config_done = nil, breakpoint = { text = lvim.icons.ui.Bug, diff --git a/lua/lvim/core/notify.lua b/lua/lvim/core/notify.lua index 272fdced..df6ce57e 100644 --- a/lua/lvim/core/notify.lua +++ b/lua/lvim/core/notify.lua @@ -3,7 +3,7 @@ local M = {} local Log = require "lvim.core.log" local defaults = { - active = false, + active = true, on_config_done = nil, opts = { ---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" } diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 57d44c9a..006452e1 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -3,6 +3,7 @@ local Log = require "lvim.core.log" M.config = function() lvim.builtin["terminal"] = { + active = true, on_config_done = nil, -- size can be a number or function which is passed the current terminal size = 20, From 1eed9f572f29568a65cf2505e2dd37d1c2e7a309 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Thu, 6 Oct 2022 02:49:58 +0000 Subject: [PATCH 092/138] feat(dap): buffernames for elements, icons, hide dap-repl by default (#3156) --- lua/lvim/core/autocmds.lua | 9 ++++++++- lua/lvim/core/breadcrumbs.lua | 27 ++++++++++++++++++++++----- lua/lvim/core/dap.lua | 3 +-- lua/lvim/core/notify.lua | 2 +- lua/lvim/core/terminal.lua | 2 +- lua/lvim/icons.lua | 4 ++++ 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 99c65c2e..ee5d8f13 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -29,7 +29,6 @@ function M.load_defaults() ]] end, }) - local definitions = { { "TextYankPost", @@ -53,6 +52,14 @@ function M.load_defaults() end, }, }, + { + "FileType", + { + group = "_hide_dap_repl", + pattern = "dap-repl", + command = "set nobuflisted", + }, + }, { "FileType", { diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index cdddd9e8..d6db55a5 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -84,13 +84,8 @@ M.winbar_filetype_exclude = { "DressingSelect", "Jaq", "harpoon", - "dapui_scopes", - "dapui_breakpoints", - "dapui_stacks", - "dapui_watches", "dap-repl", "dap-terminal", - "dapui_console", "lab", "Markdown", "", @@ -112,6 +107,28 @@ M.get_filename = function() file_icon = lvim.icons.kind.File end + local buf_ft = vim.bo.filetype + + if buf_ft == "dapui_breakpoints" then + file_icon = lvim.icons.ui.Bug + end + + if buf_ft == "dapui_stacks" then + file_icon = lvim.icons.ui.Stacks + end + + if buf_ft == "dapui_scopes" then + file_icon = lvim.icons.ui.Scopes + end + + if buf_ft == "dapui_watches" then + file_icon = lvim.icons.ui.Watches + end + + if buf_ft == "dapui_console" then + file_icon = lvim.icons.ui.DebugConsole + end + local navic_text = vim.api.nvim_get_hl_by_name("Normal", true) vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text.foreground }) diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index 6372bf6f..4045390b 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -2,7 +2,7 @@ local M = {} M.config = function() lvim.builtin.dap = { - active = true, + active = false, on_config_done = nil, breakpoint = { text = lvim.icons.ui.Bug, @@ -119,4 +119,3 @@ M.setup_ui = function() end return M - diff --git a/lua/lvim/core/notify.lua b/lua/lvim/core/notify.lua index df6ce57e..272fdced 100644 --- a/lua/lvim/core/notify.lua +++ b/lua/lvim/core/notify.lua @@ -3,7 +3,7 @@ local M = {} local Log = require "lvim.core.log" local defaults = { - active = true, + active = false, on_config_done = nil, opts = { ---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" } diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 006452e1..65cba56d 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -3,7 +3,7 @@ local Log = require "lvim.core.log" M.config = function() lvim.builtin["terminal"] = { - active = true, + active = false, on_config_done = nil, -- size can be a number or function which is passed the current terminal size = 20, diff --git a/lua/lvim/icons.lua b/lua/lvim/icons.lua index bfb1e4b9..40a83ac9 100644 --- a/lua/lvim/icons.lua +++ b/lua/lvim/icons.lua @@ -67,6 +67,10 @@ return { BookMark = "", BoxChecked = "", Bug = "", + Stacks = " ", + Scopes = "", + Watches = "", + DebugConsole = " ", Calendar = "", Check = "", ChevronRight = ">", From 5b35ed9c3288f5c631e04f80674f098d79fe130e Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Thu, 6 Oct 2022 05:20:12 +0000 Subject: [PATCH 093/138] feat: all features active by default (#3157) --- lua/lvim/core/breadcrumbs.lua | 2 +- lua/lvim/core/dap.lua | 12 +++++++++--- lua/lvim/core/notify.lua | 8 ++++++-- lua/lvim/core/terminal.lua | 2 +- lua/lvim/plugins.lua | 9 --------- snapshots/default.json | 6 +++--- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index d6db55a5..149b5fcf 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -6,7 +6,7 @@ local icons = lvim.icons.kind M.config = function() lvim.builtin.breadcrumbs = { - active = false, + active = true, on_config_done = nil, options = { icons = { diff --git a/lua/lvim/core/dap.lua b/lua/lvim/core/dap.lua index 4045390b..cff50f64 100644 --- a/lua/lvim/core/dap.lua +++ b/lua/lvim/core/dap.lua @@ -2,7 +2,7 @@ local M = {} M.config = function() lvim.builtin.dap = { - active = false, + active = true, on_config_done = nil, breakpoint = { text = lvim.icons.ui.Bug, @@ -29,7 +29,10 @@ M.config = function() end M.setup = function() - local dap = require "dap" + local status_ok, dap = pcall(require, "dap") + if not status_ok then + return + end if lvim.use_icons then vim.fn.sign_define("DapBreakpoint", lvim.builtin.dap.breakpoint) @@ -61,7 +64,10 @@ M.setup = function() end M.setup_ui = function() - local dap = require "dap" + local status_ok, dap = pcall(require, "dap") + if not status_ok then + return + end local dapui = require "dapui" dapui.setup { expand_lines = true, diff --git a/lua/lvim/core/notify.lua b/lua/lvim/core/notify.lua index 272fdced..b08c45a6 100644 --- a/lua/lvim/core/notify.lua +++ b/lua/lvim/core/notify.lua @@ -3,7 +3,7 @@ local M = {} local Log = require "lvim.core.log" local defaults = { - active = false, + active = true, on_config_done = nil, opts = { ---@usage Animation style one of { "fade", "slide", "fade_in_slide_out", "static" } @@ -58,7 +58,11 @@ function M.setup() end local opts = lvim.builtin.notify and lvim.builtin.notify.opts or defaults - local notify = require "notify" + + local status_ok, notify = pcall(require, "notify") + if not status_ok then + return + end notify.setup(opts) vim.notify = notify diff --git a/lua/lvim/core/terminal.lua b/lua/lvim/core/terminal.lua index 65cba56d..006452e1 100644 --- a/lua/lvim/core/terminal.lua +++ b/lua/lvim/core/terminal.lua @@ -3,7 +3,7 @@ local Log = require "lvim.core.log" M.config = function() lvim.builtin["terminal"] = { - active = false, + active = true, on_config_done = nil, -- size can be a number or function which is passed the current terminal size = 20, diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 0b5e1c72..a0f5d14d 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -223,15 +223,6 @@ local core_plugins = { disable = not lvim.builtin.dap.active, }, - -- Debugger management - { - "Pocco81/dap-buddy.nvim", - branch = "dev", - -- event = "BufWinEnter", - -- event = "BufRead", - disable = not lvim.builtin.dap.active, - }, - -- Debugger user interface { "rcarriga/nvim-dap-ui", diff --git a/snapshots/default.json b/snapshots/default.json index 4047d3a1..78fe9a1f 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -23,9 +23,6 @@ "cmp_luasnip": { "commit": "a9de941" }, - "dap-buddy.nvim": { - "commit": "3679132" - }, "friendly-snippets": { "commit": "2be79d8" }, @@ -65,6 +62,9 @@ "nvim-dap": { "commit": "0b320f5" }, + "nvim-dap-ui": { + "commit": "c8ce83a" + }, "nvim-lspconfig": { "commit": "f11fdff" }, From 0d578ab152708019ad10cb7b21fc4a1cb0105a1a Mon Sep 17 00:00:00 2001 From: Mattherix Date: Thu, 6 Oct 2022 07:21:34 +0200 Subject: [PATCH 094/138] fix(installer): don't overwrite previous config (#3154) --- utils/installer/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 0fc17ab2..4f0988be 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -439,7 +439,8 @@ function setup_lvim() { setup_shim - cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" + [ ! -f "$LUNARVIM_CONFIG_DIR/config.lua" ] \ + && cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" echo "Preparing Packer setup" From 9def60f1dd09ac2244672b8570092229977b43b4 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 6 Oct 2022 08:55:06 +0200 Subject: [PATCH 095/138] feat: lock new installations to nvim 0.8+ (#3111) --- .../ISSUE_TEMPLATE/general-issue-form.yaml | 2 +- .github/ISSUE_TEMPLATE/lsp-issue-form.yaml | 2 +- .github/workflows/install.yaml | 6 +- .github/workflows/plugins.yml | 2 +- README.md | 4 +- lua/lvim/bootstrap.lua | 4 +- lua/lvim/lsp/utils.lua | 57 ++----------------- lua/lvim/utils/hooks.lua | 4 +- utils/installer/install.sh | 4 +- 9 files changed, 20 insertions(+), 65 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/general-issue-form.yaml b/.github/ISSUE_TEMPLATE/general-issue-form.yaml index ea8c9cba..8faff6ae 100644 --- a/.github/ISSUE_TEMPLATE/general-issue-form.yaml +++ b/.github/ISSUE_TEMPLATE/general-issue-form.yaml @@ -33,7 +33,7 @@ body: - type: input id: nvim-version attributes: - label: Neovim version (>= 0.7.2) + label: Neovim version (>= 0.8.0) description: "Output of `nvim --version`" placeholder: | NVIM v0.8.0-dev+199-g2875d45e7 diff --git a/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml b/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml index e8079ffa..b3d4713b 100644 --- a/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml +++ b/.github/ISSUE_TEMPLATE/lsp-issue-form.yaml @@ -27,7 +27,7 @@ body: - type: input id: nvim-version attributes: - label: Neovim version (>= 0.7) + label: Neovim version (>= 0.8.0) description: "Output of `nvim --version`" placeholder: | NVIM v0.8.0-dev+199-g2875d45e7 diff --git a/.github/workflows/install.yaml b/.github/workflows/install.yaml index e21607ab..8ab27e88 100644 --- a/.github/workflows/install.yaml +++ b/.github/workflows/install.yaml @@ -21,10 +21,10 @@ jobs: include: - runner: ubuntu-latest os: linux - neovim: v0.7.0 + neovim: v0.8.0 - runner: macos-latest os: osx - neovim: v0.7.0 + neovim: v0.8.0 - runner: ubuntu-22.04 os: linux neovim: nightly @@ -78,7 +78,7 @@ jobs: uses: rhysd/action-setup-vim@v1 with: neovim: true - version: v0.7.0 + version: v0.8.0 - name: Install LunarVim timeout-minutes: 4 diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index 3df32105..d5c6310f 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -33,7 +33,7 @@ jobs: uses: rhysd/action-setup-vim@v1 with: neovim: true - version: v0.7.0 + version: v0.8.0 - name: Install LunarVim timeout-minutes: 4 diff --git a/README.md b/README.md index 2127ffd3..16ce0540 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ ## Install In One Command! -Make sure you have the release version of Neovim (0.7+). +Make sure you have the release version of Neovim (0.8+). ### Linux/MacOS: -If you are running Neovim 0.7+ +If you are running Neovim 0.8+ ```bash bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh) diff --git a/lua/lvim/bootstrap.lua b/lua/lvim/bootstrap.lua index b803cfa6..5d980498 100644 --- a/lua/lvim/bootstrap.lua +++ b/lua/lvim/bootstrap.lua @@ -1,7 +1,7 @@ local M = {} -if vim.fn.has "nvim-0.7" ~= 1 then - vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.7+", vim.log.levels.WARN) +if vim.fn.has "nvim-0.8" ~= 1 then + vim.notify("Please upgrade your Neovim base installation. Lunarvim requires v0.8+", vim.log.levels.WARN) vim.wait(5000, function() return false end) diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 53571f20..44e4f5f7 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -23,25 +23,14 @@ function M.get_active_clients_by_ft(filetype) end function M.get_client_capabilities(client_id) - local client - if not client_id then - local buf_clients = vim.lsp.buf_get_clients() - for _, buf_client in pairs(buf_clients) do - if buf_client.name ~= "null-ls" then - client = buf_client - break - end - end - else - client = vim.lsp.get_client_by_id(tonumber(client_id)) - end + local client = vim.lsp.get_client_by_id(tonumber(client_id)) if not client then - error "Unable to determine client_id" + Log:warn("Unable to determine client from client_id: " .. client_id) return end local enabled_caps = {} - for capability, status in pairs(client.server_capabilities or client.resolved_capabilities) do + for capability, status in pairs(client.server_capabilities) do if status == true then table.insert(enabled_caps, capability) end @@ -178,47 +167,13 @@ function M.format_filter(client) end end ----Provide vim.lsp.buf.format for nvim <0.8 ----@param opts table +---Simple wrapper for vim.lsp.buf.format() to provide defaults +---@param opts table|nil function M.format(opts) opts = opts or {} opts.filter = opts.filter or M.format_filter - if vim.lsp.buf.format then - return vim.lsp.buf.format(opts) - end - - local bufnr = opts.bufnr or vim.api.nvim_get_current_buf() - - ---@type table|nil - local clients = vim.lsp.get_active_clients { - id = opts.id, - bufnr = bufnr, - name = opts.name, - } - - if opts.filter then - clients = vim.tbl_filter(opts.filter, clients) - end - - clients = vim.tbl_filter(function(client) - return client.supports_method "textDocument/formatting" - end, clients) - - if #clients == 0 then - vim.notify_once "[LSP] Format request failed, no matching language servers." - end - - local timeout_ms = opts.timeout_ms or 1000 - for _, client in pairs(clients) do - local params = vim.lsp.util.make_formatting_params(opts.formatting_options) - local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, bufnr) - if result and result.result then - vim.lsp.util.apply_text_edits(result.result, bufnr, client.offset_encoding) - elseif err then - vim.notify(string.format("[LSP][%s] %s", client.name, err), vim.log.levels.WARN) - end - end + return vim.lsp.buf.format(opts) end return M diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index 4101c573..ce4335a9 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -52,8 +52,8 @@ end function M.run_post_update() Log:debug "Starting post-update hook" - if vim.fn.has "nvim-0.7" ~= 1 then - local compat_tag = "1.1.3" + if vim.fn.has "nvim-0.8" ~= 1 then + local compat_tag = "1.1.4" vim.notify( "Please upgrade your Neovim base installation. Newer version of Lunarvim requires v0.7+", vim.log.levels.WARN diff --git a/utils/installer/install.sh b/utils/installer/install.sh index 4f0988be..fee0e420 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -201,11 +201,11 @@ function print_missing_dep_msg() { } function check_neovim_min_version() { - local verify_version_cmd='if !has("nvim-0.7") | cquit | else | quit | endif' + local verify_version_cmd='if !has("nvim-0.8") | cquit | else | quit | endif' # exit with an error if min_version not found if ! nvim --headless -u NONE -c "$verify_version_cmd"; then - echo "[ERROR]: LunarVim requires at least Neovim v0.7 or higher" + echo "[ERROR]: LunarVim requires at least Neovim v0.8 or higher" exit 1 fi } From 5a4c8e3eecbfb3ef785c2eb5d2010f50b9b5d5df Mon Sep 17 00:00:00 2001 From: opalmay <65673442+opalmay@users.noreply.github.com> Date: Thu, 6 Oct 2022 17:11:37 +0300 Subject: [PATCH 096/138] fix: always use border for lsp hover (#3160) --- lua/lvim/lsp/handlers.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 81342885..84f2ba5f 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -12,9 +12,7 @@ function M.setup() float = lvim.lsp.diagnostics.float, } vim.diagnostic.config(config) - if not lvim.builtin.illuminate.active then - vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float) - end + vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float) end From 40e2d5a1715ab7cdb0c4b4d849f1628caadb6842 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Thu, 6 Oct 2022 16:12:12 +0200 Subject: [PATCH 097/138] feat(logger): hot-reload logger level (#3159) --- lua/lvim/config/init.lua | 2 ++ lua/lvim/core/log.lua | 37 +++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index 483af50d..fae6c518 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -122,6 +122,8 @@ function M:load(config_path) end end + Log:set_level(lvim.log.level) + handle_deprecated_settings() autocmds.define_autocmds(lvim.autocommands) diff --git a/lua/lvim/core/log.lua b/lua/lvim/core/log.lua index 5047ff4c..d88a659b 100644 --- a/lua/lvim/core/log.lua +++ b/lua/lvim/core/log.lua @@ -12,26 +12,23 @@ vim.tbl_add_reverse_lookup(Log.levels) local notify_opts = {} function Log:set_level(level) - local logger_ok, _ = xpcall(function() - local log_level = Log.levels[level:upper()] - local structlog = require "structlog" - if structlog then - local logger = structlog.get_logger "lvim" - for _, s in ipairs(logger.sinks) do - s.level = log_level - end + local logger_ok, logger = pcall(function() + return require("structlog").get_logger "lvim" + end) + local log_level = Log.levels[level:upper()] + if logger_ok and logger and log_level then + for _, s in ipairs(logger.sinks) do + s.level = log_level end - end, debug.traceback) - if not logger_ok then - Log:debug("Unable to set logger's level: " .. debug.traceback()) + else + vim.notify_once("Unable to set logger's level to " .. level) end local packer_ok, _ = xpcall(function() - package.loaded["packer.log"] = nil - require("packer.log").new { level = lvim.log.level } + require("packer.log").cfg { log = { level = level } } end, debug.traceback) if not packer_ok then - Log:debug("Unable to set packer's log level: " .. debug.traceback()) + vim.notify_once("Unable to set packer's log level to " .. level) end end @@ -91,7 +88,7 @@ function Log:init() vim_log_level = vim_log_level + 1 end - logger:log(vim_log_level, msg) + self:info(vim_log_level, msg) end end @@ -159,11 +156,15 @@ end ---Retrieves the handle of the logger object ---@return table|nil logger handle if found function Log:get_logger() - if self.__handle then - return self.__handle + local logger_ok, logger = pcall(function() + return require("structlog").get_logger "lvim" + end) + if logger_ok and logger then + return logger end - local logger = self:init() + logger = self:init() + if not logger then return end From f6402563abb3ace148168a27e7889c961dd94bfd Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 7 Oct 2022 04:51:09 +0200 Subject: [PATCH 098/138] feat: enable global installation (#3161) --- .github/workflows/format.yaml | 1 + init.lua | 7 +++++-- lua/lvim/config/init.lua | 6 +++++- lua/lvim/utils/git.lua | 15 ++++++++++++++- utils/bin/lvim.ps1 | 2 +- utils/bin/lvim.template | 6 ++++-- utils/installer/install.sh | 22 +++++++++++----------- utils/installer/install_bin.sh | 3 ++- 8 files changed, 43 insertions(+), 19 deletions(-) diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 52103a54..27b061ef 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -22,6 +22,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} # CLI arguments + version: 0.15.1 args: --check . shfmt-check: diff --git a/init.lua b/init.lua index a171dd53..75452843 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,8 @@ -local init_path = debug.getinfo(1, "S").source:sub(2) -local base_dir = init_path:match("(.*[/\\])"):sub(1, -2) +local base_dir = vim.env.LUNARVIM_BASE_DIR + or (function() + local init_path = debug.getinfo(1, "S").source + return init_path:sub(2):match("(.*[/\\])"):sub(1, -2) + end)() if not vim.tbl_contains(vim.opt.rtp:get(), base_dir) then vim.opt.rtp:append(base_dir) diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index fae6c518..ea36a9a0 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -118,7 +118,11 @@ function M:load(config_path) if utils.is_file(user_config_file) then Log:warn("Invalid configuration: " .. err) else - vim.notify_once(string.format("Unable to find configuration file [%s]", config_path), vim.log.levels.WARN) + vim.notify_once( + string.format("User-configuration not found. Creating an example configuration in %s", config_path) + ) + local example_config = join_paths(get_lvim_base_dir(), "utils", "installer", "config.example.lua") + vim.loop.fs_copyfile(example_config, config_path) end end diff --git a/lua/lvim/utils/git.lua b/lua/lvim/utils/git.lua index 99c178f3..e1b5ccf2 100644 --- a/lua/lvim/utils/git.lua +++ b/lua/lvim/utils/git.lua @@ -1,6 +1,7 @@ local M = {} local Log = require "lvim.core.log" +local fmt = string.format local if_nil = vim.F.if_nil local function git_cmd(opts) @@ -43,9 +44,16 @@ local function safe_deep_fetch() local fetch_mode = result[1] == "true" and "--unshallow" or "--all" ret = git_cmd { args = { "fetch", fetch_mode } } if ret ~= 0 then - Log:error("Git fetch failed! Please pull the changes manually in " .. get_lvim_base_dir()) + Log:error(fmt "Git fetch %s failed! Please pull the changes manually in %s", fetch_mode, get_lvim_base_dir()) return end + if fetch_mode == "--unshallow" then + ret = git_cmd { args = { "remote", "set-branches", "origin", "*" } } + if ret ~= 0 then + Log:error(fmt "Git fetch %s failed! Please pull the changes manually in %s", fetch_mode, get_lvim_base_dir()) + return + end + end return true end @@ -53,6 +61,11 @@ end function M.update_base_lvim() Log:info "Checking for updates" + if not vim.loop.fs_access(get_lvim_base_dir(), "w") then + Log:warn(fmt("Lunarvim update aborted! cannot write to %s", get_lvim_base_dir())) + return + end + if not safe_deep_fetch() then return end diff --git a/utils/bin/lvim.ps1 b/utils/bin/lvim.ps1 index 32723c18..3ec8125c 100644 --- a/utils/bin/lvim.ps1 +++ b/utils/bin/lvim.ps1 @@ -10,4 +10,4 @@ $env:LUNARVIM_CONFIG_DIR = $env:LUNARVIM_CONFIG_DIR ?? "$env:XDG_CONFIG_HOME\lvi $env:LUNARVIM_CACHE_DIR = $env:LUNARVIM_CACHE_DIR ?? "$env:XDG_CACHE_HOME\lvim" $env:LUNARVIM_BASE_DIR = $env:LUNARVIM_BASE_DIR ?? "$env:LUNARVIM_RUNTIME_DIR\lvim" -nvim -u "$env:LUNARVIM_RUNTIME_DIR\lvim\init.lua" @args +nvim -u "$env:LUNARVIM_BASE_DIR\init.lua" @args diff --git a/utils/bin/lvim.template b/utils/bin/lvim.template index 1b18977d..c17d25be 100644 --- a/utils/bin/lvim.template +++ b/utils/bin/lvim.template @@ -1,7 +1,9 @@ -#!/bin/sh +#!/usr/bin/env bash export LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-RUNTIME_DIR_VAR}" export LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-CONFIG_DIR_VAR}" export LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-CACHE_DIR_VAR}" -exec nvim -u "$LUNARVIM_RUNTIME_DIR/lvim/init.lua" "$@" +export LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-BASE_DIR_VAR}" + +exec -a lvim nvim -u "$LUNARVIM_BASE_DIR/init.lua" "$@" diff --git a/utils/installer/install.sh b/utils/installer/install.sh index fee0e420..cafd92ad 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -2,20 +2,20 @@ set -eo pipefail #Set branch to master unless specified by the user -declare LV_BRANCH="${LV_BRANCH:-"master"}" -declare -r LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}" -declare -r INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" +declare -x LV_BRANCH="${LV_BRANCH:-"master"}" +declare -xr LV_REMOTE="${LV_REMOTE:-lunarvim/lunarvim.git}" +declare -xr INSTALL_PREFIX="${INSTALL_PREFIX:-"$HOME/.local"}" -declare -r XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" -declare -r XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" -declare -r XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" +declare -xr XDG_DATA_HOME="${XDG_DATA_HOME:-"$HOME/.local/share"}" +declare -xr XDG_CACHE_HOME="${XDG_CACHE_HOME:-"$HOME/.cache"}" +declare -xr XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-"$HOME/.config"}" -declare -r LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" -declare -r LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" -declare -r LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}" -declare -r LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" +declare -xr LUNARVIM_RUNTIME_DIR="${LUNARVIM_RUNTIME_DIR:-"$XDG_DATA_HOME/lunarvim"}" +declare -xr LUNARVIM_CONFIG_DIR="${LUNARVIM_CONFIG_DIR:-"$XDG_CONFIG_HOME/lvim"}" +declare -xr LUNARVIM_CACHE_DIR="${LUNARVIM_CACHE_DIR:-"$XDG_CACHE_HOME/lvim"}" +declare -xr LUNARVIM_BASE_DIR="${LUNARVIM_BASE_DIR:-"$LUNARVIM_RUNTIME_DIR/lvim"}" -declare -r LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}" +declare -xr LUNARVIM_LOG_LEVEL="${LUNARVIM_LOG_LEVEL:-warn}" declare BASEDIR BASEDIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" diff --git a/utils/installer/install_bin.sh b/utils/installer/install_bin.sh index c6ad5181..920f2fd5 100755 --- a/utils/installer/install_bin.sh +++ b/utils/installer/install_bin.sh @@ -26,7 +26,8 @@ function setup_shim() { sed -e s"#RUNTIME_DIR_VAR#\"${LUNARVIM_RUNTIME_DIR}\"#"g \ -e s"#CONFIG_DIR_VAR#\"${LUNARVIM_CONFIG_DIR}\"#"g \ - -e s"#CACHE_DIR_VAR#\"${LUNARVIM_CACHE_DIR}\"#"g "$src" \ + -e s"#CACHE_DIR_VAR#\"${LUNARVIM_CACHE_DIR}\"#"g \ + -e s"#BASE_DIR_VAR#\"${LUNARVIM_BASE_DIR}\"#"g "$src" \ | tee "$dst" >/dev/null chmod u+x "$dst" From 9dfb9ef250ba3e5a6696d8719cc2ff6b3e2ebdea Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Fri, 7 Oct 2022 04:50:01 +0000 Subject: [PATCH 099/138] feat: add new copilot and other sources (#3171) --- lua/lvim/core/cmp.lua | 63 +++++++++++++++++++++++++++++++++++++++++++ lua/lvim/icons.lua | 9 +++++++ 2 files changed, 72 insertions(+) diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 319bdc64..d302ce5f 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -19,6 +19,7 @@ end local function feedkeys(key, mode) vim.api.nvim_feedkeys(T(key), mode, true) end + M.methods.feedkeys = feedkeys ---when inside a snippet, seeks to the nearest luasnip field if possible, and checks if it is jumpable @@ -113,6 +114,7 @@ local function jumpable(dir) return luasnip.in_snippet() and seek_luasnip_cursor_node() and luasnip.jumpable(1) end end + M.methods.jumpable = jumpable M.config = function() @@ -152,6 +154,7 @@ M.config = function() luasnip = "(Snippet)", buffer = "(Buffer)", tmux = "(TMUX)", + copilot = "(Copilot)", }, duplicates = { buffer = 1, @@ -167,6 +170,36 @@ M.config = function() end if lvim.use_icons then vim_item.kind = lvim.builtin.cmp.formatting.kind_icons[vim_item.kind] + + -- TODO: not sure why I can't put this anywhere else + vim.api.nvim_set_hl(0, "CmpItemKindCopilot", { fg = "#6CC644" }) + if entry.source.name == "copilot" then + vim_item.kind = lvim.icons.git.Octoface + vim_item.kind_hl_group = "CmpItemKindCopilot" + end + + vim.api.nvim_set_hl(0, "CmpItemKindTabnine", { fg = "#CA42F0" }) + if entry.source.name == "cmp_tabnine" then + vim_item.kind = lvim.icons.misc.Robot + vim_item.kind_hl_group = "CmpItemKindTabnine" + end + + vim.api.nvim_set_hl(0, "CmpItemKindCrate", { fg = "#F64D00" }) + if entry.source.name == "crates" then + vim_item.kind = lvim.icons.misc.Package + vim_item.kind_hl_group = "CmpItemKindCrate" + end + + if entry.source.name == "lab.quick_data" then + vim_item.kind = lvim.icons.misc.CircuitBoard + vim_item.kind_hl_group = "CmpItemKindConstant" + end + + vim.api.nvim_set_hl(0, "CmpItemKindEmoji", { fg = "#FDE030" }) + if entry.source.name == "emoji" then + vim_item.kind = lvim.icons.misc.Smiley + vim_item.kind_hl_group = "CmpItemKindEmoji" + end end vim_item.menu = lvim.builtin.cmp.formatting.source_names[entry.source.name] vim_item.dup = lvim.builtin.cmp.formatting.duplicates[entry.source.name] @@ -184,6 +217,36 @@ M.config = function() documentation = cmp.config.window.bordered(), }, sources = { + { + name = "copilot", + -- keyword_length = 0, + max_item_count = 3, + trigger_characters = { + { + ".", + ":", + "(", + "'", + '"', + "[", + ",", + "#", + "*", + "@", + "|", + "=", + "-", + "{", + "/", + "\\", + "+", + "?", + " ", + -- "\t", + -- "\n", + }, + }, + }, { name = "nvim_lsp" }, { name = "path" }, { name = "luasnip" }, diff --git a/lua/lvim/icons.lua b/lua/lvim/icons.lua index 40a83ac9..d0f0cf69 100644 --- a/lua/lvim/icons.lua +++ b/lua/lvim/icons.lua @@ -142,4 +142,13 @@ return { Debug = "", Trace = "✎", }, + misc = { + Robot = "ﮧ", + Squirrel = "", + Tag = "", + Watch = "", + Smiley = "ﲃ", + Package = "", + CircuitBoard = "", + }, } From dcdfbf1727731c6779396ce450a6b9d33849f835 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Fri, 7 Oct 2022 04:52:37 +0000 Subject: [PATCH 100/138] feat: use icon for copilot in statusline (#3173) --- lua/lvim/core/lualine/components.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index badece1e..91411d64 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -16,6 +16,7 @@ local statusline_hl = vim.api.nvim_get_hl_by_name("StatusLine", true) local cursorline_hl = vim.api.nvim_get_hl_by_name("CursorLine", true) local normal_hl = vim.api.nvim_get_hl_by_name("Normal", true) +vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = "NONE" }) vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = cursorline_hl.background }) vim.api.nvim_set_hl(0, "SLBranchName", { fg = normal_hl.foreground, bg = cursorline_hl.background }) vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.background }) @@ -122,12 +123,17 @@ return { end local buf_ft = vim.bo.filetype local buf_client_names = {} + local copilot_active = false -- add client for _, client in pairs(buf_clients) do - if client.name ~= "null-ls" then + if client.name ~= "null-ls" and client.name ~= "copilot" then table.insert(buf_client_names, client.name) end + + if client.name == "copilot" then + copilot_active = true + end end -- add formatter @@ -141,7 +147,14 @@ return { vim.list_extend(buf_client_names, supported_linters) local unique_client_names = vim.fn.uniq(buf_client_names) - return "[" .. table.concat(unique_client_names, ", ") .. "]" + + local language_servers = "[" .. table.concat(unique_client_names, ", ") .. "]" + + if copilot_active then + language_servers = language_servers .. "%#SLCopilot#" .. " " .. lvim.icons.git.Octoface .. "%*" + end + + return language_servers end, separator = separator, color = { gui = "bold" }, From 9509cadf402fd85f8a184fe334f870d701fdc48a Mon Sep 17 00:00:00 2001 From: opalmay <65673442+opalmay@users.noreply.github.com> Date: Fri, 7 Oct 2022 08:17:18 +0300 Subject: [PATCH 101/138] feat: buffer cmp for search, and path for command mode (#3147) --- lua/lvim/core/cmp.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index d302ce5f..1b56fed6 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -260,8 +260,8 @@ M.config = function() { name = "tmux" }, }, mapping = cmp.mapping.preset.insert { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), [""] = cmp.mapping(cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select }, { "i" }), [""] = cmp.mapping(cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select }, { "i" }), [""] = cmp.mapping.scroll_docs(-4), @@ -325,7 +325,21 @@ M.config = function() end function M.setup() - require("cmp").setup(lvim.builtin.cmp) + local cmp = require "cmp" + cmp.setup(lvim.builtin.cmp) + + cmp.setup.cmdline(":", { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "path" }, + }, + }) + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) end return M From 49de031b243c11ae2e5e21466449f64b30600167 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Fri, 7 Oct 2022 02:27:29 -0400 Subject: [PATCH 102/138] fix: nvim_dap has an issue with setting winbar for dapui_console filetype --- lua/lvim/core/breadcrumbs.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 149b5fcf..790713af 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -86,6 +86,7 @@ M.winbar_filetype_exclude = { "harpoon", "dap-repl", "dap-terminal", + "dapui_console", "lab", "Markdown", "", @@ -125,9 +126,9 @@ M.get_filename = function() file_icon = lvim.icons.ui.Watches end - if buf_ft == "dapui_console" then - file_icon = lvim.icons.ui.DebugConsole - end + -- if buf_ft == "dapui_console" then + -- file_icon = lvim.icons.ui.DebugConsole + -- end local navic_text = vim.api.nvim_get_hl_by_name("Normal", true) vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text.foreground }) @@ -225,3 +226,4 @@ M.create_winbar = function() end return M + From 9d3e1636568f5568d26817b1f8710afa27e2920f Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Fri, 7 Oct 2022 02:27:58 -0400 Subject: [PATCH 103/138] fix: formatting --- lua/lvim/core/breadcrumbs.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 790713af..33770af0 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -226,4 +226,3 @@ M.create_winbar = function() end return M - From a9f544ca786085995a025cd84753ccbfecc971ab Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Fri, 7 Oct 2022 04:25:40 -0400 Subject: [PATCH 104/138] feat: reduce noise from LSP text comes from buffer source anyway --- lua/lvim/core/cmp.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 1b56fed6..5163b877 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -247,7 +247,20 @@ M.config = function() }, }, }, - { name = "nvim_lsp" }, + { + name = "nvim_lsp", + entry_filter = function(entry, ctx) + local kind = require("cmp.types").lsp.CompletionItemKind[entry:get_kind()] + if kind == "Snippet" and ctx.prev_context.filetype == "java" then + return false + end + if kind == "Text" then + return false + end + return true + end, + }, + { name = "path" }, { name = "luasnip" }, { name = "cmp_tabnine" }, From 86dd1f113246d06859db600b08d05d807d29b5bb Mon Sep 17 00:00:00 2001 From: Leung Yau Ming Date: Fri, 7 Oct 2022 22:41:10 +0800 Subject: [PATCH 105/138] fix(typo): fix language server name typo in config example (#3176) --- utils/installer/config.example.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua index 9f54c2a4..ee599d1b 100644 --- a/utils/installer/config.example.lua +++ b/utils/installer/config.example.lua @@ -92,7 +92,7 @@ lvim.builtin.treesitter.highlight.enable = true -- -- make sure server will always be installed even if the server is in skipped_servers list -- lvim.lsp.installer.setup.ensure_installed = { --- "sumeko_lua", +-- "sumneko_lua", -- "jsonls", -- } -- -- change UI setting of `LspInstallInfo` From 099b96712fa5f7326865f229ddaabd2e190aa731 Mon Sep 17 00:00:00 2001 From: Hemanth Kotagiri Date: Sat, 8 Oct 2022 11:42:33 +0530 Subject: [PATCH 106/138] Add: Workflow to stale/close inactive issues | Fixes #3168 (#3177) --- .github/workflows/close-inactive-bot.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/close-inactive-bot.yml diff --git a/.github/workflows/close-inactive-bot.yml b/.github/workflows/close-inactive-bot.yml new file mode 100644 index 00000000..0ae33625 --- /dev/null +++ b/.github/workflows/close-inactive-bot.yml @@ -0,0 +1,22 @@ +name: Close inactive issues +on: + schedule: + - cron: '30 1 * * *' + +jobs: + close-issues: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v5 + with: + days-before-issue-stale: 30 + days-before-issue-close: 14 + stale-issue-label: 'stale' + stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity.' + close-issue-message: 'This issue was closed because it has been inactive for 14 days since being marked as stale.' + days-before-pr-stale: -1 + days-before-pr-close: -1 + repo-token: ${{ secrets.GITHUB_TOKEN }} From 53fb663efeac9a7b3a4503c59849b13a6afc33ff Mon Sep 17 00:00:00 2001 From: Opal Mizrahi Date: Sat, 8 Oct 2022 23:10:28 +0300 Subject: [PATCH 107/138] fix: telescope delete_buffer binds correct scope --- lua/lvim/core/telescope.lua | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index 6e614dd9..e7b8db8e 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -19,6 +19,14 @@ local pickers = { theme = "dropdown", previewer = false, initial_mode = "normal", + mappings = { + i = { + [""] = require("telescope.actions").delete_buffer, + }, + n = { + ["dd"] = require("telescope.actions").delete_buffer, + }, + }, }, planets = { show_pluto = true, @@ -95,6 +103,7 @@ function M.config() "--hidden", "--glob=!.git/", }, + ---@usage Mappings are fully customizable. Many familiar mapping patterns are setup as defaults. mappings = { i = { [""] = actions.move_selection_next, @@ -104,13 +113,11 @@ function M.config() [""] = actions.cycle_history_prev, [""] = actions.smart_send_to_qflist + actions.open_qflist, [""] = actions.select_default, - [""] = require("telescope.actions").delete_buffer, }, n = { [""] = actions.move_selection_next, [""] = actions.move_selection_previous, [""] = actions.smart_send_to_qflist + actions.open_qflist, - ["dd"] = require("telescope.actions").delete_buffer, }, }, pickers = pickers, @@ -137,7 +144,6 @@ end function M.setup() local previewers = require "telescope.previewers" local sorters = require "telescope.sorters" - local actions = require "telescope.actions" lvim.builtin.telescope = vim.tbl_extend("keep", { file_previewer = previewers.vim_buffer_cat.new, @@ -145,24 +151,6 @@ function M.setup() qflist_previewer = previewers.vim_buffer_qflist.new, file_sorter = sorters.get_fuzzy_file, generic_sorter = sorters.get_generic_fuzzy_sorter, - ---@usage Mappings are fully customizable. Many familiar mapping patterns are setup as defaults. - mappings = { - i = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.close, - [""] = actions.cycle_history_next, - [""] = actions.cycle_history_prev, - [""] = actions.smart_send_to_qflist + actions.open_qflist, - [""] = actions.select_default + actions.center, - }, - n = { - [""] = actions.move_selection_next, - [""] = actions.move_selection_previous, - [""] = actions.smart_send_to_qflist + actions.open_qflist, - ["dd"] = require("telescope.actions").delete_buffer, - }, - }, }, lvim.builtin.telescope) local telescope = require "telescope" From 9925edf79e1aa00a0b00eb20146edef6c3920496 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sat, 8 Oct 2022 22:14:21 +0000 Subject: [PATCH 108/138] fix(lualine): guard setup on install (#3185) --- lua/lvim/core/lualine/init.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lua/lvim/core/lualine/init.lua b/lua/lvim/core/lualine/init.lua index cd6237bf..f7cacb35 100644 --- a/lua/lvim/core/lualine/init.lua +++ b/lua/lvim/core/lualine/init.lua @@ -34,6 +34,12 @@ M.config = function() end M.setup = function() + if #vim.api.nvim_list_uis() == 0 then + local Log = require "lvim.core.log" + Log:debug "headless mode detected, skipping running setup for lualine" + return + end + local status_ok, lualine = pcall(require, "lualine") if not status_ok then return From 5699a5e5573b0766a37b7f115bc49efd52a00822 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Sat, 8 Oct 2022 18:31:02 -0400 Subject: [PATCH 109/138] fix(installer): don't set log level --- utils/installer/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/installer/install.sh b/utils/installer/install.sh index cafd92ad..aefc52c2 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -445,7 +445,6 @@ function setup_lvim() { echo "Preparing Packer setup" "$INSTALL_PREFIX/bin/lvim" --headless \ - -c "lua require('lvim.core.log'):set_level([[$LUNARVIM_LOG_LEVEL]])" \ -c 'autocmd User PackerComplete quitall' \ -c 'PackerSync' From 3d36b20de20ab9d3a92fd27c70adb83a5467e62c Mon Sep 17 00:00:00 2001 From: Opal Mizrahi Date: Sun, 9 Oct 2022 01:48:59 +0300 Subject: [PATCH 110/138] fix: move telescope.actions pcall to the top --- lua/lvim/core/telescope.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index e7b8db8e..b854a6c1 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -1,5 +1,10 @@ local M = {} +local ok, actions = pcall(require, "telescope.actions") +if not ok then + return +end + local pickers = { find_files = { theme = "dropdown", @@ -21,10 +26,10 @@ local pickers = { initial_mode = "normal", mappings = { i = { - [""] = require("telescope.actions").delete_buffer, + [""] = actions.delete_buffer, }, n = { - ["dd"] = require("telescope.actions").delete_buffer, + ["dd"] = actions.delete_buffer, }, }, }, @@ -65,10 +70,6 @@ function M.config() on_config_done = nil, } - local ok, actions = pcall(require, "telescope.actions") - if not ok then - return - end lvim.builtin.telescope = vim.tbl_extend("force", lvim.builtin.telescope, { defaults = { prompt_prefix = lvim.icons.ui.Telescope .. " ", From 8763ed28782a6196d2594016b44dcc9d1aa1b5c6 Mon Sep 17 00:00:00 2001 From: CPea <42694704+cpea2506@users.noreply.github.com> Date: Sun, 9 Oct 2022 05:50:25 +0700 Subject: [PATCH 111/138] feat: warn user when setting un-installed colorscheme (#2982) --- lua/lvim/core/theme.lua | 18 +++++++++++++----- lua/lvim/plugin-loader.lua | 4 +--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua index 394963a0..0f960d3d 100644 --- a/lua/lvim/core/theme.lua +++ b/lua/lvim/core/theme.lua @@ -1,3 +1,5 @@ +local Log = require "lvim.core.log" + local M = {} M.config = function() @@ -85,20 +87,26 @@ end M.setup = function() -- avoid running in headless mode since it's harder to detect failures if #vim.api.nvim_list_uis() == 0 then - local Log = require "lvim.core.log" Log:debug "headless mode detected, skipping running setup for lualine" return end local status_ok, theme = pcall(require, "tokyonight") - if not status_ok then - return + if status_ok and theme then + theme.setup(lvim.builtin.theme.options) end - theme.setup(lvim.builtin.theme.options) + -- ref: https://github.com/neovim/neovim/issues/18201#issuecomment-1104754564 + local colors = vim.api.nvim_get_runtime_file(("colors/%s.*"):format(lvim.colorscheme), false) + if #colors == 0 then + Log:warn(string.format("Could not find '%s' colorscheme", lvim.colorscheme)) + lvim.colorscheme = "tokyonight" + end + + vim.g.colors_name = lvim.colorscheme + vim.cmd("colorscheme " .. lvim.colorscheme) require("lvim.core.lualine").setup() - require("lvim.core.lir").icon_setup() end diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index d09c722b..392d3ceb 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -106,10 +106,8 @@ function plugin_loader.load(configurations) end end end) - -- colorscheme must get called after plugins are loaded or it will break new installs. - vim.g.colors_name = lvim.colorscheme - vim.cmd("colorscheme " .. lvim.colorscheme) end, debug.traceback) + if not status_ok then Log:warn "problems detected while loading plugins' configurations" Log:trace(debug.traceback()) From e6f50af1de686ba33b794f50957352b40ccb4bd2 Mon Sep 17 00:00:00 2001 From: Leung Yau Ming Date: Sun, 9 Oct 2022 07:08:15 +0800 Subject: [PATCH 112/138] fix(typo): fix language server name typo in config example #3176 (#3183) --- utils/installer/config_win.example.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/installer/config_win.example.lua b/utils/installer/config_win.example.lua index bc83aab7..40cc34e8 100644 --- a/utils/installer/config_win.example.lua +++ b/utils/installer/config_win.example.lua @@ -107,7 +107,7 @@ lvim.builtin.treesitter.highlight.enable = true -- -- make sure server will always be installed even if the server is in skipped_servers list -- lvim.lsp.installer.setup.ensure_installed = { --- "sumeko_lua", +-- "sumneko_lua", -- "jsonls", -- } -- -- change UI setting of `LspInstallInfo` From 5aec1756cefb39788a0fb4259223f7c72efa7e72 Mon Sep 17 00:00:00 2001 From: Ali Almohaya Date: Sun, 9 Oct 2022 02:10:53 +0300 Subject: [PATCH 113/138] feat(cmp): add configs for cmp.setup.cmdline (#3180) --- lua/lvim/core/cmp.lua | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 5163b877..42ba7003 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -334,6 +334,23 @@ M.config = function() fallback() -- if not exited early, always fallback end), }, + cmdline = { + enable = true, + options = { + { + type = ":", + sources = { + { name = "path" }, + }, + }, + { + type = { "/", "?" }, + sources = { + { name = "buffer" }, + }, + }, + }, + }, } end @@ -341,18 +358,14 @@ function M.setup() local cmp = require "cmp" cmp.setup(lvim.builtin.cmp) - cmp.setup.cmdline(":", { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "path" }, - }, - }) - cmp.setup.cmdline({ "/", "?" }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = "buffer" }, - }, - }) + if lvim.builtin.cmp.cmdline.enable then + for _, option in ipairs(lvim.builtin.cmp.cmdline.options) do + cmp.setup.cmdline(option.type, { + mapping = cmp.mapping.preset.cmdline(), + sources = option.sources, + }) + end + end end return M From 096c5ca83a89fe19e05ee4c3bbbc034620cac916 Mon Sep 17 00:00:00 2001 From: Opal Mizrahi Date: Sun, 9 Oct 2022 02:20:35 +0300 Subject: [PATCH 114/138] fix: use function for pickers --- lua/lvim/core/telescope.lua | 121 ++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/lua/lvim/core/telescope.lua b/lua/lvim/core/telescope.lua index b854a6c1..77bf552d 100644 --- a/lua/lvim/core/telescope.lua +++ b/lua/lvim/core/telescope.lua @@ -1,65 +1,62 @@ local M = {} -local ok, actions = pcall(require, "telescope.actions") -if not ok then - return -end - -local pickers = { - find_files = { - theme = "dropdown", - hidden = true, - previewer = false, - }, - live_grep = { - --@usage don't include the filename in the search results - only_sort_text = true, - theme = "dropdown", - }, - grep_string = { - only_sort_text = true, - theme = "dropdown", - }, - buffers = { - theme = "dropdown", - previewer = false, - initial_mode = "normal", - mappings = { - i = { - [""] = actions.delete_buffer, - }, - n = { - ["dd"] = actions.delete_buffer, +local function get_pickers(actions) + return { + find_files = { + theme = "dropdown", + hidden = true, + previewer = false, + }, + live_grep = { + --@usage don't include the filename in the search results + only_sort_text = true, + theme = "dropdown", + }, + grep_string = { + only_sort_text = true, + theme = "dropdown", + }, + buffers = { + theme = "dropdown", + previewer = false, + initial_mode = "normal", + mappings = { + i = { + [""] = actions.delete_buffer, + }, + n = { + ["dd"] = actions.delete_buffer, + }, }, }, - }, - planets = { - show_pluto = true, - show_moon = true, - }, - git_files = { - theme = "dropdown", - hidden = true, - previewer = false, - show_untracked = true, - }, - lsp_references = { - theme = "dropdown", - initial_mode = "normal", - }, - lsp_definitions = { - theme = "dropdown", - initial_mode = "normal", - }, - lsp_declarations = { - theme = "dropdown", - initial_mode = "normal", - }, - lsp_implementations = { - theme = "dropdown", - initial_mode = "normal", - }, -} + planets = { + show_pluto = true, + show_moon = true, + }, + git_files = { + theme = "dropdown", + hidden = true, + previewer = false, + show_untracked = true, + }, + lsp_references = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_definitions = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_declarations = { + theme = "dropdown", + initial_mode = "normal", + }, + lsp_implementations = { + theme = "dropdown", + initial_mode = "normal", + }, + } +end function M.config() -- Define this minimal config so that it's available if telescope is not yet available. @@ -70,6 +67,10 @@ function M.config() on_config_done = nil, } + local ok, actions = pcall(require, "telescope.actions") + if not ok then + return + end lvim.builtin.telescope = vim.tbl_extend("force", lvim.builtin.telescope, { defaults = { prompt_prefix = lvim.icons.ui.Telescope .. " ", @@ -121,7 +122,7 @@ function M.config() [""] = actions.smart_send_to_qflist + actions.open_qflist, }, }, - pickers = pickers, + pickers = get_pickers(actions), file_ignore_patterns = {}, path_display = { "smart" }, winblend = 0, @@ -130,7 +131,7 @@ function M.config() color_devicons = true, set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil, }, - pickers = pickers, + pickers = get_pickers(actions), extensions = { fzf = { fuzzy = true, -- false will only do exact matching From c8ef47622d4b9d24e72f4a997de10d642f8de17c Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Sun, 9 Oct 2022 03:49:45 -0400 Subject: [PATCH 115/138] fix(lualine): globalstatus=true by default --- lua/lvim/core/autocmds.lua | 11 ----------- lua/lvim/core/lualine/init.lua | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index ee5d8f13..0e6b4cd7 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -125,17 +125,6 @@ function M.load_defaults() end, }, }, - -- TODO: figure out what keeps overriding laststatus - { - "BufWinEnter", - { - group = "_last_status", - pattern = "*", - callback = function() - vim.opt.laststatus = 3 - end, - }, - }, } M.define_autocmds(definitions) diff --git a/lua/lvim/core/lualine/init.lua b/lua/lvim/core/lualine/init.lua index f7cacb35..0ee35c04 100644 --- a/lua/lvim/core/lualine/init.lua +++ b/lua/lvim/core/lualine/init.lua @@ -9,7 +9,7 @@ M.config = function() section_separators = nil, theme = nil, disabled_filetypes = nil, - globalstatus = false, + globalstatus = true, }, sections = { lualine_a = nil, From 523bafacb67708d56d0c05eadd6968eb58957c0e Mon Sep 17 00:00:00 2001 From: opalmay <65673442+opalmay@users.noreply.github.com> Date: Sun, 9 Oct 2022 22:55:47 +0300 Subject: [PATCH 116/138] Feat(installer): desktop entry (#3187) Co-authored-by: Opal Mizrahi --- utils/desktop/16x16/lvim.svg | 10 ++++++++++ utils/desktop/22x22/lvim.svg | 16 ++++++++++++++++ utils/desktop/24x24/lvim.svg | 16 ++++++++++++++++ utils/desktop/32x32/lvim.svg | 16 ++++++++++++++++ utils/desktop/48x48/lvim.svg | 16 ++++++++++++++++ utils/desktop/64x64/lvim.svg | 16 ++++++++++++++++ utils/desktop/lvim.desktop | 2 +- utils/installer/install.sh | 18 ++++++++++++++++++ 8 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 utils/desktop/16x16/lvim.svg create mode 100644 utils/desktop/22x22/lvim.svg create mode 100644 utils/desktop/24x24/lvim.svg create mode 100644 utils/desktop/32x32/lvim.svg create mode 100644 utils/desktop/48x48/lvim.svg create mode 100644 utils/desktop/64x64/lvim.svg diff --git a/utils/desktop/16x16/lvim.svg b/utils/desktop/16x16/lvim.svg new file mode 100644 index 00000000..6898fd0d --- /dev/null +++ b/utils/desktop/16x16/lvim.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/utils/desktop/22x22/lvim.svg b/utils/desktop/22x22/lvim.svg new file mode 100644 index 00000000..06f24f5b --- /dev/null +++ b/utils/desktop/22x22/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/utils/desktop/24x24/lvim.svg b/utils/desktop/24x24/lvim.svg new file mode 100644 index 00000000..456298df --- /dev/null +++ b/utils/desktop/24x24/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/utils/desktop/32x32/lvim.svg b/utils/desktop/32x32/lvim.svg new file mode 100644 index 00000000..13e53c24 --- /dev/null +++ b/utils/desktop/32x32/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/utils/desktop/48x48/lvim.svg b/utils/desktop/48x48/lvim.svg new file mode 100644 index 00000000..35baac28 --- /dev/null +++ b/utils/desktop/48x48/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/utils/desktop/64x64/lvim.svg b/utils/desktop/64x64/lvim.svg new file mode 100644 index 00000000..fd2a964e --- /dev/null +++ b/utils/desktop/64x64/lvim.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/utils/desktop/lvim.desktop b/utils/desktop/lvim.desktop index f570cfae..cb4cb476 100644 --- a/utils/desktop/lvim.desktop +++ b/utils/desktop/lvim.desktop @@ -7,7 +7,7 @@ Exec=lvim %F Terminal=true Type=Application Keywords=Text;editor; -Icon=nvim +Icon=lvim Categories=Utility;TextEditor; StartupNotify=false MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; diff --git a/utils/installer/install.sh b/utils/installer/install.sh index aefc52c2..bd751abe 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -439,6 +439,8 @@ function setup_lvim() { setup_shim + create_desktop_file + [ ! -f "$LUNARVIM_CONFIG_DIR/config.lua" ] \ && cp "$LUNARVIM_BASE_DIR/utils/installer/config.example.lua" "$LUNARVIM_CONFIG_DIR/config.lua" @@ -453,6 +455,22 @@ function setup_lvim() { verify_core_plugins } +function create_desktop_file() { + OS="$(uname -s)" + # TODO: Any other OSes that use desktop files? + [ "$OS" != "Linux" ] && return + echo "Creating desktop file" + + for d in "$LUNARVIM_BASE_DIR"/utils/desktop/*/; do + size_folder=$(basename "$d") + mkdir -p "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps/" + cp "$LUNARVIM_BASE_DIR/utils/desktop/$size_folder/lvim.svg" "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps" + done + + cp "$LUNARVIM_BASE_DIR/utils/desktop/lvim.desktop" "$XDG_DATA_HOME/applications/lvim.desktop" + xdg-desktop-menu forceupdate +} + function print_logo() { cat <<'EOF' From 4fa96e8e791a54c7d474e6f6cc6735bb5694765b Mon Sep 17 00:00:00 2001 From: opalmay <65673442+opalmay@users.noreply.github.com> Date: Mon, 10 Oct 2022 02:23:29 +0300 Subject: [PATCH 117/138] feat(uninstaller): desktop entry feat(uninstaller): desktop entry --- utils/installer/uninstall.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh index 8fc8e693..16d3c365 100755 --- a/utils/installer/uninstall.sh +++ b/utils/installer/uninstall.sh @@ -60,12 +60,23 @@ function remove_lvim_bin() { rm -f "$lvim_bin" } +function remove_desktop_file() { + OS="$(uname -s)" + # TODO: Any other OSes that use desktop files? + [ "$OS" != "Linux" ] && return + echo "Removing desktop file..." + + find "$XDG_DATA_HOME/icons/hicolor" -name "lvim.svg" -type f -delete + rm "$XDG_DATA_HOME/applications/lvim.desktop" +} + function main() { parse_arguments "$@" echo "Removing LunarVim binary..." remove_lvim_bin echo "Removing LunarVim directories..." remove_lvim_dirs + remove_desktop_file echo "Uninstalled LunarVim!" } From 34d445a052344cf0e4149459311a4b92653e8a6f Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 10 Oct 2022 00:52:51 -0400 Subject: [PATCH 118/138] fix(plugins): set max jobs to 50 on mac --- lua/lvim/plugin-loader.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/lvim/plugin-loader.lua b/lua/lvim/plugin-loader.lua index 392d3ceb..f6cb4651 100644 --- a/lua/lvim/plugin-loader.lua +++ b/lua/lvim/plugin-loader.lua @@ -16,11 +16,16 @@ function plugin_loader.init(opts) local install_path = opts.install_path or join_paths(vim.fn.stdpath "data", "site", "pack", "packer", "start", "packer.nvim") + local max_jobs = 100 + if vim.fn.has "mac" == 1 then + max_jobs = 50 + end + local init_opts = { package_root = opts.package_root or join_paths(vim.fn.stdpath "data", "site", "pack"), compile_path = compile_path, snapshot_path = snapshot_path, - max_jobs = 100, + max_jobs = max_jobs, log = { level = "warn" }, git = { clone_timeout = 120, From 16a8b92f40805f285822e24494fb7e6b6e19c1a3 Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 10 Oct 2022 00:57:45 -0400 Subject: [PATCH 119/138] chore(illuminate): pcall for configure --- lua/lvim/core/illuminate.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index ddff195a..a3ca6711 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -55,7 +55,10 @@ M.setup = function() return end - illuminate.configure(lvim.builtin.illuminate.options) + local config_ok, _ = pcall(illuminate.configure, lvim.builtin.illuminate.options) + if not config_ok then + return + end if lvim.builtin.illuminate.on_config_done then lvim.builtin.illuminate.on_config_done() From c6fd52b043056a993a762a928b8214041402e268 Mon Sep 17 00:00:00 2001 From: Ali Almohaya Date: Tue, 11 Oct 2022 19:40:39 +0300 Subject: [PATCH 120/138] chore: bump nvim-tree.lua version to `b01e7be` (#3203) --- snapshots/default.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snapshots/default.json b/snapshots/default.json index 78fe9a1f..109c7830 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -75,7 +75,7 @@ "commit": "4144654" }, "nvim-tree.lua": { - "commit": "7282f7d" + "commit": "b01e7be" }, "nvim-treesitter": { "commit": "8e76333" From 91dadd46a9d3c93b936ae79912e28d250f883e60 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Wed, 12 Oct 2022 16:16:53 +0330 Subject: [PATCH 121/138] fix(lua-dev): make sure we are loading the correct types (#3208) --- lua/lvim/lsp/providers/sumneko_lua.lua | 4 ++-- snapshots/default.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lvim/lsp/providers/sumneko_lua.lua b/lua/lvim/lsp/providers/sumneko_lua.lua index 948f1fd9..466c9151 100644 --- a/lua/lvim/lsp/providers/sumneko_lua.lua +++ b/lua/lvim/lsp/providers/sumneko_lua.lua @@ -2,10 +2,10 @@ local default_workspace = { library = { vim.fn.expand "$VIMRUNTIME", get_lvim_base_dir(), - require("lua-dev.sumneko").types(), + require("lua-dev.config").types(), }, - maxPreload = 1000, + maxPreload = 5000, preloadFileSize = 10000, } diff --git a/snapshots/default.json b/snapshots/default.json index 109c7830..8fab98d0 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -36,7 +36,7 @@ "commit": "7d8c6c4" }, "lua-dev.nvim": { - "commit": "2ffe2f6" + "commit": "2410be2" }, "lualine.nvim": { "commit": "a52f078" From ea1ebda243610d81325f75249423d59a5678cf65 Mon Sep 17 00:00:00 2001 From: tobdob Date: Thu, 13 Oct 2022 02:12:27 +0200 Subject: [PATCH 122/138] fix: Remove J and K key mappings for move (#3206) --- lua/lvim/keymappings.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/lvim/keymappings.lua b/lua/lvim/keymappings.lua index 8c182682..0f3bf6ba 100644 --- a/lua/lvim/keymappings.lua +++ b/lua/lvim/keymappings.lua @@ -83,10 +83,6 @@ local defaults = { }, visual_block_mode = { - -- Move selected line / block of text in visual mode - ["K"] = ":move '<-2gv-gv", - ["J"] = ":move '>+1gv-gv", - -- Move current line / block with Alt-j/k ala vscode. [""] = ":m '>+1gv-gv", [""] = ":m '<-2gv-gv", From fcced1811ec45f0c3e58eef99dd962ef872be20b Mon Sep 17 00:00:00 2001 From: Ali Almohaya Date: Thu, 13 Oct 2022 03:35:48 +0300 Subject: [PATCH 123/138] fix: typo in git.lua --- lua/lvim/utils/git.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/utils/git.lua b/lua/lvim/utils/git.lua index e1b5ccf2..c1bdca1b 100644 --- a/lua/lvim/utils/git.lua +++ b/lua/lvim/utils/git.lua @@ -40,7 +40,7 @@ local function safe_deep_fetch() Log:error(vim.inspect(error)) return end - -- git fetch --unshallow will cause an error on a a complete clone + -- git fetch --unshallow will cause an error on a complete clone local fetch_mode = result[1] == "true" and "--unshallow" or "--all" ret = git_cmd { args = { "fetch", fetch_mode } } if ret ~= 0 then From 09cbce44e54976a809c941a71579d7b3b4862b4e Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Thu, 13 Oct 2022 15:21:25 +0330 Subject: [PATCH 124/138] fix(breadcrumbs): make sure winbar_filetype_exclude is customizable (#3221) --- lua/lvim/core/breadcrumbs.lua | 53 ++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 33770af0..10f3f72f 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -8,6 +8,32 @@ M.config = function() lvim.builtin.breadcrumbs = { active = true, on_config_done = nil, + winbar_filetype_exclude = { + "help", + "startify", + "dashboard", + "packer", + "neo-tree", + "neogitstatus", + "NvimTree", + "Trouble", + "alpha", + "lir", + "Outline", + "spectre_panel", + "toggleterm", + "DressingSelect", + "Jaq", + "harpoon", + "dap-repl", + "dap-terminal", + "dapui_console", + "lab", + "Markdown", + "notify", + "noice", + "", + }, options = { icons = { Array = icons.Array .. " ", @@ -67,31 +93,6 @@ M.setup = function() end end -M.winbar_filetype_exclude = { - "help", - "startify", - "dashboard", - "packer", - "neo-tree", - "neogitstatus", - "NvimTree", - "Trouble", - "alpha", - "lir", - "Outline", - "spectre_panel", - "toggleterm", - "DressingSelect", - "Jaq", - "harpoon", - "dap-repl", - "dap-terminal", - "dapui_console", - "lab", - "Markdown", - "", -} - M.get_filename = function() local filename = vim.fn.expand "%:t" local extension = vim.fn.expand "%:e" @@ -161,7 +162,7 @@ local get_gps = function() end local excludes = function() - if vim.tbl_contains(M.winbar_filetype_exclude, vim.bo.filetype) then + if vim.tbl_contains(lvim.builtin.breadcrumbs.winbar_filetype_exclude, vim.bo.filetype) then return true end return false From c94450633af035b5a577ac34c7817b65d0f6b5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Rodr=C3=ADguez=20Rivero?= Date: Fri, 14 Oct 2022 10:32:14 +0200 Subject: [PATCH 125/138] fix: name treesitter source in cmp (#3223) --- lua/lvim/core/cmp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/core/cmp.lua b/lua/lvim/core/cmp.lua index 42ba7003..4ebc4d43 100644 --- a/lua/lvim/core/cmp.lua +++ b/lua/lvim/core/cmp.lua @@ -155,6 +155,7 @@ M.config = function() buffer = "(Buffer)", tmux = "(TMUX)", copilot = "(Copilot)", + treesitter = "(TreeSitter)", }, duplicates = { buffer = 1, From d433409995250f29437831d1961346821e364292 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Fri, 14 Oct 2022 14:09:08 +0200 Subject: [PATCH 126/138] feat: latest impatient updates from upstream (#3236) --- .luacheckrc | 2 + lua/lvim/impatient.lua | 309 ++++++++++++++++++++++----------- lua/lvim/impatient/profile.lua | 115 ++++++------ lua/lvim/utils/hooks.lua | 5 +- 4 files changed, 277 insertions(+), 154 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 7c592693..53307087 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,3 +1,4 @@ +---@diagnostic disable -- vim: ft=lua tw=80 stds.nvim = { @@ -30,6 +31,7 @@ stds.nvim = { std = "lua51+nvim" files["tests/*_spec.lua"].std = "lua51+nvim+busted" +files["lua/lvim/impatient*"].ignore = {"121"} -- Don't report unused self arguments of methods. self = false diff --git a/lua/lvim/impatient.lua b/lua/lvim/impatient.lua index fe26b940..beb3862a 100644 --- a/lua/lvim/impatient.lua +++ b/lua/lvim/impatient.lua @@ -1,5 +1,4 @@ -- modified version from https://github.com/lewis6991/impatient.nvim - local vim = vim local api = vim.api local uv = vim.loop @@ -7,66 +6,96 @@ local _loadfile = loadfile local get_runtime = api.nvim__get_runtime local fs_stat = uv.fs_stat local mpack = vim.mpack +local loadlib = package.loadlib -local appdir = os.getenv "APPDIR" +local std_cache = vim.fn.stdpath "cache" -local M = { +local sep +if jit.os == "Windows" then + sep = "\\" +else + sep = "/" +end + +local std_dirs = { + [""] = os.getenv "APPDIR", + [""] = os.getenv "VIMRUNTIME", + [""] = vim.fn.stdpath "data", + [""] = vim.fn.stdpath "config", + [""] = get_lvim_base_dir(), + [""] = get_runtime_dir(), + [""] = get_config_dir(), +} + +local function modpath_mangle(modpath) + for name, dir in pairs(std_dirs) do + modpath = modpath:gsub(dir, name) + end + return modpath +end + +local function modpath_unmangle(modpath) + for name, dir in pairs(std_dirs) do + modpath = modpath:gsub(name, dir) + end + return modpath +end + +-- Overridable by user +local default_config = { + chunks = { + enable = true, + path = std_cache .. sep .. "luacache_chunks", + }, + modpaths = { + enable = true, + path = std_cache .. sep .. "luacache_modpaths", + }, +} + +-- State used internally +local default_state = { chunks = { cache = {}, profile = nil, dirty = false, - path = vim.fn.stdpath "cache" .. "/luacache_chunks", + get = function(self, path) + return self.cache[modpath_mangle(path)] + end, + set = function(self, path, chunk) + self.cache[modpath_mangle(path)] = chunk + end, }, modpaths = { cache = {}, profile = nil, dirty = false, - path = vim.fn.stdpath "cache" .. "/luacache_modpaths", + get = function(self, mod) + if self.cache[mod] then + return modpath_unmangle(self.cache[mod]) + end + end, + set = function(self, mod, path) + self.cache[mod] = modpath_mangle(path) + end, }, log = {}, } +---@diagnostic disable-next-line: undefined-field +local M = vim.tbl_deep_extend("keep", _G.__luacache_config or {}, default_config, default_state) _G.__luacache = M -if not get_runtime then - -- nvim 0.5 compat - get_runtime = function(paths, all, _) - local r = {} - for _, path in ipairs(paths) do - local found = api.nvim_get_runtime_file(path, all) - for i = 1, #found do - r[#r + 1] = found[i] - end - end - return r - end -end - local function log(...) M.log[#M.log + 1] = table.concat({ string.format(...) }, " ") end -function M.print_log() +local function print_log() for _, l in ipairs(M.log) do print(l) end end -function M.enable_profile() - local P = require "lvim.impatient.profile" - - M.chunks.profile = {} - M.modpaths.profile = {} - - P.setup(M.modpaths.profile) - - M.print_profile = function() - P.print_profile(M) - end - - vim.cmd [[command! LuaCacheProfile lua _G.__luacache.print_profile()]] -end - local function hash(modpath) local stat = fs_stat(modpath) if stat then @@ -75,20 +104,6 @@ local function hash(modpath) error("Could not hash " .. modpath) end -local function modpath_mangle(modpath) - if appdir then - modpath = modpath:gsub(appdir, "/$APPDIR") - end - return modpath -end - -local function modpath_unmangle(modpath) - if appdir then - modpath = modpath:gsub("/$APPDIR", appdir) - end - return modpath -end - local function profile(m, entry, name, loader) if m.profile then local mp = m.profile @@ -107,18 +122,41 @@ local function mprofile(mod, name, loader) end local function cprofile(path, name, loader) + if M.chunks.profile then + path = modpath_mangle(path) + end profile(M.chunks, path, name, loader) end -local function get_runtime_file(basename, paths) +function M.enable_profile() + local P = require "lvim.impatient.profile" + + M.chunks.profile = {} + M.modpaths.profile = {} + + loadlib = function(path, fun) + cprofile(path, "load_start") + local f, err = package.loadlib(path, fun) + cprofile(path, "load_end", "standard") + return f, err + end + + P.setup(M.modpaths.profile) + + api.nvim_create_user_command("LuaCacheProfile", function() + P.print_profile(M, std_dirs) + end, {}) +end + +local function get_runtime_file_from_parent(basename, paths) -- Look in the cache to see if we have already loaded a parent module. -- If we have then try looking in the parents directory first. - local parents = vim.split(basename, "/") + local parents = vim.split(basename, sep) for i = #parents, 1, -1 do - local parent = table.concat(vim.list_slice(parents, 1, i), "/") - local ppath = M.modpaths.cache[parent] + local parent = table.concat(vim.list_slice(parents, 1, i), sep) + local ppath = M.modpaths:get(parent) if ppath then - if ppath:sub(-9) == "/init.lua" then + if ppath:sub(-9) == (sep .. "init.lua") then ppath = ppath:sub(1, -10) -- a/b/init.lua -> a/b else ppath = ppath:sub(1, -5) -- a/b.lua -> a/b @@ -126,38 +164,71 @@ local function get_runtime_file(basename, paths) for _, path in ipairs(paths) do -- path should be of form 'a/b/c.lua' or 'a/b/c/init.lua' - local modpath = ppath .. "/" .. path:sub(#("lua/" .. parent) + 2) + local modpath = ppath .. sep .. path:sub(#("lua" .. sep .. parent) + 2) if fs_stat(modpath) then return modpath, "cache(p)" end end end end +end - -- What Neovim does by default; slowest - local modpath = get_runtime(paths, false, { is_lua = true })[1] - return modpath, "standard" +local rtp = vim.split(vim.o.rtp, ",") + +-- Make sure modpath is in rtp and that modpath is in paths. +local function validate_modpath(modpath, paths) + local match = false + for _, p in ipairs(paths) do + if vim.endswith(modpath, p) then + match = true + break + end + end + if not match then + return false + end + for _, dir in ipairs(rtp) do + if vim.startswith(modpath, dir) then + return fs_stat(modpath) ~= nil + end + end + return false end local function get_runtime_file_cached(basename, paths) + local modpath, loader local mp = M.modpaths - if mp.cache[basename] then - local modpath = mp.cache[basename] - if fs_stat(modpath) then - mprofile(basename, "resolve_end", "cache") - return modpath + if mp.enable then + local modpath_cached = mp:get(basename) + if modpath_cached then + modpath, loader = modpath_cached, "cache" + else + modpath, loader = get_runtime_file_from_parent(basename, paths) + end + + if modpath and not validate_modpath(modpath, paths) then + modpath = nil + + -- Invalidate + mp.cache[basename] = nil + mp.dirty = true end - mp.cache[basename] = nil - mp.dirty = true end - local modpath, loader = get_runtime_file(basename, paths) + if not modpath then + -- What Neovim does by default; slowest + modpath, loader = get_runtime(paths, false, { is_lua = true })[1], "standard" + end + if modpath then mprofile(basename, "resolve_end", loader) - log("Creating cache for module %s", basename) - mp.cache[basename] = modpath_mangle(modpath) - mp.dirty = true + if mp.enable and loader ~= "cache" then + log("Creating cache for module %s", basename) + mp:set(basename, modpath) + mp.dirty = true + end end + return modpath end @@ -168,8 +239,12 @@ local function extract_basename(pats) for _, pat in ipairs(pats) do for i, npat in ipairs { -- Ordered by most specific - "lua/(.*)/init%.lua", - "lua/(.*)%.lua", + "lua" + .. sep + .. "(.*)" + .. sep + .. "init%.lua", + "lua" .. sep .. "(.*)%.lua", } do local m = pat:match(npat) if i == 2 and m and m:sub(-4) == "init" then @@ -211,8 +286,8 @@ end -- Copied from neovim/src/nvim/lua/vim.lua with two lines changed local function load_package(name) - local basename = name:gsub("%.", "/") - local paths = { "lua/" .. basename .. ".lua", "lua/" .. basename .. "/init.lua" } + local basename = name:gsub("%.", sep) + local paths = { "lua" .. sep .. basename .. ".lua", "lua" .. sep .. basename .. sep .. "init.lua" } -- Original line: -- local found = vim.api.nvim__get_runtime(paths, false, {is_lua=true}) @@ -239,7 +314,7 @@ local function load_package(name) -- So "foo-bar.baz" should result in "luaopen_bar_baz" local dash = name:find("-", 1, true) local modname = dash and name:sub(dash + 1) or name - local f, err = package.loadlib(found[1], "luaopen_" .. modname:gsub("%.", "_")) + local f, err = loadlib(found[1], "luaopen_" .. modname:gsub("%.", "_")) return f or error(err) end return nil @@ -248,14 +323,16 @@ end local function load_from_cache(path) local mc = M.chunks - if not mc.cache[path] then + local cache = mc:get(path) + + if not cache then return nil, string.format("No cache for path %s", path) end - local mhash, codes = unpack(mc.cache[path]) + local mhash, codes = unpack(cache) - if mhash ~= hash(modpath_unmangle(path)) then - mc.cache[path] = nil + if mhash ~= hash(path) then + mc:set(path) mc.dirty = true return nil, string.format("Stale cache for path %s", path) end @@ -263,7 +340,7 @@ local function load_from_cache(path) local chunk = loadstring(codes) if not chunk then - mc.cache[path] = nil + mc:set(path) mc.dirty = true return nil, string.format("Cache error for path %s", path) end @@ -274,19 +351,23 @@ end local function loadfile_cached(path) cprofile(path, "load_start") - local chunk, err = load_from_cache(path) - if chunk and not err then - log("Loaded cache for path %s", path) - cprofile(path, "load_end", "cache") - return chunk + local chunk, err + + if M.chunks.enable then + chunk, err = load_from_cache(path) + if chunk and not err then + log("Loaded cache for path %s", path) + cprofile(path, "load_end", "cache") + return chunk + end + log(err) end - log(err) chunk, err = _loadfile(path) - if not err then + if not err and M.chunks.enable then log("Creating cache for path %s", path) - M.chunks.cache[modpath_mangle(path)] = { hash(path), string.dump(chunk) } + M.chunks:set(path, { hash(path), string.dump(chunk) }) M.chunks.dirty = true end @@ -296,9 +377,12 @@ end function M.save_cache() local function _save_cache(t) + if not t.enable then + return + end if t.dirty then log("Updating chunk cache file: %s", t.path) - local f = io.open(t.path, "w+b") + local f = assert(io.open(t.path, "w+b")) f:write(mpack.encode(t.cache)) f:flush() t.dirty = false @@ -308,7 +392,7 @@ function M.save_cache() _save_cache(M.modpaths) end -function M.clear_cache() +local function clear_cache() local function _clear_cache(t) t.cache = {} os.remove(t.path) @@ -319,9 +403,12 @@ end local function init_cache() local function _init_cache(t) + if not t.enable then + return + end if fs_stat(t.path) then log("Loading cache file %s", t.path) - local f = io.open(t.path, "rb") + local f = assert(io.open(t.path, "rb")) local ok ok, t.cache = pcall(function() return mpack.decode(f:read "*a") @@ -336,6 +423,10 @@ local function init_cache() end end + if not uv.fs_stat(std_cache) then + vim.fn.mkdir(std_cache, "p") + end + _init_cache(M.chunks) _init_cache(M.modpaths) end @@ -343,20 +434,42 @@ end local function setup() init_cache() + -- Usual package loaders + -- 1. package.preload + -- 2. vim._load_package + -- 3. package.path + -- 4. package.cpath + -- 5. all-in-one + -- Override default functions + for i, loader in ipairs(package.loaders) do + if loader == vim._load_package then + package.loaders[i] = load_package + break + end + end vim._load_package = load_package + vim.api.nvim__get_runtime = get_runtime_cached - -- luacheck: ignore 121 loadfile = loadfile_cached - vim.cmd [[ - augroup impatient - autocmd VimEnter,VimLeave * lua _G.__luacache.save_cache() - augroup END + local augroup = api.nvim_create_augroup("impatient", {}) - command! LuaCacheClear lua _G.__luacache.clear_cache() - command! LuaCacheLog lua _G.__luacache.print_log() - ]] + api.nvim_create_user_command("LuaCacheClear", clear_cache, {}) + api.nvim_create_user_command("LuaCacheLog", print_log, {}) + + api.nvim_create_autocmd({ "VimEnter", "VimLeave" }, { + group = augroup, + callback = M.save_cache, + }) + + api.nvim_create_autocmd("OptionSet", { + group = augroup, + pattern = "runtimepath", + callback = function() + rtp = vim.split(vim.o.rtp, ",") + end, + }) end setup() diff --git a/lua/lvim/impatient/profile.lua b/lua/lvim/impatient/profile.lua index 0ab04d65..2eafbbf2 100644 --- a/lua/lvim/impatient/profile.lua +++ b/lua/lvim/impatient/profile.lua @@ -1,12 +1,13 @@ local M = {} -local api, uv = vim.api, vim.loop +local sep +if jit.os == "Windows" then + sep = "\\" +else + sep = "/" +end -local std_data = vim.fn.stdpath "data" -local std_config = vim.fn.stdpath "config" -local vimruntime = os.getenv "VIMRUNTIME" -local lvim_runtime = get_runtime_dir() -local lvim_config = get_config_dir() +local api, uv = vim.api, vim.loop local function load_buffer(title, lines) local bufnr = api.nvim_create_buf(false, false) @@ -19,19 +20,6 @@ local function load_buffer(title, lines) api.nvim_set_current_buf(bufnr) end -local function mod_path(path) - if not path then - return "?" - end - path = path:gsub(std_data .. "/site/pack/packer/", "/") - path = path:gsub(std_data .. "/", "/") - path = path:gsub(std_config .. "/", "/") - path = path:gsub(vimruntime .. "/", "/") - path = path:gsub(lvim_runtime .. "/", "/") - path = path:gsub(lvim_config .. "/", "/") - return path -end - local function time_tostr(x) if x == 0 then return "?" @@ -51,7 +39,7 @@ local function mem_tostr(x) return string.format("%1.1f%s", x, unit) end -function M.print_profile(I) +function M.print_profile(I, std_dirs) local mod_profile = I.modpaths.profile local chunk_profile = I.chunks.profile @@ -67,42 +55,50 @@ function M.print_profile(I) for path, m in pairs(chunk_profile) do m.load = m.load_end - m.load_start m.load = m.load / 1000000 - m.path = mod_path(path) + m.path = path or "?" end local module_content_width = 0 + local unloaded = {} + for module, m in pairs(mod_profile) do - m.resolve = 0 - if m.resolve_end then - m.resolve = m.resolve_end - m.resolve_start - m.resolve = m.resolve / 1000000 - end + local module_dot = module:gsub(sep, ".") + m.module = module_dot - m.module = module:gsub("/", ".") - m.loader = m.loader or m.loader_guess - - local path = I.modpaths.cache[module] - local path_prof = chunk_profile[path] - m.path = mod_path(path) - - if path_prof then - chunk_profile[path] = nil - m.load = path_prof.load - m.ploader = path_prof.loader + if not package.loaded[module_dot] and not package.loaded[module] then + unloaded[#unloaded + 1] = m else - m.load = 0 - m.ploader = "NA" + m.resolve = 0 + if m.resolve_start and m.resolve_end then + m.resolve = m.resolve_end - m.resolve_start + m.resolve = m.resolve / 1000000 + end + + m.loader = m.loader or m.loader_guess + + local path = I.modpaths.cache[module] + local path_prof = chunk_profile[path] + m.path = path or "?" + + if path_prof then + chunk_profile[path] = nil + m.load = path_prof.load + m.ploader = path_prof.loader + else + m.load = 0 + m.ploader = "NA" + end + + total_resolve = total_resolve + m.resolve + total_load = total_load + m.load + + if #module > module_content_width then + module_content_width = #module + end + + modules[#modules + 1] = m end - - total_resolve = total_resolve + m.resolve - total_load = total_load + m.load - - if #module > module_content_width then - module_content_width = #module - end - - modules[#modules + 1] = m end table.sort(modules, function(a, b) @@ -181,6 +177,12 @@ function M.print_profile(I) end add "" + add "Standard directories:" + for alias, path in pairs(std_dirs) do + add(" %-12s -> %s", alias, path) + end + add "" + add("%s─%s┬%s─%s┐", tcwl, lcwl, tcwl, lcwl) add(title1_fmt, "Resolve", "Load") add("%s┬%s┼%s┬%s┼%s┬%s", tcwl, lcwl, tcwl, lcwl, mcwl, n) @@ -207,7 +209,17 @@ function M.print_profile(I) add(f3, p.load, p.loader, p.path) end add("%s┴%s┴%s", tcwl, lcwl, n) + end + + if #unloaded > 0 then add "" + add(n) + add "Modules which were unable to loaded" + add(n) + for _, p in ipairs(unloaded) do + lines[#lines + 1] = p.module + end + add(n) end load_buffer("Impatient Profile Report", lines) @@ -216,13 +228,12 @@ end M.setup = function(profile) local _require = require - -- luacheck: ignore 121 require = function(mod) - local basename = mod:gsub("%.", "/") + local basename = mod:gsub("%.", sep) if not profile[basename] then profile[basename] = {} profile[basename].resolve_start = uv.hrtime() - profile[basename].loader_guess = "C" + profile[basename].loader_guess = "" end return _require(mod) end @@ -232,7 +243,7 @@ M.setup = function(profile) for i = 1, #pl do local l = pl[i] pl[i] = function(mod) - local basename = mod:gsub("%.", "/") + local basename = mod:gsub("%.", sep) profile[basename].loader_guess = i == 1 and "preloader" or "loader #" .. i return l(mod) end diff --git a/lua/lvim/utils/hooks.lua b/lua/lvim/utils/hooks.lua index ce4335a9..bf0dac60 100644 --- a/lua/lvim/utils/hooks.lua +++ b/lua/lvim/utils/hooks.lua @@ -34,10 +34,7 @@ end ---It also forces regenerating any template ftplugin files ---Tip: Useful for clearing any outdated settings function M.reset_cache() - local impatient = _G.__luacache - if impatient then - impatient.clear_cache() - end + vim.cmd [[LuaCacheClear]] local lvim_modules = {} for module, _ in pairs(package.loaded) do if module:match "lvim.core" or module:match "lvim.lsp" then From 4586140260b50ba81bca53cd90c91c22e28ee5ca Mon Sep 17 00:00:00 2001 From: 2nthony Date: Fri, 14 Oct 2022 23:28:38 +0800 Subject: [PATCH 127/138] fix(alpha): check alpha module (#3233) --- lua/lvim/core/alpha.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/lvim/core/alpha.lua b/lua/lvim/core/alpha.lua index fd637818..58b787ed 100644 --- a/lua/lvim/core/alpha.lua +++ b/lua/lvim/core/alpha.lua @@ -65,7 +65,10 @@ local function configure_additional_autocmds() end function M.setup() - local alpha = require "alpha" + local status_ok, alpha = pcall(require, "alpha") + if not status_ok then + return + end local mode = lvim.builtin.alpha.mode local config = lvim.builtin.alpha[mode].config From 1fbdcabf1915b35599c7912a45ef92888417ea65 Mon Sep 17 00:00:00 2001 From: opalmay <65673442+opalmay@users.noreply.github.com> Date: Fri, 14 Oct 2022 19:33:08 +0300 Subject: [PATCH 128/138] fix: don't install desktop file w/o xdg-desktop-menu (#3229) --- utils/installer/install.sh | 5 ++--- utils/installer/uninstall.sh | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/utils/installer/install.sh b/utils/installer/install.sh index bd751abe..87f60fd4 100755 --- a/utils/installer/install.sh +++ b/utils/installer/install.sh @@ -458,7 +458,7 @@ function setup_lvim() { function create_desktop_file() { OS="$(uname -s)" # TODO: Any other OSes that use desktop files? - [ "$OS" != "Linux" ] && return + ([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return echo "Creating desktop file" for d in "$LUNARVIM_BASE_DIR"/utils/desktop/*/; do @@ -467,8 +467,7 @@ function create_desktop_file() { cp "$LUNARVIM_BASE_DIR/utils/desktop/$size_folder/lvim.svg" "$XDG_DATA_HOME/icons/hicolor/$size_folder/apps" done - cp "$LUNARVIM_BASE_DIR/utils/desktop/lvim.desktop" "$XDG_DATA_HOME/applications/lvim.desktop" - xdg-desktop-menu forceupdate + xdg-desktop-menu install --novendor "$LUNARVIM_BASE_DIR/utils/desktop/lvim.desktop" } function print_logo() { diff --git a/utils/installer/uninstall.sh b/utils/installer/uninstall.sh index 16d3c365..597bbf85 100755 --- a/utils/installer/uninstall.sh +++ b/utils/installer/uninstall.sh @@ -63,11 +63,11 @@ function remove_lvim_bin() { function remove_desktop_file() { OS="$(uname -s)" # TODO: Any other OSes that use desktop files? - [ "$OS" != "Linux" ] && return + ([ "$OS" != "Linux" ] || ! command -v xdg-desktop-menu &>/dev/null) && return echo "Removing desktop file..." find "$XDG_DATA_HOME/icons/hicolor" -name "lvim.svg" -type f -delete - rm "$XDG_DATA_HOME/applications/lvim.desktop" + xdg-desktop-menu uninstall lvim.desktop } function main() { From 91ac8a0bb0eefc31815371454bcf59aa72d0acc3 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sat, 15 Oct 2022 10:21:24 +0330 Subject: [PATCH 129/138] fix(luadev): this plugin has been renamed (#3235) --- lua/lvim/lsp/providers/sumneko_lua.lua | 2 +- lua/lvim/plugins.lua | 4 ++-- snapshots/default.json | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/lvim/lsp/providers/sumneko_lua.lua b/lua/lvim/lsp/providers/sumneko_lua.lua index 466c9151..2caa23b6 100644 --- a/lua/lvim/lsp/providers/sumneko_lua.lua +++ b/lua/lvim/lsp/providers/sumneko_lua.lua @@ -2,7 +2,7 @@ local default_workspace = { library = { vim.fn.expand "$VIMRUNTIME", get_lvim_base_dir(), - require("lua-dev.config").types(), + require("neodev.config").types(), }, maxPreload = 5000, diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index a0f5d14d..966f3a1c 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -92,8 +92,8 @@ local core_plugins = { "hrsh7th/cmp-path", }, { - "folke/lua-dev.nvim", - module = "lua-dev", + "folke/neodev.nvim", + module = "neodev", }, -- Autopairs diff --git a/snapshots/default.json b/snapshots/default.json index 8fab98d0..e2a1d63e 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -35,8 +35,8 @@ "lir.nvim": { "commit": "7d8c6c4" }, - "lua-dev.nvim": { - "commit": "2410be2" + "neodev.nvim": { + "commit": "b2fd8b7" }, "lualine.nvim": { "commit": "a52f078" @@ -72,7 +72,7 @@ "commit": "132b273" }, "nvim-notify": { - "commit": "4144654" + "commit": "af935fd" }, "nvim-tree.lua": { "commit": "b01e7be" From a54312b7693de1862238a1a097009c5f952fcb12 Mon Sep 17 00:00:00 2001 From: Abouzar Parvan Date: Sat, 15 Oct 2022 12:54:49 +0330 Subject: [PATCH 130/138] fix(nvim-cmp-lsp): update_capabilities has been deprecated (#3245) --- lua/lvim/lsp/init.lua | 10 +++++----- snapshots/default.json | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index 1072329b..c8a2b22f 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -25,6 +25,11 @@ local function add_lsp_buffer_keybindings(bufnr) end function M.common_capabilities() + local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") + if status_ok then + return cmp_nvim_lsp.default_capabilities() + end + local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.resolveSupport = { @@ -35,11 +40,6 @@ function M.common_capabilities() }, } - local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp") - if status_ok then - capabilities = cmp_nvim_lsp.update_capabilities(capabilities) - end - return capabilities end diff --git a/snapshots/default.json b/snapshots/default.json index e2a1d63e..cd2d16c9 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -15,7 +15,7 @@ "commit": "3022dbc" }, "cmp-nvim-lsp": { - "commit": "affe808" + "commit": "389f06d" }, "cmp-path": { "commit": "447c87c" @@ -36,7 +36,7 @@ "commit": "7d8c6c4" }, "neodev.nvim": { - "commit": "b2fd8b7" + "commit": "d785dc8" }, "lualine.nvim": { "commit": "a52f078" @@ -66,7 +66,7 @@ "commit": "c8ce83a" }, "nvim-lspconfig": { - "commit": "f11fdff" + "commit": "35a731b" }, "nvim-navic": { "commit": "132b273" From e94390a9225c418dd96eb6b6822ce0dc15ce7cce Mon Sep 17 00:00:00 2001 From: 2nthony Date: Sat, 15 Oct 2022 20:06:52 +0800 Subject: [PATCH 131/138] perf(plugins): move assert `vim.env.LVIM_DEV_MODE` logic (#3238) --- lua/lvim/plugins.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 966f3a1c..db84d878 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -297,8 +297,8 @@ local get_default_sha1 = function(spec) return default_sha1[short_name] and default_sha1[short_name].commit end -for _, spec in ipairs(core_plugins) do - if not vim.env.LVIM_DEV_MODE then +if not vim.env.LVIM_DEV_MODE then + for _, spec in ipairs(core_plugins) do -- Manually lock the commit hash since Packer's snapshots are unreliable in headless mode spec["commit"] = get_default_sha1(spec) end From 48d1c38fa88dbfbaa35e81560cf0fa7d8793b195 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Sat, 15 Oct 2022 18:32:11 +0200 Subject: [PATCH 132/138] chore(plugins): bump version (#3248) * ci: update workflows * chore(plugins): bump version * chore: update depdecated settings for comment.nvim * chore(lsp): update skiplist * fixup!: take 2 for comment.nvim --- .github/workflows/commitlint.yml | 4 +-- .github/workflows/format.yaml | 4 +-- .github/workflows/install.yaml | 6 ++-- .github/workflows/lint.yaml | 4 +-- .github/workflows/plugins.yml | 6 ++-- lua/lvim/core/comment.lua | 44 +++++++++++++--------------- lua/lvim/lsp/config.lua | 6 ++-- snapshots/default.json | 50 ++++++++++++++++---------------- 8 files changed, 60 insertions(+), 64 deletions(-) diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml index 93c776e3..de6be24f 100644 --- a/.github/workflows/commitlint.yml +++ b/.github/workflows/commitlint.yml @@ -6,10 +6,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v2.3.1 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v4 + - uses: wagoid/commitlint-github-action@v5 with: configFile: .github/workflows/commitlint.config.js helpURL: https://github.com/LunarVim/LunarVim/blob/rolling/CONTRIBUTING.md#commit-messages diff --git a/.github/workflows/format.yaml b/.github/workflows/format.yaml index 27b061ef..64da97e6 100644 --- a/.github/workflows/format.yaml +++ b/.github/workflows/format.yaml @@ -15,7 +15,7 @@ jobs: name: "Formatting check with Stylua" runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Lint with stylua uses: JohnnyMorganz/stylua-action@v1 @@ -29,7 +29,7 @@ jobs: name: "Formatting check with shfmt" runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Setup Go uses: actions/setup-go@v2 diff --git a/.github/workflows/install.yaml b/.github/workflows/install.yaml index 8ab27e88..5f72bcac 100644 --- a/.github/workflows/install.yaml +++ b/.github/workflows/install.yaml @@ -33,13 +33,13 @@ jobs: neovim: nightly runs-on: ${{ matrix.runner }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install neovim binary from release env: RELEASE_VER: ${{ matrix.neovim }} run: | - echo "$HOME/.local/bin" >> $GITHUB_PATH + echo "$HOME/.local/bin" >> "$GITHUB_PATH" bash ./utils/installer/install-neovim-from-release - name: Install LunarVim @@ -72,7 +72,7 @@ jobs: shell: pwsh steps: # it's not currently possbile to run tests on windows, see nvim-lua/plenary.nvim#255 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install neovim binary uses: rhysd/action-setup-vim@v1 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c238a5d1..f136d442 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -15,7 +15,7 @@ jobs: name: "Linting with luacheck" runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: leafo/gh-actions-lua@v8 - uses: leafo/gh-actions-luarocks@v4 @@ -30,7 +30,7 @@ jobs: name: Shellcheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run ShellCheck uses: ludeeus/action-shellcheck@master with: diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index d5c6310f..46c88c81 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -25,15 +25,13 @@ jobs: contents: write pull-requests: write steps: - - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} + - uses: actions/checkout@v3 - name: Install neovim binary uses: rhysd/action-setup-vim@v1 with: neovim: true - version: v0.8.0 + version: nightly - name: Install LunarVim timeout-minutes: 4 diff --git a/lua/lvim/core/comment.lua b/lua/lvim/core/comment.lua index d07739c6..501d01b6 100644 --- a/lua/lvim/core/comment.lua +++ b/lua/lvim/core/comment.lua @@ -1,27 +1,10 @@ local M = {} function M.config() - local pre_hook = nil - if lvim.builtin.treesitter.context_commentstring.enable then - pre_hook = function(ctx) - local U = require "Comment.utils" - - -- Determine whether to use linewise or blockwise commentstring - local type = ctx.ctype == U.ctype.linewise and "__default" or "__multiline" - - -- Determine the location where to calculate commentstring from - local location = nil - if ctx.ctype == U.ctype.blockwise then - location = require("ts_context_commentstring.utils").get_cursor_location() - elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then - location = require("ts_context_commentstring.utils").get_visual_start_location() - end - - return require("ts_context_commentstring.internal").calculate_commentstring { - key = type, - location = location, - } - end + local pre_hook + local loaded, ts_comment = pcall(require, "ts_context_commentstring.integrations.comment_nvim") + if loaded and ts_comment then + pre_hook = ts_comment.create_pre_hook() end lvim.builtin.comment = { active = true, @@ -30,6 +13,11 @@ function M.config() ---@type boolean padding = true, + ---Whether cursor should stay at the + ---same position. Only works in NORMAL + ---mode mappings + sticky = true, + ---Lines to be ignored while comment/uncomment. ---Could be a regex string or a function that returns a regex string. ---Example: Use '^$' to ignore empty lines @@ -45,9 +33,6 @@ function M.config() ---Extra mapping ---Includes `gco`, `gcO`, `gcA` extra = true, - ---Extended mapping - ---Includes `g>`, `g<`, `g>[count]{motion}` and `g<[count]{motion}` - extended = false, }, ---LHS of line and block comment toggle mapping in NORMAL/VISUAL mode @@ -68,6 +53,17 @@ function M.config() block = "gb", }, + ---LHS of extra mappings + ---@type table + extra = { + ---Add comment on the line above + above = "gcO", + ---Add comment on the line below + below = "gco", + ---Add comment at the end of line + eol = "gcA", + }, + ---Pre-hook, called before commenting the line ---@type function|nil pre_hook = pre_hook, diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index b1a45d5e..358e83f8 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -10,6 +10,7 @@ local skipped_servers = { "eslint", "eslintls", "golangci_lint_ls", + "gradle_ls", "graphql", "jedi_language_server", "ltex", @@ -18,8 +19,9 @@ local skipped_servers = { "psalm", "pylsp", "quick_lint_js", - "rome", "reason_ls", + "rome", + "ruby_ls", "scry", "solang", "solc", @@ -31,8 +33,8 @@ local skipped_servers = { "sqlls", "sqls", "stylelint_lsp", - "tflint", "svlangserver", + "tflint", "verible", "vuels", } diff --git a/snapshots/default.json b/snapshots/default.json index cd2d16c9..f0a6d293 100644 --- a/snapshots/default.json +++ b/snapshots/default.json @@ -1,33 +1,33 @@ { "Comment.nvim": { - "commit": "97a188a" + "commit": "ad7ffa8" }, "LuaSnip": { - "commit": "8f8d493" + "commit": "663d544" }, "alpha-nvim": { "commit": "0bb6fc0" }, "bufferline.nvim": { - "commit": "83bf4dc" + "commit": "0606cee" }, "cmp-buffer": { "commit": "3022dbc" }, "cmp-nvim-lsp": { - "commit": "389f06d" + "commit": "2a84710" }, "cmp-path": { - "commit": "447c87c" + "commit": "91ff86c" }, "cmp_luasnip": { "commit": "a9de941" }, "friendly-snippets": { - "commit": "2be79d8" + "commit": "fd16b4d" }, "gitsigns.nvim": { - "commit": "f98c85e" + "commit": "2c6f96d" }, "indent-blankline.nvim": { "commit": "db7cbcb" @@ -35,35 +35,35 @@ "lir.nvim": { "commit": "7d8c6c4" }, - "neodev.nvim": { - "commit": "d785dc8" - }, "lualine.nvim": { - "commit": "a52f078" + "commit": "edca2b0" }, "mason-lspconfig.nvim": { - "commit": "0051870" + "commit": "bf8ac12" }, "mason.nvim": { - "commit": "59e6fee" + "commit": "45b9a4d" + }, + "neodev.nvim": { + "commit": "08d8455" }, "nlsp-settings.nvim": { - "commit": "019ea0b" + "commit": "8500c4e" }, "null-ls.nvim": { - "commit": "c0c19f3" + "commit": "643c67a" }, "nvim-autopairs": { "commit": "4fc96c8" }, "nvim-cmp": { - "commit": "b0dff0e" + "commit": "3347dd3" }, "nvim-dap": { - "commit": "0b320f5" + "commit": "e71da68" }, "nvim-dap-ui": { - "commit": "c8ce83a" + "commit": "1cd4764" }, "nvim-lspconfig": { "commit": "35a731b" @@ -75,16 +75,16 @@ "commit": "af935fd" }, "nvim-tree.lua": { - "commit": "b01e7be" + "commit": "c446527" }, "nvim-treesitter": { - "commit": "8e76333" + "commit": "1da61c9" }, "nvim-ts-context-commentstring": { - "commit": "4d3a68c" + "commit": "2941f00" }, "nvim-web-devicons": { - "commit": "563f363" + "commit": "a8cf88c" }, "onedarker.nvim": { "commit": "b00dd21" @@ -102,7 +102,7 @@ "commit": "628de7e" }, "schemastore.nvim": { - "commit": "33873c7" + "commit": "03f4f94" }, "structlog.nvim": { "commit": "232a8e2" @@ -117,10 +117,10 @@ "commit": "2a787c4" }, "tokyonight.nvim": { - "commit": "4092905" + "commit": "e6307e1" }, "vim-illuminate": { - "commit": "a2e8476" + "commit": "0603e75" }, "which-key.nvim": { "commit": "6885b66" From 24309b839ec63958a141251d55b1cb6e50049d0e Mon Sep 17 00:00:00 2001 From: Ali Almohaya Date: Sun, 16 Oct 2022 03:21:43 +0300 Subject: [PATCH 133/138] fix: disable gitsigns hunk navigation message (#3244) --- lua/lvim/core/which-key.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index 16c9df5e..55e3aae0 100644 --- a/lua/lvim/core/which-key.lua +++ b/lua/lvim/core/which-key.lua @@ -131,8 +131,8 @@ M.config = function() g = { name = "Git", g = { "lua require 'lvim.core.terminal'.lazygit_toggle()", "Lazygit" }, - j = { "lua require 'gitsigns'.next_hunk()", "Next Hunk" }, - k = { "lua require 'gitsigns'.prev_hunk()", "Prev Hunk" }, + j = { "lua require 'gitsigns'.next_hunk({navigation_message = false})", "Next Hunk" }, + k = { "lua require 'gitsigns'.prev_hunk({navigation_message = false})", "Prev Hunk" }, l = { "lua require 'gitsigns'.blame_line()", "Blame" }, p = { "lua require 'gitsigns'.preview_hunk()", "Preview Hunk" }, r = { "lua require 'gitsigns'.reset_hunk()", "Reset Hunk" }, From 2a3b9510bc8569f47176d8e4b5f84421161cc420 Mon Sep 17 00:00:00 2001 From: ChristianChiarulli Date: Sat, 15 Oct 2022 22:29:10 -0400 Subject: [PATCH 134/138] fix: copilot background should matcha statusline --- lua/lvim/core/lualine/components.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lvim/core/lualine/components.lua b/lua/lvim/core/lualine/components.lua index 91411d64..e4148e20 100644 --- a/lua/lvim/core/lualine/components.lua +++ b/lua/lvim/core/lualine/components.lua @@ -16,7 +16,7 @@ local statusline_hl = vim.api.nvim_get_hl_by_name("StatusLine", true) local cursorline_hl = vim.api.nvim_get_hl_by_name("CursorLine", true) local normal_hl = vim.api.nvim_get_hl_by_name("Normal", true) -vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = "NONE" }) +vim.api.nvim_set_hl(0, "SLCopilot", { fg = "#6CC644", bg = statusline_hl.background }) vim.api.nvim_set_hl(0, "SLGitIcon", { fg = "#E8AB53", bg = cursorline_hl.background }) vim.api.nvim_set_hl(0, "SLBranchName", { fg = normal_hl.foreground, bg = cursorline_hl.background }) vim.api.nvim_set_hl(0, "SLProgress", { fg = "#ECBE7B", bg = statusline_hl.background }) From 7715900525e5cfd7b210f9de8dd2fb25fe37b512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Rero=C5=84?= Date: Sun, 16 Oct 2022 11:52:40 +0200 Subject: [PATCH 135/138] fix: disable unsupported asian characters spellchecking (#3259) --- lua/lvim/config/settings.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/lvim/config/settings.lua b/lua/lvim/config/settings.lua index e94f9dae..4f61ed09 100644 --- a/lua/lvim/config/settings.lua +++ b/lua/lvim/config/settings.lua @@ -57,6 +57,7 @@ M.load_default_options = function() } --- SETTINGS --- + vim.opt.spelllang:append "cjk" -- disable spellchecking for asian characters (VIM algorithm does not support it) vim.opt.shortmess:append "c" -- don't show redundant messages from ins-completion-menu vim.opt.shortmess:append "I" -- don't show the default intro message vim.opt.whichwrap:append "<,>,[,],h,l" From 003060824b4830532f5efad0dbb73bf493b741a8 Mon Sep 17 00:00:00 2001 From: Josh Date: Sun, 16 Oct 2022 16:44:50 -0600 Subject: [PATCH 136/138] docs: Update contributing readme with new url for install docs. (#3254) docs: update contirbuting readme with new url for install docs --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9df262b8..21ef9a8d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ One of the best ways to begin contributing in a meaningful way is by helping fin ## Getting Started -1. Follow the [Installation](https://www.lunarvim.org/01-installing.html) guide +1. Follow the [Installation](https://www.lunarvim.org/docs/installation) guide 2. Link your fork with the repository `git remote add upstream https://github.com/lunarvim/LunarVim.git`, or use `gh fork` 3. That's it! You can now `git fetch upstream` and `git rebase [-i] upstream/rolling` to update your branches with the latest contributions. From b7b9087d34d868e3cdbe84d38ac4214b3d8ce2f0 Mon Sep 17 00:00:00 2001 From: dapc11 Date: Mon, 17 Oct 2022 04:52:49 +0200 Subject: [PATCH 137/138] fix: nil table in breadcrumbs in autocommand (#3267) --- lua/lvim/core/breadcrumbs.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 10f3f72f..ab5aa86d 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -162,10 +162,7 @@ local get_gps = function() end local excludes = function() - if vim.tbl_contains(lvim.builtin.breadcrumbs.winbar_filetype_exclude, vim.bo.filetype) then - return true - end - return false + return vim.tbl_contains(lvim.builtin.breadcrumbs.winbar_filetype_exclude or {}, vim.bo.filetype) end M.get_winbar = function() From 6f6cbc394d2a7e64964b6067a2f42d2e6a07824e Mon Sep 17 00:00:00 2001 From: Christian Chiarulli Date: Mon, 17 Oct 2022 08:06:12 -0400 Subject: [PATCH 138/138] feat(config): allow disabling reload-on-save (#3261) --- lua/lvim/config/defaults.lua | 1 + lua/lvim/config/init.lua | 4 ++++ lua/lvim/core/autocmds.lua | 35 +++++++++++++++++------------------ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/lua/lvim/config/defaults.lua b/lua/lvim/config/defaults.lua index 7e111429..1bd57b94 100644 --- a/lua/lvim/config/defaults.lua +++ b/lua/lvim/config/defaults.lua @@ -1,5 +1,6 @@ return { leader = "space", + reload_config_on_save = true, colorscheme = "tokyonight", transparent_window = false, format_on_save = { diff --git a/lua/lvim/config/init.lua b/lua/lvim/config/init.lua index ea36a9a0..59722673 100644 --- a/lua/lvim/config/init.lua +++ b/lua/lvim/config/init.lua @@ -139,6 +139,10 @@ function M:load(config_path) if lvim.transparent_window then autocmds.enable_transparent_mode() end + + if lvim.reload_config_on_save then + autocmds.enable_reload_config_on_save() + end end --- Override the configuration with a user provided one diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index 0e6b4cd7..ae10d552 100644 --- a/lua/lvim/core/autocmds.lua +++ b/lua/lvim/core/autocmds.lua @@ -3,13 +3,6 @@ local Log = require "lvim.core.log" --- Load the default set of autogroups and autocommands. function M.load_defaults() - local user_config_file = require("lvim.config"):get_user_config_path() - - if vim.loop.os_uname().version:match "Windows" then - -- autocmds require forward slashes even on windows - user_config_file = user_config_file:gsub("\\", "/") - end - vim.api.nvim_create_autocmd({ "FileType" }, { pattern = { "Jaq", @@ -41,17 +34,6 @@ function M.load_defaults() end, }, }, - { - "BufWritePost", - { - group = "_general_settings", - pattern = user_config_file, - desc = "Trigger LvimReload on saving " .. vim.fn.expand "%:~", - callback = function() - require("lvim.config"):reload() - end, - }, - }, { "FileType", { @@ -181,6 +163,23 @@ function M.toggle_format_on_save() end end +function M.enable_reload_config_on_save() + local user_config_file = require("lvim.config"):get_user_config_path() + + if vim.loop.os_uname().version:match "Windows" then + -- autocmds require forward slashes even on windows + user_config_file = user_config_file:gsub("\\", "/") + end + vim.api.nvim_create_autocmd("BufWritePost", { + group = "_general_settings", + pattern = user_config_file, + desc = "Trigger LvimReload on saving config.lua", + callback = function() + require("lvim.config"):reload() + end, + }) +end + function M.enable_transparent_mode() vim.api.nvim_create_autocmd("ColorScheme", { pattern = "*",