forked from tmacwill/vimrc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
196 lines (164 loc) · 4.07 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
188
189
190
191
192
193
194
195
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Bannus's vimrc
"
" Adapted from tmacwill/vimrc
"
" Shortcuts:
" ; maps to :
" ,a: ack from the current directory
" ,c<space>: toggle comments
" ,e: open file in new tab
" ,l: toggle NERDTree
" ,h: open a shell in a new tab
" ,ig: toggle indentation guide
" ,k: syntax-check the current file
" ,m: toggle mouse support
" ,p: toggle paste mode
" ,o: open file
" ,s: split window
" ,t: new tab
" ,w: close tab
" kj: enter normal mode and save
" Ctrl+{h,j,k,l}: move among windows
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" long live vim
set encoding=utf-8
set nocompatible
" vundle
filetype off
set rtp+=~/.vim/bundle/Vundle.vim/
call vundle#begin()
Plugin 'gmarik/Vundle.vim'
" plugins
Plugin 'tomtom/checksyntax_vim'
" color schemes
Plugin 'nanotech/jellybeans.vim'
Plugin 'tomasr/molokai'
Plugin 'vim-scripts/Skittles-Dark'
Plugin 'hukl/Smyck-Color-Scheme'
Plugin 'vim-scripts/wombat256.vim'
" plugins
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'Lokaltog/vim-powerline'
Plugin 'felixr/vim-multiedit'
Plugin 'vim-scripts/trailing-whitespace'
Plugin 'terryma/vim-multiple-cursors'
Plugin 'henrik/vim-indexed-search'
" syntax files
Plugin 'pangloss/vim-javascript'
Plugin 'tpope/vim-markdown'
Plugin 'PProvost/vim-ps1'
call vundle#end()
" checksyntax config
let g:checksyntax#auto_mode = 0
" indent-guide config
let g:indent_guides_guide_size = 1
" ctrlp config
let g:ctrlp_working_path_mode = 'ra'
" ignore files in .gitignore
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" syntax highlighting and auto-indentation
syntax on
filetype plugin indent on
:inoremap # X<C-H>#
set ai
set si
set nu
" omg folding is the worst
set nofoldenable
" expand tabs to 4 spaces
set shiftwidth=4
set tabstop=4
set smarttab
set expandtab
" faster tab navigation
nnoremap <S-tab> :tabprevious<CR>
nnoremap <tab> :tabnext<CR>
" always show tab line to avoid annoying resize
set showtabline=2
" searching options
set incsearch
set showcmd
set ignorecase
set smartcase
" disable backups
set nobackup
set nowritebackup
set noswapfile
" disable annoying beep on errors
set noerrorbells
if has('autocmd')
autocmd GUIEnter * set vb t_vb=
endif
" font options
set background=dark
set t_Co=256
colorscheme smyck
if has('win32')
set gfn=Consolas:h11
elseif has('mac')
set gfn=Inconsolata:h14,Consolas:h11
else
set gfn=DejaVu\ Sans\ Mono\ 10
endif
" keep at least 5 lines below the cursor
set scrolloff=5
" window options
set showmode
set showcmd
set ruler
set ttyfast
set backspace=indent,eol,start
set laststatus=2
" enable mouse support
set mouse=a
" better tab completion on commands
set wildmenu
set wildmode=list:longest
" close buffer when tab is closed
set nohidden
" better moving between 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
" shortcuts to common commands
let mapleader = ","
nnoremap <leader>e :tabnew<CR>:CtrlP<CR>
nnoremap <leader>h :tabnew<CR>:ConqueTerm bash<CR>
nnoremap <leader>l :NERDTreeToggle<CR>
nnoremap <leader>k :CheckSyntax<CR>
nnoremap <leader>o :CtrlP<CR>
nnoremap <leader>p :set invpaste<CR>
nnoremap <leader>t :tabnew<CR>
nnoremap <leader>s :vsplit<CR>
nnoremap <leader>w :tabclose<CR>
" ; is better than :, and kj is better than ctrl-c
nnoremap ; :
" also autosave when going to insert mode
inoremap kj <Esc>:w<CR>
" more logical vertical navigation. disable if moving by a count
" noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
" noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
nnoremap <silent> k gk
nnoremap <silent> j gj
" make copy/pasting nice
function! ToggleMouse()
if &mouse == 'a'
set mouse=r
set nonu
else
set mouse=a
set nu
endif
endfunction
nnoremap <leader>m :call ToggleMouse()<CR>
" relative line numbers
set number
set relativenumber