theclapp

Lispworks Vim Mode

Wiki Control

edit this page edit page

discuss this page discuss

Dec 2007: Please see http://theclapp.org/blog for further development of lw-vim-mode.

Download v3 code here.

I guess I should mention that I use Edi Weitz's Lispworks Add-Ons package. I suppose that might make a difference.

Most items have slightly different semantics than in Vim. Items marked with a leading (*) have significantly different semantics than in Vim.

Items marked with a (+) are not in Vim.

Some of these mappings are just my own favorites (like C-F12 to save all files), but they're in there, so I should document them.

Changing modes:

  • Enter vi mode: Shift-Ctrl-Esc, c-,,c-, (ctrl-, twice). All other commands assume you're in vi mode

  • Exit vi mode: Shift-Ctrl-Esc

  • Return to command mode (i.e from insert mode): C-[

Movement:

  • Previous line: k Up C-p

  • Previous screen line: gk

  • Next line: j Down C-j Return C-n

  • Next screen line: gj

  • Backward character: h Left C-h Backspace

  • Forward character: l (lower-case-L) Right Space

  • Backward word: b B C-Left

  • Forward word: w W C-Right

  • Goto line or end-of-file: G (uses prefix supplied by C-u)

  • Top/Bottom/Middle of window: H/L/M

  • Backward/forward one Lisp form: (/)

  • Backward/forward one list: C-(/C-)

  • Goto beginning of line: Home 0 (zero)

  • Goto end of line: $ End

  • Move to first non-blank on line: ^

  • Move to beginning of defun: [\

  • Move to end of defun: ]\

Scrolling:

  • Page down: C-f

  • Page up: C-b

  • Scroll window down by one line: C-y S-Up

  • Scroll window up by one line: C-e S-Down

  • Move current line to top of window: zt

Repeating:

  • Repeat last change: . (dot/period/full stop)

Making changes:

  • start insert: i

  • exit insert, back to command mode: Ctrl-[ (this is not the same as the Esc key!)

  • Delete next/previous character: x/X

  • Start append at end of line: A

  • Start insert at beginning of line: I

  • (*)Delete motion: d{motion} (incomplete/buggy)

  • (*)Delete to end of line: D

  • (*)Put recent deletiong: p

  • Open line up/down: O/o

  • Lowercase word: ~w

  • Lowercase/uppercase region: vu/vU

  • shift line right: >>

  • (*)Join with previous line: J (different than Vim's J key, which joins with next line)

Buffers/windows:

  • New buffer: :n

  • New window: C-w,n (that's C-w, then n)

  • Previous/next window: C-w,k / C-w,j

  • Close window: C-w,c

  • (*)List buffers: :ls,Return F7

  • (*)Select buffer: :b,Space

  • (*)Next buffer: :bn,Return C-F10

Searching:

  • (*)search forward: /

  • (*)search backward: ?

  • List matching lines (sort of like :g/re/p in Vim): :gp

  • Delete matching lines (like :g/re/d in Vim): :gd

Read/write files:

  • Save file: :w,Return

  • Save all files: :wa,Return C-F12

  • Save all files and exit: :wqa,Return

  • (*)Write file (to different filename): :w,Space

  • (*)Edit new file: :e,Space

  • Reload file from disk: :e!

  • Read file into buffer: :r,Space

Tagging/finding source:

  • (*)Find source: C-]

  • (*)Find next tag: :tn,Return

  • (*)View tag list: :ts,Return

Evaluate Lisp code:

  • (+)Evalute current defun: ,x