Posts tagged ‘vim’

Vim mode in Irssi

I came across an Irssi script that provides vim-like keybindings for the input line.

The script allows you to toggle between INSERT, COMMAND and EX modes.

In my vimrc and zshrc, I’ve already got jj mapped to Esc when in INSERT mode. The Irssi script provides this mapping by setting:

/set vim_mode_cmd_seq j

Another useful feature is the mode indicator, best used in conjunction with uberprompt.

From the README, the following common keybindings are supported:

  • Command mode: Esc <Ctrl-C>
  • Cursor motion: h l 0 ^ $ <Space> <BS> f t F T
  • History motion: j k gg G gg
  • Cursor word motion: w b ge e W gE B E
  • Word objects: aw aW
  • Yank and paste: C<y p P>
  • Change and delete: c d
  • Delete at cursor: x X
  • Replace at cursor: r
  • Insert mode: i a I A
  • Switch case: ~
  • Repeat change: .
  • Repeat: ftFT: ; ,
  • Registers: "a-"z "" "0 "* "+ "_
  • Line-wise shortcuts: dd cc yy
  • Shortcuts: s S C D
  • Scroll the scrollback buffer: Ctrl-E Ctrl-D Ctrl-Y Ctrl-U Ctrl-F Ctrl-B
  • Switch to last active window: Ctrl-6/Ctrl-^
  • Switch split windows: <Ctrl-W j Ctrl-W k>
  • Undo/Redo: u Ctrl-R

Get the script at:

Vim slow on long lines with syntax enabled

Vim is my default text editor. Besides coding, I also use vim with the Hammer plugin to do most my basic word processing.

One major annoyance I’ve found is that terminal vim responds extremely slowly when dealing with files that contain long lines (.e.g. xml, markdown, php, etc.).

Some simple changes in ~/.vimrc to overcome this:

" set max syntax columns to prevent lag on long lines (default: 3000)
set synmaxcol=128
" disable cursorline (default: nocursorline)
set nocursorline "

To compensate for loss of the visual aid in the cursorline, in my vim theme and ~/.Xresources, I changed my cursor colour from the default grey/white to yellow.