forked from Spunge/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
198 lines (167 loc) · 4.63 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
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" NOTE: comments after Bundle command are not allowed..
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" Github repos
Bundle 'altercation/vim-colors-solarized'
Bundle 'kien/ctrlp.vim'
Bundle 'xolox/vim-easytags'
Bundle 'xolox/vim-misc'
Bundle 'majutsushi/tagbar'
Bundle 'scrooloose/syntastic'
Bundle 'scrooloose/nerdcommenter'
Bundle 'msanders/snipmate.vim'
Bundle 'tpope/vim-markdown'
Bundle 'mattn/emmet-vim'
Bundle 'bling/vim-bufferline'
Bundle 'bling/vim-airline'
Bundle 'tpope/vim-surround'
Bundle 'digitaltoad/vim-jade'
Bundle 'chase/vim-ansible-yaml'
Bundle 'moll/vim-node'
Bundle 'cakebaker/scss-syntax.vim'
Bundle 'Valloric/YouCompleteMe'
" vim-scripts repos
Bundle 'AutoClose'
" Non github repos
" Bundle 'git://git.wincent.com/command-t.git'
" ...
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_javascript_checkers = ['eslint']
filetype plugin indent on " required!
" Solarized settings
set background=dark
let g:solarized_termtrans=1
let g:solarized_termcolors=256
let g:solarized_contrast="high"
let g:solarized_visibility="high"
colo solarized
let g:ansible_options = {'ignore_blank_lines': 0}
let g:user_emmet_leader_key='<C-Z>'
set encoding=utf-8
set cpoptions+=$
set gcr=a:blinkon0
set autoindent
set tabstop=4
set shiftwidth=4
set noexpandtab
set nowrap
" Temp text wrapping
"set textwidth=79
"set formatoptions+=t
set hlsearch
set incsearch
set ignorecase
set number
set guioptions-=T
syntax on
set hidden " allow buffers with unsaved changes
set mouse=a " enable mouse scrolling and clicking in iTerm
set wildmenu " expand vim commands like :tabe
set wildmode=full
set scrolloff=4 " keep 4 lines off the edges of the screen when scrolling
set nobackup " no backup file clutter
set noswapfile " never used it
set nomodeline " ignore vim modelines
set laststatus=2 " always show statusline
" fix workman binding
noremap l o
noremap o l
noremap L O
noremap O L
noremap j n
noremap n j
noremap J N
noremap N J
noremap k e
noremap e k
noremap K E
noremap E <nop>
noremap h y
noremap y h
noremap H Y
noremap Y H
" remap surround plugin
let g:surround_no_mappings = 1
nmap ds <Plug>Dsurround
nmap cs <Plug>Csurround
nmap cS <Plug>CSurround
nmap hs <Plug>Ysurround
nmap hS <Plug>YSurround
nmap hss <Plug>Yssurround
nmap hSs <Plug>YSsurround
nmap hSS <Plug>YSsurround
xmap S <Plug>VSurround
xmap gS <Plug>VgSurround
" remap buffer switching
map <C-o> :bn<CR>
map <C-y> :bp<CR>
" clear search results
vnoremap // y/<C-R>"<CR>"
map <C-n> :NERDTreeToggle<CR>
" Use space as ex command unit (:)
map <Space> :
let mapleader=","
" map <leader>/ to turn off search highlight
nnoremap <Leader>/ :noh<CR>
" Make it easy to edit files from same directory as current file
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>ew :e %%
map <leader>es :sp %%
map <leader>ev :vsp %%
map <leader>et :tabe %%
" set snippet dir
let g:snippets_dir = '~/code/dotfiles/vimsnippets/'
" Bufferline is also printing to statusline, do not want :F
let g:bufferline_echo = 0
"let g:airline_left_sep = '▶'
"let g:airline_right_sep = '◀'
"let g:airline_theme='badwolf'
let g:airline_powerline_fonts=1
" tagbar autofocus and autoclose
nmap <F8> :TagbarToggle<CR>
let g:tagbar_autoclose = 1
let g:tagbar_autofocus = 1
let g:tagbar_iconchars = ['▾', '▸']
let g:ctrlp_tabpage_position = 'ac'
" Ignore compiled python
set wildignore+=*/tmp/*,*.pyc,*/bower_components/*,*/node_modules/*
" dont look at .hg dirs to decide where current working dir is, messes up with
" subrepos
let g:ctrlp_working_path_mode = '0'
" Ignore certain files
let g:ctrlp_custom_ignore = '\v[\/]\.(node_modules|bower_components|git|hg|svn)$'
" let easytags look for tags file in project
set tags=./.tags;
let g:easytags_dynamic_files = 1
" disable auto update because it seems to make vim lag
" (use :UpdateTags -R ./*)
let g:easytags_auto_update = 0
let g:easytags_auto_highlight = 0
" include local vim conf
let s:extrarc = expand($HOME . '/.vimrc.local')
if filereadable(s:extrarc)
exec ':so ' . s:extrarc
endif
autocmd BufLeave,FocusLost * silent! wall
" hg diff stuff
function! Hgdiff()
vnew
silent r !hg diff
0
set filetype=diff
setlocal buftype=nofile
setlocal noswapfile
wincmd w
endfunction
command! Hgdiff call Hgdiff()