Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function! s:map ()
- map <buffer> <Return> <Cmd>exe 'wincmd p \|' line('.') 'cc'<CR>
- endfunction
- function! s:unmap ()
- unmap <buffer> <Return>
- endfunction
- function! s:list ()
- return expand('<amatch>')[0] == 'l' ? getloclist(0) : getqflist()
- endfunction
- autocmd! QuickFixCmdPost * if !empty(s:list()) | wincmd p | endif
- autocmd! BufWinEnter * if &buftype == 'quickfix' | call s:map() | endif
- autocmd! BufWinLeave * if &buftype == 'quickfix' | call s:unmap() | endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement