-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
301 lines (234 loc) · 8.19 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
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" To remember "
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" <ctrl+w> backwards kill word
" gi go to last position of insert mode
" gf go to file/route/class with vim-rails
" <ctrl+o> move out a level
" <ctrl+i> move in a level
"-----------------------------------------------------------------------------
" Global Stuff
"-----------------------------------------------------------------------------
cd ~/Dropbox/dev
set nocompatible
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" plugin on GitHub repo
Plugin 'simplenote.vim'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/nerdtree'
Plugin 'powerline/powerline'
Plugin 'Raimondi/delimitMate'
Plugin 'ternjs/tern_for_vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
"Plugin 'ryanoasis/vim-devicons'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
"Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" Powerline settings
set guifont=Inconsolata\ for\ Powerline\ Nerd\ Font\ Mono:h14
set encoding=utf8
let g:airline_powerline_fonts=1
let g:airline#extensions#tabline#enabled = 1
" Get pathogen up and running
call pathogen#infect()
" System default for mappings is now the "," character
let mapleader = ","
" Set ctags
map <leader>ct :!/usr/local/bin/ctags -R --exclude=.git --exclude=log *<CR>
set tags=./tags
" Use Ack
set grepprg=ack
" Ultisnips Config
let g:UltiSnipsSnippetDirectories = [ "snippets" ]
let g:UltiSnipsEditSplit = "vertical"
let g:UltiSnipsExpandTrigger = "<Tab>"
let g:UltiSnipsJumpForwardTrigger = "<Tab>"
let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
" Quick edit Ultisnips
nmap <silent> ,es :UltiSnipsEdit<CR>
" Set filetype stuff to on
filetype on
filetype plugin on
filetype indent on
" Tabstops are 4 spaces
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
"€ý,€ý, Ruby is 2 spaces
autocmd FileType ruby setlocal softtabstop=2 shiftwidth=2 tabstop=2
autocmd FileType scss setlocal softtabstop=4 shiftwidth=4 tabstop=4
" Remember last location in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
" set the search scan to wrap lines
set wrapscan
set ignorecase
" Make command line two lines high
set ch=2
" set visual bell -- i hate that damned beeping
set vb
" Allow backspacing over indent, eol, and the start of an insert
set backspace=2
" tell VIM to always put a status line in, even if there is only one window
set laststatus=2
" Don't update the display while executing macros
set lazyredraw
" Don't show the current command in the lower right corner. In OSX, if this is
" set and lazyredraw is set then it's slow as molasses, so we unset this
set showcmd
" Show the current mode
set showmode
" Switch on syntax highlighting.
syntax on
" Hide the mouse pointer while typing
set mousehide
" Set up the gui cursor to look nice
set guicursor=n-v-c:block-Cursor-blinkon0,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor,r-cr:hor20-Cursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
" set the gui options the way I like
set guioptions-=T
" This is the timeout used while waiting for user input on a multi-keyed macro
" or while just sitting and waiting for another key to be pressed measured
" in milliseconds.
"
" i.e. for the ",d" command, there is a "timeoutlen" wait period between the
" "," key and the "d" key. If the "d" key isn't pressed before the
" timeout expires, one of two things happens: The "," command is executed
" if there is one (which there isn't) or the command aborts.
set timeoutlen=500
" Keep some stuff in the history
set history=100
" These commands open folds
set foldopen=block,insert,jump,mark,percent,quickfix,search,tag,undo
" When the page STARTs to scroll, keep the cursor 8 lines from the top and 8
" lines from the bottom
set scrolloff=8
" Allow the cursor to go in to "invalid" places
set virtualedit=all
" Make the command-line completion better
set wildmenu
" get rid of the silly characters in separators
set fillchars = ""
" Add ignorance of whitespace to diff
set diffopt+=iwhite
" Enable search highlighting
set hls
" Incrementally match the search
set incsearch
" Automatically read a file that has changed on disk
set autoread
" Line numbering
set nu
" Custom mappings
" HTML
map <leader>b <s-s>tstrong>
map <leader>e <s-s>tem>
map <leader>p <s-v><s-s>tp><s-j>x<s-j>x0
map <leader>a <s-s>ta href="#">f#xi
nnoremap <leader>a f>
" Ack
map <C-n> :cn<CR>
map <C-p> :cp<CR>
" Haml
map <leader>ch 0<c-v>lr/<cr>
" File Movement
map j gj
map k gk
" Indenting in insert
inoremap <D-]> <esc>>>i
inoremap <D-[> <esc><<i
" Awesome status line
set encoding=utf-8
let g:Powerline_symbols = 'fancy'
" easy match bracket pairs
nnoremap <tab> %
vnoremap <tab> %
" Command + Enter doesnt disturb line for css
inoremap <D-CR> <C-O>o
inoremap <D-S-CR> <esc>:/}<cr>o<cr><esc>:nohls<cr>cc
" this is for delimitMate
inoremap {<CR> {<CR>}<C-o>O
" Autoclose setting
let AutoCloseExpandEnterOn = '{'
" Ctrl + Enter to block-edit element
inoremap <c-cr> <cr><esc>kl%a<cr>
" cd to the directory containing the file in the buffer
nmap <silent> ,cd :lcd %:h<CR>
nmap <silent> ,md :!mkdir -p %:p:h<CR>
" Turn off that stupid highlight search
nmap <silent> ,n :nohls<CR>
" The following beast is something i didn't write... it will return the
" syntax highlighting group that the current "thing" under the cursor
" belongs to -- very useful for figuring out what to change as far as
" syntax highlighting goes.
nmap <silent> ,qq :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">"<CR>
" set text wrapping toggles
nmap <silent> ,ww :set invwrap<CR>:set wrap?<CR>
" Delete empty lines
nmap ,del :g/^$/d<cr>
" Rails
inoremap <D-lt> <%= %><esc>hhi
inoremap <D->> <% %><esc>hhi
" delete lines and move cursor
inoremap <c-k> <esc>kddi
inoremap <c-j> <esc><s-o><esc>ji
" Edit the vimrc file
nmap <silent> ,ev :e $MYVIMRC<CR>
nmap <silent> ,sv :so $MYVIMRC<CR>
" Make horizontal scrolling easier
nmap <silent> <C-o> 10zl
nmap <silent> <C-i> 10zh
" Underline the current line with '='
nmap <silent> ,u= :t.\|s/./=/g\|:nohls<cr>
nmap <silent> ,u- :t.\|s/./-/g\|:nohls<cr>
" Misc
nmap <leader>i =i{
" Syntax coloring lines that are too long just slows down the world
set synmaxcol=2048
" Highlight the current line and column
" Don't do this - It makes window redraws painfully slow
set nocursorline
set nocursorcolumn
"-----------------------------------------------------------------------------
" Set up the window colors and size
"-----------------------------------------------------------------------------
"set guifont=Consolas:h14
set background=dark
colorscheme hybrid
:nohls
autocmd VimEnter * NERDTree
:endif