Skip to content

Instantly share code, notes, and snippets.

@lacygoill
lacygoill / CmdlineEnter_CmdlineLeave.md
Last active December 21, 2021 23:57
New events when you enter/leave a command line in Vim

In patch 8.0.1206, Vim has added 2 new events: CmdlineEnter and CmdlineLeave. They are fired every time you enter or leave a command line.

Syntax

There are 7 types of command lines, including one for normal Ex commands, debug mode commands, search commands (with a distinction between forward and backward), expressions, and inputs (more info at :h cmdwin-char). Each of them is associated with a symbol among this set : > / ? = @ -.

You can limit the effect of an autocmd listening to CmdlineEnter / CmdlineLeave to one or several types of command lines by:

@lacygoill
lacygoill / cycle_cond.md
Created August 10, 2023 16:07 — forked from pascalpoitras/cycle_cond.md
made for someone on IRC

WeeChat Screenshot

Aliases

/alias add cycle_build /mute /unset plugins.var.buffer_cycle;/mute /set plugins.var.buffer_cycle_cond $*;/allbuf /eval /${if:${eval_cond:${plugins.var.buffer_cycle_cond}}!=?mute set plugins.var.buffer_cycle ${plugins.var.buffer_cycle} ${buffer.name}}
/alias add cycle_cond /cycle_build $*;/eval /mute /buffer cycle ${plugins.var.buffer_cycle}

Examples

/cycle_cond ${channel} =~ l