-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
103 lines (74 loc) · 2.61 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
"======================================================================
" Settings
"======================================================================
syntax on
filetype plugin indent on
set expandtab
set autoindent
set smarttab
set smartindent
set hlsearch
" Allow backspaces in insert mode
set backspace=indent,eol,start
" I have git for this.
set nobackup
set noswapfile
set wildignore+=*.swp,*.back,*.pyc,*.class,*.beam
" don't beep
set visualbell
set noerrorbells
" don't flash
set t_vb=
" first complete to max, then show a list
set wildmode=longest,list,full
"======================================================================
" Commands
"======================================================================
command! Clean execute "%s/\\s\\+$//g"
" sudo writing a file within vim -- courtesy of jimmyngo
command W w !sudo tee % > /dev/null
" ===================================================================
" Key Mappings
" ===================================================================
" Toggle highlighting
noremap <F5> :set hlsearch!<CR>
" Clear search
noremap <c-h> :let @/=""<CR>
" jj pulls you out of insert mode
inoremap jj <ESC>
" Ctrl-j/k movesd panes
inoremap <c-j> <ESC><c-w>j<c-w>_i
noremap <c-j> <c-w>j<c-w>_
inoremap <c-k> <ESC><c-w>k<c-w>_i
noremap <c-k> <c-w>k<c-w>_
" Ctrl-o equals panes
inoremap <c-o> <ESC><c-w>=i
noremap <c-o> <c-w>=
" Big u redoes
nmap <U> :redo<CR>
"Remove all trailing whitespace by pressing Ctrl-w
nnoremap <c-q> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
inoremap <c-e> <ESC>:q<CR>
nnoremap <c-e> :q<CR>
"======================================================================
" Appearance
"======================================================================
" Visual indicator of more than 80 columns changed to red
highlight ColorColumn ctermbg=red
highlight ColorColumn guibg=red
" Visual indicator of extraneous whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
"======================================================================
" TODO Filetype settings to move
"======================================================================
" HTML Coding
au FileType html set expandtab matchpairs+=<:> tabstop=4 shiftwidth=4
" HTML Django stuff
au FileType htmldjango set expandtab matchpairs+=<:> tabstop=4 shiftwidth=4
" CSS files
au FileType css set expandtab tabstop=4 shiftwidth=4
" CFG files
au FileType cfg set expandtab tabstop=4 shiftwidth=4
" JSON files
au! BufRead,BufNewFile *.json set filetype=json autoindent formatoptions=tcq2l textwidth=78 shiftwidth=2 softtabstop=2 tabstop=8 expandtab foldmethod=syntax