-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdot-vimrc.after
228 lines (198 loc) · 6.76 KB
/
dot-vimrc.after
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
" file: .vimrc
" Enable 256 color support. This won't work everywhere, but it works
" everywhere I usually have shells.
set t_Co=256
"let ruby_fold = 1
filetype plugin indent on
"call pathogen#infect()
set nocompatible " vi < vim
set nohls " don't highlight searches
set ignorecase " make searches case-insensitive ...
set smartcase " ... unless they contain an uppercase character
set tabstop=2 softtabstop=2 shiftwidth=2 shiftround smarttab expandtab
set autoindent " indent to the same level as the previous line
set nomodeline " modelines could be dangerous, don't allow them
set matchpairs+=<:>
hi MatchParen ctermbg=black ctermfg=green
" minimal but informative status line
"set rulerformat=%l/%L(%p%%)\ c%c
" Replaced by airline (https://github.com/bling/vim-airline)
"if has("statusline")
" set laststatus=2 " always show the status line
"
" "set statusline=%<%f%=\ [%1*%M%*%n%R%H%Y]\ \ %-25(%3l,%c%03V\ \ %P\ (%L)%)%12o'%03b''%03B'
" set statusline=%f
"
" " Add syntastic if enabled
" "if janus#is_plugin_enabled('syntastic')
" set statusline+=%#warningmsg#
" set statusline+=%{SyntasticStatuslineFlag()}
" set statusline+=%*
" "endif
"
" set statusline+=%4m " modified?
" set statusline+=%r " read only?
" set statusline+=%= " begin right section
" set statusline+=%-7('\\x%02B'%) " Hex value of byte under cursor
" set statusline+=%y " filetype
" set statusline+=%3l/%L " current line / end line
" set statusline+=(%P), " Percentage of file
" set statusline+=c%c " column
"endif
" BEGIN Airline config
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
"let g:airline_left_sep = '▶'
"let g:airline_right_sep = '◀'
let g:airline_left_sep = ''
let g:airline_right_sep = ''
let g:airline#extensions#branch#enabled = 1
" Disable the filetype section
let g:airline_section_y = ''
let g:airline_symbols.branch = '⎇'
let g:airline_mode_map = {
\ '__' : '-',
\ 'n' : 'N',
\ 'i' : 'I',
\ 'R' : 'R',
\ 'c' : 'C',
\ 'v' : 'V',
\ 'V' : 'V',
\ '' : 'V',
\ 's' : 'S',
\ 'S' : 'S',
\ '' : 'S',
\ }
" END Airline config
" Mappings
" ========
set pastetoggle=<f12>
" I never use F1 for help. I really meant to hit escape, thanks.
map <F1> <ESC>
map! <F1> <ESC>
" Make spacebar behave like in less
" This can be annoying
nmap <Space> <PageDown>
" make Y behave similarly to C and D rather than cc and dd (which is already
" covered by yy). This should be the default behavior
nmap Y y$
" have the Tab key insert a tab in front of all selected lines in visual mode
vmap <Tab> >
vmap <S-Tab> <LT>
" Make <ctrl> + w in insert mode do what i meant (change split windows)
inoremap <C-W> <ESC><C-W>
" Make my normal tic to visually find my cursor drop out of insert mode
imap jkj <ESC>
"ctrl-hjkl switches windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" I thought these were going to be much handier than they turned out to be.
" It seems I don't really need to insert time and datestamps in files very
" often.
"iab _TIME <C-R>=strftime("%T")<CR>
"iab _DATE <C-R>=strftime("%a %b %d %T %Z %Y")<CR>
"iab _DATES <C-R>=strftime("%b %d %Y")<CR>
"imap <F2> _TIME
"imap <F3> _DATE
"imap <F4> _DATES
"nmap <F2> i_TIME<ESC>
"nmap <F3> i_DATE<ESC>
"nmap <F4> i_DATES<ESC>=
" Convert lines of hex bytes into escaped strings, e.g.:
" 00 01 02
" becomes
" \x00\x01\x02
" This is handy when developing shellcode and working with hex dumps
nmap <F5> 0i :s/\s*$//\n:s/ \+/\\x/g\ni"A"==j
" make <enter> insert a newline in normal mode
" This might get annoying
nmap <CR> o<ESC>:w<CR>
" 00 11 22
" close braces automatically
" This can be annoying, especially when pasting code; might help to ``:set
" paste'' before pasting and ``:set nopaste'' afterward
" Use <f12> (the pastetoggle key, set above) to do it more easily.
imap {<CR> {<CR>}<UP><ESC>A<CR>
"set list listchars=tab:»·,trail:·
set list listchars=tab:»\ ,trail:·
if !exists("au_loaded")
let au_loaded = 1
au Filetype text set tw=78 et noautoindent nocindent nosmartindent wrap
au Filetype make,automake set noexpandtab
au BufWritePre * call KillWhitey()
augroup rb
au Filetype ruby set expandtab tabstop=2 softtabstop=2 shiftwidth=2 shiftround
au Filetype ruby set textwidth=78
" Highlight trailing whitespace, mixed spaces and tabs, and spaces at
" beginning of line to catch bad indents.
au FileType ruby hi BogusWhitespace ctermbg=darkgreen guibg=darkgreen
au FileType ruby match BogusWhitespace /\s\+$\|\t\+ \+\| \+\t\+/
augroup END
augroup py
au Filetype python set expandtab cindent smartindent autoindent
au Filetype python set tabstop=4 softtabstop=4 shiftwidth=4 shiftround
augroup END
augroup go
au Filetype go set noet cindent smartindent autoindent
au Filetype go set tabstop=4 softtabstop=4 shiftwidth=4 shiftround
augroup END
augroup c
au Filetype c,cpp set noet cindent smartindent autoindent
au Filetype c,cpp set tabstop=4 softtabstop=4 shiftwidth=4 shiftround
au Filetype c,cpp iab #i #include
au Filetype c,cpp iab #d #define
augroup END
augroup ps1
au Filetype ps1,psm set expandtab cindent smartindent autoindent
au Filetype ps1,psm set tabstop=4 softtabstop=4 shiftwidth=4 shiftround
augroup END
endif
function! Preserve(command)
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
execute a:command
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" Stolen from a couple of random github users
" https://github.com/sdavies/dotfiles/blob/master/.vimrc
" https://github.com/ahawthorne/.dotfiles/blob/master/.vimrc
function! KillWhitey()
" Double blank lines
"call Preserve("%s/\n\{3,}/\r\r/e %s/\\s\\+$//e")
" Whitespace
call Preserve("%s/\\s\\+$//e")
endfunction
colorscheme inkpot
"colorscheme anotherdark
"colorscheme darkZ
"colorscheme desert
set background=dark
"hi Comment ctermfg=darkcyan
" I can't see blue on a black background. make #defines readable
"hi PreProc ctermfg=darkcyan
"set foldmethod=indent
"set foldnestmax=1
set fillchars=fold:\
let b:simplefold_nestable_start_expr = ''
" Colors!
highlight Folded ctermbg=none ctermfg=grey
highlight FoldColumn ctermbg=white ctermfg=black
if has("mouse")
set mousehide
endif
" some useful additions found at:
" * http://www.jauu.net/data/dotfiles/vimrc.asc
" * http://www.stripey.com/vim/vimrc.html
" * http://www.twoevils.org/files/.vimrc
" * https://github.com/sdavies/dotfiles/blob/master/.vimrc
" * https://github.com/ahawthorne/.dotfiles/blob/master/.vimrc
"
"