nixos-config/home-manager/modules/neovim.nix

106 lines
2.2 KiB
Nix
Raw Normal View History

2022-01-26 19:45:40 +00:00
{ pkgs, ... }: {
2022-02-16 15:50:31 +00:00
programs.neovim = {
2022-02-06 23:01:27 +00:00
enable = true;
withPython3 = true;
2022-03-29 14:58:31 +00:00
extraPackages = with pkgs; [
(python3.withPackages (ps: with ps; [
black
flake8
]))
];
2022-02-16 15:50:31 +00:00
vimAlias = true;
2022-02-07 17:11:50 +00:00
plugins = with pkgs.vimPlugins; [
# Nice statusbar at the bottom
vim-airline
# Autoformatter for 'all' languages
neoformat
# Colorscheme
gruvbox-nvim
2022-02-16 15:50:31 +00:00
# Fileexplorer in the sidebar
nvim-tree-lua
# Fancy icons for sidebar
nvim-web-devicons
# Bar at the top for all open buffers
bufferline-nvim
# git diff icons on the left sidebar
vim-gitgutter
# blockcomments
tcomment_vim
2022-04-11 12:28:53 +00:00
# Go plugin from fatih
vim-go
2022-03-29 14:58:31 +00:00
# Coc language server support
coc-nvim
coc-go
coc-python
2022-02-07 17:11:50 +00:00
];
2022-02-06 23:01:27 +00:00
extraConfig = ''
2022-03-29 14:58:31 +00:00
set nocompatible
2022-02-06 23:01:27 +00:00
set mouse=a
2022-02-16 15:50:31 +00:00
set termguicolors
set background=dark
set nu
colorscheme gruvbox
set hlsearch
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set cursorline
let mapleader = ","
" Autosave when focus is lost
:au FocusLost * :wa
""Hotkeys
set pastetoggle=<F10>
nnoremap <silent><cr> :nohlsearch<CR>
inoremap jj <Esc>
" Faster tab switching
map <Tab> :bnext<cr>
map <S-Tab> :bprevious<cr>
" easier moving of code blocks
set hidden
vnoremap < <gv
vnoremap > >gv
" Permanent undo history
set dir=~/.tmp/
set backupdir=~/.tmp/bak
if v:version >= 703
set undodir=~/.tmp/
set undofile
set undolevels=100
set undoreload=1000
endif
2022-04-11 12:28:53 +00:00
" vim-go
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_types = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
2022-02-16 15:50:31 +00:00
lua << EOF
require("bufferline").setup{}
require("nvim-tree").setup{}
2022-02-16 15:50:31 +00:00
EOF
2022-02-06 23:01:27 +00:00
'';
};
2022-01-26 19:45:40 +00:00
}