nixos/roles/home/common.nix

109 lines
2.9 KiB
Nix
Raw Normal View History

2021-10-14 12:53:44 +01:00
{ config, pkgs, ... }:
{
imports = [ ./zsh.nix ./git.nix ];
2021-10-14 12:53:44 +01:00
home = {
2021-11-21 10:36:57 +00:00
stateVersion = "21.05";
2021-10-14 12:53:44 +01:00
sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
2021-11-21 10:36:57 +00:00
packages = with pkgs; [ rizin sshfs nixfmt ];
2021-10-14 12:53:44 +01:00
};
programs.neovim = {
2021-11-21 10:36:57 +00:00
enable = true;
2021-11-25 11:42:32 +00:00
extraPackages = with pkgs; [
nodePackages.prettier
cmake-format
clang-tools
rustfmt
];
extraConfig = ''
2021-06-30 19:52:53 +01:00
" syntax
syntax enable
2021-06-30 19:52:53 +01:00
" color themes
set termguicolors
colorscheme molokai
2021-06-30 19:52:53 +01:00
" wildcard mode
2021-06-27 17:13:17 +01:00
set wildmode=longest:full,full
2021-07-01 01:38:15 +01:00
2021-06-30 19:52:53 +01:00
" remapping popup menu (command autocompletion)
2021-10-13 13:29:07 +01:00
" cnoremap <expr> <up> pumvisible() ? "<C-p>" : "<up>
" cnoremap <expr> <down> pumvisible() ? "<C-n>" : "<down>"
" cnoremap <expr> <CR> pumvisible() ? "<C-e>":"<CR>"
2021-06-30 19:52:53 +01:00
" set line numbers
2021-06-27 17:13:17 +01:00
set number
2021-06-30 19:52:53 +01:00
" YouCompleteMe
let g:ycm_key_list_stop_completion = ['<C-y>', '<CR>']
let g:ycm_key_list_select_completion = ['<Up>', '<Down>', '<TAB>']
2021-06-30 19:52:53 +01:00
" enable indent guides
let g:indent_guides_enable_on_vim_startup = 1
2021-07-01 05:23:25 +01:00
" Exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
" Start NERDTree. If a file is specified, move the cursor to its window.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * NERDTree | if argc() > 0 || exists("s:std_in") | wincmd p | endif
" Start NERDTree when Vim starts with a directory argument.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
" Exit Vim if NERDTree is the only window left.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() |
\ quit | endif
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" Highlight row and column
set cul
set cuc
2021-07-07 10:46:26 +01:00
" Fix for code not being aligned if between comment blocks
set cindent cinkeys-=0#
2021-08-23 19:00:19 +01:00
set expandtab shiftwidth=2 tabstop=2 softtabstop=2
2021-10-13 13:29:07 +01:00
2021-11-21 10:36:57 +00:00
" Enable alignment
let g:neoformat_basic_format_align = 1
" Enable tab to spaces conversion
let g:neoformat_basic_format_retab = 1
" Enable trimmming of trailing whitespace
let g:neoformat_basic_format_trim = 1
'';
2021-06-27 17:13:17 +01:00
2021-11-21 10:36:57 +00:00
viAlias = true;
vimAlias = true;
2021-11-21 10:36:57 +00:00
plugins = with pkgs.vimPlugins; [
2021-07-01 05:23:25 +01:00
vim-nix
molokai
YouCompleteMe
2021-07-01 05:23:25 +01:00
vim-airline
2021-06-27 15:16:08 +01:00
vim-airline-themes
2021-11-21 10:36:57 +00:00
vim-lsp
2021-06-27 15:16:08 +01:00
vim-indent-guides
2021-11-21 10:36:57 +00:00
vim-signify
2021-07-01 05:23:25 +01:00
nerdtree
vim-easy-align
2021-07-07 10:46:26 +01:00
vim-fugitive
2021-10-13 13:29:07 +01:00
vimtex
2021-11-21 10:36:57 +00:00
neoformat
];
};
}