1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 07:15:52 +03:00
kakoune/VIMTOKAK

77 lines
2.6 KiB
Plaintext
Raw Normal View History

2011-11-23 04:31:40 +04:00
Vi(m) to Kakoune:
=================
Kakoune is inspired heavily by Vim. It strives to be as efficient as Vim,
2015-11-19 18:25:20 +03: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 05:46:08 +04: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 22:41:50 +04:00
2011-11-23 04:31:40 +04:00
delete a word:
* vim: dw
* kak: wd
delete a character:
* vim: x
2015-04-02 21:18:15 +03:00
* kak: d or ;d (; reduces the selection to a single char)
2011-11-23 04:31:40 +04:00
copy a line:
* vim: yy
* kak: xy
global replace:
2012-12-28 17:07:53 +04:00
* vim: :%s/word/replacement<ret>
2022-12-04 16:18:03 +03:00
* kak: %sword<ret>creplacement<esc>,
2011-11-23 04:31:40 +04:00
2013-12-24 05:46:08 +04: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 16:18:03 +03: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 05:46:08 +04: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 16:18:03 +03: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 05:12:03 +03:00
replace in current curly brace block:
2013-12-24 05:46:08 +04: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 05:46:08 +04:00
2011-11-23 04:31:40 +04:00
join line with next:
* vim: J
2020-12-23 21:59:18 +03:00
* kak: <a-J>
2011-11-23 04:31:40 +04:00
delete to line end:
* vim: d$
2020-12-23 21:59:18 +03:00
* kak: <a-l>d or Gld
2013-02-25 22:24:53 +04: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 22:24:53 +04: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 22:24:53 +04:00
* 0 and $ became <a-h> and <a-l>. Equivalent bindings are gh and gl.
2013-04-05 20:31:23 +04: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 18:25:20 +03:00
selections matching (or not matching) the entered regex.