Skip to content

Instantly share code, notes, and snippets.

@sl4m
Created July 6, 2011 15:11
Show Gist options
  • Save sl4m/1067471 to your computer and use it in GitHub Desktop.
Save sl4m/1067471 to your computer and use it in GitHub Desktop.
stealing janus' CommandTFlush call when FocusGained event is triggered
autocmd FocusGained * call s:CmdTFlush()
function s:CmdTFlush(...)
if exists(":CommandTFlush") == 2
CommandTFlush
endif
endfunction
@cdemyanovich
Copy link

Was wondering what the 2 means. The exists() documentation explains that it's an exact match with one command.

@sl4m
Copy link
Author

sl4m commented Jul 6, 2011

I noticed that as well when reading Janus' gvimrc file. I kept it when carrying it over to my gvimrc (and gist) and tested it out.

If you check out the gvimrc, you'll see other places where they use == 0 and == 1

https://github.com/carlhuda/janus/blob/master/gvimrc

@sl4m
Copy link
Author

sl4m commented Aug 26, 2011

When does BufWritePost occur?

@sl4m
Copy link
Author

sl4m commented Aug 26, 2011

Like if I created a new file via NerdTree, will it trigger BufWritePost?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment