summaryrefslogtreecommitdiffstats
path: root/lass/2configs/vim.nix
diff options
context:
space:
mode:
authorlassulus <lass@aidsballs.de>2015-07-28 20:28:21 +0200
committerlassulus <lass@aidsballs.de>2015-07-28 20:28:21 +0200
commitac64527c5707cca5fc6e6e6ecf3957129cdb32b2 (patch)
tree741d27e6ec9279b6bd42deec2b4023aedc1bd598 /lass/2configs/vim.nix
parentb5d5b75d7d6dcc42f69418e6a454a64502fa6aee (diff)
lass: port everything to stockholm
Diffstat (limited to 'lass/2configs/vim.nix')
-rw-r--r--lass/2configs/vim.nix118
1 files changed, 118 insertions, 0 deletions
diff --git a/lass/2configs/vim.nix b/lass/2configs/vim.nix
new file mode 100644
index 000000000..3fe45e1d1
--- /dev/null
+++ b/lass/2configs/vim.nix
@@ -0,0 +1,118 @@
+{ config, pkgs, ... }:
+
+let
+ customPlugins.mustang2 = pkgs.vimUtils.buildVimPlugin {
+ name = "Mustang2";
+ src = pkgs.fetchFromGitHub {
+ owner = "croaker";
+ repo = "mustang-vim";
+ rev = "6533d7d21bf27cae94d9c2caa575f627f003dfd5";
+ sha256 = "0zlmcrr04j3dkiivrhqi90f618lmnnnpvbz1b9msfs78cmgw9w67";
+ };
+ };
+
+in {
+
+ environment.systemPackages = [
+ (pkgs.vim_configurable.customize {
+ name = "vim";
+
+ vimrcConfig.customRC = ''
+ set nocompatible
+ set t_Co=16
+ syntax on
+ " TODO autoload colorscheme file
+ set background=dark
+ colorscheme mustang
+ filetype off
+ filetype plugin indent on
+
+ imap <F1> <nop>
+
+ set mouse=a
+ set ruler
+ set showmatch
+ set backspace=2
+ set visualbell
+ set encoding=utf8
+ set showcmd
+ set wildmenu
+
+ set title
+ set titleold=
+ set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}
+
+ set autoindent
+
+ set ttyfast
+
+ set pastetoggle=<INS>
+
+
+ " Force Saving Files that Require Root Permission
+ command! W silent w !sudo tee "%" >/dev/null
+
+ nnoremap <C-c> :q<Return>
+ vnoremap < <gv
+ vnoremap > >gv
+
+ nmap <esc>q :buffer
+
+ "Tabwidth
+ set ts=2 sts=2 sw=2 et
+
+ " create Backup/tmp/undo dirs
+ function! InitBackupDir()
+ let l:parent = $HOME . '/.vim/'
+ let l:backup = l:parent . 'backups/'
+ let l:tmpdir = l:parent . 'tmp/'
+ let l:undodi = l:parent . 'undo/'
+
+ if !isdirectory(l:parent)
+ call mkdir(l:parent)
+ endif
+ if !isdirectory(l:backup)
+ call mkdir(l:backup)
+ endif
+ if !isdirectory(l:tmpdir)
+ call mkdir(l:tmpdir)
+ endif
+ if !isdirectory(l:undodi)
+ call mkdir(l:undodi)
+ endif
+ endfunction
+ call InitBackupDir()
+
+ " Backups & Files
+ set backup
+ set backupdir=~/.vim/backups
+ set directory=~/.vim/tmp//
+ set viminfo='20,<1000,s100,h,n~/.vim/tmp/info
+ set undodir=$HOME/.vim/undo
+ set undofile
+
+ " highlight whitespaces
+ highlight ExtraWhitespace ctermbg=red guibg=red
+ match ExtraWhitespace /\s\+$/
+ autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
+ autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
+ autocmd InsertLeave * match ExtraWhitespace /\s\+$/
+ autocmd BufWinLeave * call clearmatches()
+
+ "ft specific stuff
+ autocmd BufRead *.js,*.json set ts=2 sts=2 sw=2 et
+ autocmd BufRead *.hs set ts=4 sts=4 sw=4 et
+
+ "esc timeout
+ set timeoutlen=1000 ttimeoutlen=0
+ '';
+
+ vimrcConfig.vam.knownPlugins = pkgs.vimPlugins // customPlugins;
+ vimrcConfig.vam.pluginDictionaries = [
+ { names = [ "Gundo" "commentary" "mustang2" ]; }
+ { names = [ "vim-addon-nix" ]; ft_regex = "^nix\$"; }
+ ];
+
+ })
+ ];
+}