Skip to content

Latest commit

 

History

History
186 lines (150 loc) · 14.3 KB

VIM_COMPARISON.org

File metadata and controls

186 lines (150 loc) · 14.3 KB

Vim Comparison

Intro

Despite being another modal editing scheme, meow is not very similar to Vim, but instead tends to be more like kakoune.

The primary difference to Vim are that there is no dedicated visual mode in meow, since it’s essentially built into normal mode. Almost every movement in normal mode creates a visual selection on which some command can act on.

The other main difference is that the language grammar you use in Vim is flipped in meow.

In Vim, you might use something like 4w to move 4 words forward. 4 acts as a quantifier, and w is the so called “verb.” In meow, we think about commands the opposite way. We’d first select a single word, with meow-next-word (which, critically, both moves the point and creates a selection), and then press 3 to select three more words. This process can be indefinitely extended. For example, if you say 2 and 6 afterwards you select another 8 words forward.

Once you have a selection, you can decide to execute an action (“verb”) representing what you want to do on this selection.

In vim, to change (delete and enter insert mode) 3 words, you might press c3w. In meow, this would be e3c since the grammar is inverted.

Meow has the clear advantage that when you create the selection, you get visual feedback on what your target selection is, and then can decide which verb to execute. You can choose to abort if you selected something wrong, or better, revert your selection to make a new one. In Vim on the other hand, you commit on the verb right away, then guess at your selection target (which is harder the more things you want to act on). If you mess up, you have no choice but to undo everything and try again.

Since many people who want to give meow a try, come from a Vim / Evil background, here is an overview of typical Vim keybindings for common actions and how they can be achieved in meow.

Note:

We provide only command names here, this is because meow has no built-in keybind set (yet?). If you decide to use the suggested QWERTY keybindings, you can look up the default binding to each command there.

For ease of reading, all meow- prefixes are stripped.

Italic (e.g. negative-argument) represents a builtin command.

Brackets (e.g. [reverse]) represents an optional step. You don’t always replicate the same cursor movement, the selection does the job sometimes.

Movement

VimMeowDescription ; Tips
hleftcharacter left
jnextnext line
kprevprevious line
lrightcharacter right
wnext-wordnext word
Wnext-symbolnext symbol (as determined by the syntax table)
bback-wordlast word
Bback-symbollast symbol
emark-wordend of word
Emark-symbolend of symbol
geback-word back-word [reverse]end of previous word; no need to reverse before append
gEback-symbol back-symbol [reverse]end of previous symbol; no need to reverse before append
0line [reverse] OR C-abeginning of line; no need to reverse before insert
^​joinfirst none whitespace character
$​lineEOL
f <char>find <char>forward to next char
F <char>negative-argument find <char>backward to last char
t <char>till <char>till next char
T <char>negative-argument till <char>backward till next char
%block OR to-blockjump to matching paren; not one to one replacement can jump from anywhere inside the block to end
;repeatrepeat last f or t movement; builtin repeat works with any command
C-upage-up OR M-vpage up; depends on whether to select or not
C-dpage-down OR C-vpage down
ggbeginning-of-thing b OR M-<beginning of file
Gend-of-thing OR M->end of file
:<num>goto-linego to line number
C-omeow-pop-to-marklast position in jumplist; mark-ring based, only in current buffer
C-imeow-unpop-to-marknext position in jumplist; mark-ring based, only in current buffer

Search

VimMeowDescription
/visit OR C-s OR C-M-sforward search; depends on whether you need incremental search
?negative-argument visit OR C-r OR C-M-rbackward search
nsearchnext match
pnegative-argument searchlast match; the direction preserves, you only need negative argument for the first time

Switch into insert mode

VimMeowDescription
iinsertinsert
aappendappend (needs (setq meow-use-cursor-position-hack t))
Ijoin appendinsert before first character in line
Aline appendappend end of line
oopen-belowinsert into line beneath
Oopen-aboveinsert into line above

Delete and go to insert mode

VimMeowDescription
c <num> <noun><noun> <num> changechange
r <char>replace a single character and go back to normal mode

Normal mode modifications

VimMeowDescription
~M-l & M-u & M-ctoggle case under cursor; not one to one replacement
C-xNot implemented see heredecrement number under cursor.
C-aNot implemented see hereincrement number under cursor
gUwword C-x C-uuppercase word (works with all nouns)
guwword C-x C-llowercase word (works with all nouns)
xdeletedelete under cursor
Dkilldelete to end of line
ddkill OR kill-whole-linedelete line
d <num> <noun><noun> <num> kill
uundoundo
C-rcancel undoredo; Emacs has a different undo system with a stack, so to undo the undo, you do some action which has no effect and afterwards meow-undo works in the other way

Macros

Vim uses registers to store macros. Meow only has a key to start a macro and afterwards play it. When a new macro is recorded the old one will be overridden. The reason is that meow just wraps the default Emacs Macro behavior.

If you want to store the last recorded macro, you can give it a name with kmacro-name-last-macro or give it a key with kmacro-to-register. You can afterwards execute that command from the M-x menu.

VimMeowDescription
q <register>start-kmacro-or-insert-counterstart a macro recording
qend-or-call-kmacrofinish a macro recording
@ <register>end-or-call-kmacroplay a macro

Adjectives

Except for some cases, namely meow-word, meow-line and meow-block, meow generalizes the idea of selection in and around “things”. You may select inside any “thing” by first calling meow-inner-of-thing and then following the onscreen prompts. Meow makes it easy to define your own “things” as well, all it takes is a pair of regular expressions!

VimMeowDescription
<action> iwmark-word <action>current word
<action> iWmark-symbol <action>current symbol
<action> i[inner-of-thing <action>inside square brackets)
<action> ci[bounds-of-thing <action>around square brackets)

Command Mode Operations

Generally there is no mode in meow similar to command mode. But there is Keypad Mode (entered with space) which let’s you execute normal emacs commands without holding modifier keys. Many things done in command mode can be achieved via this mode and some common and useful examples are given here.

VimMeowDescription
:wSPC x s(save buffer)
:qaSPC m x “kill-emacs”close vim / emacs
:wqSPC x csave and close emacs

Vim Plugin

VimMeowDescription
commentary.vimM-;
vim-surroundNot implementedSee https://github.com/mkleehammer/surround