-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
72 lines (59 loc) · 1.3 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
" Builtin plugins
runtime ftplugin/man.vim " Man pages
" Basic config
syntax on
set list listchars=trail:·,tab:⎈⎈,eol:¬
set number
set cursorline
set cc=79
set mouse=a
set breakindent
inoremap jj <ESC>
set encoding=utf-8 fileencodings=
" Split related
set splitright
set splitbelow
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
nnoremap <c-h> <c-w>h
" Increment / Tabs related
set smarttab
set smartindent
set expandtab
set shiftwidth=3
set tabstop=3
" Movements
nnoremap j gj
nnoremap k gk
" Trailing whitespace removal
autocmd BufWritePre * %s/\s\+$//e
" Makefile
autocmd FileType make <buffer> set noexpandtab
" brackets and quotes
inoremap "" ""<left>
inoremap '' ''<left>
inoremap () ()<left>
inoremap [] []<left>
inoremap {} {}<left>
inoremap {<CR> {<CR>}<ESC>O
inoremap {;<CR> {<CR>};<ESC>O
" Annoying typos / mod removal
map q: <nop>
nnoremap Q <nop>
" C main shortcut
autocmd FileType c inoremap <buffer> main<CR> int main(int argc, char *argv[])<CR>{<CR><CR>}<up><TAB>
" Header creator
function HeaderFuncts()
let @a = ""
:%v/static/g/^\a\+ .*(.*)/s/\(.*\)/\1;/
:%v/static/g/^\a\+ .*(.*);/y A
u
endfunction
command HeaderFunc exec HeaderFuncts()
" Make and QuickFixList shortcut
function MakeFunc()
:copen
:w | make
endfunction
command Make exec MakeFunc ()