update and optimize nvim

This commit is contained in:
Tibeuleu
2026-06-09 17:13:34 +02:00
parent d0ee76ef6c
commit 1bf3a84fd0
6 changed files with 137 additions and 124 deletions

View File

@@ -1,7 +1,7 @@
require("ts_context_commentstring").setup({
enable_autocmd = false,
})
require('Comment').setup({
require('mini.comment').setup({
ignore = '^$', -- Ignore empty lines
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
})

View File

@@ -106,8 +106,8 @@ local servers = {
-- Default handlers for LSP
local default_handlers = {
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" }),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "rounded", focus = false }),
["textDocument/hover"] = vim.lsp.buf.hover({ border = "rounded" }),
["textDocument/signatureHelp"] = vim.lsp.buf.signature_help({ border = "rounded", focus = false }),
}
-- nvim-cmp supports additional completion capabilities

View File

@@ -1,4 +1,4 @@
require'nvim-treesitter.configs'.setup {
require 'nvim-treesitter'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "bash", "bibtex", "c", "cpp", "lua", "markdown", "python", "vim", "vimdoc" },
@@ -19,7 +19,7 @@ require'nvim-treesitter.configs'.setup {
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
disable = {"latex"},
disable = { "latex" },
additional_vim_regex_highlighting = false,
},
}
@@ -36,21 +36,20 @@ opt.foldexpr = "nvim_treesitter#foldexpr()"
-------- This function is taken from https://github.com/norcalli/nvim_utils
function M.nvim_create_augroups(definitions)
for group_name, definition in pairs(definitions) do
api.nvim_command('augroup '..group_name)
api.nvim_command('augroup ' .. group_name)
api.nvim_command('autocmd!')
for _, def in ipairs(definition) do
local command = table.concat(vim.iter{'autocmd', def}:flatten():totable(), ' ')
local command = table.concat(vim.iter { 'autocmd', def }:flatten():totable(), ' ')
api.nvim_command(command)
end
api.nvim_command('augroup END')
end
end
local autoCommands = {
-- other autocommands
open_folds = {
{"BufReadPost,FileReadPost", "*", "normal zR"}
{ "BufReadPost,FileReadPost", "*", "normal zR" }
}
}

View File

@@ -16,56 +16,65 @@ end
bootstrap_pckr()
require('pckr').add{
require('pckr').add {
{
'nvim-telescope/telescope.nvim',
tag = '0.1.1',
-- or branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
};
"ellisonleao/gruvbox.nvim";
version = '*',
requires = {
{ 'nvim-lua/plenary.nvim' },
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
}
},
"ellisonleao/gruvbox.nvim",
{
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end,
};
branch = "main",
build = ':TSUpdate'
},
{
'ThePrimeagen/harpoon',
requires = { {'nvim-lua/plenary.nvim'} }
};
'mbbill/undotree';
'tpope/vim-fugitive';
'airblade/vim-gitgutter';
'lukas-reineke/indent-blankline.nvim';
'JoosepAlviste/nvim-ts-context-commentstring';
'numToStr/Comment.nvim';
'lervag/vimtex';
requires = { { 'nvim-lua/plenary.nvim' } }
},
'mbbill/undotree',
'tpope/vim-fugitive',
'airblade/vim-gitgutter',
'lukas-reineke/indent-blankline.nvim',
'JoosepAlviste/nvim-ts-context-commentstring',
{
'nvim-mini/mini.comment',
branch = "main",
config = function()
require('mini.comment').setup()
end,
},
'lervag/vimtex',
{
'neovim/nvim-lspconfig',
requires = {
-- LSP Support
{'williamboman/mason.nvim'},
{'williamboman/mason-lspconfig.nvim'},
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
-- DAP Support
{'mfussenegger/nvim-dap'},
{'mfussenegger/nvim-dap-python'},
{'jay-babu/mason-nvim-dap.nvim'},
{ 'mfussenegger/nvim-dap' },
{ 'mfussenegger/nvim-dap-python' },
{ 'jay-babu/mason-nvim-dap.nvim' },
-- Autocompletion
{'hrsh7th/nvim-cmp'},
{'hrsh7th/cmp-nvim-lsp'},
{'hrsh7th/cmp-buffer'},
{'hrsh7th/cmp-path'},
{'hrsh7th/cmp-cmdline'},
{ 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-path' },
{ 'hrsh7th/cmp-cmdline' },
-- Snippets
{'L3MON4D3/LuaSnip'},
{'saadparwaiz1/cmp_luasnip'},
{'rafamadriz/friendly-snippets'},
{'onsails/lspkind.nvim'},
{
'L3MON4D3/LuaSnip',
run = "make install_jsregexp",
},
{ 'saadparwaiz1/cmp_luasnip' },
{ 'rafamadriz/friendly-snippets' },
{ 'onsails/lspkind.nvim' },
-- Utils
{'j-hui/fidget.nvim'},
{'folke/neodev.nvim'}
};
};
{ 'j-hui/fidget.nvim' },
{ 'folke/neodev.nvim' }
},
},
}

View File

@@ -11,7 +11,7 @@ vim.g.mapleader = " "
vim.g.maplocalleader = ";"
-- Set Explorer keybind to leader-"e"
vim.keymap.set("n","<leader>e", vim.cmd.Ex)
vim.keymap.set("n", "<leader>e", vim.cmd.Ex)
-- Disable Space bar since it'll be used as the leader key
nnoremap("<space>", "<nop>")
@@ -90,37 +90,37 @@ end
-- Goto next diagnostic of any severity
nnoremap("]d", function()
vim.diagnostic.goto_next({})
vim.diagnostic.jump({ count = 1, float = true })
vim.api.nvim_feedkeys("zz", "n", false)
end)
-- Goto prev diagnostic of any severity
nnoremap("[d", function()
vim.diagnostic.goto_prev({})
vim.diagnostic.jump({ count = -1, float = true })
vim.api.nvim_feedkeys("zz", "n", false)
end)
-- Goto next error diagnostic
nnoremap("]e", function()
vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR })
vim.diagnostic.jump({ severity = vim.diagnostic.severity.ERROR, count = 1, float = true })
vim.api.nvim_feedkeys("zz", "n", false)
end)
-- Goto previous error diagnostic
nnoremap("[e", function()
vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR })
vim.diagnostic.jump({ severity = vim.diagnostic.severity.ERROR, count = -1, float = true })
vim.api.nvim_feedkeys("zz", "n", false)
end)
-- Goto next warning diagnostic
nnoremap("]w", function()
vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN })
vim.diagnostic.jump({ severity = vim.diagnostic.severity.WARN, count = 1, float = true })
vim.api.nvim_feedkeys("zz", "n", false)
end)
-- Goto previous warning diagnostic
nnoremap("[w", function()
vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.WARN })
vim.diagnostic.jump({ severity = vim.diagnostic.severity.WARN, count = -1, float = true })
vim.api.nvim_feedkeys("zz", "n", false)
end)

View File

@@ -11,7 +11,7 @@
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.mdx': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
map <leader>v :VimwikiIndex<CR>
let g:vimwiki_list = [{'path': '~/.local/share/nvim/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
@@ -37,6 +37,11 @@
autocmd BufWritePost ~/.config/i3/config !i3 restart
autocmd BufWritePost ~/.config/i3blocks/config !i3 restart
" Remove checkhealth warning for optionnal providers
let g:loaded_node_provider = 0
let g:loaded_perl_provider = 0
let g:loaded_ruby_provider = 0
" Function for toggling the bottom statusbar:
let s:hidden_all = 0
function! ToggleHiddenAll()