nvim: update coding config

- treesitter upgrade
- defer pyright hints to ruff
This commit is contained in:
dogeystamp 2024-08-05 18:22:59 -04:00
parent f523507e7a
commit c58fa424ac
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
3 changed files with 14 additions and 9 deletions

View File

@ -82,12 +82,6 @@ nnoremap <silent> ZF :qa<cr>
" see .config/nvim/lua/init.lua " see .config/nvim/lua/init.lua
lua require('init') lua require('init')
" Code folding
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
" unfold by default
set foldlevel=99
" auto-pairs " auto-pairs
packadd auto-pairs packadd auto-pairs
let g:AutoPairsFlyMode = 0 let g:AutoPairsFlyMode = 0

View File

@ -58,6 +58,11 @@ require 'nvim-treesitter.configs'.setup {
}, },
} }
-- code folding
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.wo.foldlevel = 99 -- unfold by default
------ ------
-- treesitter (language intelligent) motions -- treesitter (language intelligent) motions
------ ------
@ -148,6 +153,12 @@ end
-- find ruff config file path -- find ruff config file path
local ruff_config = vim.fs.root(0, { ".git", "pyproject.toml" }) or "" local ruff_config = vim.fs.root(0, { ".git", "pyproject.toml" }) or ""
vim.cmd.packadd("cmp-nvim-lsp")
local cmp_nvim_lsp = require('cmp_nvim_lsp')
local pyright_cap = cmp_nvim_lsp.default_capabilities()
-- disable hint level diagnostics in pyright (defer to ruff)
pyright_cap.textDocument.publishDiagnostics = { tagSupport = { valueSet = { 2 } } }
-- table declares LSPs to be set up -- table declares LSPs to be set up
-- as well as settings per server (overrides defaults) -- as well as settings per server (overrides defaults)
local servers = { local servers = {
@ -157,7 +168,8 @@ local servers = {
-- defer to ruff -- defer to ruff
disableOrganizeImports = true, disableOrganizeImports = true,
}, },
} },
capabilities = pyright_cap,
}, },
ruff = { ruff = {
settings = { settings = {
@ -231,7 +243,6 @@ end
-- completions -- completions
------ ------
vim.cmd.packadd("nvim-cmp") vim.cmd.packadd("nvim-cmp")
vim.cmd.packadd("cmp-nvim-lsp")
local cmp = require('cmp') local cmp = require('cmp')
cmp.setup({ cmp.setup({

@ -1 +1 @@
Subproject commit aa02427dfeaead86fae038024ae7b29299f08b8c Subproject commit 1aad04ecde5ebf8f2b3eea5c6f39d38b251757f5