In Vim, when entering a new tab, how to ignore BufEnter event? -


i have autocmds run vimscript function. function bound tabenter , bufenter.

however when enters new tab, function run several times because both autocmds fire (and tabenter seems fire bufenter previous "current" buffer before firing again new buffer...i think).

anyway, how can run function once when enters new tab?

you didn't tell when functionality needs triggered; maybe combination of events (tabenter , bufenter unrelated; if same buffer displayed in both tabs?) off, , problem fixed choosing other events.

apart that, could:

  • store last processed buffer (bufnr('')) / window (winnr()) / ... in script-local variable, , short-circuit function if it's same
  • if problem long delay in function, store timestamp (localtime()) , short-circuit when little time passed
  • if have tab-switching under control (but don't), :noautocmd , :set eventigore+=... remedy this

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -