Add: neovim git configuration

This commit is contained in:
DuN0z 2025-10-22 08:18:41 +02:00
parent c6e5dc2762
commit 55aad968ab
5 changed files with 85 additions and 140 deletions

59
flake.lock generated
View file

@ -113,11 +113,11 @@
]
},
"locked": {
"lastModified": 1760929667,
"narHash": "sha256-nZh6uvc71nVNaf/y+wesnjwsmJ6IZZUnP2EzpZe48To=",
"lastModified": 1761081701,
"narHash": "sha256-IwpfaKg5c/WWQiy8b5QGaVPMvoEQ2J6kpwRFdpVpBNQ=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "189c21cf879669008ccf06e78a553f17e88d8ef0",
"rev": "9b4a2a7c4fbd75b422f00794af02d6edb4d9d315",
"type": "github"
},
"original": {
@ -144,11 +144,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1760725957,
"narHash": "sha256-tdoIhL/NlER290HfSjOkgi4jfmjeqmqrzgnmiMtGepE=",
"lastModified": 1760862643,
"narHash": "sha256-PXwG0TM7Ek87DNx4LbGWuD93PbFeKAJs4FfALtp7Wo0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "81b927b14b7b3988334d5282ef9cba802e193fe1",
"rev": "33c6dca0c0cb31d6addcd34e90a63ad61826b28c",
"type": "github"
},
"original": {
@ -160,11 +160,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1760921481,
"narHash": "sha256-5aDRQrm4gUCIicnpKi2jo7K8M33i7C56uAmNmaiJQFs=",
"lastModified": 1761077392,
"narHash": "sha256-CvXrgrSqL4FSRBpnw2jYJgSDd+cQU2xv08i9jId5REo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "773d463d37341ffc8bd05a704156e87b195173be",
"rev": "78e184ebc71ffe05ce6ebf4175bc462c7ee42a8e",
"type": "github"
},
"original": {
@ -190,17 +190,31 @@
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1760965567,
"narHash": "sha256-0JDOal5P7xzzAibvD0yTE3ptyvoVOAL0rcELmDdtSKg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "cb82756ecc37fa623f8cf3e88854f9bf7f64af93",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nur": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1760938759,
"narHash": "sha256-R/ZiW9qW+NGsFDF1Hvl4lIiPrfn+o2HFMTBsUaaWNoc=",
"lastModified": 1761113343,
"narHash": "sha256-rRDrmrPAeqwnwPlmmUt8SPrkCs1zZfbMc1/eTc9Mx/I=",
"owner": "nix-community",
"repo": "NUR",
"rev": "96bc3f5b3f1cb0760e7a3876b317bd55b248cb3b",
"rev": "e16244aee8fd17d81458001de1657a6df23971e2",
"type": "github"
},
"original": {
@ -209,6 +223,24 @@
"type": "github"
}
},
"nvim-config": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1761113802,
"narHash": "sha256-HuP5TTFNzrxuro6UeA8+++BCV9x9rLhQ0bW5lbU3fTM=",
"ref": "refs/heads/master",
"rev": "154c606ecbc9069df8289e81b46025a6f9820867",
"revCount": 5,
"type": "git",
"url": "https://govel.porzh.me/DuN0z/neovim-config.git"
},
"original": {
"type": "git",
"url": "https://govel.porzh.me/DuN0z/neovim-config.git"
}
},
"root": {
"inputs": {
"agenix": "agenix",
@ -216,7 +248,8 @@
"home-manager-stable": "home-manager-stable",
"nixpkgs-stable": "nixpkgs-stable",
"nixpkgs-unstable": "nixpkgs-unstable",
"nur": "nur"
"nur": "nur",
"nvim-config": "nvim-config"
}
},
"systems": {

View file

@ -14,6 +14,7 @@
};
nur.url = "github:nix-community/NUR";
agenix.url = "github:ryantm/agenix";
nvim-config.url = "git+https://govel.porzh.me/DuN0z/neovim-config.git";
};
outputs = {
@ -23,6 +24,7 @@
home-manager,
nur,
agenix,
nvim-config,
...
}: let
mkUnstablePkgsWithNur = {
@ -37,6 +39,7 @@
in {
nixosConfigurations = {
pennsardin = nixpkgs-unstable.lib.nixosSystem {
specialArgs = { inherit nvim-config; };
system = "x86_64-linux";
pkgs = mkUnstablePkgsWithNur {
system = "x86_64-linux";
@ -48,6 +51,13 @@
modules = [
./hosts/pennsardin/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true ;
useUserPackages = true ;
extraSpecialArgs = {inherit nvim-config; };
};
}
];
};

View file

@ -1,125 +0,0 @@
{pkgs, ...}: {
programs.neovim = {
enable = true;
withNodeJs = true;
withPython3 = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
coc.enable = true;
plugins = with pkgs.vimPlugins; [
goyo-vim
nerdtree
limelight-vim
];
extraConfig = ''
set number
set relativenumber
set scrolloff=4
set signcolumn=yes
set mouse=a
set clipboard=unnamedplus
set ignorecase
set smartcase
set incsearch
set tabstop=2
set shiftwidth=2
set expandtab
set splitright
set splitbelow
set termguicolors
set updatetime=300
set undofile
let mapleader = " "
colorscheme retrobox
syntax enable
nnoremap <F10> :Goyo<CR>
inoremap <F10> <Esc> :Goyo<CR>
let g:goyo_width = 100
command! Q qall!
" --- Fichiers détat : swap / backup / undo ---
let s:state = has('unix') ? $HOME . '/.local/state/nvim' : $HOME . '/nvim-state'
" Crée les dossiers si besoin (silencieusement)
silent! call mkdir(s:state . '/swap', 'p')
silent! call mkdir(s:state . '/backup', 'p')
silent! call mkdir(s:state . '/undo', 'p')
augroup MdNoSuggest
autocmd!
autocmd FileType markdown let b:coc_suggest_disable = 1 | let b:coc_diagnostic_disable = 1
augroup END
" Goyo : pas de coupure de mots + Limelight auto
autocmd User GoyoEnter
\ let w:_wrap=&l:wrap | let w:_tw=&l:textwidth | let w:_fo=&l:formatoptions |
\ setlocal wrap linebreak nolist textwidth=0 |
\ setlocal formatoptions-=t formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=l |
\ Limelight
autocmd User GoyoLeave
\ if exists('w:_wrap') | let &l:wrap=w:_wrap | unlet w:_wrap | endif |
\ if exists('w:_tw') | let &l:textwidth=w:_tw | unlet w:_tw | endif |
\ if exists('w:_fo') | let &l:formatoptions=w:_fo | unlet w:_fo | endif |
\ Limelight!
" Swap files (fichiers déchange)
set directory^=~/.local/state/nvim/swap//
" Backups (copie avant écriture) optionnel mais utile
set backup
set writebackup
set backupdir=~/.local/state/nvim/backup//
" Undo persistant ( pour la rédaction)
set undofile
set undodir=~/.local/state/nvim/undo//
" --- Résolution auto des conflits de swap ---
augroup ResolveSwap
autocmd!
" Si un swap existe quand on ouvre un fichier
autocmd SwapExists * call s:ResolveSwap(v:swapname, expand('<afile>'))
augroup END
function! s:ResolveSwap(swapname, filename) abort
" Si le fichier sur disque est plus récent que le swap -> on édite quand même (e)
if getftime(a:filename) > getftime(a:swapname)
let v:swapchoice = 'e' " edit anyway (ignore le swap)
else
" Sinon, ouvre en lecture seule par prudence (o).
" Tu pourras décider ensuite (écraser, récupérer, diff).
let v:swapchoice = 'o'
endif
endfunction
" Rendre les messages de swap moins dramatiques
set shortmess+=A
inoremap <silent><expr> <Enter> pumvisible() ? coc#pum#confirm() : "\<CR>"
'';
extraPackages = with pkgs; [
ripgrep
fd
xclip
];
};
}
# vim: set ts=2 sw=2 sts=2 et :

View file

@ -1,6 +1,5 @@
{pkgs, ...}: {
{pkgs, nvim-config, ...}: {
imports = [
../common/nvim.nix
../../hm/common/git.nix
../../hm/common/zsh.nix
];
@ -11,9 +10,36 @@
packages = with pkgs; [
bat
tree
ruff
pyright
gcc
marksman
lua-language-server
];
};
programs.neovim = {
enable = true ;
viAlias = true ;
vimAlias = true;
};
home.file.".config/nvim" = {
source = nvim-config ;
recursive = true ;
};
programs.zsh.enable = true;
programs.ruff = {
enable = true ;
settings = {
line-length = 100;
per-file-ignores = { "__init__.py" = [ "F401" ]; };
lint = {
select = [ "E4" "E7" "E9" "F" ];
ignore = [ ];
};
};
};
}
# vim: set ts=2 sw=2 sts=2 et :

View file

@ -63,6 +63,7 @@ in {
settings = {
X11Forwarding = true;
X11DisplayOffset = 10;
X11UseLocalhost = true ;
};
};