alpha
Login
or
Join now
j3s.sh
/
dotfiles
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
my dotz
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
nvim: got golang working finally
author
Jes Olson
date
3 years ago
(Feb 19, 2023, 6:34 PM -0800)
commit
5f09e7da
5f09e7daf0b61e015eae5e0f402d75bbdf76adf9
parent
8ead1950
8ead1950090b5ffec5f5032205820fcf03a4066a
+14
-14
1 changed file
Expand all
Collapse all
Unified
Split
.config
nvim
init.lua
+14
-14
.config/nvim/init.lua
Reviewed
···
4
4
use 'neovim/nvim-lspconfig' -- Configurations for Nvim LSP
5
5
use 'sainnhe/everforest' -- Colorscheme
6
6
7
7
-
-- Very powerful search
7
7
+
-- Very powerful picker
8
8
use {
9
9
'nvim-telescope/telescope.nvim', tag = '0.1.1',
10
10
requires = {{
···
43
43
-- Mappings.
44
44
-- See `:help vim.lsp.*` for documentation on any of the below functions
45
45
local bufopts = { noremap=true, silent=true, buffer=bufnr }
46
46
-
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
47
47
-
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
46
46
+
vim.keymap.set('n', 'gd', builtin.lsp_definitions, bufopts)
47
47
+
vim.keymap.set('n', 'gi', builtin.lsp_implementations, bufopts)
48
48
+
vim.keymap.set('n', 'gr', builtin.lsp_references, bufopts)
48
49
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
49
49
-
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
50
50
-
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
51
51
-
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
52
52
-
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
53
53
-
vim.keymap.set('n', '<space>wl', function()
54
54
-
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
55
55
-
end, bufopts)
56
56
-
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
50
50
+
vim.keymap.set('n', '<C-k>', vim.lsp.buf.hover, bufopts)
51
51
+
vim.keymap.set('n', '<space>D', builtin.lsp_type_definitions, bufopts)
57
52
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
58
58
-
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
59
59
-
vim.keymap.set('n', 'gr', builtin.lsp_references, bufopts)
60
60
-
vim.keymap.set('n', '<space>F', function() vim.lsp.buf.format { async = true } end, bufopts)
61
53
end
54
54
+
55
55
+
vim.api.nvim_create_autocmd('BufWritePre', {
56
56
+
pattern = '*.go',
57
57
+
callback = function()
58
58
+
vim.lsp.buf.format()
59
59
+
vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true })
60
60
+
end
61
61
+
})
62
62
63
63
---- golang
64
64
require('lspconfig')['gopls'].setup{