neovim additions
This commit is contained in:
parent
315e988734
commit
409f13a1db
25 changed files with 242 additions and 86 deletions
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/init.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/init.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/lua/conf/autocmd.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/lua/conf/autocmd.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/lua/conf/lsp-config.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/lua/conf/lsp-config.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/lua/conf/remap.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/lua/conf/remap.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/lua/conf/settings.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/lua/conf/settings.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/luasnippets/matlab.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/luasnippets/matlab.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/luasnippets/tex.lua
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/luasnippets/tex.lua
|
||||
|
|
@ -1 +1 @@
|
|||
/nix/store/hhz4243ymgf24x646pxh30jm38iss4rd-home-manager-files/.config/nvim/queries/nix/injections.scm
|
||||
/nix/store/9zm2q9k1vrgi6j8f3p14xz9xkh0ch2xy-home-manager-files/.config/nvim/queries/nix/injections.scm
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
pyright # python v2
|
||||
|
||||
# formatters
|
||||
nixfmt-rfc-style
|
||||
nixfmt
|
||||
stylua
|
||||
ruff
|
||||
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@
|
|||
../plugins/lualine.nix
|
||||
../plugins/luasnip.nix
|
||||
../plugins/mini.nix
|
||||
../plugins/neogit.nix
|
||||
../plugins/noice.nix
|
||||
../plugins/oil.nix
|
||||
../plugins/snacks.nix
|
||||
../plugins/telescope.nix
|
||||
../plugins/treesitter.nix
|
||||
../plugins/vimtex.nix
|
||||
../plugins/web-devicons.nix
|
||||
../plugins/which-key.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
-- (.config/nvim/lua/neoconf/autocmd.lua)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ async = false })
|
||||
end,
|
||||
})
|
||||
|
||||
local function run_curr_python_file()
|
||||
-- Get file name in the current buffer
|
||||
local file_name = vim.api.nvim_buf_get_name(0)
|
||||
|
|
@ -37,12 +31,21 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||
vim.wo.conceallevel = 2
|
||||
-- Désactive vimtex pour ces fichiers
|
||||
vim.b.vimtex_syntax_enabled = 0
|
||||
-- spellcheck
|
||||
vim.wo.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
pcall(vim.treesitter.start)
|
||||
local ok = pcall(vim.treesitter.start)
|
||||
if ok then
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
end,
|
||||
})
|
||||
-- active spell sur .tex
|
||||
vim.api.nvim_create_autocmd("FileType", { pattern = "tex", callback = function() vim.wo.spell = true end })
|
||||
|
||||
vim.api.nvim_create_autocmd("TextYankPost", { callback = function() vim.highlight.on_yank() end })
|
||||
|
|
|
|||
|
|
@ -1,14 +1,48 @@
|
|||
-- diagnostic
|
||||
vim.diagnostic.config({
|
||||
virtual_text = {
|
||||
prefix = "●", -- Icône avant le message
|
||||
source = "if_many", -- Affiche la source LSP si plusieurs
|
||||
prefix = "●",
|
||||
source = "if_many",
|
||||
format = function(diag)
|
||||
return string.format("%s: %s", diag.source, diag.message)
|
||||
end,
|
||||
},
|
||||
signs = true,
|
||||
underline = true,
|
||||
update_in_insert = false, -- Évite flicker en insert
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "[d", function()
|
||||
vim.diagnostic.jump({ count = -1, float = true })
|
||||
end, { desc = "Previous diagnostic" })
|
||||
vim.keymap.set("n", "]d", function()
|
||||
vim.diagnostic.jump({ count = 1, float = true })
|
||||
end, { desc = "Next diagnostic" })
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
desc = "Configure LSP keymaps on attach",
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
map("gd", vim.lsp.buf.definition, "Goto Definition")
|
||||
map("gD", vim.lsp.buf.declaration, "Goto Declaration")
|
||||
map("gr", vim.lsp.buf.references, "Goto References")
|
||||
map("gI", vim.lsp.buf.implementation, "Goto Implementation")
|
||||
map("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
map("<leader>rn", vim.lsp.buf.rename, "Rename")
|
||||
map("<leader>ca", vim.lsp.buf.code_action, "Code Action")
|
||||
map("<leader>ds", vim.lsp.buf.document_symbol, "Document Symbols")
|
||||
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client:supports_method("textDocument/inlayHint") then
|
||||
vim.lsp.inlay_hint.enable(true, { bufnr = event.buf })
|
||||
map("<leader>th", function()
|
||||
local enabled = vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })
|
||||
vim.lsp.inlay_hint.enable(not enabled, { bufnr = event.buf })
|
||||
end, "Toggle Inlay Hints")
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@ vim.keymap.set("n", "<leader>fb", builtin.buffers, { desc = "Telescope buffers"
|
|||
vim.keymap.set("n", "<leader>fh", builtin.help_tags, { desc = "Telescope help tags" })
|
||||
-- oil
|
||||
vim.keymap.set("n", "<leader>n", "<cmd>Oil<CR>", { desc = "Launch oil buffer" })
|
||||
-- python
|
||||
vim.keymap.set("n", "<F5>", ":w<CR>:!python3 %<CR>", { noremap = true, silent = false })
|
||||
|
||||
vim.keymap.set("n", "-", "<cmd>Oil<CR>", { desc = "Open parent directory" })
|
||||
-- spell checker from fr to en
|
||||
vim.keymap.set("n", "<leader>sf", function()
|
||||
if vim.o.spelllang == "fr" then
|
||||
|
|
@ -48,6 +46,7 @@ vim.api.nvim_create_user_command("OctaveRun", function()
|
|||
vim.cmd("write")
|
||||
vim.cmd('!octave -qf "%:p"')
|
||||
end, {})
|
||||
vim.keymap.set("n", "<leader>ro", "<cmd>OctaveRun<CR>", { desc = "Run current Octave/Matlab file" })
|
||||
|
||||
-- set vimtex main to current file
|
||||
local function vimtex_set_main()
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ end)
|
|||
vim.o.breakindent = true
|
||||
-- indent options
|
||||
vim.o.autoindent = true
|
||||
vim.o.smartindent = true
|
||||
-- vim.o.smartindent = true
|
||||
vim.o.expandtab = true
|
||||
-- save undo history
|
||||
vim.o.undofile = true
|
||||
|
|
@ -39,8 +39,15 @@ vim.o.scrolloff = 10
|
|||
-- confirm save/confirm
|
||||
vim.o.confirm = true
|
||||
-- spell checking
|
||||
vim.opt.spell = true
|
||||
-- vim.opt.spell = true
|
||||
vim.opt.spelllang = "fr"
|
||||
-- wrap
|
||||
vim.o.wrap = true
|
||||
vim.o.linebreak = true
|
||||
-- indent
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
-- timers
|
||||
vim.o.updatetime = 250
|
||||
vim.o.timeoutlen = 300
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
{ inputs, ... }:
|
||||
{ inputs, pkgs, ... }:
|
||||
let
|
||||
nixvim = import (
|
||||
builtins.fetchGit {
|
||||
|
|
@ -23,5 +23,6 @@ in
|
|||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
nixpkgs.source = pkgs.path;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@
|
|||
nix = [ "nixfmt" ];
|
||||
lua = [ "stylua" ];
|
||||
python = [ "ruff_format" ];
|
||||
format_on_save = {
|
||||
lsp_fallback = true;
|
||||
timeout_ms = 500;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,61 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
gitsigns = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
programs.nixvim.plugins.gitsigns.enable = true;
|
||||
|
||||
programs.nixvim.keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "]c";
|
||||
action.__raw = ''
|
||||
function()
|
||||
if vim.wo.diff then return "]c" end
|
||||
vim.schedule(function() require("gitsigns").nav_hunk("next") end)
|
||||
return "<Ignore>"
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "Next git hunk";
|
||||
expr = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "[c";
|
||||
action.__raw = ''
|
||||
function()
|
||||
if vim.wo.diff then return "[c" end
|
||||
vim.schedule(function() require("gitsigns").nav_hunk("prev") end)
|
||||
return "<Ignore>"
|
||||
end
|
||||
'';
|
||||
options = {
|
||||
desc = "Previous git hunk";
|
||||
expr = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>hs";
|
||||
action.__raw = ''function() require("gitsigns").stage_hunk() end'';
|
||||
options.desc = "Stage hunk";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>hr";
|
||||
action.__raw = ''function() require("gitsigns").reset_hunk() end'';
|
||||
options.desc = "Reset hunk";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>hp";
|
||||
action.__raw = ''function() require("gitsigns").preview_hunk() end'';
|
||||
options.desc = "Preview hunk";
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>hb";
|
||||
action.__raw = ''function() require("gitsigns").blame_line({ full = true }) end'';
|
||||
options.desc = "Blame line";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
enable = true;
|
||||
servers = {
|
||||
nil_ls.enable = true;
|
||||
lua-ls = {
|
||||
lua_ls = {
|
||||
enable = true;
|
||||
settings.Lua.diagnostics.globals = [ "vim" ];
|
||||
};
|
||||
|
|
|
|||
16
home/afoucaultc/packages/neovim/plugins/neogit.nix
Normal file
16
home/afoucaultc/packages/neovim/plugins/neogit.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.nixvim.plugins = {
|
||||
neogit.enable = true;
|
||||
diffview.enable = true; # compagnon habituel de neogit pour les diffs
|
||||
};
|
||||
|
||||
programs.nixvim.keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>gg";
|
||||
action = "<cmd>Neogit<cr>";
|
||||
options.desc = "Open Neogit";
|
||||
}
|
||||
];
|
||||
}
|
||||
10
home/afoucaultc/packages/neovim/plugins/noice.nix
Normal file
10
home/afoucaultc/packages/neovim/plugins/noice.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.nixvim.plugins.noice = {
|
||||
enable = true;
|
||||
settings.lsp = {
|
||||
"vim.lsp.util.convert_input_to_markdown_lines" = true;
|
||||
"vim.lsp.util.stylize_markdown" = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
11
home/afoucaultc/packages/neovim/plugins/snacks.nix
Normal file
11
home/afoucaultc/packages/neovim/plugins/snacks.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.nixvim.plugins.snacks = {
|
||||
enable = true;
|
||||
settings = {
|
||||
bigfile.enabled = true; # gère proprement les très gros fichiers
|
||||
quickfile.enabled = true; # affichage plus rapide au démarrage
|
||||
indent.enabled = true; # guides d'indentation visuels
|
||||
};
|
||||
};
|
||||
}
|
||||
8
home/afoucaultc/packages/neovim/plugins/web-devicons.nix
Normal file
8
home/afoucaultc/packages/neovim/plugins/web-devicons.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
web-devicons.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,10 +1,17 @@
|
|||
{ ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
which-key = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.nixvim.plugins.which-key.enable = true;
|
||||
|
||||
programs.nixvim.extraConfigLua = ''
|
||||
require("which-key").add({
|
||||
{ "<leader>f", group = "Find" },
|
||||
{ "<leader>g", group = "Git" },
|
||||
{ "<leader>h", group = "Git Hunk" },
|
||||
{ "<leader>s", group = "Spell" },
|
||||
{ "<leader>c", group = "Code" },
|
||||
{ "<leader>r", group = "Run" },
|
||||
{ "<leader>l", group = "LaTeX" },
|
||||
{ "<leader>t", group = "Toggle" },
|
||||
})
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
stylix = {
|
||||
enable = true;
|
||||
targets.gtksourceview.enable = false;
|
||||
targets.nixvim.enable = false;
|
||||
base16Scheme = "${pkgs.base16-schemes}/share/themes/tokyo-night-dark.yaml";
|
||||
polarity = "dark";
|
||||
cursor = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue