From e804bebf8cdd8ac467696a1c5de04fcd39703e71 Mon Sep 17 00:00:00 2001 From: aszlig Date: Mon, 13 Oct 2014 06:15:48 +0200 Subject: cfgfiles: Add vim configuration without plugins. Yep, it's only a rudimentary configuration without any plugins yet, because so far I've been using VAM to manage plugins but in the end I want to have them consistent among all my machines. Signed-off-by: aszlig --- cfgfiles/vim.nix | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 cfgfiles/vim.nix (limited to 'cfgfiles') diff --git a/cfgfiles/vim.nix b/cfgfiles/vim.nix new file mode 100644 index 00000000..4da0a058 --- /dev/null +++ b/cfgfiles/vim.nix @@ -0,0 +1,91 @@ +{ pkgs ? import {} }: + +let + generic = '' + syntax on + colorscheme elflord + + " boolean + set nocompatible + set showcmd + set showmatch + set ignorecase + set smartcase + set incsearch + set modeline + set smarttab + set expandtab + set smartindent + set ruler + + " non-boolean + set tabstop=4 + set softtabstop=4 + set shiftwidth=4 + set textwidth=80 + set termencoding=ascii + set backspace=indent,eol,start + set background=dark + ''; + + plugin = '' + " erlang + let erlang_folding = 0 + let erlang_highlight_bif = 1 + let erlang_force_use_vimerl_indent = 1 + + " python + let python_highlight_numbers = 1 + let python_highlight_builtins = 1 + let python_highlight_exceptions = 1 + ''; + + autocmd = '' + " jump to last position + au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g'\"zz" | endif + + " filetype defaults + filetype plugin indent on + au BufNewFile,BufRead *.as set filetype=actionscript + au BufNewFile,BufRead *.html set tabstop=4|set shiftwidth=4|set expandtab + au FileType python set textwidth=79 + au FileType gitcommit set textwidth=72 + + " highlight unnecessary whitespace + highlight ExtraWhitespace ctermbg=red guibg=red + match ExtraWhitespace /\s\+$/ + au BufWinEnter,InsertLeave * match ExtraWhitespace /\s\+$/ + au InsertEnter * match ExtraWhitespace /\s\+\%#\@80v.\+', -1) + ''; + + misc = '' + " ASCII art mode + fun! AAMode() + highlight clear ExtraWhitespace + for m in getmatches() + if m.group == 'ErrorMsg' && m.pattern == '\%>80v.\+' + call matchdelete(m.id) + endif + endfor + endfun + + " flake everything that has been *detected* as python (not just by suffix). + autocmd BufWritePost * if &ft ==# 'python' | call Flake8() | endif + ''; + +in pkgs.writeText "vimrc" '' + ${generic} + ${plugin} + + if has("autocmd") + ${autocmd} + endif + + ${misc} +'' -- cgit 1.4.1