diff --git a/VIMTOKAK b/VIMTOKAK index d2c89f8a..80f9d0fd 100644 --- a/VIMTOKAK +++ b/VIMTOKAK @@ -1,11 +1,16 @@ Vi(m) to Kakoune: ================= -Most operations in Kakoune are reversed compared to Vim: In kak, you first -select the text you want to act on, then you edit it. This way, things are -much more consistent, as for example, kak does not need a key for delete -character, the delete key handles this just fine as long as you did not -select more than a character (but clearing selection is only one space away). +Kakoune is inspired heavily by Vim, it strives to be as efficient as Vim, +more consistent and simpler. A big differences is that a lot of special +features in Vim just become regular interaction of basic features in +Kakoune. + +Operations and moves are reversed in Kakoune. First select whatever text +you want to operate on, and then use an modifying operation. That makes +things more consistent (Vim needs a separate x and d operation because +of the operator -> move order, Kakoune only needs the d operation). That +also allows more complex selections. delete a word: * vim: dw @@ -23,6 +28,22 @@ global replace: * vim: :%s/word/replacement * kak: %swordcreplacement +Explanation: '%' selects the entire buffer, 's' opens a prompt for a +regex, validates the regex and replace the selection with one +per matches (hence, all occurences of word are selected). 'c' deletes +the selection contents and enter insert mode, replacement is typed +and goes back to normal mode. + +Note that the Kakoune version is one key less, and is not a special +feature per se, but just a nice way Kakoune features work together. + +replace in current curly braces block: + * vim: viB:s/word/replacement + * kak: Bswordcreplacement + +Here again, we need to rely on another Vim special feature, visual +mode. + join line with next: * vim: J * kak: alt-J @@ -44,4 +65,4 @@ alphabetic chars had to change. :[gv]/re/cmd to emulate :g or :v, use % to select the whole buffer, alt-s to get one selection by line, and then alt-k or alt-K in order to keep only the -selections matching (or not matching) the entered regex. +selections matching (or not matching) the entered regex.