Add golang support to vim

This commit is contained in:
Daniel Lynn 2021-06-22 11:27:27 -05:00
parent 248224a8d9
commit 18a0b30bb3
5 changed files with 66 additions and 6 deletions

View File

@ -3,5 +3,33 @@
"git.changedSign.text": "▐",
"git.removedSign.text": "▐",
"git.topRemovedSign.text": "▐",
"git.changeRemovedSign.text": "▐"
"git.changeRemovedSign.text": "▐",
"suggest.noselect": false,
"diagnostic.errorSign": "✘",
"diagnostic.warningSign": "⚠",
"diagnostic.infoSign": "🛈",
"diagnostic.checkCurrentLine": true,
"coc.preferences.formatOnSaveFiletypes": [
"javascript",
"html",
"json",
"css",
"scss",
"go"
],
"coc.preferences.hoverTarget": "float",
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": [
"go.mod"
],
"filetypes": [
"go"
]
}
},
"go.goplsOptions": {
"staticcheck": true
}
}

View File

@ -18,16 +18,20 @@ function! s:sonokai_custom() abort
" the fourth parameter is for UI highlighting which is optional,
" and the last parameter is for `guisp` which is also optional.
" See `autoload/sonokai.vim` for the format of `l:palette`.
call sonokai#highlight('LineNr', l:palette.grey, l:palette.bg1)
call sonokai#highlight('SignColumn', l:palette.fg, l:palette.bg1)
call sonokai#highlight('VertSplit', l:palette.bg1, l:palette.none)
call sonokai#highlight('Terminal', l:palette.fg, l:palette.bg1)
call sonokai#highlight('BlueSign', l:palette.blue, l:palette.bg1)
call sonokai#highlight('CocGitAddedSign', l:palette.green, l:palette.bg1)
call sonokai#highlight('CocGitChangeRemovedSign', l:palette.purple, l:palette.bg1)
call sonokai#highlight('CocGitChangedSign', l:palette.blue, l:palette.bg1)
call sonokai#highlight('CocGitRemovedSign', l:palette.red, l:palette.bg1)
call sonokai#highlight('CocGitTopRemovedSign', l:palette.red, l:palette.bg1)
call sonokai#highlight('CocGitChangeRemovedSign', l:palette.purple, l:palette.bg1)
call sonokai#highlight('GitCommitTemplateTag', l:palette.orange, l:palette.none)
call sonokai#highlight('GreenSign', l:palette.green, l:palette.bg1)
call sonokai#highlight('LineNr', l:palette.grey, l:palette.bg1)
call sonokai#highlight('RedSign', l:palette.red, l:palette.bg1)
call sonokai#highlight('SignColumn', l:palette.fg, l:palette.bg1)
call sonokai#highlight('Terminal', l:palette.fg, l:palette.bg1)
call sonokai#highlight('VertSplit', l:palette.bg1, l:palette.none)
call sonokai#highlight('YellowSign', l:palette.yellow, l:palette.bg1)
endfunction
augroup CustomColors

22
nvim/golang Normal file
View File

@ -0,0 +1,22 @@
" disable all linters as that is taken care of by coc.nvim
let g:go_diagnostics_enabled = 0
let g:go_metalinter_enabled = []
" don't jump to errors after metalinter is invoked
let g:go_jump_to_error = 0
" run go imports on file save
let g:go_fmt_command = "goimports"
" automatically highlight variable your cursor is on
let g:go_auto_sameids = 0
" syntax highlighting
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_operators = 1
let g:go_highlight_extra_types = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_generate_tags = 1

View File

@ -2,6 +2,7 @@
Plug 'cespare/vim-toml'
Plug 'mileszs/ack.vim'
Plug 'tpope/vim-fugitive'
Plug 'fatih/vim-go'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-surround'

5
vimrc
View File

@ -95,6 +95,11 @@ if filereadable(expand("~/.config/nvim/test"))
source ~/.config/nvim/test
endif
" Golang setup
if filereadable(expand("~/.config/nvim/golang"))
source ~/.config/nvim/golang
endif
" Color setup
if filereadable(expand("~/.config/nvim/colors"))
source ~/.config/nvim/colors