2022-08-14 00:01:29 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
2022-08-16 19:14:35 +00:00
|
|
|
} @ inputs: {
|
2022-07-22 20:42:05 +00:00
|
|
|
home-manager.users.buffet = {
|
|
|
|
home.sessionVariables = {
|
|
|
|
EDITOR = "nvim";
|
|
|
|
};
|
|
|
|
|
2022-08-17 10:45:56 +00:00
|
|
|
# TODO: completion
|
2022-08-16 21:07:40 +00:00
|
|
|
programs.neovim = let
|
|
|
|
leader = ",";
|
|
|
|
in {
|
2022-07-22 20:42:05 +00:00
|
|
|
enable = true;
|
2022-08-16 19:14:35 +00:00
|
|
|
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;}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
{
|
|
|
|
plugin = gitsigns-nvim;
|
2022-08-17 11:24:05 +00:00
|
|
|
config = ''
|
|
|
|
lua require 'gitsigns'.setup()
|
|
|
|
set signcolumn=yes
|
|
|
|
'';
|
2022-08-16 19:14:35 +00:00
|
|
|
}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
# TODO: replace with own bar
|
|
|
|
{
|
|
|
|
plugin = lightline-vim;
|
2022-08-17 11:24:05 +00:00
|
|
|
config = ''
|
|
|
|
let g:lightline = { 'colorscheme': 'solarized' }
|
|
|
|
set noshowmode
|
|
|
|
'';
|
2022-08-16 19:14:35 +00:00
|
|
|
}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
{
|
|
|
|
plugin = lspsaga-nvim;
|
2022-08-17 10:48:32 +00:00
|
|
|
config = ''
|
|
|
|
lua require 'lspsaga'.init_lsp_saga()
|
2022-08-17 11:59:02 +00:00
|
|
|
|
2022-08-17 11:59:21 +00:00
|
|
|
nnoremap <silent> ${leader}a :Lspsaga code_action<cr>
|
|
|
|
nnoremap <silent> ${leader}r :Lspsaga rename<cr>
|
|
|
|
nnoremap <silent> gd :lua vim.lsp.buf.definition()<cr>
|
|
|
|
nnoremap <silent> gD :lua vim.lsp.buf.declaration()<cr>
|
2022-08-17 10:48:32 +00:00
|
|
|
'';
|
2022-08-16 19:14:35 +00:00
|
|
|
}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
{
|
|
|
|
plugin = NeoSolarized;
|
|
|
|
config = ''
|
|
|
|
set background=light
|
|
|
|
colorscheme NeoSolarized
|
|
|
|
'';
|
|
|
|
}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-17 12:19:53 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-autopairs;
|
|
|
|
config = "lua require 'nvim-autopairs'.setup {}";
|
|
|
|
}
|
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-lspconfig;
|
2022-08-16 21:06:39 +00:00
|
|
|
config = let
|
|
|
|
configure = srv: "lua require 'lspconfig'.${srv}.setup {}";
|
|
|
|
servers = [
|
|
|
|
"clangd"
|
|
|
|
"rust_analyzer"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
lib.strings.concatStringsSep "\n" (builtins.map configure servers);
|
2022-08-16 19:14:35 +00:00
|
|
|
}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
{
|
|
|
|
plugin = telescope-nvim;
|
2022-08-16 21:07:40 +00:00
|
|
|
config = ''
|
2022-08-17 11:59:21 +00:00
|
|
|
nnoremap <silent> ${leader}f :Telescope find_files<cr>
|
|
|
|
nnoremap <silent> ${leader}g :Telescope live_grep<cr>
|
|
|
|
nnoremap <silent> ${leader}b :Telescope buffers<cr>
|
|
|
|
nnoremap <silent> ${leader}: :Telescope commands<cr>
|
2022-08-16 21:07:40 +00:00
|
|
|
'';
|
2022-08-16 19:14:35 +00:00
|
|
|
}
|
2022-07-22 20:42:05 +00:00
|
|
|
|
2022-08-16 19:14:35 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
]);
|
2022-08-17 12:19:53 +00:00
|
|
|
config = ''
|
|
|
|
lua <<EOF
|
|
|
|
require 'nvim-treesitter.configs'.setup {
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
additional_vim_regex_highlighting = false,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
EOF
|
2022-08-16 20:10:01 +00:00
|
|
|
'';
|
2022-08-16 19:14:35 +00:00
|
|
|
}
|
2022-08-16 20:11:38 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
plugin = vimwiki;
|
|
|
|
# TODO: vimwiki config
|
|
|
|
}
|
2022-08-16 19:14:35 +00:00
|
|
|
];
|
2022-08-16 21:07:40 +00:00
|
|
|
|
2022-08-17 11:24:05 +00:00
|
|
|
extraConfig = let
|
|
|
|
theme = import ../theme.nix;
|
|
|
|
in ''
|
|
|
|
" keybinds
|
2022-08-16 21:07:40 +00:00
|
|
|
let mapleader = "${leader}"
|
|
|
|
let g:mapleader = "${leader}"
|
2022-08-17 10:48:32 +00:00
|
|
|
|
|
|
|
inoremap kj <esc>
|
|
|
|
|
|
|
|
vnoremap < <gv
|
|
|
|
vnoremap > >gv
|
|
|
|
|
|
|
|
nnoremap <c-h> <c-w>h
|
|
|
|
nnoremap <c-j> <c-w>j
|
|
|
|
nnoremap <c-k> <c-w>k
|
|
|
|
nnoremap <c-l> <c-w>l
|
|
|
|
|
|
|
|
nnoremap <leader>s :w<cr>
|
2022-08-17 11:24:05 +00:00
|
|
|
|
|
|
|
" 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 nowrap
|
|
|
|
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\+$/
|
2022-08-16 21:07:40 +00:00
|
|
|
'';
|
2022-07-22 20:42:05 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|