dotfiles/nix/home.nix
2019-03-02 19:34:15 -08:00

223 lines
5.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ config, lib, pkgs, ... }:
with lib;
{
home.packages = with pkgs; [
htop
ripgrep
ranger
nox
zsh-autosuggestions
zsh-syntax-highlighting
zsh-history-substring-search
];
programs.command-not-found.enable = true;
programs.git = {
enable = true;
userName = "Haak Saxberg";
userEmail = "haak.erling@gmail.com";
};
programs.zsh = {
enable = true;
enableCompletion = true;
defaultKeymap = "viins";
initExtra = mkForce (''
export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH
export EDITOR=vim
source $HOME/.nix-profile/etc/profile.d/nix.sh
source $HOME/.nix-profile/share/fzf/key-bindings.zsh
source $HOME/.nix-profile/share/fzf/completion.zsh
source $HOME/.nix-profile/share/zsh-autosuggestions/zsh-autosuggestions.zsh
source $HOME/.nix-profile/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.config/zsh/local.zsh
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
'');
oh-my-zsh = {
enable = true;
theme = "bureau";
plugins = [
"git"
"z"
"sudo"
"nix-shell"
"tmuxinator"
];
};
};
programs.neovim = {
enable = true;
vimAlias = true;
withPython = true;
configure = {
packages.nixBundle = with pkgs.vimPlugins; {
start = [
vim-sensible
vim-startify
vim-javascript
vim-ruby
vim-nix
elm-vim
vim-elixir
"alchemist.vim"
haskell-vim
vim-markdown
vimtex
vim-airline
rainbow
vim-signify
vim-indent-guides
vim-surround
fugitive
easymotion
tagbar
vinegar
undotree
vim-test
ale
"fzf.vim"
fzfWrapper
LanguageClient-neovim
"deoplete.nvim"
papercolor-theme
];
};
customRC = ''
filetype plugin indent on
" ALE
let g:ale_fix_on_save = 1
" Easymotion
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)
let g:EasyMotion_landing_highlight = 0
" Rainbow parentheses
let g:rainbow_conf = {
\ 'guifgs': ['RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3', 'RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3', 'RoyalBlue3', 'DarkOrchid3', 'firebrick3', 'RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3'],
\ 'ctermfgs': ['red', 'brown', 'blue', 'gray', 'green', 'magenta', 'cyan', 'darkred', 'brown', 'darkblue', 'gray', 'darkgreen', 'darkmagenta', 'darkcyan', 'red'],
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold']
\}
let g:rainbow_active = 1
" Vim-Test
nmap <silent> <leader>t :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>a :TestSuite<CR>
nmap <silent> <leader>l :TestLast<CR>
nmap <silent> <leader>g :TestVisit<CR>
let test#strategy = "neovim"
" Deoplete
let g:deoplete#enable_at_startup = 1
" Indent guides
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_start_level = 2
" let netrw look like NERDTree
let g:netrw_liststyle = 3
let mapleader=","
set nobackup
set noswapfile
set pastetoggle=<F2>
set nowrap
set background=dark
colorscheme PaperColor
set nocompatible
set number
set numberwidth=1
set cursorline
set cursorcolumn
set ruler
set list
set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+,eol:$
set matchpairs+=<:>
set ts=2
set shiftwidth=2
set expandtab
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
""" Searching and Patterns
set ignorecase
set smartcase
set smarttab
set hlsearch
" Add the g flag to search/replace by default
set gdefault
"recalculate the trailing whitespace warning when idle, and after saving
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
" strip trailing whitespace
autocmd BufWritePre * :%s/\s\+$//e
""" Handy remaps
noremap ; :
inoremap jj <Esc>
map <silent> <leader>V :source ~/.config/nvim/init.vim<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
map \q :q<CR>
map \w :w<CR>
noremap Q <nop>
""" Terminal mode remaps
tnoremap <Esc> <C-\><C-n>
nnoremap <leader>o :below 10sp term://$SHELL<cr>i
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Dont reset cursor to start of line when moving around.
set nostartofline
" minimal number of lines to keep above/below cursorline
set scrolloff=10
" Local overrides?
if filereadable($HOME . "/.vimrc.local")
source ~/.vimrc.local
endif
'';
};
};
programs.tmux = {
enable = true;
tmuxinator = {
enable = true;
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --no-ignore --follow --files --hidden --smart-case --glob \\\"!.git/*\\\"";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.file.".tmux.conf" = {
source = ./tmux/tmux.conf;
};
}