Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. function! s:map ()
  2. map <buffer> <Return> <Cmd>exe 'wincmd p \|' line('.') 'cc'<CR>
  3. endfunction
  4.  
  5. function! s:unmap ()
  6. unmap <buffer> <Return>
  7. endfunction
  8.  
  9. function! s:list ()
  10. return expand('<amatch>')[0] == 'l' ? getloclist(0) : getqflist()
  11. endfunction
  12.  
  13. autocmd! QuickFixCmdPost * if !empty(s:list()) | wincmd p | endif
  14. autocmd! BufWinEnter * if &buftype == 'quickfix' | call s:map() | endif
  15. autocmd! BufWinLeave * if &buftype == 'quickfix' | call s:unmap() | endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement