diff options
Diffstat (limited to '.config/nvim/lua/core')
-rw-r--r-- | .config/nvim/lua/core/autocmds.lua | 5 | ||||
-rw-r--r-- | .config/nvim/lua/core/autopairs.lua | 20 | ||||
-rw-r--r-- | .config/nvim/lua/core/builtins/init.lua | 1 | ||||
-rw-r--r-- | .config/nvim/lua/core/cmp.lua | 51 | ||||
-rw-r--r-- | .config/nvim/lua/core/commands.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/core/dap.lua | 14 | ||||
-rw-r--r-- | .config/nvim/lua/core/dashboard.lua | 24 | ||||
-rw-r--r-- | .config/nvim/lua/core/gitsigns.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/core/info.lua | 107 | ||||
-rw-r--r-- | .config/nvim/lua/core/log.lua | 1 | ||||
-rw-r--r-- | .config/nvim/lua/core/lspinstall.lua | 19 | ||||
-rw-r--r-- | .config/nvim/lua/core/lualine/components.lua | 3 | ||||
-rw-r--r-- | .config/nvim/lua/core/nvimtree.lua | 49 | ||||
-rw-r--r-- | .config/nvim/lua/core/project.lua | 2 | ||||
-rw-r--r-- | .config/nvim/lua/core/terminal.lua | 37 | ||||
-rw-r--r-- | .config/nvim/lua/core/which-key.lua | 47 |
16 files changed, 225 insertions, 159 deletions
diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua index 3432e14..9ee9e90 100644 --- a/.config/nvim/lua/core/autocmds.lua +++ b/.config/nvim/lua/core/autocmds.lua @@ -14,6 +14,11 @@ options.autocommands = { "nnoremap <silent> <buffer> q :q<CR>", }, { + "FileType", + "lsp-installer", + "nnoremap <silent> <buffer> q :q<CR>", + }, + { "TextYankPost", "*", "lua require('vim.highlight').on_yank({higroup = 'Search', timeout = 200})", diff --git a/.config/nvim/lua/core/autopairs.lua b/.config/nvim/lua/core/autopairs.lua index 8ea3094..0c9ec28 100644 --- a/.config/nvim/lua/core/autopairs.lua +++ b/.config/nvim/lua/core/autopairs.lua @@ -7,8 +7,16 @@ function M.config() ---@usage map <CR> on insert mode map_cr = true, ---@usage auto insert after select function or method item - -- NOTE: This should be wrapped into a function so that it is re-evaluated when opening new files - map_complete = vim.bo.filetype ~= "tex", + map_complete = true, + ---@usage automatically select the first item + auto_select = true, + ---@usage use insert confirm behavior instead of replace + insert = false, + ---@usage -- modifies the function or method delimiter by filetypes + map_char = { + all = "(", + tex = "{", + }, ---@usage check treesitter check_ts = true, ts_config = { @@ -52,9 +60,11 @@ M.setup = function() if package.loaded["cmp"] then require("nvim-autopairs.completion.cmp").setup { - map_cr = true, -- map <CR> on insert mode - map_complete = true, -- it will auto insert `(` after select function or method item - auto_select = true, -- automatically select the first item + map_cr = options.builtin.autopairs.map_cr, + map_complete = options.builtin.autopairs.map_complete, + auto_select = options.builtin.autopairs.auto_select, + insert = options.builtin.autopairs.insert, + map_char = options.builtin.autopairs.map_char, } end diff --git a/.config/nvim/lua/core/builtins/init.lua b/.config/nvim/lua/core/builtins/init.lua index dc9b5ff..c3b3618 100644 --- a/.config/nvim/lua/core/builtins/init.lua +++ b/.config/nvim/lua/core/builtins/init.lua @@ -15,7 +15,6 @@ local builtins = { "core.bufferline", "core.autopairs", "core.comment", - "core.lspinstall", "core.lualine", } diff --git a/.config/nvim/lua/core/cmp.lua b/.config/nvim/lua/core/cmp.lua index 50f7058..f9f2d01 100644 --- a/.config/nvim/lua/core/cmp.lua +++ b/.config/nvim/lua/core/cmp.lua @@ -30,10 +30,40 @@ M.config = function() return end options.builtin.cmp = { + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, formatting = { + 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 = " ", + }, format = function(entry, vim_item) - local icons = require("lsp.kind").icons - vim_item.kind = icons[vim_item.kind] + vim_item.kind = options.builtin.cmp.formatting.kind_icons[vim_item.kind] vim_item.menu = ({ nvim_lsp = "(LSP)", emoji = "(Emoji)", @@ -78,7 +108,7 @@ M.config = function() -- TODO: potentially fix emmet nonsense ["<Tab>"] = cmp.mapping(function() if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(T "<C-n>", "n") + vim.fn.feedkeys(T "<down>", "n") elseif luasnip.expand_or_jumpable() then vim.fn.feedkeys(T "<Plug>luasnip-expand-or-jump", "") elseif check_backspace() then @@ -94,7 +124,7 @@ M.config = function() }), ["<S-Tab>"] = cmp.mapping(function(fallback) if vim.fn.pumvisible() == 1 then - vim.fn.feedkeys(T "<C-p>", "n") + vim.fn.feedkeys(T "<up>", "n") elseif luasnip.jumpable(-1) then vim.fn.feedkeys(T "<Plug>luasnip-jump-prev", "") else @@ -107,10 +137,15 @@ M.config = function() ["<C-Space>"] = cmp.mapping.complete(), ["<C-e>"] = cmp.mapping.close(), - ["<CR>"] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, + ["<CR>"] = cmp.mapping(function(fallback) + if not require("cmp").confirm(options.builtin.cmp.confirm_opts) then + if luasnip.jumpable() then + vim.fn.feedkeys(T "<Plug>luasnip-jump-next", "") + else + fallback() + end + end + end), }, } end diff --git a/.config/nvim/lua/core/commands.lua b/.config/nvim/lua/core/commands.lua index 403194e..34033d4 100644 --- a/.config/nvim/lua/core/commands.lua +++ b/.config/nvim/lua/core/commands.lua @@ -10,7 +10,7 @@ M.defaults = { endif endfunction ]], - [[command! LvimInfo lua require('core.info').toggle_popup(vim.bo.filetype)]], + [[command! NvimInfo lua require('core.info').toggle_popup(vim.bo.filetype)]], } M.load = function(commands) diff --git a/.config/nvim/lua/core/dap.lua b/.config/nvim/lua/core/dap.lua index 6179ea3..fb56f82 100644 --- a/.config/nvim/lua/core/dap.lua +++ b/.config/nvim/lua/core/dap.lua @@ -10,6 +10,18 @@ M.config = function() linehl = "", numhl = "", }, + breakpoint_rejected = { + text = "", + texthl = "LspDiagnosticsSignHint", + linehl = "", + numhl = "", + }, + stopped = { + text = "", + texthl = "LspDiagnosticsSignInformation", + linehl = "DiagnosticUnderlineInfo", + numhl = "LspDiagnosticsSignInformation", + }, } end @@ -17,6 +29,8 @@ M.setup = function() local dap = require "dap" vim.fn.sign_define("DapBreakpoint", options.builtin.dap.breakpoint) + vim.fn.sign_define("DapBreakpointRejected", options.builtin.dap.breakpoint_rejected) + vim.fn.sign_define("DapStopped", options.builtin.dap.stopped) dap.defaults.fallback.terminal_win_cmd = "50vsplit new" options.builtin.which_key.mappings["d"] = { diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua index 70e862e..8df581e 100644 --- a/.config/nvim/lua/core/dashboard.lua +++ b/.config/nvim/lua/core/dashboard.lua @@ -1,5 +1,5 @@ local M = {} -local home_dir = vim.loop.os_homedir() +local utils = require "utils" M.config = function(config) options.builtin.dashboard = { @@ -7,7 +7,7 @@ M.config = function(config) on_config_done = nil, search_handler = "telescope", disable_at_vim_enter = 0, - session_directory = home_dir .. "/.cache/options/sessions", + session_directory = utils.join_paths(get_cache_dir(), "sessions"), custom_header = { " ##############..... ############## ", " ##############......############## ", @@ -67,15 +67,21 @@ M.setup = function() vim.g.dashboard_session_directory = options.builtin.dashboard.session_directory - vim.cmd "let packages = len(globpath('~/.local/share/lunarvim/site/pack/packer/start', '*', 0, 1))" - - vim.api.nvim_exec( - [[ - let g:dashboard_custom_footer = ['LunarVim loaded '..packages..' plugins '] -]], - false + local num_plugins_loaded = #vim.fn.globpath( + get_runtime_dir() .. "/site/pack/packer/start", + "*", + 0, + 1 ) + local footer = { + "nvim loaded " .. num_plugins_loaded .. " plugins ", + "", + } + + local text = require "interface.text" + vim.g.dashboard_custom_footer = text.align_center({ width = 0 }, footer, 0.49) -- Use 0.49 as counts for 2 characters + require("core.autocmds").define_augroups { _dashboard = { -- seems to be nobuflisted that makes my stuff disappear will do more testing diff --git a/.config/nvim/lua/core/gitsigns.lua b/.config/nvim/lua/core/gitsigns.lua index d9c9187..97f5314 100644 --- a/.config/nvim/lua/core/gitsigns.lua +++ b/.config/nvim/lua/core/gitsigns.lua @@ -42,7 +42,7 @@ M.config = function() noremap = true, buffer = true, }, - watch_index = { interval = 1000 }, + watch_gitdir = { interval = 1000 }, sign_priority = 6, update_debounce = 200, status_formatter = nil, -- Use default diff --git a/.config/nvim/lua/core/info.lua b/.config/nvim/lua/core/info.lua index 83e3542..bb53644 100644 --- a/.config/nvim/lua/core/info.lua +++ b/.config/nvim/lua/core/info.lua @@ -10,6 +10,7 @@ local M = { } local fmt = string.format +local text = require "interface.text" local function str_list(list) return fmt("[ %s ]", table.concat(list, ", ")) @@ -73,21 +74,32 @@ local function tbl_set_highlight(terms, highlight_group) end end +local function make_client_info(client) + local client_enabled_caps = require("lsp.utils").get_ls_capabilities(client.id) + local name = client.name + local id = client.id + local document_formatting = client.resolved_capabilities.document_formatting + local client_info = { + fmt("* Name: %s", name), + fmt("* Id: %s", tostring(id)), + fmt("* Supports formatting: %s", tostring(document_formatting)), + } + if not vim.tbl_isempty(client_enabled_caps) then + local caps_text = "* Capabilities list: " + local caps_text_len = caps_text:len() + local enabled_caps = text.format_table(client_enabled_caps, 3, " | ") + enabled_caps = text.shift_right(enabled_caps, caps_text_len) + enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1)) + vim.list_extend(client_info, enabled_caps) + end + + return client_info +end + function M.toggle_popup(ft) local lsp_utils = require "lsp.utils" - local client = lsp_utils.get_active_client_by_ft(ft) - local is_client_active = false - local client_enabled_caps = {} - local client_name = "" - local client_id = 0 - local document_formatting = false - if client ~= nil then - is_client_active = not client.is_stopped() - client_enabled_caps = require("lsp").get_ls_capabilities(client.id) - client_name = client.name - client_id = client.id - document_formatting = client.resolved_capabilities.document_formatting - end + local clients = lsp_utils.get_active_client_by_ft(ft) + local client_names = {} local header = { fmt("Detected filetype: %s", ft), @@ -97,23 +109,23 @@ function M.toggle_popup(ft) ), } - local text = require "interface.text" local lsp_info = { "Language Server Protocol (LSP) info", - fmt("* Associated server: %s", client_name), - fmt("* Active: %s (id: %d)", tostring(is_client_active), client_id), - fmt("* Supports formatting: %s", tostring(document_formatting)), + fmt "* Associated server(s):", } - if not vim.tbl_isempty(client_enabled_caps) then - local caps_text = "* Capabilities list: " - local caps_text_len = caps_text:len() - local enabled_caps = text.format_table(client_enabled_caps, 3, " | ") - enabled_caps = text.shift_left(enabled_caps, caps_text_len) - enabled_caps[1] = fmt("%s%s", caps_text, enabled_caps[1]:sub(caps_text_len + 1)) - vim.list_extend(lsp_info, enabled_caps) + + for _, client in pairs(clients) do + vim.list_extend(lsp_info, make_client_info(client)) + table.insert(client_names, client.name) end - local null_ls = require "lsp.null-ls" - local registered_providers = null_ls.list_supported_provider_names(ft) + + local null_formatters = require "lsp.null-ls.formatters" + local null_linters = require "lsp.null-ls.linters" + local registered_formatters = null_formatters.list_supported_names(ft) + local registered_linters = null_linters.list_supported_names(ft) + local registered_providers = {} + vim.list_extend(registered_providers, registered_formatters) + vim.list_extend(registered_providers, registered_linters) local registered_count = vim.tbl_count(registered_providers) local null_ls_info = { "Formatters and linters", @@ -124,30 +136,6 @@ function M.toggle_popup(ft) ), } - local null_formatters = require "lsp.null-ls.formatters" - local missing_formatters = null_formatters.list_unsupported_names(ft) - local missing_formatters_status = {} - if not vim.tbl_isempty(missing_formatters) then - missing_formatters_status = { - fmt( - "* Missing formatters: %s", - table.concat(missing_formatters, " , ") .. " " - ), - } - end - - local null_linters = require "lsp.null-ls.linters" - local missing_linters = null_linters.list_unsupported_names(ft) - local missing_linters_status = {} - if not vim.tbl_isempty(missing_linters) then - missing_linters_status = { - fmt( - "* Missing linters: %s", - table.concat(missing_linters, " , ") .. " " - ), - } - end - local content_provider = function(popup) local content = {} @@ -160,8 +148,6 @@ function M.toggle_popup(ft) lsp_info, { "" }, null_ls_info, - missing_formatters_status, - missing_linters_status, { "" }, { "" }, get_formatter_suggestion_msg(ft), @@ -172,21 +158,18 @@ function M.toggle_popup(ft) vim.list_extend(content, section) end - return text.align(popup, content, 0.5) + return text.align_left(popup, content, 0.5) end local function set_syntax_hl() - vim.cmd [[highlight NvimInfoIdentifier gui=bold]] - vim.cmd [[highlight link NvimInfoHeader Type]] - vim.cmd [[let m=matchadd("NvimInfoHeader", "Language Server Protocol (LSP) info")]] - vim.cmd [[let m=matchadd("NvimInfoHeader", "Formatters and linters")]] - vim.cmd('let m=matchadd("NvimInfoIdentifier", " ' .. ft .. '$")') + vim.cmd [[highlight nvimInfoIdentifier gui=bold]] + vim.cmd [[highlight link nvimInfoHeader Type]] + vim.cmd [[let m=matchadd("nvimInfoHeader", "Language Server Protocol (LSP) info")]] + vim.cmd [[let m=matchadd("nvimInfoHeader", "Formatters and linters")]] + vim.cmd('let m=matchadd("nvimInfoIdentifier", " ' .. ft .. '$")') vim.cmd 'let m=matchadd("string", "true")' vim.cmd 'let m=matchadd("error", "false")' - tbl_set_highlight(registered_providers, "NvimInfoIdentifier") - tbl_set_highlight(missing_formatters, "NvimInfoIdentifier") - tbl_set_highlight(missing_linters, "NvimInfoIdentifier") - vim.cmd('let m=matchadd("NvimInfoIdentifier", "' .. client_name .. '")') + tbl_set_highlight(registered_providers, "nvimInfoIdentifier") end local Popup = require("interface.popup"):new { diff --git a/.config/nvim/lua/core/log.lua b/.config/nvim/lua/core/log.lua index bcc68e4..de03521 100644 --- a/.config/nvim/lua/core/log.lua +++ b/.config/nvim/lua/core/log.lua @@ -8,6 +8,7 @@ function Log:add_entry(msg, level) if self.__handle then -- plenary uses lower-case log levels self.__handle[level:lower()](msg) + return end local status_ok, plenary = pcall(require, "plenary") if status_ok then diff --git a/.config/nvim/lua/core/lspinstall.lua b/.config/nvim/lua/core/lspinstall.lua deleted file mode 100644 index 79c7502..0000000 --- a/.config/nvim/lua/core/lspinstall.lua +++ /dev/null @@ -1,19 +0,0 @@ -local M = {} - -M.config = function() - options.builtin.lspinstall = { - active = true, - on_config_done = nil, - } -end - -M.setup = function() - local lspinstall = require "lspinstall" - lspinstall.setup() - - if options.builtin.lspinstall.on_config_done then - options.builtin.lspinstall.on_config_done(lspinstall) - end -end - -return M diff --git a/.config/nvim/lua/core/lualine/components.lua b/.config/nvim/lua/core/lualine/components.lua index 78f1793..9333a17 100644 --- a/.config/nvim/lua/core/lualine/components.lua +++ b/.config/nvim/lua/core/lualine/components.lua @@ -109,14 +109,11 @@ return { local buf_client_names = {} -- add client - local utils = require "lsp.utils" - local active_client = utils.get_active_client_by_ft(buf_ft) for _, client in pairs(buf_clients) do if client.name ~= "null-ls" then table.insert(buf_client_names, client.name) end end - vim.list_extend(buf_client_names, active_client or {}) -- add formatter local formatters = require "lsp.null-ls.formatters" diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua index 1e764c7..ff8db15 100644 --- a/.config/nvim/lua/core/nvimtree.lua +++ b/.config/nvim/lua/core/nvimtree.lua @@ -5,8 +5,23 @@ function M.config() options.builtin.nvimtree = { active = true, on_config_done = nil, - side = "left", - width = 30, + setup = { + auto_open = 0, + auto_close = 1, + tab_open = 0, + update_focused_file = { + enable = 1, + }, + lsp_diagnostics = 1, + view = { + width = 30, + side = "left", + auto_resize = false, + mappings = { + custom_only = false, + }, + }, + }, show_icons = { git = 1, folders = 1, @@ -15,16 +30,11 @@ function M.config() tree_width = 30, }, ignore = { ".git", "node_modules", ".cache" }, - auto_open = 0, - auto_close = 1, quit_on_open = 0, - follow = 1, hide_dotfiles = 1, git_hl = 1, root_folder_modifier = ":t", - tab_open = 0, allow_resize = 1, - lsp_diagnostics = 1, auto_ignore_ft = { "startify", "dashboard" }, icons = { default = "", @@ -52,7 +62,7 @@ end function M.setup() local status_ok, nvim_tree_config = pcall(require, "nvim-tree.config") if not status_ok then - Log:error("Failed to load nvim-tree.config") + Log:error "Failed to load nvim-tree.config" return end local g = vim.g @@ -63,17 +73,17 @@ function M.setup() -- Implicitly update nvim-tree when project module is active if options.builtin.project.active then - vim.g.nvim_tree_update_cwd = 1 - vim.g.nvim_tree_respect_buf_cwd = 1 - vim.g.nvim_tree_disable_netrw = 0 - vim.g.nvim_tree_hijack_netrw = 0 + options.builtin.nvimtree.respect_buf_cwd = 1 + options.builtin.nvimtree.setup.update_cwd = 1 + options.builtin.nvimtree.setup.disable_netrw = 0 + options.builtin.nvimtree.setup.hijack_netrw = 0 vim.g.netrw_banner = 0 end local tree_cb = nvim_tree_config.nvim_tree_callback - if not g.nvim_tree_bindings then - g.nvim_tree_bindings = { + if not options.builtin.nvimtree.setup.view.mappings.list then + options.builtin.nvimtree.setup.view.mappings.list = { { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, { key = "h", cb = tree_cb "close_node" }, { key = "v", cb = tree_cb "vsplit" }, @@ -96,11 +106,18 @@ function M.setup() if options.builtin.nvimtree.on_config_done then options.builtin.nvimtree.on_config_done(nvim_tree_config) end + require("nvim-tree").setup(options.builtin.nvimtree.setup) end function M.on_open() - if package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left" then - require("bufferline.state").set_offset(options.builtin.nvimtree.width + 1, "") + if + package.loaded["bufferline.state"] + and options.builtin.nvimtree.setup.view.side == "left" + then + require("bufferline.state").set_offset( + options.builtin.nvimtree.setup.view.width + 1, + "" + ) end end diff --git a/.config/nvim/lua/core/project.lua b/.config/nvim/lua/core/project.lua index c7eacde..b2d4f5f 100644 --- a/.config/nvim/lua/core/project.lua +++ b/.config/nvim/lua/core/project.lua @@ -35,7 +35,7 @@ function M.config() ---@type string ---@usage path to store the project history for use in telescope - datapath = CACHE_PATH, + datapath = get_cache_dir(), } end diff --git a/.config/nvim/lua/core/terminal.lua b/.config/nvim/lua/core/terminal.lua index 01b7709..1a7b0bc 100644 --- a/.config/nvim/lua/core/terminal.lua +++ b/.config/nvim/lua/core/terminal.lua @@ -1,5 +1,5 @@ local M = {} -local utils = require "utils" +local Log = require "core.log" M.config = function() options.builtin["terminal"] = { @@ -81,8 +81,11 @@ end M._exec_toggle = function(exec) local binary = M._split(exec)[1] if vim.fn.executable(binary) ~= 1 then - local Log = require "core.log" - Log:error("Unable to run executable " .. binary .. ". Please make sure it is installed properly.") + Log:error( + "Unable to run executable " + .. binary + .. ". Please make sure it is installed properly." + ) return end local Terminal = require("toggleterm.terminal").Terminal @@ -90,29 +93,16 @@ M._exec_toggle = function(exec) exec_term:toggle() end -local function get_log_path(name) - --handle custom paths not managed by Plenary.log - local logger = require "core.log" - local file - if name == "nvim" then - file = CACHE_PATH .. "/log" - else - file = logger:new({ plugin = name }):get_path() - end - if utils.is_file(file) then - return file - end -end - ---Toggles a log viewer according to log.viewer.layout_config ----@param name can be the name of any of the managed logs, e,g. "lunarvim" or the default ones {"nvim", "lsp", "packer.nvim"} -M.toggle_log_view = function(name) - local logfile = get_log_path(name) - if not logfile then - return +---@param logfile string the fullpath to the logfile +M.toggle_log_view = function(logfile) + local log_viewer = options.log.viewer.cmd + if vim.fn.executable(log_viewer) ~= 1 then + log_viewer = "less +F" end + log_viewer = log_viewer .. " " .. logfile local term_opts = vim.tbl_deep_extend("force", options.builtin.terminal, { - cmd = options.log.viewer.cmd .. " " .. logfile, + cmd = log_viewer, open_mapping = options.log.viewer.layout_config.open_mapping, direction = options.log.viewer.layout_config.direction, -- TODO: this might not be working as expected @@ -122,7 +112,6 @@ M.toggle_log_view = function(name) local Terminal = require("toggleterm.terminal").Terminal local log_view = Terminal:new(term_opts) - -- require("core.log"):debug("term", vim.inspect(term_opts)) log_view:toggle() end diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua index d4ef1a2..db67055 100644 --- a/.config/nvim/lua/core/which-key.lua +++ b/.config/nvim/lua/core/which-key.lua @@ -162,8 +162,14 @@ M.config = function() p = { name = "Peek", d = { "<cmd>lua require('lsp.peek').Peek('definition')<cr>", "Definition" }, - t = { "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>", "Type Definition" }, - i = { "<cmd>lua require('lsp.peek').Peek('implementation')<cr>", "Implementation" }, + t = { + "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>", + "Type Definition", + }, + i = { + "<cmd>lua require('lsp.peek').Peek('implementation')<cr>", + "Implementation", + }, }, q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" }, r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" }, @@ -179,23 +185,46 @@ M.config = function() "<cmd>edit ~/.config/nvim/config.lua<cr>", "Edit config.lua", }, - k = { "<cmd>lua require('keymappings').print()<cr>", "View LunarVim's default keymappings" }, + k = { + "<cmd>lua require('keymappings').print()<cr>", + "View LunarVim's default keymappings", + }, i = { "<cmd>lua require('core.info').toggle_popup(vim.bo.filetype)<cr>", "Toggle nvim Info", }, l = { name = "+logs", - D = { "<cmd>edit ~/.cache/nvim/lunarvim.log<cr>", "Open the default logfile" }, - n = { "<cmd>lua require('core.terminal').toggle_log_view('lsp')<cr>", "view lsp log" }, - N = { "<cmd>edit ~/.cache/nvim/log<cr>", "Open the Neovim logfile" }, - l = { "<cmd>lua require('core.terminal').toggle_log_view('nvim')<cr>", "view neovim log" }, - L = { "<cmd>edit ~/.cache/nvim/lsp.log<cr>", "Open the LSP logfile" }, + d = { + "<cmd>lua require('core.terminal').toggle_log_view(require('core.log').get_path())<cr>", + "view default log", + }, + D = { + "<cmd>lua vim.fn.execute('edit ' .. require('core.log').get_path())<cr>", + "Open the default logfile", + }, + l = { + "<cmd>lua require('core.terminal').toggle_log_view(vim.lsp.get_log_path())<cr>", + "view lsp log", + }, + L = { + "<cmd>lua vim.fn.execute('edit ' .. vim.lsp.get_log_path())<cr>", + "Open the LSP logfile", + }, + n = { + "<cmd>lua require('core.terminal').toggle_log_view(os.getenv('NVIM_LOG_FILE'))<cr>", + "view neovim log", + }, + N = { "<cmd>edit $NVIM_LOG_FILE<cr>", "Open the Neovim logfile" }, p = { "<cmd>lua require('core.terminal').toggle_log_view('packer.nvim')<cr>", "view packer log", }, - P = { "<cmd>edit ~/.cache/nvim/packer.nvim.log<cr>", "Open the Packer logfile" }, + P = { + "<cmd>exe 'edit '.stdpath('cache').'/packer.nvim.log'<cr>", + "Open the Packer logfile", + }, + r = { "<cmd>lua require('utils').reload_config()<cr>", "Reload configurations" }, }, }, s = { |