update vim stuff

This commit is contained in:
Sean Buckley 2023-09-15 13:19:18 -04:00
parent 43e1c34470
commit 9e2e33dee9
4 changed files with 92 additions and 33 deletions

View file

@ -22,7 +22,6 @@
nix-top
nixpkgs-fmt
nodejs
nodePackages.prettier
openssl
parted
pciutils

View file

@ -1,32 +0,0 @@
{ config, lib, pkgs, ... }:
let
lower_left_triangle = builtins.fromJSON '' "\uE0B8" '';
upper_left_triangle = builtins.fromJSON '' "\uE0BC" '';
in
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
defaultEditor = true;
configure = {
packages.sconfig.start = with pkgs.vimPlugins; [
vim-gitgutter
vim-nix
];
customRC = ''
set mouse=
set encoding=utf-8
scriptencoding utf-8
set list nowrap scrolloff=9 updatetime=300 number
highlight GitGutterAdd ctermfg=10
highlight GitGutterChange ctermfg=11
highlight GitGutterDelete ctermfg=9
let g:gitgutter_sign_removed = '${lower_left_triangle}'
let g:gitgutter_sign_removed_first_line = '${upper_left_triangle}'
let g:gitgutter_sign_modified_removed = '~~'
'';
};
};
}

30
modules/vim/default.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
defaultEditor = true;
configure = {
packages.sconfig.start = with pkgs.vimPlugins; [
airline
bufferline-nvim
nerdtree
vim-autoformat
vim-gitgutter
vim-nix
vim-startify
];
customRC = ''
source ${./init.vim}
'';
};
};
environment.systemPackages = with pkgs; [
nodePackages.prettier
(writeShellScriptBin "black" ''
exec ${pkgs.python3.pkgs.black}/bin/black "$@"
'')
];
}

62
modules/vim/init.vim Normal file
View file

@ -0,0 +1,62 @@
"misc
set mouse=
set encoding=utf-8
set number relativenumber
set list
set nowrap
set scrolloff=9
"configure plugins
let g:gitgutter_sign_removed = "\uE0B8"
let g:gitgutter_sign_removed_first_line = "\uE0BC"
let g:gitgutter_sign_modified_removed = '~~'
set updatetime=500
highlight GitGutterAdd ctermfg=10
highlight GitGutterChange ctermfg=11
highlight GitGutterDelete ctermfg=9
let g:startify_custom_header = "''"
let g:startify_custom_indices = map(range(1,100), 'string(v:val)')
"auto formatting
let g:formatters_python = ['black']
let g:formatdef_nixpkgsfmt="'nixpkgs-fmt'"
let g:formatters_nix = ['nixpkgsfmt']
let g:formatdef_prettier="'prettier --stdin-filepath ' . expand('%:p')"
let g:formatters_js = ['prettier']
let g:formatters_json = ['prettier']
let g:formatters_ts = ['prettier']
let g:formatters_yaml = ['prettier']
autocmd BufWritePre * :Autoformat
"menus
nnoremap <silent> <space>e :NERDTreeFocus<CR>:vertical resize 30<CR>
nnoremap <silent> <space>o :Startify<CR>
"buffers
nnoremap <silent> <space>w :q<CR>
nnoremap <silent> <space>q :bd<CR>
nnoremap <silent> <space>d :bnext<CR>
nnoremap <silent> <space>a :bprevious<CR>
"window shortcuts
nnoremap <space>h <C-W>h
nnoremap <space>j <C-W>j
nnoremap <space>k <C-W>k
nnoremap <space>l <C-W>l
nnoremap <space>v <C-W>v
nnoremap <space>s <C-W>s
lua << EOF
require("bufferline").setup{}
EOF