era-configuration-nix/vim.nix

177 lines
4.9 KiB
Nix
Raw Normal View History

2017-02-28 22:55:14 +01:00
# Largely adapted from: https://www.mpscholten.de/nixos/2016/04/11/setting-up-vim-on-nixos.html
2017-02-28 22:09:06 +01:00
with import <nixpkgs> {};
2017-03-19 02:12:14 +01:00
let plugins = let inherit (vimUtils) buildVimPluginFrom2Nix; in {
"better-whitespace" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "better-whitespace";
src = fetchgit {
url = "git://github.com/ntpeters/vim-better-whitespace";
rev = "7729bada7ad8d341b910367da8a900490bd15e86";
sha256 = "0kkj13jjzjyv2b17sk8bka2d55czz7v6xvv0zz1i8qidvg6lbniw";
};
dependencies = [];
};
"systemd-syntax" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "systemd-syntax";
src = fetchgit {
url = "git://github.com/Matt-Deacalion/vim-systemd-syntax";
rev = "05bd51f87628e4b714b9d1d16259e1ead845924a";
sha256 = "04jlbm4cf47kvys22czz1i3fcqzz4zih2h6pkcfns9s8rs6clm3c";
};
dependencies = [];
};
"opencl-syntax" = buildVimPluginFrom2Nix { # created by nix#NixDerivation
name = "opencl-syntax";
src = fetchgit {
url = "git://github.com/petRUShka/vim-opencl";
rev = "a75693fdb1526cf0f2f2d1a6bdc23d6537ac1b6f";
sha256 = "0ba3kj65h2lsn7s0fazhmbaa7nr8b9ssda3i54259mcc4nhwvi7b";
};
dependencies = [];
};
}; in vim_configurable.customize {
2017-02-28 22:09:06 +01:00
name = "vim";
2017-03-19 02:12:14 +01:00
vimrcConfig.vam.knownPlugins = pkgs.vimPlugins // plugins;
2017-02-28 22:09:06 +01:00
vimrcConfig.vam.pluginDictionaries = [
{ names = [
"Solarized"
2017-03-19 02:12:14 +01:00
"better-whitespace"
"elm-vim"
2017-07-21 10:54:22 +02:00
"calendar-vim"
2017-02-28 22:09:06 +01:00
"fugitive"
2017-07-21 10:54:22 +02:00
"opencl-syntax"
2017-02-28 22:09:06 +01:00
"surround"
2017-07-21 10:54:22 +02:00
"systemd-syntax"
2017-03-19 02:12:14 +01:00
"vim-nix"
2017-02-28 22:09:06 +01:00
"vimtex"
2017-07-21 10:54:22 +02:00
"vimwiki"
2017-03-11 10:47:47 +01:00
#https://github.com/vim-voom/VOoM
#https://github.com/tpope/vim-obsession
2017-02-28 22:09:06 +01:00
]; }
];
vimrcConfig.customRC = ''
" Must have for vim
set nocompatible
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Display nbsp
set listchars=tab:\|\ ,nbsp:·
set list
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Remap ESC on ,,
map ,, <ESC>
imap ,, <ESC>
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
scriptencoding utf-8
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Must be *after* pathogen
filetype plugin indent on
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Leader
let mapleader=","
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
" let maplocalleader = "-"
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" 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
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
let g:solarized_termcolors=16
colorscheme solarized
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Set line numbering
set number
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Don't wrap lines, it's ugly
set nowrap
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" 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
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Set par as default wrapper
2017-02-28 23:13:53 +01:00
set formatprg=${par.outPath}/bin/par\ -w80
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Set mouse on
set mouse=a
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Don't set timeout - this breaks the leader use
set notimeout
set ttimeout
2017-03-19 02:12:14 +01:00
2017-07-21 10:54:22 +02:00
" Color lines in a different shade up to 80 columns
2017-02-28 22:09:06 +01:00
let &colorcolumn=join(range(81,999),",")
2017-03-19 02:12:14 +01:00
2017-07-21 10:54:22 +02:00
" automatically jump to the end of the text you just copied/pasted:
xnoremap <silent> y y`]
nnoremap <silent> yy yy`]
xnoremap <silent> p p`]
xnoremap <silent> P P`]
nnoremap <silent> p p`]
nnoremap <silent> P P`]
2017-02-28 22:09:06 +01:00
" vimtex options
let g:vimtex_fold_enabled=1
let g:vimtex_fold_manual=1
2017-05-29 12:02:40 +02:00
let g:vimtex_compiler_enabled=0
2017-03-19 02:12:14 +01:00
2017-03-20 10:21:55 +01:00
" conceal to unicode symbols
nnoremap <leader>l :silent let &conceallevel = (&conceallevel+1)%4<CR>
2017-03-20 10:21:55 +01:00
set conceallevel=2
set concealcursor=nvc
let g:tex_conceal="abdmgs"
2017-03-20 10:21:55 +01:00
2017-02-28 22:09:06 +01:00
" nice pluginless stuff
set path+=**
set wildmenu
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" Tag generation
command! MakeTags !ctags -R .
2017-03-19 02:12:14 +01:00
2017-02-28 22:09:06 +01:00
" 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
2017-03-25 10:19:01 +01:00
" Set filetype tex for tikz files
au BufNewFile,BufRead *.tikz set filetype=tex
2017-07-21 10:54:22 +02:00
" vimwiki stuff
let g:vimwiki_list = [
\{'path': '~/vimwiki/personal.wiki'}
\]
au BufRead,BufNewFile *.wiki set filetype=vimwiki
:autocmd FileType vimwiki map <leader>d :VimwikiMakeDiaryNote
function! ToggleCalendar()
execute ":Calendar"
if exists("g:calendar_open")
if g:calendar_open == 1
execute "q"
unlet g:calendar_open
else
g:calendar_open = 1
end
else
let g:calendar_open = 1
end
endfunction
:autocmd FileType vimwiki map <leader>c :call ToggleCalendar()
2017-02-28 22:09:06 +01:00
'';
}