-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.vimrc
197 lines (166 loc) · 4.89 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
set guioptions-=m "menu bar
set guioptions-=T "toolbar
set guioptions-=r "scrollbar
set hlsearch
set incsearch
set ignorecase
syntax on
let python_highlight_all=1
set cindent
set number " line numbers
set cursorline " highlight cursor line
set pastetoggle=<F2>
" using alt/meta to jump words
set linebreak
" facilitate ctag viewing
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
" read tags file from upper directories
set tags=./tags;/
set tabstop=2
set softtabstop=2 expandtab
set expandtab
set smarttab
set shiftwidth=2
inoremap <nul> <c-n>
set autoread
filetype plugin on
filetype indent on
set colorcolumn=100
" yank to clipboard
if has('macunix')
set clipboard=unnamed
elseif has('unix')
set clipboard=unnamedplus
endif
" search visually selected block
vnoremap / <Esc>/\%V
" select entire line without leading or trailing spaces
nnoremap vil ^vg_
" Highlight all instances of word under cursor, when idle.
" Useful when studying strange source code.
" Type z/ to toggle highlighting on/off.
nnoremap z/ :if AutoHighlightToggle()<Bar>set hls<Bar>endif<CR>
function! AutoHighlightToggle()
let @/ = ''
if exists('#auto_highlight')
au! auto_highlight
augroup! auto_highlight
setl updatetime=4000
echo 'Highlight current word: off'
return 0
else
augroup auto_highlight
au!
au CursorHold * let @/ = '\V\<'.escape(expand('<cword>'), '\').'\>'
augroup end
setl updatetime=1000
echo 'Highlight current word: ON'
return 1
endif
endfunction
au FileType c set makeprg=gcc\ %
au FileType cpp set makeprg=g++\ %
" Remove current highlighting
map zh :nohlsearch<CR>
" requires SIMBL and MouseTerm
" enables mouse reporting in vim, so you can scroll and select using mouse
if has("mouse")
set mouse=a
endif
" Fix the difficult-to-read default setting for diff text highlighting. The
" bang (!) is required since we are overwriting the DiffText setting. The highlighting
" for "Todo" also looks nice (yellow) if you don't like the "MatchParen" colors.
highlight DiffAdd cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffDelete cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffChange cterm=bold ctermfg=10 ctermbg=17 gui=none guifg=bg guibg=Red
highlight DiffText cterm=bold ctermfg=10 ctermbg=88 gui=none guifg=bg guibg=Red
" Use system clipboard for copy/pasting
vmap <C-x> :!pbcopy<CR>
vmap <C-c> :w !pbcopy<CR><CR>
" resize buffers
nnoremap s. :vertical resize -1<cr>
nnoremap s, :vertical resize +1<cr>
nnoremap s- :resize -1<cr>
nnoremap s= :resize +1<cr>
set splitbelow
set splitright
" move between buffers
nnoremap sj <C-w>j
nnoremap sk <C-w>k
nnoremap sh <C-w>h
nnoremap sl <C-w>l
nnoremap sq :BD<CR>
nnoremap <C-j> :bn<CR>
nnoremap <C-k> :bp<CR>
nnoremap <C-Tab> :bn<CR>
nnoremap <C-S-Tab> :bp<CR>
" treat wrapped lines as multi-lines
noremap k gk
noremap j gj
noremap 0 g0
noremap $ g$
" list open files
nnoremap ff :ls<cr>:b<Space>
" open grep prompt
nnoremap grep :Grep <c-r>=expand("<cword>")<cr><CR>
set nocompatible " be iMproved
" filetype off " required!
filetype plugin indent on " required!
" or
" filetype plugin on " to not use the indentation settings set by plugins
execute pathogen#infect()
autocmd vimenter * wincmd p
map tre :NERDTreeToggle<CR>
" turn off smart indentation for pasting
map! jj <ESC>
map! kk <ESC>
" save shortcut
nnoremap ss :w<CR>
"nerdcommenter
nmap cc <leader>c<Space>
vmap cc <leader>c<Space>
" persistent undo
set undofile
set undodir=~/.backup/vim/undo,~/tmp,/tmp
set autoindent
set smartindent
" theme
color codeschool
if has('macunix')
set guifont=Monaco:h12
endif
set guioptions-=T " Removes top toolbar
set guioptions-=r " Removes right hand scroll bar
set go-=L " Removes left hand scroll bar
autocmd User Rails let b:surround_{char2nr('-')} = "<% \r %>" " displays <% %> correctly
:set cpoptions+=$ " puts a $ marker for the end of words/lines in cw/c$ commands
" ctrlp ignore options
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|\.hg|\.svn|_site|node_modules|DS_Store|build)$',
\ }
" fold
set foldmethod=syntax
set foldnestmax=1
" git gutter signs
let g:gitgutter_sign_added = '▓'
let g:gitgutter_sign_modified = '▓'
let g:gitgutter_sign_removed = '▓'
" conque term
nnoremap terminal :sp<CR>:ConqueTerm bash<CR>
" disable cursor blink
set guicursor+=n-v-c:blinkon0
" new line above
nmap <C-Enter> <ESC>ko
imap <C-Enter> <ESC>ko
" easygrep config
let g:EasyGrepRecursive=1
let g:EasyGrepCommand=1
let g:EasyGrepFilesToExclude="*.swp,*~,*.swo,.git,build,node_modules"
let g:EasyGrepAllOptionsInExplorer=1
let g:EasyGrepJumpToMatch=0
" swap files
set noswapfile
" jedi-vim, don't show the docstring pane
autocmd FileType python setlocal completeopt-=preview