blob: 4da0a058e9dfbb7d7580a44fe554de431d235f98 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
{ pkgs ? import <nixpkgs> {} }:
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\+\%#\@<!$/
" prevent colorscheme from overriding these highlights
au ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
" highlight everything exceeding 80 characters
au BufWinEnter * let w:m2=matchadd('ErrorMsg', '\%>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}
''
|