updated vimrc

This commit is contained in:
2016-08-07 10:32:14 +01:00
parent e261be10b6
commit 44e658c142
+38 -1
View File
@@ -53,6 +53,7 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'jlanzarotta/bufexplorer'
Plug 'chriskempson/base16-vim', { 'commit': '98aa775c5fd9156ada4f912a9af41f1c020da55d' }
Plug 'vim-airline/vim-airline-themes'
Plug 'danro/rename.vim'
call plug#end() " required
filetype on
filetype plugin on
@@ -406,7 +407,7 @@ let g:syntastic_javascript_checkers = ['jshint']
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
set conceallevel=2
set conceallevel=0
set concealcursor=vin
" Complete options (disable preview scratch window, longest removed to aways
@@ -607,6 +608,41 @@ nnoremap j gj
nnoremap k gk
" ====================================
function! s:ag_to_qf(line)
let parts = split(a:line, ':')
return {'filename': parts[0], 'lnum': parts[1], 'col': parts[2],
\ 'text': join(parts[3:], ':')}
endfunction
function! s:ag_handler(lines)
if len(a:lines) < 2 | return | endif
let cmd = get({'ctrl-x': 'split',
\ 'ctrl-v': 'vertical split',
\ 'ctrl-t': 'tabe'}, a:lines[0], 'e')
let list = map(a:lines[1:], 's:ag_to_qf(v:val)')
let first = list[0]
execute cmd escape(first.filename, ' %#\')
execute first.lnum
execute 'normal!' first.col.'|zz'
if len(list) > 1
call setqflist(list)
copen
wincmd p
endif
endfunction
command! -nargs=* Ag call fzf#run({
\ 'source': printf('ag --nogroup --column --color "%s"',
\ escape(empty(<q-args>) ? '^(?=.)' : <q-args>, '"\')),
\ 'sink*': function('<sid>ag_handler'),
\ 'options': '--ansi --expect=ctrl-t,ctrl-v,ctrl-x --delimiter : --nth 4.. '.
\ '--multi --bind=ctrl-a:select-all,ctrl-d:deselect-all '.
\ '--color hl:68,hl+:110',
\ 'down': '50%'
\ })
" Source local vim script for the current machine
" (Keep this at bottom to overwrite configs above with system specific
" configs)
@@ -692,3 +728,4 @@ nnoremap <silent> <Leader><Enter> :call fzf#run({
" endif
" endif