VIMTOKAK (2673B)
1 Vi(m) to Kakoune: 2 ================= 3 4 Kakoune is inspired heavily by Vim. It strives to be as efficient as Vim, 5 more consistent and simpler. A big difference is that a lot of special 6 features in Vim just become regular interactions of basic features in 7 Kakoune. 8 9 Operations and moves are reversed in Kakoune. First select whatever text 10 you want to operate on, and then use a modifying operation. That makes 11 things more consistent: Vim needs separate x and d operations because 12 of the operator -> move order, while Kakoune only needs the d operation. 13 Selecting first also allows more complex selections. 14 15 delete a word: 16 * vim: dw 17 * kak: wd 18 19 delete a character: 20 * vim: x 21 * kak: d or ;d (; reduces the selection to a single char) 22 23 copy a line: 24 * vim: yy 25 * kak: xy 26 27 global replace: 28 * vim: :%s/word/replacement<ret> 29 * kak: %sword<ret>creplacement<esc>, 30 31 Explanation: '%' selects the entire buffer, 's' opens a prompt for a 32 regex, <ret> validates the regex and replaces the selection with one 33 per match (hence all occurences of "word" are selected). 'c' deletes 34 the selection contents and enters insert mode where "replacement" is 35 typed, and <esc> goes back to normal mode. The final ',' gets rid of 36 multiple cursors. 37 38 Note that the Kakoune version is one key less, and is not a special 39 feature per se, but just a nice way Kakoune features work together. 40 41 global interactive replace: 42 * vim: :%s/word/replacement/gc<ret> 43 and then keep pressing 'y' to accept the change or 'n' to reject. 44 * kak: /word<ret>creplacement<esc> 45 and then press 'n' to search for the next occurence and either '.' 46 to redo the last insert operation (that is replace 'word' with 47 'replacement') or 'n' to go to the next match. 48 49 replace in current curly brace block: 50 * vim: viB:s/word/replacement<ret> 51 * kak: <a-i>Bsword<ret>creplacement<esc> 52 53 Here again, Vim had to rely on a special feature, visual mode. 54 55 join line with next: 56 * vim: J 57 * kak: <a-J> 58 59 delete to line end: 60 * vim: d$ 61 * kak: <a-l>d or Gld 62 63 Some classic Vim moves are not bound to the same key. Kakoune 64 uses shifted moves to extend the selection, so Vim moves that were bound to 65 shifted characters had to change. 66 67 * % became m (for "matching"). However, m replaces the selection with the next 68 block. If you want to get a selection from the current point to the next 69 block's end, you should use ;M (; reduces the selection to one character). 70 71 * 0 and $ became <a-h> and <a-l>. Equivalent bindings are gh and gl. 72 73 :[gv]/re/cmd 74 To emulate :g or :v, use % to select the whole buffer, <a-s> to get 75 one selection per line, and then <a-k> or <a-K> to keep only the 76 selections matching (or not matching) the entered regex.