-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
187 lines (157 loc) · 5.21 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
185
186
187
" .vimrc
" Tyler Mulligan <[email protected]>
" Last Updated 03/03/2016
set nocompatible " don't keep vi bugs
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Plugins
Plugin 'kien/tabman.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'ervandew/supertab'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'blueshirts/darcula'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Theme
syntax enable " highlighting
set term=xterm-256color " for compatibility with tmux
set t_Co=256 " 256 color support
set background=dark " assume dark background
color darcula
highlight Normal ctermbg=NONE
highlight nonText ctermbg=NONE
" vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_theme='distinguished'
set laststatus=2
"let mapleader = "\<Space>"
" Environment Basics
set shortmess+=I " remove splash
set virtualedit=all " free roaming cursor
"set paste " sane pasting
set mouse=iv " auto mouse
set ruler " show cursor position
set number " line numbers
"set spell " spell checker
set history=100 " history
set visualbell " No beeps
" Tabs
set autoindent " in favor of smart
set smartindent " go with the flow
set tabstop=4 " normal tabs
set smarttab " smart tabs
set softtabstop=4 " normal tabs
set shiftwidth=4 " normal tabs
set expandtab " tabs to spaces
set copyindent
" Better Editor
set linebreak " Break lines at word
set showbreak=+++ " Broken line prefix
set textwidth=100 " Line wrap # of cols
set cursorline " highlight current line
set showmatch " braces
set incsearch " search as you type
set hlsearch " highlight search term
set wrap " wrap text
set wildmenu " show commands at the bottom
set wildmode=list:longest,full
set autoread " reload file when written to externally
" Simplify splitting hotkeys
map <C-H> <C-W>h<C-W>_
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
map <C-L> <C-W>l<C-W>_
" Splits
nnoremap <leader>w <C-w>
nnoremap <leader>, <C-w><C-w>
nnoremap <leader>h :split<CR>
nnoremap <leader>v :vsplit<CR>
nnoremap <leader>- :split<CR>
nnoremap <leader>\| :vsplit<CR>
" Tab switching ctrl + left/right
map <C-Left> <Esc>:tabprev<CR>
map <C-Right> <Esc>:tabnext<CR>
"nnoremap <C-h> <Esc>:tabprev<CR>
"nnoremap <C-l> <Esc>:tabnext<CR>
" New Tab ctrl + t
nnoremap <C-t> :tabnew<CR>
inoremap <C-t> <Esc>:tabnew<CR>
" Plugin hotkeys
nmap <leader>nt :NERDTreeToggle<cr>
" quick edit and reload of vimrc
nnoremap <silent> <leader>ev :vsp $MYVIMRC<CR>
nnoremap <silent> <leader>sv :so $MYVIMRC<CR>
" quicker :
nnoremap ; :
" clear search
nmap <silent> <leader>/ :nohlsearch<CR>
" sudo saver
cmap W! w !sudo tee % >/dev/null
" SuperTab
let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabContextDefaultCompletionType = "<c-n>"
" Paste fix
function! WrapForTmux(s)
if !exists('$TMUX')
return a:s
endif
let tmux_start = "\<Esc>Ptmux;"
let tmux_end = "\<Esc>\\"
return tmux_start . substitute(a:s, "\<Esc>", "\<Esc>\<Esc>", 'g') . tmux_end
endfunction
let &t_SI .= WrapForTmux("\<Esc>[?2004h")
let &t_EI .= WrapForTmux("\<Esc>[?2004l")
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
" Omnomnomnom
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" Tab widths per filetype
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
autocmd FileType css setlocal shiftwidth=2 tabstop=2
" tmux compatibility
if &term =~ '^screen' && exists('$TMUX')
set mouse+=a
" tmux knows the extended mouse mode
set ttymouse=xterm2
" tmux will send xterm-style keys when xterm-keys is on
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
execute "set <xHome>=\e[1;*H"
execute "set <xEnd>=\e[1;*F"
execute "set <Insert>=\e[2;*~"
execute "set <Delete>=\e[3;*~"
execute "set <PageUp>=\e[5;*~"
execute "set <PageDown>=\e[6;*~"
execute "set <xF1>=\e[1;*P"
execute "set <xF2>=\e[1;*Q"
execute "set <xF3>=\e[1;*R"
execute "set <xF4>=\e[1;*S"
execute "set <F5>=\e[15;*~"
execute "set <F6>=\e[17;*~"
execute "set <F7>=\e[18;*~"
execute "set <F8>=\e[19;*~"
execute "set <F9>=\e[20;*~"
execute "set <F10>=\e[21;*~"
execute "set <F11>=\e[23;*~"
execute "set <F12>=\e[24;*~"
endif