omniflake/home/minimal/nvim/default.nix
2026-04-12 18:48:42 +02:00

248 lines
6.6 KiB
Nix

{ pkgs, ... }:
{
home.packages = with pkgs; [
astro-language-server
marksman
nil
tree-sitter
typescript-language-server
vim-language-server
];
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
extraConfig = builtins.readFile ./config.vim;
plugins = with pkgs.vimPlugins;
[
cmp-buffer
cmp-cmdline
cmp-emoji
cmp-fish
cmp-nvim-lsp
cmp-nvim-ultisnips
cmp-path
{
plugin = vim-fugitive;
type = "lua";
config = ''
vim.api.nvim_set_keymap("n", "<Leader>g", ":Git<CR>", { noremap = true, silent = true })
'';
}
{
plugin = fzf-vim;
type = "lua";
config = ''
vim.api.nvim_set_keymap('i', '<c-x><c-f>', '<Plug>(fzf-complete-path)', { silent = true })
vim.api.nvim_set_keymap('i', '<c-x><c-k>', '<Plug>(fzf-complete-word)', { silent = true })
vim.api.nvim_set_keymap('i', '<c-x><c-l>', '<Plug>(fzf-complete-line)', { silent = true })
vim.api.nvim_set_keymap('n', '<localleader><tab>', '<Plug>(fzf-maps-n)', { silent = true })
vim.api.nvim_set_keymap('x', '<localleader><tab>', '<Plug>(fzf-maps-x)', { silent = true })
vim.api.nvim_set_keymap('o', '<localleader><tab>', '<Plug>(fzf-maps-o)', { silent = true })
vim.api.nvim_set_keymap('n', '<leader>b', ':Buffers<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>o', ':Files<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>O', ':Files ~/', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>r', ':Read<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>R', ':Read ~/', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>a', ':Ag<return>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>A', ':Ag ~/', { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>.', ':Files ~/devel/omniflake/<return>', { noremap = true, silent = true })
vim.api.nvim_create_user_command(
'Read',
'call fzf#run(fzf#wrap({\'sink\': \'read\', \'dir\': <q-args>}))',
{ nargs = '?', complete = 'dir' }
)
'';
}
{
plugin = goyo-vim;
config = ''
nnoremap <silent> yog :Goyo<CR>
nnoremap <silent> [og :Goyo 80<return>
nnoremap <silent> ]og :Goyo!<return>
'';
}
{
plugin = limelight-vim;
config = ''
set termguicolors
let g:limelight_conceal_ctermfg = 'darkgray'
nnoremap yof :Limelight!!<return>
nnoremap [of :Limelight<return>
nnoremap ]of :Limelight!<return>
'';
}
nabla-nvim
{
plugin = nvim-cmp;
type = "lua";
config = builtins.readFile ./nvim-cmp.lua;
}
{
plugin = nvim-colorizer-lua;
config = "lua require 'colorizer'.setup()";
}
{
plugin = nvim-lspconfig;
type = "lua";
config = ''
vim.lsp.enable('astro')
vim.lsp.enable('marksman')
vim.lsp.enable('nil_ls')
vim.lsp.enable('r_language_server')
vim.lsp.enable('rust_analyzer')
vim.lsp.enable('texlab')
vim.lsp.enable('ts_ls')
vim.lsp.enable('vimls')
vim.api.nvim_del_keymap('i', '<c-s>')
vim.keymap.set({ 'i' }, "<c-tab>", vim.lsp.buf.signature_help, { desc = "Show signature help" })
'';
}
{
plugin = (nvim-treesitter.withPlugins (p: [ p.nix p.lua p.r p.typescript ]));
type = "lua";
config = ''
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'nix', 'markdown', 'lua', 'r' },
callback = function()
-- Enable Tree-sitter-based folding
vim.o.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
vim.o.foldmethod = 'expr'
-- Optional: configure fold behavior
vim.o.foldlevel = 99
vim.o.foldlevelstart = 99
end,
})
'';
}
{
plugin = catppuccin-nvim;
config = ''
colorscheme catppuccin-nvim
'';
}
# {
# plugin = papercolor-theme;
# config = ''
# colorscheme PaperColor
# '';
# }
quarto-nvim
typescript-vim
{
plugin = ultisnips;
type = "lua";
config = ''
vim.api.nvim_set_keymap('n', '<leader>se', ':UltiSnipsEdit!<return>', { noremap = true, silent = true })
'';
}
vifm-vim
{
plugin = vim-astro;
config = ''
let g:astro_typescript = 'enable'
'';
}
vim-commentary
{
plugin = vim-easy-align;
config = ''
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
'';
}
{
plugin = vim-fish;
}
vim-nix
{
plugin = vim-pandoc;
config = ''
let g:pandoc#modules#disabled = ["completion", "command", "menu"]
'';
}
vim-pandoc-syntax
vim-repeat
{
plugin = vim-slime;
config = ''
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": ":.2"}
let g:slime_no_mappings = 1
let g:slime_dont_ask_default = 1
xmap s <plug>SlimeRegionSend
nmap s <plug>SlimeMotionSend
nmap ss <plug>SlimeLineSend
nnoremap s: :SlimeSend1
'';
}
vim-snippets
vim-speeddating
vim-surround
{
plugin = vim-unimpaired;
config = ''
nnoremap =p <Nop>
nnoremap =P <Nop>
nnoremap =s <Nop>
'';
}
{
plugin = vimwiki;
config = ''
let g:vimwiki_list = [ { 'path': '~/notes/', 'syntax': 'markdown', 'ext': '.md' } ]
nnoremap <Leader>wt <Nop>
nnoremap <Leader>w<Leader>t <Nop>
nmap <C-j> <Plug>VimwikiNextLink
nmap <C-k> <Plug>VimwikiPrevLink
let g:vimwiki_key_mappings = { 'headers': 0, 'text_objs': 0, 'lists': 0, 'lists_return': 0, 'html': 0 }
'';
}
];
withRuby = false;
withPython3 = true;
};
xdg.configFile."nvim" = {
source = ./dotfiles;
recursive = true;
};
home.shellAliases.v = "nvim";
}