{ lib, pkgs, ... } @ inputs: { home-manager.users.buffet = { home.sessionVariables = { EDITOR = "nvim"; }; # TODO: completion programs.neovim = let leader = ","; in { enable = true; plugins = let buildPlugin = name: pkgs.vimUtils.buildNeovimPluginFrom2Nix { inherit name; src = inputs."${name}"; }; buildPlugins = names: lib.attrsets.genAttrs names buildPlugin; plugins = buildPlugins ["lsp-trouble"]; in with pkgs.vimPlugins; with plugins; [ {plugin = editorconfig-nvim;} {plugin = fugitive;} {plugin = lsp-trouble;} {plugin = rust-vim;} {plugin = tabular;} {plugin = vim-nix;} {plugin = vim-repeat;} { 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 = gitsigns-nvim; config = '' lua require 'gitsigns'.setup() set signcolumn=yes ''; } # TODO: replace with own bar { plugin = lightline-vim; config = '' let g:lightline = { 'colorscheme': 'solarized' } set noshowmode ''; } { plugin = lspsaga-nvim; config = '' lua require 'lspsaga'.init_lsp_saga() nnoremap ${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 = NeoSolarized; config = '' set background=light colorscheme NeoSolarized ''; } { plugin = nvim-autopairs; config = "lua require 'nvim-autopairs'.setup {}"; } { plugin = nvim-lspconfig; config = let configure = srv: "lua require 'lspconfig'.${srv}.setup {}"; servers = [ "clangd" "rust_analyzer" ]; in lib.strings.concatStringsSep "\n" (builtins.map configure servers); } { plugin = telescope-nvim; config = '' nnoremap ${leader}f :Telescope find_files nnoremap ${leader}g :Telescope live_grep nnoremap ${leader}b :Telescope buffers nnoremap ${leader}: :Telescope commands ''; } { plugin = nvim-treesitter.withPlugins (plugins: with plugins; [ tree-sitter-bash tree-sitter-bibtex tree-sitter-c tree-sitter-cmake tree-sitter-comment tree-sitter-cpp tree-sitter-css tree-sitter-devicetree tree-sitter-dockerfile tree-sitter-fennel tree-sitter-go tree-sitter-javascript tree-sitter-json tree-sitter-latex tree-sitter-lua tree-sitter-make tree-sitter-markdown tree-sitter-nix tree-sitter-perl tree-sitter-python tree-sitter-regex tree-sitter-rust tree-sitter-toml ]); config = '' lua < 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 shiftwidth=4 set tabstop=4 set expandtab set shiftround set autoindent set smartindent highlight! ExtraWhitespace guibg=${theme.normal.red} match ExtraWhitespace /\s\+$/ ''; }; }; }