Skip to content

Commit

Permalink
Experiment with nvim-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
oalders committed Jan 11, 2024
1 parent f3487d5 commit 834eaa7
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nvim/lua/conf/lspconfig/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ lspconfig.gopls.setup({
},
staticcheck = true,
gofumpt = true,
-- root_dir = root_pattern("go.mod", ".git"),
},
},
})
lspconfig.golangci_lint_ls.setup {}

-- After setting up mason-lspconfig you may set up servers via lspconfig
-- See server/src/server.ts in PerlNavigator for a list of available settings
Expand Down
22 changes: 22 additions & 0 deletions nvim/lua/conf/nvim-lint/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
local l = require 'lint'

vim.api.nvim_create_autocmd({ 'BufWritePost', 'VimEnter', 'BufEnter' }, {
pattern = { '*' },
callback = function()
l.try_lint()
end,
})

l.linters_by_ft = {
go = { 'golangcilint' },
lua = { 'selene' },
markdown = { 'markdownlint' },
perl = { 'perlimports' },
sql = { 'sqlfluff' },
vim = { 'vint' },
yaml = { 'yamllint' },
}

for ft, _ in pairs(l.linters_by_ft) do
table.insert(l.linters_by_ft[ft], 'typos')
end
1 change: 1 addition & 0 deletions nvim/lua/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,6 @@ require('conf/lspconfig')

require('conf/lualine')
require('conf/noice')
require('conf/nvim-lint')
require('conf/ufo')
require('conf/which-key')
1 change: 1 addition & 0 deletions vim/vim-plug-vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if has('nvim')
Plug 'folke/which-key.nvim' " better organization of key mappings
Plug 'Hubro/nvim-splitrun' " :Splitrun some command
Plug 'kyazdani42/nvim-web-devicons' " Recommended (for coloured icons for bufferline.nvim)
Plug 'mfussenegger/nvim-lint' " Linter harness
Plug 'nvim-lualine/lualine.nvim' " status line
Plug 'nvim-lua/plenary.nvim' " required by other plugins
Plug 'nvimtools/none-ls.nvim' " null-ls replacement
Expand Down

0 comments on commit 834eaa7

Please sign in to comment.