diff --git a/neovim/lua/plugins/hydra.lua b/neovim/lua/plugins/hydra.lua index 98fa793..6895dd6 100644 --- a/neovim/lua/plugins/hydra.lua +++ b/neovim/lua/plugins/hydra.lua @@ -26,7 +26,7 @@ return { ]] hydra({ - body = "g", + body = "v", config = { color = "teal", hint = { diff --git a/neovim/lua/plugins/lsp.lua b/neovim/lua/plugins/lsp.lua index 229699d..c726233 100644 --- a/neovim/lua/plugins/lsp.lua +++ b/neovim/lua/plugins/lsp.lua @@ -19,7 +19,9 @@ return { automatic_installation = true, ensure_installed = { "jdtls", - "lua_ls" + "gopls", + "lua_ls", + "templ", }, handlers = nil }) @@ -40,14 +42,14 @@ return { -- See `:help K` for why this keymap keymap("n", "K", vim.lsp.buf.hover, { buffer = bufnr, desc = "LSP: Hover Documentation" }) - keymap("n", "K", vim.lsp.buf.signature_help, { buffer = bufnr, desc = "LSP: Signature Documentation" }) + keymap("n", "", vim.lsp.buf.signature_help, { buffer = bufnr, desc = "LSP: Signature Documentation" }) keymap("n", "rn", vim.lsp.buf.rename, { buffer = bufnr, desc = "LSP: Rename" }) keymap("n", "ca", vim.lsp.buf.code_action, { buffer = bufnr, "LSP: Code Action" }) keymap("gr", require('telescope.builtin').lsp_references, "Goto References") - keymap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - keymap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + keymap("ds", require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + keymap("ws", require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') -- Lesser used LSP functionality keymap("n", "wa", vim.lsp.buf.add_workspace_folder, { buffer = bufnr, desc = "[W]orkspace [A]dd Folder" }) @@ -91,8 +93,61 @@ return { }, }) + lspconfig.gopls.setup({ + capabilities = capabilities, + flags = { + allow_incremental_sync = true, + debounce_text_changes = 500 + }, + on_attach = on_attach, + settings = { + gopls = { + analyses = { + fieldalignment = false, + fillreturns = true, + nilness = true, + nonewvars = true, + shadow = true, + ST1003 = true, + undeclaredname = true, + unreachable = true, + unusedparams = true, + unusedwrite = true, + useany = true, + }, + codelenses = { + generate = true, -- show the `go generate` lens. + gc_details = true, -- Show a code lens toggling the display of gc's choices. + test = true, + regenerate_cgo = true, + tidy = true, + upgrade_dependency = true, + vendor = true, + }, + hints = { + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + constantValues = true, + functionTypeParameters = true, + parameterNames = true, + rangeVariableTypes = true, + }, + usePlaceholders = true, + completeUnimported = true, + staticcheck = true, + matcher = 'Fuzzy', + diagnosticsDelay = '500ms', + symbolMatcher = 'fuzzy', + }, + }, + }) - + vim.filetype.add({ extension = { templ = "templ"} }) + lspconfig.templ.setup({ + capabilities = capabilities, + on_attach = on_attach, + }) end, dependencies = { "folke/neodev.nvim", diff --git a/neovim/lua/plugins/telescope.lua b/neovim/lua/plugins/telescope.lua index 3ae2586..6286540 100644 --- a/neovim/lua/plugins/telescope.lua +++ b/neovim/lua/plugins/telescope.lua @@ -17,16 +17,24 @@ return { layout_strategy = "vertical", mappings = { i = { - -- Use C-j and C-k to scroll previewer + -- Use M-h, M-j and M-k to scroll previewer [""] = false, [""] = false, - [""] = function (prompt_bufnr) + [""] = function (prompt_bufnr) action_set.scroll_previewer(prompt_bufnr, 1) end, - [""] = function (prompt_bufnr) + [""] = function (prompt_bufnr) action_set.scroll_previewer(prompt_bufnr, -1) end, + -- Use C-j and C-k to move cursor + [""] = function (prompt_bufnr) + action_set.shift_selection(prompt_bufnr, 1) + end, + [""] = function (prompt_bufnr) + action_set.shift_selection(prompt_bufnr, -1) + end, + -- Toggle preview [""] = action_layout.toggle_preview, @@ -34,19 +42,55 @@ return { [''] = function(prompt_bufnr) -- Use nvim-window-picker to choose the window by dynamically attaching a function local picker = action_state.get_current_picker(prompt_bufnr) - picker.get_selection_window = function(p) - local picked_window_id = require('window-picker').pick_window() or vim.api.nvim_get_current_win() + picker.get_selection_window = function(pkr) + local picked_window_id = require("window-picker").pick_window() or vim.api.nvim_get_current_win() -- Unbind after using so next instance of the picker acts normally - p.get_selection_window = nil + pkr.get_selection_window = nil return picked_window_id end - return action_set.edit(prompt_bufnr, 'edit') + return action_set.edit(prompt_bufnr, "edit") end, }, n = { + -- Use M-j and M-k to scroll previewer + [""] = false, + [""] = false, + [""] = function (prompt_bufnr) + action_set.scroll_previewer(prompt_bufnr, 1) + end, + [""] = function (prompt_bufnr) + action_set.scroll_previewer(prompt_bufnr, -1) + end, + + -- Use C-j and C-k to move cursor + ["j"] = false, + ["k"] = false, + [""] = function (prompt_bufnr) + action_set.shift_selection(prompt_bufnr, 1) + end, + [""] = function (prompt_bufnr) + action_set.shift_selection(prompt_bufnr, -1) + end, + + -- Toggle preview [""] = action_layout.toggle_preview, + + -- The following function allows you to choose what window a file is opened in + [''] = function(prompt_bufnr) + -- Use nvim-window-picker to choose the window by dynamically attaching a function + local picker = action_state.get_current_picker(prompt_bufnr) + picker.get_selection_window = function(pkr) + local picked_window_id = require("window-picker").pick_window() or vim.api.nvim_get_current_win() + + -- Unbind after using so next instance of the picker acts normally + pkr.get_selection_window = nil + return picked_window_id + end + + return action_set.edit(prompt_bufnr, "edit") + end, }, }, path_display = function (_, path) @@ -71,7 +115,8 @@ return { ["_"] = false, json = true, yaml = true, - } + }, + sorting_strategy = "ascending", }, file_browser = { hijack_netrw = true, @@ -79,9 +124,14 @@ return { i = { [""] = file_browser_actions.sort_by_date, [""] = file_browser_actions.sort_by_size, + [""] = function (prompt_bufnr) + action_set.shift_selection(prompt_bufnr, 0) + print("selected") + end, }, n = { - + [""] = file_browser_actions.sort_by_date, + [""] = file_browser_actions.sort_by_size, }, }, }, @@ -99,6 +149,11 @@ return { [""] = lga_actions.quote_prompt({ postfix = " --glob "}), [""] = lga_actions.quote_prompt({ postfix = " -t " }), }, + n = { + [""] = lga_actions.quote_prompt(), + [""] = lga_actions.quote_prompt({ postfix = " --glob "}), + [""] = lga_actions.quote_prompt({ postfix = " -t " }), + }, }, } },