diff options
| author | Robert Günzler <r@gnzler.io> | 2021-11-02 17:51:01 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2021-11-02 19:06:49 +0100 |
| commit | 5b8b04fc1b5f765d1e9f6f59e3309562b5feef35 (patch) | |
| tree | 1c1a392180f74f670a010959c17007aecef82300 /.vim/lua/plugins.lua | |
| parent | 128828b8e993a457a35afd1c71bf0b5fbd1a8a25 (diff) | |
vim: fixup lsp and treesitter config
Diffstat (limited to '.vim/lua/plugins.lua')
| -rw-r--r-- | .vim/lua/plugins.lua | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/.vim/lua/plugins.lua b/.vim/lua/plugins.lua index e532c0a..b263ba2 100644 --- a/.vim/lua/plugins.lua +++ b/.vim/lua/plugins.lua @@ -79,15 +79,38 @@ return require('packer').startup({function() requires = {'nvim-lua/plenary.nvim'}, config = function() local nls = require('null-ls') + local h = require('null-ls.helpers') nls.config { + -- debug = true, sources = { nls.builtins.diagnostics.shellcheck, -- *sh -- nls.builtins.formatting.clang_format, -- c* -- nls.builtins.formatting.gofumpt, -- go -- nls.builtins.formatting.json_tool, -- json - nls.builtins.formatting.rustfmt, -- rust + -- nls.builtins.formatting.rustfmt, -- rust nls.builtins.formatting.shfmt, -- *sh nls.builtins.formatting.yapf, -- python + h.make_builtin({ + method = nls.methods.DIAGNOSTICS, + filetypes = { 'go' }, + generator_opts = { + command = 'sh', + args = { + '-c', + 'golangci-lint run --fix=false --out-format=tab -E gocritic | grep ^$RELNAME', + }, + to_stdin = false, + check_exit_code = {0, 1}, + format = 'line', + on_output = h.diagnostics.from_patterns({ + { + pattern = [[(.+):(%d+):(%d+)%s+([%w%_%-]+)%s+(.*)]], + groups = { 'data', 'row', 'col', 'source', 'message' }, + } + }) + }, + factory = h.generator_factory, + }) } } @@ -145,8 +168,7 @@ return require('packer').startup({function() 'nvim-treesitter/nvim-treesitter-textobjects', }, config = function() - require('nvim-treesitter.configs').setup { - ensure_installed = { + local enabled = { 'bash', 'c', 'c_sharp', @@ -168,7 +190,12 @@ return require('packer').startup({function() 'typescript', 'vim', 'yaml', + 'zig', }, + } + + require('nvim-treesitter.configs').setup { + ensure_installed = enabled, highlight = { enable = true, }, @@ -217,7 +244,7 @@ return require('packer').startup({function() } augroup { - treesitter = {{ 'FileType', '*', [[ set foldmethod=expr foldexpr=nvim_treesitter#foldexpr() ]] }} + treesitter = {{ 'FileType', table.concat(enabled, ','), [[ set foldmethod=expr foldexpr=nvim_treesitter#foldexpr() ]] }} } end} -- }}} |