2011-11-23 01:31:40 +01:00
|
|
|
Vi(m) to Kakoune:
|
|
|
|
=================
|
|
|
|
|
2013-12-24 02:46:08 +01:00
|
|
|
Kakoune is inspired heavily by Vim, it strives to be as efficient as Vim,
|
2015-11-19 16:25:20 +01:00
|
|
|
more consistent and simpler. A big difference is that a lot of special
|
|
|
|
features in Vim just become regular interactions of basic features in
|
|
|
|
Kakoune.
|
2013-12-24 02:46:08 +01:00
|
|
|
|
|
|
|
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.
|
2012-11-12 19:41:50 +01:00
|
|
|
|
2011-11-23 01:31:40 +01:00
|
|
|
delete a word:
|
|
|
|
* vim: dw
|
|
|
|
* kak: wd
|
|
|
|
|
|
|
|
delete a character:
|
|
|
|
* vim: x
|
2015-04-02 20:18:15 +02:00
|
|
|
* kak: d or ;d (; reduces the selection to a single char)
|
2011-11-23 01:31:40 +01:00
|
|
|
|
|
|
|
copy a line:
|
|
|
|
* vim: yy
|
|
|
|
* kak: xy
|
|
|
|
|
|
|
|
global replace:
|
2012-12-28 14:07:53 +01:00
|
|
|
* vim: :%s/word/replacement<ret>
|
|
|
|
* kak: %sword<ret>creplacement<esc>
|
2011-11-23 01:31:40 +01:00
|
|
|
|
2013-12-24 02:46:08 +01:00
|
|
|
Explanation: '%' selects the entire buffer, 's' opens a prompt for a
|
|
|
|
regex, <ret> 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 <esc> 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<ret>
|
|
|
|
* kak: <a-i>Bsword<ret>creplacement<esc>
|
|
|
|
|
|
|
|
Here again, we need to rely on another Vim special feature, visual
|
|
|
|
mode.
|
|
|
|
|
2011-11-23 01:31:40 +01:00
|
|
|
join line with next:
|
|
|
|
* vim: J
|
|
|
|
* kak: alt-J
|
|
|
|
|
|
|
|
delete to line end:
|
|
|
|
* vim: d$
|
2012-06-02 17:48:12 +02:00
|
|
|
* kak: alt-ld or gld
|
2013-02-25 19:24:53 +01:00
|
|
|
|
|
|
|
some classic vim moves are not bound to the same key, this is due to Kakoune
|
|
|
|
using shifted moves to append to selection, so moves that were bound to non
|
|
|
|
alphabetic chars had to change.
|
|
|
|
|
|
|
|
* % become m (for matching), however m will replace selection with the next
|
|
|
|
block, if you want to get a selection from current point to next block end,
|
2013-08-28 19:53:07 +02:00
|
|
|
you should use <space>M (<space> clears the selection to one character)
|
2013-02-25 19:24:53 +01:00
|
|
|
|
|
|
|
* 0 and $ became alt-h and alt-l. Another binding is gh and gl.
|
2013-04-05 18:31:23 +02:00
|
|
|
|
|
|
|
:[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
|
2015-11-19 16:25:20 +01:00
|
|
|
selections matching (or not matching) the entered regex.
|