Skip to content

Latest commit

 

History

History
173 lines (141 loc) · 14.5 KB

VIM_COMPARISON.org

File metadata and controls

173 lines (141 loc) · 14.5 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.

Please note that 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.

Movement

VimMeowDescription
hmeow-leftcharacter left
jmeow-nextnext line
kmeow-prevprevious line
lmeow-rightcharacter right
wmeow-next-wordnext word
Wmeow-next-symbolnext symbol (as determined by the syntax table)
bmeow-back-wordlast word
Bmeow-back-symbollast symbol
emeow-mark-wordend of word
Emeow-mark-symbolend of symbol
gemeow-previous-word - 1 - meow-next-wordend of previous word
gEmeow-previous-symbol - 1 - meow-next-wordend of previous symbol
0negative-argument - meow-linebeginning of line
0meow-line - meow-reversebeginning of line
^meow-joinfirst none whitespace character
$meow-lineEOL
f - <symbol>meow-find - <symbol>forward to next symbol
F - <symbol>negative argument - meow-find - <symbol>backward to last symbol
t - <symbol>meow-till - <symbol>till next symbol
%meow-blockjump to matching paren; not one to one replacement can jump from anywhere inside the block to end
;meow-find / meow-till - <number>repeat last f or t movement
C-umeow-page-uppage up
C-dmeow-page-downpage down
ggmeow-beginning-of-thing - bbeginning of file
Gmeow-end-of-thing - bend of file
:<num>meow-goto-linego to line number
C-olast position in jumplist
C-inext position in jumplist

Search

VimMeowDescription
/meow-visitforward forward
?negative-argument - meow-visitbackward search
nmeow-searchnext match
plast match

Switch into insert mode

VimMeowDescription
imeow-insertinsert
ameow-appendappend (needs (setq meow-use-cursor-position-hack t))
Imeow-join - meow-appendinsert before first character in line
Ameow-line - meow-insertappend end of line
omeow-open-belowinsert into line beneath
Omeow-open-aboveinsert into line above

Delete and go to insert mode

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

Normal mode modifications

VimMeowDescription
.meow-repeatrepeat last command
~ (on lowercase)C-x C-u (upcase-region)uppercase char under cursor
~ (on uppercase)C-x C-l (downcase-region)lowercase char under cursor
C-xNot implemented see heredecrement number under cursor.
C-aNot implemented see hereincrement number under cursor
gUwmeow-word C-x C-uuppercase word (works with all nouns)
guwmeow-word C-x C-llowercase word (works with all nouns)
xmeow-deletedelete under cursor
Dmeow-killdelete to end of line
ddmeow-line - meow-killdelete line
d <num> <noun><noun> <num> meow-kill
umeow-undoundo
C-rmeow-cancel - meow-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 more than macro you can store the last recorded macro under a name with the kmacro-name-last-macro command. You can afterwards execute that command from the M-x menu.

VimMeowDescription
q <register>meow-start-kmacro-or-insert-counterstart a macro
qmeow-end-or-call-kmacrostop a macro
@ <register>meow-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> iwmeow-mark-word <action>current word
<action> iWmeow-mark-symbol <action>current symbol
<action> i[meow-inner-of-thing <action>inside square brackets)
<action> ci[meow-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.vimmeow-comment
vim-surround?