feat(nvim): clean configuration

This commit is contained in:
2025-10-24 08:18:51 +02:00
parent 28714d5f8a
commit d84f20edf0
5 changed files with 105 additions and 87 deletions

View File

@@ -12,7 +12,7 @@ return {
typescript = { "eslint_d" },
javascriptreact = { "eslint_d" },
typescriptreact = { "eslint_d" },
python = { "flake8" },
python = { "ruff" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })

View File

@@ -10,9 +10,15 @@ return {
config = function()
local lsp_zero = require("lsp-zero")
lsp_zero.on_attach(function(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp_zero.default_keymaps({ buffer = bufnr })
local opts = { buffer = bufnr, silent = true }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, vim.tbl_extend("force", opts, { desc = "Go to definition" }))
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, vim.tbl_extend("force", opts, { desc = "Go to declaration" }))
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, vim.tbl_extend("force", opts, { desc = "Go to implementation" }))
vim.keymap.set("n", "gr", vim.lsp.buf.references, vim.tbl_extend("force", opts, { desc = "Show references" }))
vim.keymap.set("n", "K", vim.lsp.buf.hover, vim.tbl_extend("force", opts, { desc = "Hover documentation" }))
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, vim.tbl_extend("force", opts, { desc = "Rename symbol" }))
vim.keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, vim.tbl_extend("force", opts, { desc = "Code action" }))
end)
require("mason").setup({})

View File

@@ -1,7 +1,13 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" },
dependencies = {
"nvim-lua/plenary.nvim",
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
},
},
opts = {
defaults = {
file_ignore_patterns = { "**/*.pdf" },
@@ -35,17 +41,25 @@ return {
},
},
config = function(_, opts)
require("telescope").setup(opts)
vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopePromptNormal", { bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopeResultsNormal", { bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopePreviewNormal", { bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopePromptBorder", { fg = "#3c3836", bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopeResultsBorder", { fg = "#3c3836", bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopePreviewBorder", { fg = "#3c3836", bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopePromptTitle", { fg = "#3c3836", bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopeResultsTitle", { fg = "#3c3836", bg = "#3c3836" })
vim.api.nvim_set_hl(0, "TelescopePreviewTitle", { fg = "#3c3836", bg = "#3c3836" })
local telescope = require("telescope")
telescope.setup(opts)
telescope.load_extension("fzf")
local bg = vim.api.nvim_get_hl(0, { name = "CursorColumn" }).bg
if type(bg) == "number" then
bg = string.format("#%06x", bg)
end
vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = bg })
vim.api.nvim_set_hl(0, "TelescopePromptNormal", { bg = bg })
vim.api.nvim_set_hl(0, "TelescopeResultsNormal", { bg = bg })
vim.api.nvim_set_hl(0, "TelescopePreviewNormal", { bg = bg })
vim.api.nvim_set_hl(0, "TelescopePromptBorder", { fg = bg, bg = bg })
vim.api.nvim_set_hl(0, "TelescopeResultsBorder", { fg = bg, bg = bg })
vim.api.nvim_set_hl(0, "TelescopePreviewBorder", { fg = bg, bg = bg })
vim.api.nvim_set_hl(0, "TelescopePromptTitle", { fg = bg, bg = bg })
vim.api.nvim_set_hl(0, "TelescopeResultsTitle", { fg = bg, bg = bg })
vim.api.nvim_set_hl(0, "TelescopePreviewTitle", { fg = bg, bg = bg })
end,
keys = {
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },

View File

@@ -21,7 +21,10 @@ return {
"markdown_inline",
},
sync_install = false,
highlight = { enable = false },
highlight = {
enable = true,
disable = { "latex" },
},
indent = { enable = true },
})
end,

View File

@@ -1,46 +1,43 @@
local cmd = vim.cmd -- execute Vim commands
local exec = vim.api.nvim_exec -- execute Vimscript
-- local fn = vim.fn -- call Vim functions
local g = vim.g -- global variables
local opt = vim.opt -- global/buffer/windows-scoped options
local cmd = vim.cmd
local exec = vim.api.nvim_exec
local g = vim.g
local opt = vim.opt
g.showmode = true
g.hidden = true -- Required to keep multiple buffers open multiple buffers
opt.mouse = 'a' -- enable mouse
opt.clipboard = 'unnamedplus' -- copy/paste with system
opt.swapfile = false -- no swapfile
opt.mouse = 'a'
opt.clipboard = 'unnamedplus'
opt.swapfile = false
opt.wrap = true -- Display long lines as just one line
opt.expandtab = true -- Use space instead of tabs
opt.tabstop = 4 -- Insert 4 spaces for a tab
opt.shiftwidth = 4 -- Change the number of space characters inserted for indentation
opt.smarttab = true -- Makes tabbing smarter will realize you have 2 vs 4
opt.autoindent = true -- Good auto indent
opt.foldmethod='indent'
opt.wrap = true
opt.expandtab = true
opt.tabstop = 4
opt.shiftwidth = 4
opt.smarttab = true
opt.autoindent = true
opt.foldmethod = 'indent'
opt.number = true -- show line number
opt.relativenumber = true -- show relative line number
opt.cursorline = true -- highlight current line
opt.number = true
opt.relativenumber = true
opt.cursorline = true
opt.scrolloff = 8 -- Keep 8 lines visible above/below cursor
opt.ignorecase = true -- Ignore case on search
opt.smartcase = true -- ignore lowercse for the whoel pattern
opt.scrolloff = 8
opt.ignorecase = true
opt.smartcase = true
opt.completeopt = 'menuone,noselect,noinsert' -- completion options
opt.completeopt = 'menuone,noselect,noinsert'
opt.spell = true
opt.spelllang = {'fr', 'en'}
vim.api.nvim_create_autocmd("FileType", {
pattern = { "markdown", "text", "tex", "gitcommit" },
callback = function()
vim.opt_local.spell = true
vim.opt_local.spelllang = { "fr", "en" }
end,
})
opt.nrformats = opt.nrformats + 'alpha'
opt.showmatch = true
g.showtabline = true
-- don't auto commenting new lines
cmd[[au BufEnter * set fo-=c fo-=r fo-=o]]
opt.showmatch = true -- show parenthethis match
-- Highlight on yank
exec([[
augroup YankHighlight
autocmd!
@@ -48,6 +45,4 @@ exec([[
augroup end
]], false)
-- Python 3
g.python3_host_prog="~/.venv/nvim/bin/python"
g.python3_host_prog = vim.fn.expand("~/.venv/nvim/bin/python")