Add vi/vim-like modes and keybindings to WeeChat.
To switch to Normal mode, press Esc or Ctrl+Space.
Two bar items are provided:
- mode_indicator: shows the currently active mode (e.g.
NORMAL). - vi_buffer: shows partial commands (e.g.
df).
You can add them to your input bar. For example, using iset.pl:
/iset weechat.bar.input.items<Alt+Enter>- Add
[mode_indicator]+at the start, and,[vi_buffer]at the end. - Final result example:
"[mode_indicator]+[input_prompt]+(away),[input_search], [input_paste],input_text,[vi_buffer]"
To switch back to Insert mode, you can use i, a, A, etc.
To execute an Ex command, simply precede it with a ':' while in normal mode, for example: ":h" or ":s/foo/bar".
d{motion}Delete text that {motion} moves over.c{motion}Delete {motion} text and start insert.y{motion}Yank {motion} text to clipboard.
h[count] characters to the left exclusive.l[count] characters to the right exclusive.w[count] words forward exclusive.W[count] WORDS forward exclusive.b[count] words backward.B[count] WORDS backward.geBackward to the end of word [count] inclusive.gEBackward to the end of WORD [count] inclusive.eForward to the end of word [count] inclusive.EForward to the end of WORD [count] inclusive.0To the first character of the line.^To the first non-blank character of the line exclusive.$To the end of the line exclusive.f{char}To [count]'th occurence of {char} to the right.F{char}To [count]'th occurence of {char} to the left.t{char}Till before [count]'th occurence of {char} to the right.T{char}Till after [count]'th occurence of {char} to the left.
<Space>[count] characters to the right.<BS>[count] characters to the left.xDelete [count] characters under and after the cursor.XDelete [count] characters before the cursor.~Switch case of the character under the cursor.;Repeat latest f, t, F or T [count] times.,Repeat latest f, t, F or T in opposite direction [count] times.r{char}Replace [count] characters with {char}` under and after the cursor.REnter Replace mode. Counts are not supported.ddDelete line.ccDelete line and start insert.yyYank line to clipboard. Requires xsel.IInsert text before the first non-blank in the line.pPut the text from the clipboard after the cursor. Requires xsel.
jScroll buffer up. *kScroll buffer down. *^UScroll buffer page up. *^DScroll buffer page down. *gtorKGo to the next buffer.gTorJGo to the previous buffer.ggGoto first line.GGoto line [count], default last line. */Launch WeeChat search mode^^Jump to the last buffer.
* Counts may not work as intended, depending on the value of
weechat.look.scroll_amount and weechat.look.scroll_page_percent.
^WhGo to the window to the left.^WjGo to the window below the current one.^WkGo to the window above the current one.^WlGo to the window to the right.^W=Balance windows' sizes.^WxSwap window with the next one.^WsSplit current window in two.^WvSplit current window in two, but vertically.^WqQuit current window.
:hHelp (/help):setSet WeeChat config option (/set):qCloses current buffer (/close):qallExits WeeChat (/exit):wSaves settings (/save):spSplit current window in two (/window splith).:vspSplit current window in two, but vertically (/window splitv).:!{cmd}Execute shell command (/exec -buffer shell):s/pattern/repl:s/pattern/repl/gSearch/Replace *:commandAll other commands will be passed to WeeChat (e.g. ':script …' is equivalent to '/script …').
* Supports regex (check docs for the Python re module for more
information). & in the replacement is also substituted by the pattern. If
the g flag isn't present, only the first match will be substituted.
- version 0.1: initial release
- version 0.2: added esc to switch to normal mode, various key bindings and commands.
- version 0.2.1: fixes/refactoring
- version 0.3: separate operators from motions and better handling. Added yank operator, I/p. Other fixes and improvements. The Escape key should work flawlessly on WeeChat ≥ 0.4.4.
- version 0.4: added: f, F, t, T, r, R, W, E, B, gt, gT, J, K, ge, gE, X, ~, ,, ;, ^^, ^Wh, ^Wj, ^Wk, ^Wl, ^W=, ^Wx, ^Ws, ^Wv, ^Wq, :!cmd, :sp, :vsp. Improved substitutions (:s/foo/bar). Rewrote key handling logic to take advantage of WeeChat API additions. Many fixes and improvements. WeeChat ≥ 1.0.0 required.