{ lib, pkgs, ... } @ inputs: { home-manager.users.buffet = { home.sessionVariables = { EDITOR = "nvim"; }; home.packages = with pkgs; [ clang-tools nil rust-analyzer sumneko-lua-language-server ]; programs.neovim = let leader = ","; in { enable = true; plugins = let buildPlugin = pname: pkgs.vimUtils.buildVimPluginFrom2Nix { inherit pname; version = "unknown"; src = inputs."${pname}"; }; buildPlugins = names: lib.attrsets.genAttrs names buildPlugin; plugins = buildPlugins [ "cmp-conventionalcommits" "cmp-git" "gh-nvim" "nvim-cmp-vlime" "rust-tools-nvim" "vim-hy" "vlime" ]; in with pkgs.vimPlugins; with plugins; [ {plugin = cmp-buffer;} {plugin = cmp-calc;} {plugin = cmp-conventionalcommits;} {plugin = cmp-latex-symbols;} {plugin = cmp-nvim-lsp;} {plugin = cmp-path;} {plugin = cmp-treesitter;} {plugin = cmp-vsnip;} {plugin = editorconfig-nvim;} {plugin = fennel-vim;} {plugin = friendly-snippets;} {plugin = fugitive;} {plugin = lualine-lsp-progress;} {plugin = nvim-cmp-vlime;} {plugin = parinfer-rust;} {plugin = pest-vim;} {plugin = playground;} {plugin = rust-vim;} {plugin = tabular;} {plugin = vim-nix;} {plugin = vim-hy;} {plugin = vim-repeat;} {plugin = vlime;} { plugin = cmp-git; config = "lua require 'cmp_git'.setup {}"; } { plugin = crates-nvim; config = '' lua require 'crates'.setup {} nnoremap ${leader}ct :lua require('crates').toggle() nnoremap ${leader}cr :lua require('crates').reload() nnoremap ${leader}cv :lua require('crates').show_versions_popup() nnoremap ${leader}cf :lua require('crates').show_features_popup() nnoremap ${leader}cd :lua require('crates').show_dependencies_popup() nnoremap ${leader}cu :lua require('crates').update_crate() vnoremap ${leader}cu :lua require('crates').update_crates() nnoremap ${leader}ca :lua require('crates').update_all_crates() nnoremap ${leader}cU :lua require('crates').upgrade_crate() vnoremap ${leader}cU :lua require('crates').upgrade_crates() nnoremap ${leader}cA :lua require('crates').upgrade_all_crates() nnoremap ${leader}cH :lua require('crates').open_homepage() nnoremap ${leader}cR :lua require('crates').open_repository() nnoremap ${leader}cD :lua require('crates').open_documentation() nnoremap ${leader}cC :lua require('crates').open_crates_io() ''; } { plugin = gh-nvim; config = '' lua < ${leader}qcc :GHCloseCommit nnoremap ${leader}qce :GHExpandCommit nnoremap ${leader}qct :GHOpenToCommit nnoremap ${leader}qcp :GHPopOutCommit nnoremap ${leader}qcz :GHCollapseCommit nnoremap ${leader}qip :GHPreviewIssue nnoremap ${leader}qrb :GHStartReview nnoremap ${leader}qrc :GHCloseReview nnoremap ${leader}qrd :GHDeleteReview nnoremap ${leader}qre :GHExpandReview nnoremap ${leader}qrs :GHSubmitReview nnoremap ${leader}qrz :GHCollapseReview nnoremap ${leader}qpc :GHClosePR nnoremap ${leader}qpd :GHPRDetails nnoremap ${leader}qpe :GHExpandPR nnoremap ${leader}qpo :GHOpenPR nnoremap ${leader}qpp :GHPopOutPR nnoremap ${leader}qpr :GHRefreshPR nnoremap ${leader}qpt :GHOpenToPR nnoremap ${leader}qpz :GHCollapsePR nnoremap ${leader}qtc :GHCreateThread nnoremap ${leader}qtn :GHNextThread nnoremap ${leader}qt :GHToggleThread ''; } { plugin = gitsigns-nvim; config = '' lua < ${leader}lt :LTPanel ''; } { plugin = litee-calltree-nvim; config = '' lua require 'litee.calltree'.setup {} nnoremap ${leader}lci :lua vim.lsp.buf.incoming_calls() nnoremap ${leader}lco :lua vim.lsp.buf.outgoing_calls() ''; } { plugin = litee-symboltree-nvim; config = '' lua require 'litee.symboltree'.setup {} nnoremap ${leader}ls :lua vim.lsp.buf.document_symbol() ''; } { plugin = lualine-nvim; config = '' lua < ${leader}a :Lspsaga code_action nnoremap ${leader}r :Lspsaga rename nnoremap gd :lua vim.lsp.buf.definition() nnoremap gD :lua vim.lsp.buf.declaration() ''; } { plugin = nvim-cmp; config = '' set completeopt=menu,menuone,noselect lua <'] = cmp.mapping.confirm({ select = true }), [''] = cmp.mapping.select_prev_item(select_opts), [''] = cmp.mapping.select_next_item(select_opts), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.abort(), }, sources = cmp.config.sources { { name = 'buffer' }, { name = 'calc' }, { name = 'conventionalcommits' }, { name = 'crates' }, { name = 'git' }, { name = 'latex_symbols' }, { name = 'nvim_lsp' }, { name = 'path' }, { name = 'treesitter' }, { name = 'vlime' }, { name = 'vsnip' }, }, } EOF ''; } { plugin = nvim-dap; config = '' nnoremap lua require 'dap'.continue() nnoremap lua require 'dap'.step_over() nnoremap lua require 'dap'.step_into() nnoremap lua require 'dap'.step_out() nnoremap ${leader}db lua require'dap'.toggle_breakpoint() nnoremap ${leader}dB lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) nnoremap ${leader}dr lua require'dap'.repl.open() nnoremap ${leader}dl lua require'dap'.run_last() lua < ${leader}f :Telescope find_files nnoremap ${leader}F :Telescope find_files hidden=true no_ignore=true nnoremap ${leader}g :Telescope live_grep nnoremap ${leader}b :Telescope buffers nnoremap ${leader}: :Telescope commands ''; } { plugin = trouble-nvim; config = '' nnoremap ${leader}t :TroubleToggle ''; } { plugin = vim-vsnip; config = '' imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' ''; } { plugin = vimwiki; # TODO: vimwiki config } ]; extraConfig = let theme = import ../theme.nix; in '' " keybinds let mapleader = "${leader}" let g:mapleader = "${leader}" inoremap kj vnoremap < >gv nnoremap h nnoremap j nnoremap k nnoremap l nnoremap s :w " misc set termguicolors set mouse=a set undofile set hidden set encoding=utf-8 set hlsearch set incsearch set ignorecase set smartcase set lazyredraw set splitbelow set splitright set matchtime=2 set showmatch set wrap set breakindent set nowritebackup set updatetime=250 set colorcolumn=+1 set cursorline set signcolumn=yes set shiftwidth=4 set tabstop=4 set expandtab set shiftround set autoindent set smartindent highlight! ExtraWhitespace guibg=${theme.normal.red} match ExtraWhitespace /\s\+$/ autocmd FileType lisp setlocal shiftwidth=2 tabstop=2 lua <