era-configuration-nix/vim.nix
2017-02-28 23:13:53 +01:00

105 lines
2.7 KiB
Nix

# Largely adapted from: https://www.mpscholten.de/nixos/2016/04/11/setting-up-vim-on-nixos.html
with import <nixpkgs> {};
vim_configurable.customize {
name = "vim";
vimrcConfig.vam.knownPlugins = pkgs.vimPlugins;
vimrcConfig.vam.pluginDictionaries = [
{ names = [
"vim-nix"
"Solarized"
"fugitive"
"surround"
"elm-vim"
"vimtex"
#"vim/.vim/bundle/VOoM" is missing
#"vim/.vim/bundle/vim-better-whitespace is missing
#"vim/.vim/bundle/vim-systemd-syntax is missing
#"vim/.vim/bundle/vim-obsession is missing
#"vim/.vim/bundle/vim-opencl is missing
]; }
];
vimrcConfig.customRC = ''
" Must have for vim
set nocompatible
" Display nbsp
set listchars=tab:\|\ ,nbsp:·
set list
" Remap ESC on ,,
map ,, <ESC>
imap ,, <ESC>
scriptencoding utf-8
" Must be *after* pathogen
filetype plugin indent on
" Leader
let mapleader=","
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
" let maplocalleader = "-"
" Highlighting
syntax enable
if has('gui_running')
" When gui is running, it pretty much sets its own colors
set background=light
set guifont=Inconsolata\ 16
else
" If we're in a terminal, then we stay default, terminal will choose
" which colors it likes.
set background=dark
endif
let g:solarized_termcolors=16
colorscheme solarized
" Set line numbering
set number
" Don't wrap lines, it's ugly
set nowrap
" Deal with tabs
set softtabstop=2
set tabstop=2 " 1 tab = 2 spaces
set shiftwidth=2 " Indent with 2 spaces
set expandtab " Insert spaces instead of tabs
" Set par as default wrapper
set formatprg=${par.outPath}/bin/par\ -w80
" Set mouse on
set mouse=a
" Don't set timeout - this breaks the leader use
set notimeout
set ttimeout
let &colorcolumn=join(range(81,999),",")
" vimtex options
let g:vimtex_fold_enabled=1
let g:vimtex_fold_manual=1
" nice pluginless stuff
set path+=**
set wildmenu
" Tag generation
command! MakeTags !ctags -R .
" Less noise in netrw
let g:netrw_banner=0
let g:netrw_browse_split=4
let g:netrw_altv=1
let g:netrw_liststyle=3
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" Normal backspace
set backspace=indent,eol,start
'';
}