feat(nvim): clean configuration
This commit is contained in:
@@ -12,7 +12,7 @@ return {
|
|||||||
typescript = { "eslint_d" },
|
typescript = { "eslint_d" },
|
||||||
javascriptreact = { "eslint_d" },
|
javascriptreact = { "eslint_d" },
|
||||||
typescriptreact = { "eslint_d" },
|
typescriptreact = { "eslint_d" },
|
||||||
python = { "flake8" },
|
python = { "ruff" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||||
|
|||||||
@@ -10,9 +10,15 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
local lsp_zero = require("lsp-zero")
|
local lsp_zero = require("lsp-zero")
|
||||||
lsp_zero.on_attach(function(client, bufnr)
|
lsp_zero.on_attach(function(client, bufnr)
|
||||||
-- see :help lsp-zero-keybindings
|
local opts = { buffer = bufnr, silent = true }
|
||||||
-- to learn the available actions
|
|
||||||
lsp_zero.default_keymaps({ buffer = bufnr })
|
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)
|
end)
|
||||||
|
|
||||||
require("mason").setup({})
|
require("mason").setup({})
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
branch = "0.1.x",
|
branch = "0.1.x",
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build = "make",
|
||||||
|
},
|
||||||
|
},
|
||||||
opts = {
|
opts = {
|
||||||
defaults = {
|
defaults = {
|
||||||
file_ignore_patterns = { "**/*.pdf" },
|
file_ignore_patterns = { "**/*.pdf" },
|
||||||
@@ -15,37 +21,45 @@ return {
|
|||||||
height = 0.80,
|
height = 0.80,
|
||||||
preview_cutoff = 120,
|
preview_cutoff = 120,
|
||||||
},
|
},
|
||||||
sorting_strategy = "ascending",
|
sorting_strategy = "ascending",
|
||||||
borderchars = { "█", "█", "█", "█", "█", "█", "█", "█" },
|
borderchars = { "█", "█", "█", "█", "█", "█", "█", "█" },
|
||||||
prompt_prefix = " 🔍 ",
|
prompt_prefix = " 🔍 ",
|
||||||
selection_caret = " ➜ ",
|
selection_caret = " ➜ ",
|
||||||
entry_prefix = " ",
|
entry_prefix = " ",
|
||||||
winblend = 0,
|
winblend = 0,
|
||||||
results_title = "",
|
results_title = "",
|
||||||
prompt_title = "",
|
prompt_title = "",
|
||||||
preview_title = "",
|
preview_title = "",
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<C-d>"] = require("telescope.actions").delete_buffer,
|
["<C-d>"] = require("telescope.actions").delete_buffer,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<C-d>"] = require("telescope.actions").delete_buffer,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
n = {
|
|
||||||
["<C-d>"] = require("telescope.actions").delete_buffer,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("telescope").setup(opts)
|
local telescope = require("telescope")
|
||||||
vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = "#3c3836" })
|
telescope.setup(opts)
|
||||||
vim.api.nvim_set_hl(0, "TelescopePromptNormal", { bg = "#3c3836" })
|
telescope.load_extension("fzf")
|
||||||
vim.api.nvim_set_hl(0, "TelescopeResultsNormal", { bg = "#3c3836" })
|
|
||||||
vim.api.nvim_set_hl(0, "TelescopePreviewNormal", { bg = "#3c3836" })
|
local bg = vim.api.nvim_get_hl(0, { name = "CursorColumn" }).bg
|
||||||
vim.api.nvim_set_hl(0, "TelescopePromptBorder", { fg = "#3c3836", bg = "#3c3836" })
|
if type(bg) == "number" then
|
||||||
vim.api.nvim_set_hl(0, "TelescopeResultsBorder", { fg = "#3c3836", bg = "#3c3836" })
|
bg = string.format("#%06x", bg)
|
||||||
vim.api.nvim_set_hl(0, "TelescopePreviewBorder", { fg = "#3c3836", bg = "#3c3836" })
|
end
|
||||||
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, "TelescopeNormal", { bg = bg })
|
||||||
vim.api.nvim_set_hl(0, "TelescopePreviewTitle", { fg = "#3c3836", bg = "#3c3836" })
|
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,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
|
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
|
||||||
|
|||||||
@@ -4,26 +4,29 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
local configs = require("nvim-treesitter.configs")
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
configs.setup({
|
configs.setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua",
|
"lua",
|
||||||
"vim",
|
"vim",
|
||||||
"vimdoc",
|
"vimdoc",
|
||||||
"javascript",
|
"javascript",
|
||||||
"html",
|
"html",
|
||||||
"python",
|
"python",
|
||||||
"dockerfile",
|
"dockerfile",
|
||||||
"latex",
|
"latex",
|
||||||
"yaml",
|
"yaml",
|
||||||
"regex",
|
"regex",
|
||||||
"bash",
|
"bash",
|
||||||
"markdown",
|
"markdown",
|
||||||
"markdown_inline",
|
"markdown_inline",
|
||||||
},
|
},
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
highlight = { enable = false },
|
highlight = {
|
||||||
indent = { enable = true },
|
enable = true,
|
||||||
})
|
disable = { "latex" },
|
||||||
|
},
|
||||||
|
indent = { enable = true },
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
-- opts = function(_, opts)
|
-- opts = function(_, opts)
|
||||||
-- vim.treesitter.language.register("markdown", "mdx")
|
-- vim.treesitter.language.register("markdown", "mdx")
|
||||||
|
|||||||
@@ -1,46 +1,43 @@
|
|||||||
local cmd = vim.cmd -- execute Vim commands
|
local cmd = vim.cmd
|
||||||
local exec = vim.api.nvim_exec -- execute Vimscript
|
local exec = vim.api.nvim_exec
|
||||||
-- local fn = vim.fn -- call Vim functions
|
local g = vim.g
|
||||||
local g = vim.g -- global variables
|
local opt = vim.opt
|
||||||
local opt = vim.opt -- global/buffer/windows-scoped options
|
|
||||||
|
|
||||||
g.showmode = true
|
opt.mouse = 'a'
|
||||||
g.hidden = true -- Required to keep multiple buffers open multiple buffers
|
opt.clipboard = 'unnamedplus'
|
||||||
opt.mouse = 'a' -- enable mouse
|
opt.swapfile = false
|
||||||
opt.clipboard = 'unnamedplus' -- copy/paste with system
|
|
||||||
opt.swapfile = false -- no swapfile
|
|
||||||
|
|
||||||
opt.wrap = true -- Display long lines as just one line
|
opt.wrap = true
|
||||||
opt.expandtab = true -- Use space instead of tabs
|
opt.expandtab = true
|
||||||
opt.tabstop = 4 -- Insert 4 spaces for a tab
|
opt.tabstop = 4
|
||||||
opt.shiftwidth = 4 -- Change the number of space characters inserted for indentation
|
opt.shiftwidth = 4
|
||||||
opt.smarttab = true -- Makes tabbing smarter will realize you have 2 vs 4
|
opt.smarttab = true
|
||||||
opt.autoindent = true -- Good auto indent
|
opt.autoindent = true
|
||||||
opt.foldmethod='indent'
|
opt.foldmethod = 'indent'
|
||||||
|
|
||||||
opt.number = true -- show line number
|
opt.number = true
|
||||||
opt.relativenumber = true -- show relative line number
|
opt.relativenumber = true
|
||||||
opt.cursorline = true -- highlight current line
|
opt.cursorline = true
|
||||||
|
|
||||||
opt.scrolloff = 8 -- Keep 8 lines visible above/below cursor
|
opt.scrolloff = 8
|
||||||
opt.ignorecase = true -- Ignore case on search
|
opt.ignorecase = true
|
||||||
opt.smartcase = true -- ignore lowercse for the whoel pattern
|
opt.smartcase = true
|
||||||
|
|
||||||
opt.completeopt = 'menuone,noselect,noinsert' -- completion options
|
opt.completeopt = 'menuone,noselect,noinsert'
|
||||||
|
|
||||||
opt.spell = true
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
opt.spelllang = {'fr', 'en'}
|
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.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]]
|
cmd[[au BufEnter * set fo-=c fo-=r fo-=o]]
|
||||||
|
|
||||||
opt.showmatch = true -- show parenthethis match
|
|
||||||
|
|
||||||
-- Highlight on yank
|
|
||||||
exec([[
|
exec([[
|
||||||
augroup YankHighlight
|
augroup YankHighlight
|
||||||
autocmd!
|
autocmd!
|
||||||
@@ -48,6 +45,4 @@ exec([[
|
|||||||
augroup end
|
augroup end
|
||||||
]], false)
|
]], false)
|
||||||
|
|
||||||
|
g.python3_host_prog = vim.fn.expand("~/.venv/nvim/bin/python")
|
||||||
-- Python 3
|
|
||||||
g.python3_host_prog="~/.venv/nvim/bin/python"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user