diff --git a/nvim/init.lua b/nvim/init.lua index 77c8b84..6f91829 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -77,8 +77,7 @@ map("n", "Q", "", { noremap = true }) map("n", "q:", "", { noremap = true }) map({ "n", "v" }, "", "", { silent = true }) -map("n", "e", [[:vnew ~/dotfiles/nvim/init.lua]], { noremap = true }) -map("n", "ww", [[:cd %:p:h]], { noremap = true }) +map("n", "ww", [[:cd %:p:h]], { noremap = true }) -- change workspace map("n", "", "noh", { silent = true, noremap = true }) map("", "", "", { silent = true, noremap = true }) @@ -140,6 +139,18 @@ vim.api.nvim_create_autocmd("ColorScheme", { end, }) +-- reload +vim.api.nvim_create_autocmd("FocusGained", { + desc = "Reload files from disk when we focus vim", + pattern = "*", + command = "if getcmdwintype() == '' | checktime | endif", +}) +vim.api.nvim_create_autocmd("BufEnter", { + desc = "Every time we enter an unmodified buffer, check if it changed on disk", + pattern = "*", + command = "if &buftype == '' && !&modified && expand('%') != '' | exec 'checktime ' . expand('') | endif", +}) + -- ---------------------------------------- -- LSP -- ---------------------------------------- @@ -157,9 +168,9 @@ local function lspsetup() local severity = diag.severity.HINT local keyspec = { -- workspaces - { "wa", vim.lsp.buf.add_workspace_folder }, - { "wr", vim.lsp.buf.remove_workspace_folder }, - { "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end }, + -- { "wa", vim.lsp.buf.add_workspace_folder }, + -- { "wr", vim.lsp.buf.remove_workspace_folder }, + -- { "wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end }, -- jump { "", function() diag.open_float({ source = true }) end }, { "", function() diag.jump({ severity = { min = severity }, float = true, count = 1 }) end }, @@ -174,8 +185,8 @@ local function lspsetup() -- popups { "", vim.lsp.buf.signature_help, { "n", "i" } }, -- symbols - { "ds", vim.lsp.buf.document_symbol }, - { "ws", vim.lsp.buf.workspace_symbol }, + -- { "ds", vim.lsp.buf.document_symbol }, + -- { "ws", vim.lsp.buf.workspace_symbol }, -- other { "K", vim.lsp.buf.hover }, { "", vim.lsp.buf.rename }, @@ -1003,7 +1014,7 @@ local function makespec_search() "kevinhwang91/nvim-hlslens", dependencies = { "haya14busa/vim-asterisk" }, cmd = { "HlSearchLensDisable", "HlSearchLensEnable", "HlSearchLensToggle" }, - opts = { nearest_only = true }, + opts = { nearest_only = true, nearest_float_when = "never" }, keys = { { "*", [[(asterisk-z*)lua require('hlslens').start()]], mode = { "n", "x" }, {} }, { "#", [[(asterisk-z#)lua require('hlslens').start()]], mode = { "n", "x" }, {} },