Latest changes

This commit is contained in:
Wil Simpson 2024-06-17 18:26:31 -04:00
parent c1315e0d16
commit 8d946c13e7
6 changed files with 95 additions and 79 deletions

View File

@ -262,8 +262,8 @@ vim.o.scrolloff = 5
vim.o.sidescrolloff = 10 vim.o.sidescrolloff = 10
-- Set tabs to 4 spaces -- Set tabs to 4 spaces
vim.o.tabstop = 4 vim.o.tabstop = 2
vim.o.softtabstop = 4 vim.o.softtabstop = 2
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
@ -275,6 +275,15 @@ vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
-- Map window slection
vim.keymap.set('n', '<M-h>', "<C-w>h", { silent = true })
vim.keymap.set('n', '<M-j>', "<C-w>j", { silent = true })
vim.keymap.set('n', '<M-k>', "<C-w>k", { silent = true })
vim.keymap.set('n', '<M-l>', "<C-w>l", { silent = true })
-- Map copy to clipboard
vim.keymap.set('v', '<leader>y', "\"+y", { silent = true })
-- [[ Highlight on yank ]] -- [[ Highlight on yank ]]
-- See `:help vim.highlight.on_yank()` -- See `:help vim.highlight.on_yank()`
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true }) local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
@ -410,7 +419,7 @@ local on_attach = function(_, bufnr)
end end
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction') nmap('<c-a>', vim.lsp.buf.code_action, '[C]ode [A]ction')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
@ -420,8 +429,8 @@ local on_attach = function(_, bufnr)
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap -- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation') nmap('<c-i>', vim.lsp.buf.hover, 'Hover Documentation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation') nmap('<c-p>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality -- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
@ -516,31 +525,31 @@ cmp.setup {
end, end,
}, },
mapping = cmp.mapping.preset.insert { mapping = cmp.mapping.preset.insert {
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<M-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<M-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {}, ['<M-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true,
}, },
['<Tab>'] = cmp.mapping(function(fallback) -- ['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then -- if cmp.visible() then
cmp.select_next_item() -- cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then -- elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() -- luasnip.expand_or_jump()
else -- else
fallback() -- fallback()
end -- end
end, { 'i', 's' }), -- end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback) -- ['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then -- if cmp.visible() then
cmp.select_prev_item() -- cmp.select_prev_item()
elseif luasnip.jumpable(-1) then -- elseif luasnip.jumpable(-1) then
luasnip.jump(-1) -- luasnip.jump(-1)
else -- else
fallback() -- fallback()
end -- end
end, { 'i', 's' }), -- end, { 'i', 's' }),
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },

View File

@ -1,3 +0,0 @@
return {
'jiangmiao/auto-pairs'
}

View File

@ -0,0 +1,3 @@
return {
'github/copilot.vim',
}

View File

@ -1,9 +1,9 @@
return { return {
'easymotion/vim-easymotion', 'easymotion/vim-easymotion',
config = function() config = function()
vim.keymap.set('n', 'f', '<Plug>(easymotion-f)', { desc = '[f]ind next character' }) vim.keymap.set('n', '<leader>f', '<Plug>(easymotion-f)', { desc = '[f]ind next character' })
vim.keymap.set('n', 'F', '<Plug>(easymotion-F)', { desc = '[F]ind previous character' }) vim.keymap.set('n', '<leader>F', '<Plug>(easymotion-F)', { desc = '[F]ind previous character' })
vim.keymap.set('n', 't', '<Plug>(easymotion-t)', { desc = '[t]ill next character' }) vim.keymap.set('n', '<leader>t', '<Plug>(easymotion-t)', { desc = '[t]ill next character' })
vim.keymap.set('n', 'T', '<Plug>(easymotion-T)', { desc = '[T]ill previous character' }) vim.keymap.set('n', '<leader>T', '<Plug>(easymotion-T)', { desc = '[T]ill previous character' })
end, end,
} }

View File

@ -5,6 +5,14 @@ return {
}, },
config = function() config = function()
require("go").setup() require("go").setup()
local format_sync_grp = vim.api.nvim_create_augroup("GoImport", {})
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*.go",
callback = function()
require('go.format').goimport()
end,
group = format_sync_grp,
})
end, end,
event = { 'CmdlineEnter' }, event = { 'CmdlineEnter' },
ft = { 'go', 'gomod' }, ft = { 'go', 'gomod' },

View File

@ -32,7 +32,7 @@ return {
require('mason-nvim-dap').setup { require('mason-nvim-dap').setup {
-- Makes a best effort to setup the various debuggers with -- Makes a best effort to setup the various debuggers with
-- reasonable debug configurations -- reasonable debug configurations
automatic_setup = true, automatic_setup = false,
-- You'll need to check that you have the required things installed -- You'll need to check that you have the required things installed
-- online, please don't ask me how to install them :) -- online, please don't ask me how to install them :)
@ -92,7 +92,7 @@ return {
dap.listeners.before.event_terminated['dapui_config'] = dapui.close dap.listeners.before.event_terminated['dapui_config'] = dapui.close
dap.listeners.before.event_exited['dapui_config'] = dapui.close dap.listeners.before.event_exited['dapui_config'] = dapui.close
dap.defaults.fallback.exception_breakpoints = {'Notice', 'Warning', 'Error', 'Exception'} dap.defaults.fallback.exception_breakpoints = { 'Notice', 'Warning', 'Error', 'Exception' }
-- Install golang specific config -- Install golang specific config
require('dap-go').setup() require('dap-go').setup()
@ -104,7 +104,7 @@ return {
adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" }, adapters = { "pwa-node", "pwa-chrome", "pwa-msedge", "node-terminal", "pwa-extensionHost" },
} }
for _, jsLang in ipairs({'typescript', 'javascript'}) do for _, jsLang in ipairs({ 'typescript', 'javascript' }) do
require("dap").configurations[jsLang] = { require("dap").configurations[jsLang] = {
{ {
type = "pwa-node", type = "pwa-node",
@ -117,7 +117,7 @@ return {
type = "pwa-node", type = "pwa-node",
request = "attach", request = "attach",
name = "Attach", name = "Attach",
processId = require'dap.utils'.pick_process, processId = require 'dap.utils'.pick_process,
cwd = "${workspaceFolder}", cwd = "${workspaceFolder}",
}, },
{ {
@ -182,6 +182,5 @@ return {
}, },
} }
end end
end, end,
} }