-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
executable file
·242 lines (193 loc) · 6.18 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
set nocompatible
let mapleader = ","
set ttyfast
set backspace=2
set nobackup
set nowritebackup
set noswapfile
set history=50
set ruler
set showcmd
set incsearch
set laststatus=2
set autowrite
if exists('+undodir')
set undodir=~/.backups
endif
if exists('+undofile')
set undofile
endif
set clipboard=unnamed
set notimeout
set mouse=a
set ttymouse=xterm2
set magic
set hidden
set splitright
set splitbelow
syntax on
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" ----------------------------------------------------------------------------
" Colors
" ----------------------------------------------------------------------------
colorscheme pencil
set background=light
if has("gui_running")
set anti
set lines=999 columns=150
set guifont=Ubuntu\ Mono\ for\ Powerline:h18,Monaco:h17
set guioptions=egmrt
if has('win32') || has('win64')
set guifont=Ubuntu\ Mono\ for\ Powerline:h12,Consolas:h12
endif
" Show tab number (useful for Cmd-1, Cmd-2.. mapping)
autocmd VimEnter * set guitablabel=%N:\ %t\ %M
endif
" ----------------------------------------------------------------------------
" Visual Settings
" ----------------------------------------------------------------------------
set noerrorbells
set novisualbell
set number
set hlsearch
set ignorecase
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set si " smart indent
set linebreak
set formatoptions+=n " support for numbered/bullet lists
set virtualedit=block " allow virtual edit in visual block ..
set nofoldenable " dont fold by default
" Display tabs and trailing spaces visually
set list listchars=tab:\ \ ,trail:·
" ----------------------------------------------------------------------------
" UI
" ----------------------------------------------------------------------------
set nolazyredraw " turn off lazy redraw
set wildmode=list:longest,full
set wildignore+=*/.hg/*,*/.svn/*,*/vendor/cache/*,*/public/system/*,*/tmp/*,*/log/*,*/.git/*,*/.jhw-cache/*,*/solr/data/*,*/node_modules/*,*/.DS_Store
" ----------------------------------------------------------------------------
" Remapping
" ----------------------------------------------------------------------------
" sane movement with wrap turned on
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
nnoremap <Down> gj
nnoremap <Up> gk
vnoremap <Down> gj
vnoremap <Up> gk
inoremap <Down> <C-o>gj
inoremap <Up> <C-o>gk
" sane window movement
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" sane window creation
nnoremap <silent> vv <C-w>v
nnoremap <silent> ss <C-w>s
" Toggle NERDTree
map <C-d> :NERDTreeToggle<CR>
" project search
nmap <leader>f :Ag<space>
" goto buffer
" nmap <C-b> :CtrlPBuffer<cr>
" imap <C-b> <esc>:CtrlPBuffer<cr>
" goto symbol
nmap <C-r> :CtrlPBufTag<cr>
imap <C-r> <esc>:CtrlPBufTag<cr>
nmap <C-R> :CtrlPBufTagAll<cr>
imap <C-R> <esc>:CtrlPBufTagAll<cr>
" goto file
nmap <C-t> :CtrlP<cr>
imap <C-t> <esc>:CtrlP<cr>
" toggle tagbar
nmap <leader>] :TagbarToggle<cr>
" (c)lose buffer
nmap <C-c> <Plug>Kwbd
" Fixing search
" nnoremap / /\v
" vnoremap / /\v
" nmap <silent> // :nohlsearch<cr>
"(v)im (r)eload
nmap <silent> <leader>vr :so %<cr>
" Semicolon at end of line by typing ;;
inoremap ;; <C-o>A;<esc>
" w!! to write a file as sudo
" stolen from Steve Losh
cmap w!! w !sudo tee % >/dev/null
" Remove trailing whitespace and ^M
nnoremap <leader>sn :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
" ---------------------------------------------------------------------------
" Plugin settings
" ---------------------------------------------------------------------------
" Airline
let g:airline_powerline_fonts=0
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
let g:airline_theme = 'pencil'
" Make nerdtree look nice
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let g:NERDTreeWinSize = 30
let g:NERDSpaceDelims=1
" Don't auto open nerd tree on startup
let g:nerdtree_tabs_open_on_gui_startup = 0
" Focus in the main content window
let g:nerdtree_tabs_focus_on_files = 1
" Syntastic Config
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'
" NeoComplete & NeoSnippets
let g:acp_enableAtStartup = 0
" Use neocomplete.
let g:neocomplete#enable_at_startup = 1
" Use smartcase.
let g:neocomplete#enable_smart_case = 1
" Recommended key-mappings.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : (pumvisible() ? "\<C-n>" : "\<TAB>")
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
" Enable omni completion.
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
let g:ackprg = 'ag --nogroup --column'
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
" expand matchpairs on return
let delimitMate_expand_cr = 1
" Fix Cursor in TMUX
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
" ---------------------------------------------------------------------------
" Auto cmd stuff for file types
" ---------------------------------------------------------------------------
if has("autocmd")
autocmd FileType mkd,txt setlocal wrap linebreak nolist
autocmd FileType php setlocal ts=4 sts=4 sw=4
endif
au BufNewFile,BufRead *.twig set ft=jinja
augroup markdown
au!
au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown
augroup END