100 lines
2.4 KiB
Nix
100 lines
2.4 KiB
Nix
{ pkgs, ... }:
|
|
|
|
let
|
|
leader = ''","'';
|
|
|
|
my-fzf-vim = with pkgs.vimPlugins; {
|
|
plugin = fzf-vim;
|
|
config = ''
|
|
let mapleader = ${leader}
|
|
nnoremap <leader>ff :Files<CR>
|
|
nnoremap <leader>fb :Buffers<CR>
|
|
nnoremap <leader>fw :Windows<CR>
|
|
nnoremap <leader>fl :Lines<CR>
|
|
nnoremap <leader>fm :Marks<CR>
|
|
nnoremap <leader>fc :Commands<CR>
|
|
nnoremap <leader>fr :Rg<CR>
|
|
nnoremap <leader>fk :Maps<CR>
|
|
'';
|
|
};
|
|
|
|
my-neovim-sensible = with pkgs.vimPlugins; {
|
|
plugin = neovim-sensible;
|
|
config = ''
|
|
let mapleader = ${leader}
|
|
nnoremap <leader>bd :bdelete<CR>
|
|
'';
|
|
};
|
|
|
|
my-gruvbox = with pkgs.vimPlugins; {
|
|
plugin = gruvbox;
|
|
config = ''
|
|
colorscheme gruvbox
|
|
'';
|
|
};
|
|
|
|
emptyString = "''";
|
|
|
|
myLightline = with pkgs.vimPlugins; {
|
|
plugin = lightline-vim;
|
|
config = ''
|
|
function! StatusDiagnostic() abort
|
|
let info = get(b:, 'coc_diagnostic_info', {})
|
|
if empty(info) | return ${emptyString} | endif
|
|
let msgs = []
|
|
if get(info, 'error', 0)
|
|
call add(msgs, ' ' . info['error'])
|
|
endif
|
|
if get(info, 'warning', 0)
|
|
call add(msgs, ' ' . info['warning'])
|
|
endif
|
|
return join(msgs, ' ') . ' ' . get(g:, 'coc_status', ${emptyString})
|
|
endfunction
|
|
|
|
" Hide modes in status line, since lightline shows them
|
|
set noshowmode
|
|
let g:lightline = {
|
|
\ 'colorscheme': 'gruvbox',
|
|
\ 'active': {
|
|
\ 'left': [ [ 'mode', 'paste' ],
|
|
\ [ 'cocstatus', 'readonly', 'filename', 'modified' ] ]
|
|
\ },
|
|
\ 'component_function': {
|
|
\ 'cocstatus': 'StatusDiagnostic'
|
|
\ },
|
|
\ }
|
|
'';
|
|
};
|
|
|
|
myConfiguration = builtins.concatStringsSep "\n" (map (pair: pair.config) [
|
|
my-fzf-vim
|
|
my-gruvbox
|
|
my-neovim-sensible
|
|
myLightline
|
|
]);
|
|
|
|
additionalPackages = map (pair: pair.plugin) [
|
|
my-fzf-vim
|
|
my-gruvbox
|
|
my-neovim-sensible
|
|
myLightline
|
|
];
|
|
|
|
in {
|
|
programs.neovim = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
configure = {
|
|
customRC = myConfiguration;
|
|
packages.myVimPackage = with pkgs.vimPlugins; {
|
|
start = [ vim-lastplace vim-nix vim-unimpaired ] ++ additionalPackages;
|
|
};
|
|
};
|
|
|
|
viAlias = true;
|
|
vimAlias = true;
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [ ripgrep ];
|
|
}
|