Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 13302

`autocmd`s are commands executed automatically on certain events. Questions on creating or modifying `autocmd` definitions are appropriate for this tag.

2 votes
2 answers
449 views

alternative of `BufWinLeave` autocmd that triggers when buffer goes invisible from the screen

I want an autocmd to be executed when a buffer goes invisible from the screen (current tab). What is the best approach to achieve this? Let me make it more specific. … I want an autocmd for this a window's (W) buffer (B1) is changed to another one (B2) or that window is destroyed; B1 is not displayed in other windows of the current tabpage This is equivalent to say …
doraemon's user avatar
  • 1,677
1 vote

alternative of `BufWinLeave` autocmd that triggers when buffer goes invisible from the screen

Based on @user938271's answer, I slightly changed the code so that it is more concise: augroup will_buffer_become_invisible au! BufLeave * call s:will_buffer_become_invisible() augroup END fu! s …
doraemon's user avatar
  • 1,677
3 votes
0 answers
88 views

the matching pattern for TabClosed autocmd

If I want to setup a TabClosed autocmd for a specific tab page only, what should I do? Can I use the autocmd {pat} argument? Is this {pat} still matched against the filename? … PS: I know that <afile> can be used as the tab page number, but tab page can be moved around after the autocmd is set. So a tab page nr may not work. Is there a concept as tab page id like the winid? …
doraemon's user avatar
  • 1,677
8 votes
2 answers
2k views

autocmd with quickfix window

I tried autocmd WinEnter quickfix echo 'winenter' autocmd BufEnter quickfix echo 'bufenter' None of them works. I doubt that it is because these two commands needs file name after the event name. …
doraemon's user avatar
  • 1,677
0 votes
Accepted

QuickFixCmdPost autocommand after Glog

I finally got this solution: that is to check the &grepprg, which is a string. For Glog, it should match ^git\>.*\<grep\>. (has exceptions since grep may appear as filename) The function will look li …
doraemon's user avatar
  • 1,677
1 vote
2 answers
848 views

QuickFixCmdPost autocommand after Glog

from fugitive to populate the quickfix window and set the following autocmd for QuickFixCmdPost (The following questions general and are not specific to Glog, I just use it as example) autocmd QuickFixCmdPost … It seems that w:quickfix_title is not set before the autocmd finishes. Calling :cwindow to open the window does not get it set immediately. …
doraemon's user avatar
  • 1,677