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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
" general options
set nocompatible
set background=dark
set showcmd
set showmatch
set ignorecase
set smartcase
set incsearch
set autowrite
syntax on
filetype plugin indent on
" TODO: reconsider this, possible risk
set modeline
set wrapmargin=4
set linebreak
set ruler
set cryptmethod=blowfish
set foldmethod=syntax
set scrolloff=3
set wildmenu
set hlsearch
set conceallevel=2
set ttyfast
set undofile
set nojoinspaces
set belloff=all
set splitbelow
set splitright
" tabs handling
set expandtab
set shiftwidth=4
set tabstop=4
" mouse
set mouse=a
set ttymouse=sgr
" the default includes autoselect, which syncs contents of visual selection
" to clipboard; that is slow and I don't need it
set clipboard=
" statusline
"
" colors:
" User1: window number
" User2: modified flag
"
" path [Help][Preview][RO][ftype] \\// [window number][+]
set statusline=%(%f\ %h%w%r%y\ %=\ %1*[%{winnr()}]%2*%m%*%)
" divider between left and right-aligned bits
set statusline+=%=
" line,byte column[-virtual column]
set statusline+=%(%l,%c%V\ %=\ %P%)
" use standard places for the vim state files
set dir=~/.cache/vim/swap//
set backupdir=~/.cache/vim/bkp//
set undodir=~/.local/var/vim/undo
set viminfo+=n~/.local/var/vim/viminfo
if &t_Co < 88
colorscheme default
else
let g:inkpot_black_background = 1
colorscheme inkpot
endif
" trailing whitespace highlighting
augroup vimrc
autocmd!
autocmd VimEnter,WinNew * call matchadd('WhiteSpaceEOL', '\s\+$')
augroup END
" extension-based filetypes
let filetype_m="mma"
let filetype_par="config"
".tex files default to latex
let g:tex_flavor='latex'
" enable syntax folding in viml files
let g:vimsyn_folding = 'af'
" autodisable syntax folding for c files (it's slow)
autocmd BufEnter *.c,*.h setlocal foldmethod=manual
" C indent options
set cinoptions=(0
""" key mappings
map zJ zjzo
" the default mapping enters the ex mode, which is very annoying since it's
" easy to trigger by mistake (going for ZQ, missing Z)
map Q <Nop>
nmap gb :bnext<CR>
nmap gB :bprevious<CR>
map <leader>m :make<CR>
" zoom/maximize a window
nnoremap <C-w>z <C-w>\|<C-w>_
" miniSnip configuration
" FIXME split off?
let g:miniSnip_trigger = '<C-j>'
" line diff mode
" TODO: split off into plugin?
function LineDiff()
silent execute "!linediff " . v:fname_in . " " . v:fname_new . " > " . v:fname_out
endfunction
function SetLineDiff()
set diffexpr=LineDiff()
diffupdate
redraw
endfunction
" hybrid line numbers
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
|