-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
154 lines (124 loc) · 4.2 KB
/
vimrc
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
set nocompatible
let mapleader="="
let perl_include_pod=1
" Prepend our runtime paths so we override the defaults
set runtimepath=
set runtimepath+=~/.dotfiles/vim/bufexplorer
set runtimepath+=~/.dotfiles/vim/dockerfile.vim
set runtimepath+=~/.dotfiles/vim/vim-perl
set runtimepath+=~/.dotfiles/vim/solarized
set runtimepath+=~/.dotfiles/vim/vim-crystal
set runtimepath+=~/.dotfiles/vim/vim-elixir
set runtimepath+=~/.dotfiles/vim/vim-pony
set runtimepath+=~/.dotfiles/vim/vim-vue-plugin
set runtimepath+=~/.dotfiles/vim/6502 " *.s / *.inc -> 6502
set runtimepath+=~/.dotfiles/vim/general
set runtimepath+=~/.dotfiles/vim/after
set runtimepath+=$VIMRUNTIME
" Force template toolkit filetypes
augroup template_toolkit
autocmd!
autocmd BufNewFile,BufRead *.tt2 setf tt2html
autocmd BufNewFile,BufRead *.tt setf tt2html
augroup END
" Workaround ubuntu vim issue
" Bug: https://bugs.launchpad.net/ubuntu/+source/vim/+bug/572627
" Fix: http://stackoverflow.com/questions/3383502/pathogen-does-not-load-plugins
filetype off
syntax on
filetype plugin on
runtime macros/matchit.vim
" :help termcap-cursor-shape
" 1,2 = block (blink,steady)
" 3,4 = underscore
" 5,6 = pipe
let &t_SI = "\e[5 q"
let &t_SR = "\e[3 q"
let &t_EI = "\e[2 q"
" Turn off the annoying continual highlight of matching parens
let loaded_matchparen=1
" Highlight trailing whitespace - http://vim.wikia.com/wiki/VimTip396
" Make sure this is done before the colorscheme loads
augroup trailing_whitespace
autocmd!
autocmd ColorScheme * highlight TrailingWhitespace ctermbg=red guibg=red
autocmd InsertEnter * match TrailingWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match TrailingWhitespace /\s\+$/
autocmd BufWinEnter * match TrailingWhitespace /\s\+$/
augroup END
" syn bindings
augroup filetype
autocmd BufNewFile,BufRead *.psgi set filetype=perl
autocmd BufNewFile,BufRead *.json set syntax=javascript
"TODO: check if we need these - these may replace the ones in general/ftplugin
" autocmd BufNewFile,BufRead *.tt2 set syntax=tt2html
" autocmd BufNewFile,BufRead *.tt set syntax=tt2html
augroup END
" Auto-detect solarized from the SOLARIZED env var
if $SOLARIZED == ''
colorscheme dim
else
colorscheme sdt_solarized
endif
" BufExplorer settings
let g:bufExplorerShowRelativePath=1
" uselect settings
let g:uselect_bin = "~/.dotfiles/uselect/uselect"
set autoindent showmatch
set noincsearch nobackup nocindent nohlsearch visualbell
set indentexpr=""
set formatoptions=""
set scrolloff=3
set tabstop=4 shiftwidth=4 expandtab shiftround smarttab
set tabpagemax=666
set confirm
set errorfile=.vimerrors.err
set backupskip=/tmp/*,/private/tmp/*
set fillchars+=vert:\ ,fold:-
set lcs+=tab:>_
if v:version < 802
set nomodeline " see CVE-2019-12735 - fixed in 8.2
endif
set modelines=5
" I added these years ago to avoid some unwanted new indenting behaviour
" These make the ftplugin-based stuff not work (like matchit)
" let b:did_ftplugin = 1
" filetype indent off
" Disable control-A incrementing - this goes off by accident sometimes in tmux
nnoremap <c-a> <Nop>
" =s : search for trailing whitespace
nnoremap <Leader>s /\s\+$<CR>
" =S : delete all trailing whitespace
nnoremap <Leader>S :%s/\s\+$//<CR>
" =- last buffer
nnoremap <Leader>- :n#<CR>
" == open bufexplorer menu
nnoremap <Leader>= :BufExplorer<CR>
" =tN N-space tabs
nnoremap <Leader>t2 :set ts=2 sw=2 et<CR>
nnoremap <Leader>t4 :set ts=4 sw=4 et<CR>
nnoremap <Leader>t8 :set ts=8 sw=8 et<CR>
" =md Make directory of current file
nnoremap <Leader>md :!mkdir -p $( dirname % )<CR>
" =<tab> Toggle visible whitespace
nnoremap <Leader><tab> :set list!<CR>
" =pp Toggle :set paste
nnoremap <Leader>pp :set paste!<CR>
" =fv fv word under cursor
nnoremap <Leader>fv :FC<CR>
" =gv gv word under cursor
nnoremap <Leader>gv :GC<CR>
" =lv lv word under cursor
nnoremap <Leader>lv :LC<CR>
" =rs reload syntax
nnoremap <Leader>rs :syntax sync fromstart<CR>
" =pN resize tmux pane to N pages (81 * N - 1)
nnoremap <Leader>p1 :!tmux resize-pane -x 80<cr>
nnoremap <Leader>p2 :!tmux resize-pane -x 161<cr>
nnoremap <Leader>p3 :!tmux resize-pane -x 242<cr>
if filereadable($HOME."/.dotfiles/local/vimrc")
source ~/.dotfiles/local/vimrc
endif
if filereadable("./.vimrc.local")
sandbox source ./.vimrc.local
endif