Guest User

Untitled

a guest
Jul 31st, 2015
359
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function! ToggleTestAutoGroup()
  2.     let l:enable = exists('#TestAutoGroup#BufEnter')
  3.     augroup TestAutoGroup
  4.         autocmd!
  5.     augroup END
  6.     if !l:enable
  7.         augroup TestAutoGroup
  8.             autocmd BufEnter   * echom "BufEnter " . bufnr("%")
  9.             autocmd BufLeave   * echom "BufLeave " . bufnr("%")
  10.             autocmd TabEnter   * echom "TabEnter " . tabpagenr()
  11.             autocmd TabLeave   * echom "TabLeave " . tabpagenr()
  12.         augroup END
  13.     endif
  14. endfunction
  15.  
  16. nnoremap <F4> :call ToggleTestAutoGroup()<CR>
RAW Paste Data