Skip to content

Commit

Permalink
Updates to config
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaprimrose committed Jan 17, 2024
1 parent e2a7c45 commit fef8337
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 15 deletions.
2 changes: 1 addition & 1 deletion neovim/lua/plugins/hydra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ return {
]]

hydra({
body = "<leader>g",
body = "<leader>v",
config = {
color = "teal",
hint = {
Expand Down
65 changes: 60 additions & 5 deletions neovim/lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ return {
automatic_installation = true,
ensure_installed = {
"jdtls",
"lua_ls"
"gopls",
"lua_ls",
"templ",
},
handlers = nil
})
Expand All @@ -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", "<leader>K", vim.lsp.buf.signature_help, { buffer = bufnr, desc = "LSP: Signature Documentation" })
keymap("n", "<C-k>", vim.lsp.buf.signature_help, { buffer = bufnr, desc = "LSP: Signature Documentation" })

keymap("n", "<leader>rn", vim.lsp.buf.rename, { buffer = bufnr, desc = "LSP: Rename" })
keymap("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = bufnr, "LSP: Code Action" })

keymap("<leader>gr", require('telescope.builtin').lsp_references, "Goto References")
keymap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
keymap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
keymap("<leader>ds", require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
keymap("<leader>ws", require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')

-- Lesser used LSP functionality
keymap("n", "<leader>wa", vim.lsp.buf.add_workspace_folder, { buffer = bufnr, desc = "[W]orkspace [A]dd Folder" })
Expand Down Expand Up @@ -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",
Expand Down
73 changes: 64 additions & 9 deletions neovim/lua/plugins/telescope.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,80 @@ 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
["<C-d>"] = false,
["<C-u>"] = false,
["<C-j>"] = function (prompt_bufnr)
["<M-j>"] = function (prompt_bufnr)
action_set.scroll_previewer(prompt_bufnr, 1)
end,
["<C-k>"] = function (prompt_bufnr)
["<M-k>"] = function (prompt_bufnr)
action_set.scroll_previewer(prompt_bufnr, -1)
end,

-- Use C-j and C-k to move cursor
["<C-j>"] = function (prompt_bufnr)
action_set.shift_selection(prompt_bufnr, 1)
end,
["<C-k>"] = function (prompt_bufnr)
action_set.shift_selection(prompt_bufnr, -1)
end,

-- Toggle preview
["<M-p>"] = action_layout.toggle_preview,

-- The following function allows you to choose what window a file is opened in
['<C-g>'] = 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
["<C-d>"] = false,
["<C-u>"] = false,
["<M-j>"] = function (prompt_bufnr)
action_set.scroll_previewer(prompt_bufnr, 1)
end,
["<M-k>"] = function (prompt_bufnr)
action_set.scroll_previewer(prompt_bufnr, -1)
end,

-- Use C-j and C-k to move cursor
["j"] = false,
["k"] = false,
["<C-j>"] = function (prompt_bufnr)
action_set.shift_selection(prompt_bufnr, 1)
end,
["<C-k>"] = function (prompt_bufnr)
action_set.shift_selection(prompt_bufnr, -1)
end,

-- Toggle preview
["<M-p>"] = action_layout.toggle_preview,

-- The following function allows you to choose what window a file is opened in
['<C-g>'] = 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)
Expand All @@ -71,17 +115,23 @@ return {
["_"] = false,
json = true,
yaml = true,
}
},
sorting_strategy = "ascending",
},
file_browser = {
hijack_netrw = true,
mappings = {
i = {
["<S-d>"] = file_browser_actions.sort_by_date,
["<S-s>"] = file_browser_actions.sort_by_size,
["<C-s>"] = function (prompt_bufnr)
action_set.shift_selection(prompt_bufnr, 0)
print("selected")
end,
},
n = {

["<S-d>"] = file_browser_actions.sort_by_date,
["<S-s>"] = file_browser_actions.sort_by_size,
},
},
},
Expand All @@ -99,6 +149,11 @@ return {
["<C-g>"] = lga_actions.quote_prompt({ postfix = " --glob "}),
["<C-t>"] = lga_actions.quote_prompt({ postfix = " -t " }),
},
n = {
["<C-q>"] = lga_actions.quote_prompt(),
["<C-g>"] = lga_actions.quote_prompt({ postfix = " --glob "}),
["<C-t>"] = lga_actions.quote_prompt({ postfix = " -t " }),
},
},
}
},
Expand Down

0 comments on commit fef8337

Please sign in to comment.