diff --git a/nvim/lsp/lua_ls.lua b/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..14f7ba3 --- /dev/null +++ b/nvim/lsp/lua_ls.lua @@ -0,0 +1,12 @@ +return { + settings = { + Lua = { + completion = { + callSnippet = "Replace", + }, + diagnostics = { + globals = { "vim" }, + }, + }, + }, +} diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index c71437c..96ee73a 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -1,11 +1,25 @@ --- [[ Basic Keymaps ]] +local keymap = vim.keymap.set -vim.keymap.set("n", "", "nohlsearch") -vim.keymap.set("n", "f", vim.diagnostic.setloclist, { desc = "Open diagnostic quick[f]ix list" }) -vim.keymap.set("n", "q", "q") -vim.keymap.set("n", "Q", "qa") -vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the left window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the right window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the upper window" }) +-- Normal mode +keymap("n", "", "nohlsearch") +keymap("n", "f", vim.diagnostic.setloclist, { desc = "Open diagnostic quick[f]ix list" }) +keymap("n", "w", "w!", { desc = "[w]rite current file", silent = true }) +keymap("n", "q", "q", { desc = "[q]uit current buffer", silent = true }) +keymap("n", "Q", "qa", { desc = "[Q]uit completely", silent = true }) +keymap("n", "fb", ":lua vim.lsp.buf.format()", { desc = "[f]ormat [b]uffer", silent = true }) +keymap("n", "", "", { desc = "Move focus to the left window" }) +keymap("n", "", "", { desc = "Move focus to the right window" }) +keymap("n", "", "", { desc = "Move focus to the lower window" }) +keymap("n", "", "", { desc = "Move focus to the upper window" }) +keymap( + "n", + "gd", + "lua vim.lsp.buf.definition()", + { desc = "[g]o to [d]efinition", noremap = true, silent = true } +) + +-- Visual mode +keymap("v", "p", '"_dP', { desc = "[p]aste without overwriting default register" }) + +-- Terminal mode +keymap("t", "", "", { desc = "Exit terminal mode" }) diff --git a/nvim/lua/config/lazy/10-git.lua b/nvim/lua/config/lazy/10-git.lua deleted file mode 100644 index 8045131..0000000 --- a/nvim/lua/config/lazy/10-git.lua +++ /dev/null @@ -1,28 +0,0 @@ -return { - { - "lewis6991/gitsigns.nvim", - opts = { - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "_" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - }, - }, - }, - -- { - -- "kdheepak/lazygit.nvim", - -- lazy = false, - -- cmd = { - -- "LazyGit", - -- "LazyGitConfig", - -- "LazyGitCurrentFile", - -- "LazyGitFilter", - -- "LazyGitFilterCurrentFile", - -- }, - -- keys = { - -- { "gs", "LazyGit", desc = "LazyGit" }, - -- }, - -- }, -} diff --git a/nvim/lua/config/lazy/20-which-key.lua b/nvim/lua/config/lazy/20-which-key.lua deleted file mode 100644 index d01c9ad..0000000 --- a/nvim/lua/config/lazy/20-which-key.lua +++ /dev/null @@ -1,47 +0,0 @@ -return { - "folke/which-key.nvim", - event = "VimEnter", - opts = { - delay = 0, - icons = { - mappings = vim.g.have_nerd_font, - keys = vim.g.have_nerd_font and {} or { - Up = " ", - Down = " ", - Left = " ", - Right = " ", - C = " ", - M = " ", - D = " ", - S = " ", - CR = " ", - Esc = " ", - ScrollWheelDown = " ", - ScrollWheelUp = " ", - NL = " ", - BS = " ", - Space = " ", - Tab = " ", - F1 = "", - F2 = "", - F3 = "", - F4 = "", - F5 = "", - F6 = "", - F7 = "", - F8 = "", - F9 = "", - F10 = "", - F11 = "", - F12 = "", - }, - }, - - -- Document existing key chains - spec = { - { "s", group = "[S]earch" }, - { "e", group = "[E]xplorer/Tree" }, - { "t", group = "[T]oggle" }, - }, - }, -} diff --git a/nvim/lua/config/lazy/40-lsp.lua b/nvim/lua/config/lazy/40-lsp.lua deleted file mode 100644 index e2738ff..0000000 --- a/nvim/lua/config/lazy/40-lsp.lua +++ /dev/null @@ -1,206 +0,0 @@ -return { - { - "folke/lazydev.nvim", - ft = "lua", - opts = { - library = { - { path = "${3rd}/luv/library", words = { "vim%.uv" } }, - }, - }, - }, - { - "neovim/nvim-lspconfig", - dependencies = { - { "mason-org/mason.nvim", opts = {} }, - "mason-org/mason-lspconfig.nvim", - "WhoIsSethDaniel/mason-tool-installer.nvim", - { "j-hui/fidget.nvim", opts = {} }, - "saghen/blink.cmp", - }, - config = function() - vim.api.nvim_create_autocmd("LspAttach", { - group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or "n" - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) - end - vim.lsp.set_log_level("WARN") - -- Rename the variable under your cursor. - map("grn", vim.lsp.buf.rename, "[R]e[n]ame") - -- Execute a code action, usually your cursor needs to be on top of an error - map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" }) - -- Find references for the word under your cursor. - map("grr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences") - -- Jump to the implementation of the word under your cursor. - map("gri", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation") - -- Jump to the definition of the word under your cursor. - map("grd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition") - -- WARN: This is not Goto Definition, this is Goto Declaration. - map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration") - -- Fuzzy find all the symbols in your current document. - map("gO", require("telescope.builtin").lsp_document_symbols, "Open Document Symbols") - -- Fuzzy find all the symbols in your current workspace. - map("gW", require("telescope.builtin").lsp_dynamic_workspace_symbols, "Open Workspace Symbols") - -- Jump to the type of the word under your cursor. - map("grt", require("telescope.builtin").lsp_type_definitions, "[G]oto [T]ype Definition") - - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client - ---@param method vim.lsp.protocol.Method - ---@param bufnr? integer some lsp support methods only in specific files - ---@return boolean - local function client_supports_method(client, method, bufnr) - if vim.fn.has("nvim-0.11") == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if - client - and client_supports_method( - client, - vim.lsp.protocol.Methods.textDocument_documentHighlight, - event.buf - ) - then - local highlight_augroup = - vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) - vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd("LspDetach", { - group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) - end, - }) - end - - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if - client - and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) - then - map("th", function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) - end, "[T]oggle Inlay [H]ints") - end - end, - }) - - -- Diagnostic Config - -- See :help vim.diagnostic.Opts - vim.diagnostic.config({ - severity_sort = true, - float = { border = "rounded", source = "if_many" }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = "󰅚 ", - [vim.diagnostic.severity.WARN] = "󰀪 ", - [vim.diagnostic.severity.INFO] = "󰋽 ", - [vim.diagnostic.severity.HINT] = "󰌶 ", - }, - } or {}, - virtual_text = { - source = "if_many", - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - }) - - local capabilities = require("blink.cmp").get_lsp_capabilities() - local servers = { - terraformls = { - filetypes = { "terraform", "terraform-vars", "hcl" }, - cmd = { - "terraform-ls", - "serve", - "-log-file", - vim.fs.dirname(require("vim.lsp.log").get_filename()) .. "/terraform-ls.log", - }, - }, - lua_ls = { - settings = { - Lua = { - completion = { - callSnippet = "Replace", - }, - }, - }, - }, - } - - -- Ensure the servers and tools above are installed - -- - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - -- LSPs - "json-lsp", - "lua_ls", - "ruby_lsp", - "rubocop", - "rust_analyzer", - "terraformls", - -- Formatters - "fixjson", - "goimports", - "hclfmt", - "prettierd", - "shellharden", - "stylua", - "yamlfix", - --- Linters - "swiftlint", - }) - require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) - - require("mason-lspconfig").setup({ - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_enable = true, - automatic_installation = false, - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) - require("lspconfig")[server_name].setup(server) - end, - }, - }) - end, - }, -} diff --git a/nvim/lua/config/lazy_init.lua b/nvim/lua/config/lazy_init.lua index bed6ab6..ad3bf29 100644 --- a/nvim/lua/config/lazy_init.lua +++ b/nvim/lua/config/lazy_init.lua @@ -1,14 +1,14 @@ local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - error("Error cloning lazy.nvim:\n" .. out) - end + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + error("Error cloning lazy.nvim:\n" .. out) + end end vim.opt.rtp:prepend(lazypath) require("lazy").setup({ - spec = "config.lazy", - change_detection = { notify = false }, + spec = { import = "plugins" }, + change_detection = { notify = false }, }) diff --git a/nvim/lua/config/settings.lua b/nvim/lua/config/settings.lua index f8d7ff4..3f8d67e 100644 --- a/nvim/lua/config/settings.lua +++ b/nvim/lua/config/settings.lua @@ -1,37 +1,49 @@ -vim.g.have_nerd_font = true -vim.o.guifont = "Inconsolata Patched G:h12" -if vim.g.neovide then - vim.opt.cmdheight = 0 - vim.o.linespace = 5 - vim.g.neovide_cursor_animation_length = 0 - vim.g.neovide_scroll_animation_length = 0 -end -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.signcolumn = "yes" -vim.opt.mouse = "a" --- Don't show the mode, since it's already in the status line -vim.opt.showmode = false +local opt = vim.opt +-- Columns and gutters +opt.colorcolumn = "80" -- Highlight column 80 +opt.number = true -- Line numbers in the gutter +opt.relativenumber = true -- Relative line numbers in the gutter +opt.signcolumn = "yes:1" -- Sign column in the gutter always visible + +-- Indentation +opt.autoindent = true -- Enable auto-indentation +opt.breakindent = true -- ? +opt.expandtab = true -- Default to spaces instead of tabs +opt.shiftround = true -- Round indent to multiple of shift-width +opt.shiftwidth = 4 -- Number of spaces when auto-indenting +opt.softtabstop = 4 -- Number of spaces for a tab when editing +opt.tabstop = 4 -- Number of spaces for a tab + +-- Display and adornments +opt.cursorline = true -- Highlight current line +opt.guifont = "Inconsolata Patched G:h12" +opt.list = true -- Show whitespace characters +opt.listchars = { tab = "» ", trail = "○", nbsp = "␣", lead = "•" } +opt.scrolloff = 3 -- Show 3 lines above and below cursor +opt.showmode = false -- Don't show the mode since it's in our statusline +opt.termguicolors = true -- Use true terminal colors +opt.virtualedit = "block" +opt.winborder = "rounded" -- Rounded borders for windows + +-- Behavior +opt.confirm = true +opt.ignorecase = true -- Ignore case in search and commands +opt.inccommand = "split" -- Preview substitutions live +opt.mouse = "a" -- Turn on mouse support +opt.smartcase = true -- ? +opt.splitbelow = true +opt.splitright = true +opt.timeoutlen = 1000 -- Command timeout length +opt.undofile = true +opt.updatetime = 250 -- ? + +-- Clipboard -- Sync clipboard between OS and Neovim. vim.schedule(function() - vim.opt.clipboard = "unnamedplus" + vim.opt.clipboard = "unnamedplus" end) -vim.opt.timeoutlen = 1000 -vim.opt.breakindent = true -vim.opt.undofile = true -vim.opt.ignorecase = true -vim.opt.smartcase = true -vim.opt.updatetime = 250 -vim.opt.timeoutlen = 300 -vim.opt.splitright = true -vim.opt.splitbelow = true -vim.opt.list = true -vim.opt.listchars = { tab = "» ", trail = "○", nbsp = "␣", lead = "•" } --- Preview substitutions live, as you type! -vim.opt.inccommand = "split" -vim.opt.cursorline = true -vim.opt.scrolloff = 5 -vim.opt.confirm = true -vim.opt.virtualedit = "block" +-- Features +vim.cmd.filetype("plugin indent on") +vim.g.have_nerd_font = true diff --git a/nvim/lua/config/lazy/00-colorscheme.lua b/nvim/lua/plugins/00-colorscheme.lua similarity index 100% rename from nvim/lua/config/lazy/00-colorscheme.lua rename to nvim/lua/plugins/00-colorscheme.lua diff --git a/nvim/lua/plugins/10-git.lua b/nvim/lua/plugins/10-git.lua new file mode 100644 index 0000000..db5e441 --- /dev/null +++ b/nvim/lua/plugins/10-git.lua @@ -0,0 +1,14 @@ +return { + { + "lewis6991/gitsigns.nvim", + opts = { + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + }, + }, + }, +} diff --git a/nvim/lua/plugins/20-which-key.lua b/nvim/lua/plugins/20-which-key.lua new file mode 100644 index 0000000..35ce717 --- /dev/null +++ b/nvim/lua/plugins/20-which-key.lua @@ -0,0 +1,19 @@ +return { + "folke/which-key.nvim", + event = "VimEnter", + opts = { + delay = 0, + icons = { + mappings = vim.g.have_nerd_font, + keys = vim.g.have_nerd_font, + }, + + -- Document existing key chains + spec = { + { "s", group = "[S]earch" }, + { "e", group = "[E]xplorer/Tree" }, + { "t", group = "[T]oggle" }, + { "g", group = "[G]oto/Actions" }, + }, + }, +} diff --git a/nvim/lua/config/lazy/30-fuzzyfinder.lua b/nvim/lua/plugins/30-fuzzyfinder.lua similarity index 55% rename from nvim/lua/config/lazy/30-fuzzyfinder.lua rename to nvim/lua/plugins/30-fuzzyfinder.lua index 6d85a11..4fe7572 100644 --- a/nvim/lua/config/lazy/30-fuzzyfinder.lua +++ b/nvim/lua/plugins/30-fuzzyfinder.lua @@ -1,3 +1,5 @@ +local keymap = vim.keymap.set + return { "nvim-telescope/telescope.nvim", event = "VimEnter", @@ -32,32 +34,32 @@ return { -- Define these keys here since they require access to runtime values local builtin = require("telescope.builtin") - vim.keymap.set("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) - vim.keymap.set("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) - vim.keymap.set("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) - vim.keymap.set("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) - vim.keymap.set("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) - vim.keymap.set("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) - vim.keymap.set("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) - vim.keymap.set("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) - vim.keymap.set("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) + keymap("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) + keymap("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) + keymap("n", "sf", builtin.find_files, { desc = "[S]earch [F]iles" }) + keymap("n", "ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) + keymap("n", "sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) + keymap("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) + keymap("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) + keymap("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) + keymap("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) + keymap("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) - vim.keymap.set("n", "/", function() + keymap("n", "/", function() builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ winblend = 10, previewer = false, })) end, { desc = "[/] Fuzzily search in current buffer" }) - vim.keymap.set("n", "s/", function() + keymap("n", "s/", function() builtin.live_grep({ grep_open_files = true, prompt_title = "Live Grep in Open Files", }) end, { desc = "[S]earch [/] in Open Files" }) - vim.keymap.set("n", "sn", function() + keymap("n", "sn", function() builtin.find_files({ cwd = vim.fn.stdpath("config") }) end, { desc = "[S]earch [N]eovim files" }) end, diff --git a/nvim/lua/config/lazy/31-tree.lua b/nvim/lua/plugins/31-tree.lua similarity index 100% rename from nvim/lua/config/lazy/31-tree.lua rename to nvim/lua/plugins/31-tree.lua diff --git a/nvim/lua/config/lazy/32-tabs.lua b/nvim/lua/plugins/32-tabs.lua similarity index 100% rename from nvim/lua/config/lazy/32-tabs.lua rename to nvim/lua/plugins/32-tabs.lua diff --git a/nvim/lua/config/lazy/33-terminal.lua b/nvim/lua/plugins/33-terminal.lua similarity index 100% rename from nvim/lua/config/lazy/33-terminal.lua rename to nvim/lua/plugins/33-terminal.lua diff --git a/nvim/lua/plugins/40-lsp.lua b/nvim/lua/plugins/40-lsp.lua new file mode 100644 index 0000000..8fa7c85 --- /dev/null +++ b/nvim/lua/plugins/40-lsp.lua @@ -0,0 +1,147 @@ +local servers = { + -- LSPs + "json-lsp", + "lua_ls", + "ruby_lsp", + "rubocop", + "rust_analyzer", + "terraformls", + -- Formatters + "fixjson", + "goimports", + "hclfmt", + "prettierd", + "shellharden", + "stylua", + "yamlfix", + --- Linters + "swiftlint", +} + +return { + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + dependencies = { + "mason-org/mason-lspconfig.nvim", + }, + opts = { + ensure_installed = servers, + }, + }, + { + "mason-org/mason-lspconfig.nvim", + opts = { + ensure_installed = {}, + automatic_enable = true, + automatic_installation = false, + }, + dependencies = { + { "mason-org/mason.nvim", opts = {} }, + "neovim/nvim-lspconfig", + }, + }, + { + "neovim/nvim-lspconfig", + dependencies = { + "mason-org/mason.nvim", + "mason-org/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + { "j-hui/fidget.nvim", opts = {} }, + "saghen/blink.cmp", + }, + config = function() + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + vim.keymap.set(mode or "n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + + map("grn", vim.lsp.buf.rename, "[R]e[n]ame") + map("ga", vim.lsp.buf.code_action, "[g]oto [a]ction", { "n", "x" }) + map("gtr", require("telescope.builtin").lsp_references, "[g]o[t]o [r]eferences") + map("gti", require("telescope.builtin").lsp_implementations, "[g]o[t]o [i]mplementation") + map("gtd", require("telescope.builtin").lsp_definitions, "[g]o[t]o [d]efinition") + map("gtD", vim.lsp.buf.declaration, "[g]o[t]o [D]eclaration") + map("gtt", require("telescope.builtin").lsp_type_definitions, "[g]o[t]o [t]ype Definition") + map("gsb", require("telescope.builtin").lsp_document_symbols, "[g]oto [s]ymbols in [b]uffer") + map( + "gsw", + require("telescope.builtin").lsp_dynamic_workspace_symbols, + "[g]oto [s]ymbols in [w]orkspace" + ) + + local client = vim.lsp.get_client_by_id(event.data.client_id) + local augroup = vim.api.nvim_create_augroup + local autocmd = vim.api.nvim_create_autocmd + if not client then + return + end + + if client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = augroup("kickstart-lsp-highlight", { clear = false }) + autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + autocmd("LspDetach", { + group = augroup("kickstart-lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ + group = "kickstart-lsp-highlight", + buffer = event2.buf, + }) + end, + }) + end + if client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map("th", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) + end, "[T]oggle Inlay [H]ints") + end + end, + }) + end, + }, +} +-- { + +-- config = function() + +-- -- Diagnostic Config +-- -- See :help vim.diagnostic.Opts +-- vim.diagnostic.config({ +-- severity_sort = true, +-- float = { border = "rounded", source = "if_many" }, +-- underline = { severity = vim.diagnostic.severity.ERROR }, +-- signs = vim.g.have_nerd_font and { +-- text = { +-- [vim.diagnostic.severity.ERROR] = "󰅚 ", +-- [vim.diagnostic.severity.WARN] = "󰀪 ", +-- [vim.diagnostic.severity.INFO] = "󰋽 ", +-- [vim.diagnostic.severity.HINT] = "󰌶 ", +-- }, +-- } or {}, +-- virtual_text = { +-- source = "if_many", +-- spacing = 2, +-- format = function(diagnostic) +-- local diagnostic_message = { +-- [vim.diagnostic.severity.ERROR] = diagnostic.message, +-- [vim.diagnostic.severity.WARN] = diagnostic.message, +-- [vim.diagnostic.severity.INFO] = diagnostic.message, +-- [vim.diagnostic.severity.HINT] = diagnostic.message, +-- } +-- return diagnostic_message[diagnostic.severity] +-- end, +-- }, +-- }) +-- end, +-- }, diff --git a/nvim/lua/config/lazy/41-autoformat.lua b/nvim/lua/plugins/41-autoformat.lua similarity index 100% rename from nvim/lua/config/lazy/41-autoformat.lua rename to nvim/lua/plugins/41-autoformat.lua diff --git a/nvim/lua/config/lazy/42-autocomplete.lua b/nvim/lua/plugins/42-autocomplete.lua similarity index 100% rename from nvim/lua/config/lazy/42-autocomplete.lua rename to nvim/lua/plugins/42-autocomplete.lua diff --git a/nvim/lua/config/lazy/43-winbar.lua b/nvim/lua/plugins/43-winbar.lua similarity index 100% rename from nvim/lua/config/lazy/43-winbar.lua rename to nvim/lua/plugins/43-winbar.lua diff --git a/nvim/lua/config/lazy/44-statusline.lua b/nvim/lua/plugins/44-statusline.lua similarity index 100% rename from nvim/lua/config/lazy/44-statusline.lua rename to nvim/lua/plugins/44-statusline.lua diff --git a/nvim/lua/config/lazy/60-comments.lua b/nvim/lua/plugins/60-comments.lua similarity index 100% rename from nvim/lua/config/lazy/60-comments.lua rename to nvim/lua/plugins/60-comments.lua diff --git a/nvim/lua/config/lazy/80-mini.lua b/nvim/lua/plugins/80-mini.lua similarity index 100% rename from nvim/lua/config/lazy/80-mini.lua rename to nvim/lua/plugins/80-mini.lua diff --git a/nvim/lua/config/lazy/81-surround.lua b/nvim/lua/plugins/81-surround.lua similarity index 100% rename from nvim/lua/config/lazy/81-surround.lua rename to nvim/lua/plugins/81-surround.lua diff --git a/nvim/lua/config/lazy/82-autopairs.lua b/nvim/lua/plugins/82-autopairs.lua similarity index 100% rename from nvim/lua/config/lazy/82-autopairs.lua rename to nvim/lua/plugins/82-autopairs.lua diff --git a/nvim/lua/config/lazy/83-multiline.lua b/nvim/lua/plugins/83-multiline.lua similarity index 100% rename from nvim/lua/config/lazy/83-multiline.lua rename to nvim/lua/plugins/83-multiline.lua diff --git a/nvim/lua/config/lazy/90-ai.lua b/nvim/lua/plugins/90-ai.lua similarity index 55% rename from nvim/lua/config/lazy/90-ai.lua rename to nvim/lua/plugins/90-ai.lua index 76c8bec..a65cd85 100644 --- a/nvim/lua/config/lazy/90-ai.lua +++ b/nvim/lua/plugins/90-ai.lua @@ -2,13 +2,8 @@ return { "yetone/avante.nvim", event = "VeryLazy", version = false, - - ---@module 'avante' - ---@type avante.Config opts = { - build = vim.fn.has("win32") ~= 0 - and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" - or "make", + build = "make", provider = "claude", }, dependencies = { diff --git a/nvim/lua/config/lazy/99-treesitter.lua b/nvim/lua/plugins/99-treesitter.lua similarity index 100% rename from nvim/lua/config/lazy/99-treesitter.lua rename to nvim/lua/plugins/99-treesitter.lua diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 4f38d50..a90440c 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -37,6 +37,8 @@ alias av="ansible-vault" # tool aliases if [[ -x "$(command -v nvim)" ]]; then alias vim="nvim" + alias v="nvim" + alias vv="NVIM_APPNAME=nvim-new nvim" fi if [[ -x "$(command -v highlight)" ]]; then alias ccat='highlight -O ansi --force'