Last active
May 23, 2024 09:42
-
-
Save sbmueller/ec9e894f811917f6601daf974c8d3c01 to your computer and use it in GitHub Desktop.
Project-specific neovim configuration (exrc)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- nvim-lint settings | |
local lint = require("lint") | |
local lspconfig = require("lspconfig") | |
-- Add an additional generic linter | |
vim.api.nvim_create_autocmd( | |
{"BufWritePost"}, | |
{ | |
group = "Fixers", | |
pattern = "*", | |
callback = function() | |
lint.try_lint("cspell") -- generic spell check | |
end | |
} | |
) | |
-- Overwrite or extend existing linters | |
lint.linters_by_ft = | |
vim.tbl_extend( | |
"force", -- overwrite any existing entries | |
lint.linters_by_ft, | |
{ | |
python = {"pylint", "flake8"}, | |
markdown = {"markdownlint"} | |
} | |
) | |
-- Configure LSP options | |
lspconfig.basedpyright.manager.config.settings = | |
vim.tbl_extend( | |
"force", | |
lspconfig.basedpyright.manager.config.settings, | |
{ | |
basedpyright = { | |
analysis = { | |
typeCheckingMode = "off" | |
} | |
} | |
} | |
) | |
-- Modify arguments for specific linters | |
lint.linters.flake8.args = { | |
"--format=%(path)s:%(row)d:%(col)d:%(code)s:%(text)s", | |
"--no-show-source", | |
"--max-line-length", | |
"88", | |
"--ignore", | |
"E203,E501,W503", | |
"--stdin-display-name", | |
function() | |
return vim.api.nvim_buf_get_name(0) | |
end, | |
"-" | |
} | |
-- Filetype specific settings using autocommands | |
vim.api.nvim_create_augroup("FiletypeSettings", {clear = true}) | |
vim.api.nvim_create_autocmd( | |
{"BufNewFile", "BufRead"}, | |
{ | |
group = "FiletypeSettings", | |
pattern = "*.md", | |
command = "set tw=120 colorcolumn=120" | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment