-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Migrating from Vim
Note: As Helix is inspired by Vim and Kakoune, the keybindings are similar but also have some differences. The content of this page is inspired by Kakoune Wiki.
NOTE: Unlike vim, f
, F
, t
and T
are not confined to the current line.
delete a word:
- vim:
dw
- helix:
wd
change a word:
- vim:
cw
- helix:
ec
orwc
(includes the whitespace after the word)
delete a character:
- vim:
x
- helix:
d
or;d
(;
reduces the selection to a single char)
copy a line:
- vim:
yy
- helix:
xy
global replace:
- vim:
:%s/word/replacement/g<ret>
- helix:
%sword<ret>creplacement<esc>
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 then <esc>
goes back to normal mode.
go to last line:
- vim:
G
- helix:
ge
go to line start:
- vim:
0
- helix:
gh
go to line first non-blank character:
- vim:
^
- helix:
gs
go to line end:
- vim:
$
- helix:
gl
delete to line end:
- vim:
D
- helix:
vgld
ort<ret>d
Note: v
is used along with gl
(go to line end), because gl
does not select text.
t<ret>
selects "'til" the newline represented by <ret>
.
jump to matching bracket:
- vim:
%
- helix:
mm
auto complete:
- vim:
C-p
- helix:
C-x
comment lines:
- vim: no keybinding by default. Using something like vim-commentary adds this functionality
- helix:
C-c
search for the word under the cursor:
- vim:
*
- helix:
A-o*n
(if there's an LSP) orbe*n
Explanation: if there's an LSP, A-o
expands selection to the parent syntax node (with would be the word in our case). Then *
uses the current selection as the search pattern, and n
goes to the next occurence. b
selects to the begining of the word, and e
selects to the end of the word, effectively selecting the whole word.
block selection:
- vim:
C-v
, then expand your selection vertically and horizontally - helix: There's no "block selection" mode, so instead you'd use multiple cursors. Expand your block selection vertically by adding new cursors on the line below with
C
, and horizontally using standard movements
search "foo" and replace with "bar" in the current selection:
- vim:
:s/foo/bar/g<ret>
- helix:
sfoo<ret>cbar<esc>,
Explanation: s
will open a prompt in the command line for a regex, and select all matches inside the selection (effectively adding a new cursor on each match). Pressing enter will then finalise this step, and allow the c
to change the selections to "bar". When done, go back to normal mode with <esc>
, and keep only the primary selection with ,
(remove all the additional cursors).
select the whole file:
- vim:
ggVG
- helix:
%
reload a file from disk:
- vim:
:e<ret>
- helix:
:reload<ret>
(or:reload-all<ret>
to reload all the buffers)
run shell command:
- vim:
:!command
- helix:
:sh command
setting a bookmark (bookmarking a location):
- vim:
ma
to set bookmark with name a. Use`a
to go back to this bookmarked location. - helix: there are no named bookmarks, but you can save a location in the jumplist with
C-s
, then jump back to that location by opening the jumplist picker with<space>-j
, or back in the jumplist withC-o
and forward withC-i
Helix allows some limited movement in insert
mode without switching to normal
mode.