all repos — dotfiles @ 96694a0d43092ef7ab3aec86643e20396df36114

linux dotfiles

nvim: flake8 and mypy run only in a python project
Prithu Goswami pg@prithu.dev
Tue, 20 Sep 2022 20:32:33 +0530
commit

96694a0d43092ef7ab3aec86643e20396df36114

parent

b55025b9b95679dbea855eb58817f76fa194d5be

M config/nvim/init.luaconfig/nvim/init.lua

@@ -115,8 +115,16 @@ null_ls.builtins.formatting.prettier,

-- python null_ls.builtins.formatting.black.with({extra_args={"--fast"}}), null_ls.builtins.formatting.isort, - null_ls.builtins.diagnostics.flake8, - null_ls.builtins.diagnostics.mypy, + null_ls.builtins.diagnostics.flake8.with({ + condition = function(utils) + return utils.root_has_file({"pyproject.toml", ".flake8"}) + end, + }), + null_ls.builtins.diagnostics.mypy.with({ + condition = function(utils) + return utils.root_has_file({"pyproject.toml"}) + end, + }), } })
M config/nvim/lua/lsp/init.luaconfig/nvim/lua/lsp/init.lua

@@ -33,6 +33,9 @@ prefix = "",

}, } +-- TODO set this up when upgrading to Neovim v0.8 +-- local navic = require('nvim-navic') + vim.diagnostic.config(config) vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded",

@@ -72,6 +75,8 @@ vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)

vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) vim.keymap.set('n', '<leader>]', vim.lsp.buf.formatting, bufopts) + -- TODO set this up when upgrading to Neovim v0.8 + -- navic.attach(client, bufnr) end
M config/nvim/lua/options.luaconfig/nvim/lua/options.lua

@@ -18,6 +18,7 @@ vim.opt.number = true

vim.opt.backspace = 'indent,eol,start' vim.opt.termguicolors = true + vim.cmd('colorscheme base16-classic-dark') vim.cmd('filetype plugin indent on')
M config/nvim/lua/plugins.luaconfig/nvim/lua/plugins.lua

@@ -19,6 +19,11 @@

-- lsp use 'neovim/nvim-lspconfig' use 'jose-elias-alvarez/null-ls.nvim' + -- set this up when winbar is available + -- use { + -- "SmiteshP/nvim-navic", + -- requires = "neovim/nvim-lspconfig" + -- } -- completion use 'hrsh7th/nvim-cmp'