kakoune/VIMTOKAK

77 lines
2.6 KiB
Plaintext
Raw Normal View History

2011-11-23 01:31:40 +01:00
Vi(m) to Kakoune:
=================
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 a modifying operation. That makes
things more consistent: Vim needs separate x and d operations because
of the operator -> move order, while Kakoune only needs the d operation.
Selecting first 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>
2022-12-04 14:18:03 +01:00
* 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 replaces the selection with one
per match (hence all occurences of "word" are selected). 'c' deletes
2022-12-04 14:18:03 +01:00
the selection contents and enters insert mode where "replacement" is
typed, and <esc> goes back to normal mode. The final ',' gets rid of
multiple cursors.
2013-12-24 02:46:08 +01:00
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.
2022-12-04 14:18:03 +01:00
global interactive replace:
* vim: :%s/word/replacement/gc<ret>
and then keep pressing 'y' to accept the change or 'n' to reject.
* kak: /word<ret>creplacement<esc>
and then press 'n' to search for the next occurence and either '.'
to redo the last insert operation (that is replace 'word' with
'replacement') or 'n' to go to the next match.
2021-06-13 04:12:03 +02:00
replace in current curly brace block:
2013-12-24 02:46:08 +01:00
* vim: viB:s/word/replacement<ret>
* kak: <a-i>Bsword<ret>creplacement<esc>
Here again, Vim had to rely on a special feature, visual mode.
2013-12-24 02:46:08 +01:00
2011-11-23 01:31:40 +01:00
join line with next:
* vim: J
2020-12-23 19:59:18 +01:00
* kak: <a-J>
2011-11-23 01:31:40 +01:00
delete to line end:
* vim: d$
2020-12-23 19:59:18 +01:00
* kak: <a-l>d or Gld
2013-02-25 19:24:53 +01:00
Some classic Vim moves are not bound to the same key. Kakoune
uses shifted moves to extend the selection, so Vim moves that were bound to
shifted characters had to change.
2013-02-25 19:24:53 +01:00
* % became m (for "matching"). However, m replaces the selection with the next
block. If you want to get a selection from the current point to the next
block's end, you should use ;M (; reduces the selection to one character).
2013-02-25 19:24:53 +01:00
* 0 and $ became <a-h> and <a-l>. Equivalent bindings are 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, <a-s> to get
one selection per line, and then <a-k> or <a-K> to keep only the
2015-11-19 16:25:20 +01:00
selections matching (or not matching) the entered regex.