chore: update neovim config to use extraConfig 🎨

This commit is contained in:
DannyDannyDanny 2026-01-11 15:03:46 +01:00
parent 086d6d898a
commit da93ae365e

View file

@ -1,81 +1,75 @@
{ config, pkgs, ... }: { pkgs, ... }:
{ {
programs.neovim = { programs.neovim = {
enable = true; enable = true;
defaultEditor = true; defaultEditor = true;
configure = { # TODO: refactor (some parts) to extraLuaConfig
customRC = '' extraConfig = ''
set title set title
set go=a set go=a
set mouse=a set mouse=a
set nohlsearch set nohlsearch
set number set number
let mapleader="," let mapleader=","
lua << EOF lua << EOF
local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme' local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme'
local f=io.open(config_file, "r") local f = io.open(config_file, "r")
if f~=nil then if f ~= nil then
local system_theme = f:read() local system_theme = f:read()
-- f:close() io.close(f)
io.close(f) if system_theme == 'dark' then
if system_theme == 'dark' then vim.cmd("set bg=dark")
vim.cmd("set bg=dark") elseif system_theme == 'light' then
elseif system_theme == 'light' then vim.cmd("set bg=light")
vim.cmd("set bg=light") else
else print('warning: expected value "light" or "dark"')
print('warning: expected value "light" or "dark"') print(' got:', system_theme)
print(' got:', system_theme) print(' expected path:', config_file)
print(' expected path:', file) end
end else
else print('warning: nvim color scheme not found')
print('warning: nvim color scheme not found') print(' expected path:', config_file)
print(' expected path:', file) end
end EOF
EOF
colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
" netrw (dir listing) settings " netrw (dir listing) settings
let g:netrw_liststyle = 3 let g:netrw_liststyle = 3
let g:netrw_banner = 0 let g:netrw_banner = 0
let g:netrw_browse_split = 3 let g:netrw_browse_split = 3
let g:netrw_winsize = 25 " % of page let g:netrw_winsize = 25 " % of page
set listchars=tab:\ ,space:·,nbsp:,trail:,eol:,precedes:«,extends:» set listchars=tab:\ ,space:·,nbsp:,trail:,eol:,precedes:«,extends:»
set clipboard+=unnamedplus set clipboard+=unnamedplus
" Replace-all is aliased to S. " Replace-all is aliased to S.
nnoremap S :%s//g<Left><Left> nnoremap S :%s//g<Left><Left>
" save file with ,w " save file with ,w
map <leader>w :w<cr><Space> map <leader>w :w<cr><Space>
" spellcheck " spellcheck
set spell spelllang=en_us set spell spelllang=en_us
setlocal spell! spelllang=en_us setlocal spell! spelllang=en_us
''; '';
# vimPlugins inspired from Alexnortung
# https://discourse.nixos.org/t/neovim-no-longer-uses-config-or-plugins/13399/4 plugins = with pkgs.vimPlugins; [
packages.nix = with pkgs.vimPlugins; { vim-surround # shortcuts for setting () {} etc.
start = [ vim-gitgutter # git diff in sign column
vim-surround # shortcuts for setting () {} etc. # vim-airline # nice and light status bar # doesn't work nicely with tmux
vim-gitgutter # git diff in sign column # coc-nvim coc-git coc-highlight coc-python coc-rls coc-vetur coc-vimtex coc-yaml coc-html coc-json # auto completion
# vim-airline # nice and light status bar # doesn't work nicely with tmux vim-nix # nix highlight
# coc-nvim coc-git coc-highlight coc-python coc-rls coc-vetur coc-vimtex coc-yaml coc-html coc-json # auto completion # vimtex # latex stuff - disabled due to build check issue
vim-nix # nix highlight fzf-lua # fuzzy finder through lua
# vimtex # latex stuff - disabled due to build check issue nerdtree # file structure inside nvim
fzf-lua # fuzzy finder through lua rainbow # color parenthesis
nerdtree # file structure inside nvim # gruvbox-nvim # theme
rainbow # color parenthesis catppuccin-nvim # theme
# gruvbox-nvim # theme goyo-vim # write prose
catppuccin-nvim # theme limelight-vim # prose paragraph highlighter
goyo-vim # write prose ];
limelight-vim # prose paragraph highlighter
];
opt = [];
};
};
}; };
} }