-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
executable file
·188 lines (152 loc) · 6.24 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
" not old vi compat mode
set nocp
" use pathogen to add things from ~/.vim/bundle and ~/.vim/autoload
execute pathogen#infect()
filetype on
filetype plugin on
filetype indent on
syntax on
set ruler
set number
set autoindent
set smartindent
set expandtab
set tabstop=4
set shiftwidth=4
" recovery dir in case the box crashes
set directory=~/.vim/tmp
" the way I used to do backup files
"set backupdir=~/.vim/backup
"set backup
"set writebackup
let vimDir = '$HOME/.vim'
set autowrite
set updatecount=10
if has('persistent_undo')
let myUndoDir = expand(vimDir . '/undo')
" Create dirs
call system('mkdir ' . vimDir)
call system('mkdir ' . myUndoDir)
let &undodir = myUndoDir
set undolevels=5000
set undofile
endif
" regexes match { as literal {, groupings need escaping
set magic
" wild matching mode
set wildmode=longest:full,full " enables bash-like autocomplete for commands
" in case I want to disable folding
"set nofoldenable
"set foldminlines=99999
"set fdm=indent
" yes even during diff
"let g:vim_markdown_folding_disabled=1
set diffopt=filler,context:1000000 " filler is default and inserts empty lines for sync
if &diff
"disable folding
set diffopt=filler,context:1000000
endif
set matchpairs+=<:> "Allow % to bounce between angles too
set backspace=indent,eol,start "Make backspaces delete sensibly
set shiftround "Indent/outdent to nearest tabstop
" stuff I used to use from Perl Best Practices when I wrote perl all day every day
"Inserting these abbreviations inserts the corresponding Perl statement...
"iab phbp #! /usr/bin/perl -w
"iab pdbg use Data::Dumper 'Dumper';warn Dumper [];hi
"iab pbmk use Benchmark qw( cmpthese );cmpthese -10, {};O
"iab pusc use Smart::Comments;###
"iab putm use Test::More qw( no_plan );
"
"iab papp :r ~/.vim/code_templates/perl_app_template.pl
"iab pmod :r ~/.vim/code_templates/perl_mod_template.pm
" END from PBP - trying out
" when splitting windows put new below
set splitbelow
" when splitting windows put new to the right
set splitright
" show search matches while typing
set incsearch
" When there is a previous search pattern, highlight all its matches
set hlsearch
let Tlist_Ctags_Cmd = '/opt/pkg/bin/exctags'
if has('gui_running')
set guioptions-=T " no toolbar
set transparency=4
endif
set guifont=Source\ Code\ Pro:h14
" to enable nerdtree on open
" autocmd vimenter * NERDTree
" solarized colors
set background=dark
let g:solarized_termcolors= 256
let g:solarized_termtrans = 1
let g:solarized_degrade = 1
"let g:solarized_bold = 0
"let g:solarized_underline = 0
"let g:solarized_italic = 0
"let g:solarized_contrast = "high"
"let g:solarized_visibility= "high"
colorscheme solarized
let g:indent_guides_auto_colors = 1
"autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=white
"autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=lightgrey
" Status line stuff
set laststatus=2
hi User1 ctermbg=lightblue ctermfg=black guibg=#af8700 guifg=#262626
hi User2 ctermbg=red ctermfg=blue guibg=#657b83 guifg=#262626
hi User3 ctermbg=blue ctermfg=green guibg=DarkGray guifg=#262626
set statusline=%1* " use User1 colorscheme
set statusline+=%F " full filename
set statusline+=%2* " use User2 colorscheme
set statusline+=%m " modified flag set? shows [-] or [+]
set statusline+=%r " read only flag set? shows [RO]
set statusline+=%h " help file flag? shows [help]
set statusline+=%w " preview window flag?
set statusline+=%= " right justify the rest
set statusline+=\ [Format:\ %{&ff}] " file format
set statusline+=\ [Filetype:\ %Y] " filetype
set statusline+=\ [ASCII:\ %03.3b] " ascii code for char under cursor
set statusline+=\ [HEX:\ %02.2B] " hex for char under cursor
set statusline+=\ [Position\ r,c:\ %04l,%04v] " cursor posistion line/column
set statusline+=\ [Progress:\ %02p%%] " cursor percent of way through file
set statusline+=%3* " use User3 colorscheme
set statusline+=\ [Length=%L] " File length in line
" syntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let syntastic_always_populate_loc_list = 1
let syntastic_auto_loc_list = 1
let syntastic_check_on_open = 1
let syntastic_check_on_wq = 0
let syntastic_sh_shellcheck_args = '-x'
let syntastic_markdown_mdl_exec = "markdownlint"
let syntastic_markdown_mdl_args = "--config .markdownlintrc"
" function! FindConfig(prefix, what, where)
" let cfg = findfile(a:what, escape(a:where, ' ') . ';')
" return cfg !=# '' ? ' ' . a:prefix . ' ' . shellescape(cfg) : ''
" endfunction
"
" autocmd FileType markdown let g:syntastic_markdown_mdl_args =
" \ get(g:, 'syntastic_markdown_mdl_args', '') .
" \ FindConfig('--config', '.markdownlintrc', expand('<afile>:p:h', 1))
" no more search matches landing on the bottom, center matching line in my window
nnoremap n nzz
nnoremap } }zz
cmap vs vertical split
cmap vd vertical diffsplit
cmap w!! w !sudo tee % >/dev/null
" Mapping of keys to insetion of comments for various types of files
" , #perl and conf # comments
map ,# :s/^/#/<CR>:s/\\\<CR>
" insert a whole line of hashes
map ,## :s/^/######################################################################/<CR>
" ,/ C/C++/C#/Java // comments
map ,/ :s/^/\/\//<CR>
" ,< HTML comment
map ,< :s/^\(.*\)$/<!-- \1 -->/<CR><Esc>:nohlsearch<CR>
" c++ java style comments
map ,* :s/^\(.*\)$/\/\* \1 \*\//<CR><Esc>:nohlsearch<CR>