tomato/modules/neovim/default.nix
2021-08-23 10:42:53 +00:00

103 lines
2.5 KiB
Nix

{ pkgs, ... }: {
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
configure = {
customRC = ''
let mapleader="\<SPACE>"
syntax on
filetype on
filetype plugin indent on
set showmatch
set number
set formatoptions+=o
set expandtab
set tabstop=3
set shiftwidth=3
set nojoinspaces
set splitbelow
set splitright
if !&scrolloff
set scrolloff=3
endif
if !&sidescrolloff
set sidescrolloff=3
endif
set nostartofline
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
set list
set ignorecase
set smartcase
set gdefault
if maparg('<C-L>', 'n') ==# '''
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
endif
nmap <Leader>s :%s//g<Left><Left>
function! NumberToggle()
if(&relativenumber == 1)
set nornu
set number
else
set rnu
endif
endfunc
nnoremap <Leader>r :call NumberToggle()<cr>
nnoremap <Leader>o :CtrlP<CR>
nnoremap <Leader>b :CtrlPBuffer<CR>
nnoremap <Leader>f :CtrlPMRUFiles<CR>
let g:airline#extensions#tabline#enabled = 2
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#right_sep = ' '
let g:airline#extensions#tabline#right_alt_sep = '|'
let g:airline_left_sep = ' '
let g:airline_left_alt_sep = '|'
let g:airline_right_sep = ' '
let g:airline_right_alt_sep = '|'
let g:idris_indent_if = 3
let g:idris_indent_case = 5
let g:idris_indent_let = 4
let g:idris_indent_where = 6
let g:idris_indent_do = 3
let g:idris_indent_rewrite = 8
autocmd FileType idris :packadd idris2-vim
let g:rainbow_conf = {
\ 'ctermfgs': ['red', 'green', 'blue', 'cyan', 'magenta'],
\ 'cterms': ['bold']
\}
'';
packages.nix = with pkgs.vimPlugins; {
start = [
vim-nix
vim-racket
idris2-vim
airline
ctrlp
vim-javascript-syntax
rainbow_parentheses
];
};
};
};
}