Skip to content

Commit 0a978e0

Browse files
snowioweshrh
andauthored
Initial proposal for a Vim Comparison (#238)
* initial proposal for a Vim Comparison * use org table and add further keybindings * add undo-redo and put descriptions into one line * Various rewrites and formatting changes * add some more comparisons Co-authored-by: esrh <[email protected]>
1 parent b6db7f3 commit 0a978e0

File tree

1 file changed

+173
-0
lines changed

1 file changed

+173
-0
lines changed

VIM_COMPARISON.org

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
#+title: Vim Comparison
2+
3+
* Intro
4+
5+
Despite being another modal editing scheme, meow is not very similar
6+
to [[https://www.vim.org/][Vim]], but instead tends to be more like [[https://kakoune.org/][kakoune]].
7+
8+
The primary difference to Vim are that there is no dedicated visual mode
9+
in meow, since it's essentially built into normal mode. Almost every
10+
movement in normal mode creates a visual selection on which some
11+
command can act on.
12+
13+
The other main difference is that the language grammar you use in Vim is
14+
flipped in meow.
15+
16+
In Vim, you might use something like =4w= to move 4 words forward. =4=
17+
acts as a quantifier, and =w= is the so called "verb." In meow, we think
18+
about commands the opposite way. We'd first select a single word, with
19+
=meow-next-word= (which, critically, both moves the point *and* creates a
20+
selection), and /then/ press =3= to select three more words. This process
21+
can be indefinitely extended. For example, if you say 2 and 6
22+
afterwards you select another 8 words forward.
23+
24+
Once you have a selection, you can decide to execute an action
25+
("verb") representing what you want to do on this selection.
26+
27+
In vim, to change (delete and enter insert mode) 3 words, you might
28+
press =c3w=. In meow, this would be =e3c= since the grammar is inverted.
29+
30+
Meow has the clear advantage that when you create the selection, you
31+
get visual feedback on what your target selection is, and then can
32+
decide which verb to execute. You can choose to abort if you selected
33+
something wrong, or better, revert your selection to make a new
34+
one. In Vim on the other hand, you commit on the verb right away, then
35+
guess at your selection target (which is harder the more things you want
36+
to act on). If you mess up, you have no choice but to undo everything
37+
and try again.
38+
39+
Since many people who want to give meow a try, come from a Vim / Evil
40+
background, here is an overview of typical Vim keybindings for common
41+
actions and how they can be achieved in meow.
42+
43+
Please note that we provide only command names here, this is because
44+
meow has no built-in keybind set (yet?). If you decide to use the
45+
suggested [[https://github.com/meow-edit/meow/blob/master/KEYBINDING_QWERTY.org][QWERTY]] keybindings, you can look up the default binding to
46+
each command there.
47+
48+
* Movement
49+
50+
| Vim | Meow | Description |
51+
|--------------+-----------------------------------------------+---------------------------------------------------------------------------------------------------|
52+
| h | ~meow-left~ | character left |
53+
| j | ~meow-next~ | next line |
54+
| k | ~meow-prev~ | previous line |
55+
| l | ~meow-right~ | character right |
56+
| w | ~meow-next-word~ | next word |
57+
| W | ~meow-next-symbol~ | next symbol (as determined by the [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-Tables.html][syntax table]]) |
58+
| b | ~meow-back-word~ | last word |
59+
| B | ~meow-back-symbol~ | last symbol |
60+
| e | ~meow-mark-word~ | end of word |
61+
| E | ~meow-mark-symbol~ | end of symbol |
62+
| ge | =meow-previous-word= - 1 - =meow-next-word= | end of previous word |
63+
| gE | =meow-previous-symbol= - 1 - =meow-next-word= | end of previous symbol |
64+
| 0 | ~negative-argument~ - ~meow-line~ | beginning of line |
65+
| 0 | ~meow-line~ - ~meow-reverse~ | beginning of line |
66+
| ^ | ~meow-join~ | first none whitespace character |
67+
| $ | ~meow-line~ | EOL |
68+
| f - <symbol> | ~meow-find~ - <symbol> | forward to next symbol |
69+
| F - <symbol> | ~negative argument~ - ~meow-find~ - <symbol> | backward to last symbol |
70+
| t - <symbol> | ~meow-till~ - <symbol> | till next symbol |
71+
| % | ~meow-block~ | jump to matching paren; not one to one replacement can jump from anywhere inside the block to end |
72+
| ; | ~meow-find~ / ~meow-till~ - <number> | repeat last f or t movement |
73+
| C-u | ~meow-page-up~ | page up |
74+
| C-d | ~meow-page-down~ | page down |
75+
| gg | ~meow-beginning-of-thing~ - b | beginning of file |
76+
| G | ~meow-end-of-thing~ - b | end of file |
77+
| :<num> | ~meow-goto-line~ | go to line number |
78+
| C-o | | last position in jumplist |
79+
| C-i | | next position in jumplist |
80+
81+
* Search
82+
83+
| Vim | Meow | Description |
84+
|-----+------------------------------------+-----------------|
85+
| / | ~meow-visit~ | forward forward |
86+
| ? | ~negative-argument~ - ~meow-visit~ | backward search |
87+
| n | ~meow-search~ | next match |
88+
| p | | last match |
89+
90+
* Switch into insert mode
91+
92+
| Vim | Meow | Description |
93+
|-----+-----------------------------+---------------------------------------------------------|
94+
| i | ~meow-insert~ | insert |
95+
| a | ~meow-append~ | append (needs ~(setq meow-use-cursor-position-hack t)~) |
96+
| I | ~meow-join~ - ~meow-append~ | insert before first character in line |
97+
| A | ~meow-line~ - ~meow-insert~ | append end of line |
98+
| o | ~meow-open-below~ | insert into line beneath |
99+
| O | ~meow-open-above~ | insert into line above |
100+
101+
* Delete and go to insert mode
102+
103+
| Vim | Meow | Description |
104+
|----------------+----------------------------+-------------------------------------------------------|
105+
| c <num> <noun> | <noun> <num> ~meow-change~ | change |
106+
| r <char> | | replace a single character and go back to normal mode |
107+
108+
109+
* Normal mode modifications
110+
111+
| Vim | Meow | Description |
112+
|------------------+-----------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
113+
| . | =meow-repeat= | repeat last command |
114+
| ~ (on lowercase) | C-x C-u (upcase-region) | uppercase char under cursor |
115+
| ~ (on uppercase) | C-x C-l (downcase-region) | lowercase char under cursor |
116+
| C-x | *Not implemented* see [[https://www.emacswiki.org/emacs/IncrementNumber][here]] | decrement number under cursor. |
117+
| C-a | *Not implemented* see [[https://www.emacswiki.org/emacs/IncrementNumber][here]] | increment number under cursor |
118+
| gUw | ~meow-word~ C-x C-u | uppercase word (works with all nouns) |
119+
| guw | ~meow-word~ C-x C-l | lowercase word (works with all nouns) |
120+
| x | ~meow-delete~ | delete under cursor |
121+
| D | ~meow-kill~ | delete to end of line |
122+
| dd | ~meow-line~ - ~meow-kill~ | delete line |
123+
| d <num> <noun> | <noun> <num> ~meow-kill~ | |
124+
| u | ~meow-undo~ | undo |
125+
| C-r | ~meow-cancel~ - ~meow-undo~ | redo; Emacs has a [[https://www.emacswiki.org/emacs/RedoMode][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 |
126+
127+
* Macros
128+
129+
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 overriden.
130+
The reason is that meow just wraps the [[https://www.emacswiki.org/emacs/KeyboardMacros][default Emacs Macro]] behavior.
131+
132+
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.
133+
134+
| Vim | Meow | Description |
135+
|--------------+---------------------------------------+---------------|
136+
| q <register> | ~meow-start-kmacro-or-insert-counter~ | start a macro |
137+
| q | ~meow-end-or-call-kmacro~ | stop a macro |
138+
| @ <register> | ~meow-end-or-call-kmacro~ | play a macro |
139+
140+
* Adjectives
141+
142+
Except for some cases, namely =meow-word=, =meow-line= and =meow-block=,
143+
meow generalizes the idea of selection in and around "things". You may
144+
select inside any "thing" by first calling =meow-inner-of-thing= and
145+
then following the onscreen prompts. Meow makes it easy to define your
146+
own "things" as well, all it takes is a pair of regular expressions!
147+
148+
| Vim | Meow | Description |
149+
|--------------+---------------------------------+-------------------------|
150+
| <action> iw | ~meow-mark-word~ <action> | current word |
151+
| <action> iW | ~meow-mark-symbol~ <action> | current symbol |
152+
| <action> i[ | ~meow-inner-of-thing~ <action> | inside square brackets) |
153+
| <action> ci[ | ~meow-bounds-of-thing~ <action> | around square brackets) |
154+
155+
* Command Mode Operations
156+
Generally there is no mode in meow similar to command mode. But there
157+
is Keypad Mode (entered with space) which let's you execute normal
158+
emacs commands without holding modifier keys. Many things done in
159+
command mode can be achieved via this mode and some common and useful
160+
examples are given here.
161+
162+
| Vim | Meow | Description |
163+
|-----+----------------------+----------------------|
164+
| :w | SPC x s | (save buffer) |
165+
| :qa | SPC m x "kill-emacs" | close vim / emacs |
166+
| :wq | SPC x c | save and close emacs |
167+
168+
* Vim Plugin
169+
170+
| Vim | Meow | Description |
171+
|----------------+----------------+-------------|
172+
| commentary.vim | ~meow-comment~ | |
173+
| vim-surround | ? | |

0 commit comments

Comments
 (0)