diff --git a/.gitmodules b/.gitmodules index ad97ff9..a3559d3 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,9 +7,6 @@ [submodule "telescope.nvim"] path = site/pack/filebrowser/start/telescope.nvim url = https://github.com/nvim-telescope/telescope.nvim.git -[submodule "vim-go"] - path = site/pack/golang/opt/vim-go - url = https://github.com/fatih/vim-go.git [submodule "markdown-preview.nvim"] path = site/pack/markdown/start/markdown-preview.nvim url = https://github.com/iamcco/markdown-preview.nvim.git @@ -40,6 +37,9 @@ [submodule "nvim-lspconfig"] path = site/pack/lsp/start/nvim-lspconfig url = https://github.com/neovim/nvim-lspconfig.git -[submodule "site/pack/qol/start/harpoon"] +[submodule "vim-go"] + path = site/pack/golang/start/vim-go + url = https://github.com/fatih/vim-go.git +[submodule "harpoon"] path = site/pack/qol/start/harpoon url = https://github.com/ThePrimeagen/harpoon.git diff --git a/config/init.lua b/config/init.lua index 417bb9b..a74bed5 100644 --- a/config/init.lua +++ b/config/init.lua @@ -2,6 +2,7 @@ require('keymap') require('plugins') require('calcurse') require('i3conf') +require('go') -- prevent cursor override vim.cmd('set guicursor=') @@ -9,6 +10,11 @@ vim.cmd('set guicursor=') vim.cmd('filetype plugin indent on') vim.cmd('set ts=4 sts=4 sw=4 expandtab') +-- clipboard +vim.cmd('set clipboard+=unnamedplus') +vim.keymap.set('n', 'Y', '"+y') +vim.keymap.set('n', 'P', '"+p') + -- hybrid numbering vim.opt.relativenumber = true vim.opt.number = true @@ -33,6 +39,7 @@ Transparent = true -- timeouts vim.opt.ttimeout = true vim.opt.ttimeoutlen = 100 +vim.o.updatetime = 250 -- nvim tree basics @@ -50,7 +57,7 @@ local lspconfig = require('lspconfig') -- Go lspconfig.gopls.setup{ - cmd = {"gopls", "server"}, + cmd = {"gopls", "serve"}, filetypes = {"go", "gomod"}, settings = { gopls = { @@ -86,8 +93,45 @@ lspconfig.pylsp.setup{} -- TypeScript lspconfig.tsserver.setup{} --- lsp mappingsd -vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) -vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) -vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) -vim.keymap.set('n', 'H', vim.lsp.buf.hover, opts) +-- Fix virtual text going off screen +vim.diagnostic.config({ + virtual_text = false, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = false, +}) + + +vim.api.nvim_create_autocmd('LspAttach', { + callback = function(ev) + -- custom colors + vim.cmd('hi DiagnosticUnderlineError cterm=undercurl guisp=Red') + -- key mappings + local opts = { buffer = ev.buf,} + -- error viewing + vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) + vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) + vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) + -- def viewing/rename + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) + vim.keymap.set('n', 'H', vim.lsp.buf.hover, opts) + -- auto hover for error viewing + vim.api.nvim_create_autocmd("CursorHold", { + callback = function() + opts = { + buffer = ev.buf, + focusable = false, + border = 'rounded', + source = 'always', + prefix = ' ', + scope = 'cursor', + close_events = { "BufLeave","CursorMoved","InsertEnter","FocusLost" }, + } + vim.diagnostic.open_float(nil, opts) + end + }) + end, +}) diff --git a/site/after/ftplugin/go.lua b/config/lua/go.lua similarity index 88% rename from site/after/ftplugin/go.lua rename to config/lua/go.lua index 59c3b62..7165a05 100644 --- a/site/after/ftplugin/go.lua +++ b/config/lua/go.lua @@ -1,5 +1,3 @@ -vim.cmd('packadd vim-go') - vim.g.go_hightlight_types = 1 vim.g.go_hightlight_fields = 1 vim.g.go_hightlight_functions = 1 diff --git a/site/pack/golang/start/vim-go b/site/pack/golang/start/vim-go new file mode 160000 index 0000000..a494378 --- /dev/null +++ b/site/pack/golang/start/vim-go @@ -0,0 +1 @@ +Subproject commit a494378f6c106a97e39c62b493c14476f9f7de4f