I managed to put together a crude implementation of netrw that actually works pretty well. The code is crude at the moment too, so there may be bugs.
Often I find myself working on a file within a folder and I'd like to see the other files available within that same folder. In standard Helix you would have to launch the file picker and search for the folder name (possibly even more specific if there's similarly named folders), which hopefully we can all argee is much slower than having this information presented to you in a neat buffer.
Press -
to open Netrw. If pressed at a scratch pad, the working directory will be lauched that Helix was launched from. If pressed while a file is focused,
it will open at the directory of that file.
You'll notice that NORMAL
mode becomes NETRW
mode and you see files and folders. You can navigate just like any other buffer, but keys that would change text
or enter different modes have been disabled.
Press enter
to open. If the line under your cursor is a directory, netrw will open that directory and you will remain within netrw. If it's a file, that file will be opened and the netrw
buffer will close.
I'd like to figure out how to color the directories so that they stand out more. I'd also like to place symbols in front of them like a folder or the icon for whatever language the file is. The super long term goal would be to be able to edit the buffer and have it edit the actual file system like oil.nvim does. I fear that Helix is not currently equipped for such asks... from what I can tell it's not very flexible from how the devs designed it and I don't know enough about the project to build something like that from scratch.
- Implement VIM motions as closely as possible
- Reuse Helix's already implemented functions as much as possible
- Integrate lazygit into Helix somehow (very long term goal)
- Integrate an oil.nvim style file browser (very long term goal)
-
v
w/W
b/B
e/E
-
vi
(select inside textobject) andva
(select around textobject)w/W
p
- treesitter objects
f
for functiont
for typea
for argumentc
for commentT
for test
- pairs
{
(
[
- etc
NOTE: The pairs matching first looks for any surrounding pair and if not found, will search for the next one forward
-
vt
andvf
- i.e.
vt"
orvT"
to select until"
forward or backwards - i.e.
vf"
orvF"
to select to"
forward or backwards - using a count like
3vf"
- i.e.
-
V
enters visual line mode
-
dd
deletes entire line- accepts counts like
3dd
to delete 3 lines
- accepts counts like
-
D
to delete from cursor to end of line -
d
w/W
b/B
e/E
-
di
(select inside textobject) andda
(select around textobject)-
w/W
-
p
-
treesitter objects
f
for functiont
for typea
for argumentc
for commentT
for test
-
pairs
{
(
[
- etc
NOTE: The pairs matching first looks for any surrounding pair and if not found, will search for the next one forward
-
-
dt
anddf
- i.e.
dt"
ordT"
to delete until"
forward or backwards - i.e.
df"
ordF"
to delete to"
forward or backwards - using a count like
3df"
- i.e.
-
C
to change from cursor to end of line -
c
w/W
b/B
e/E
-
ci
(select inside textobject) andca
(select around textobject)-
w/W
-
p
-
treesitter objects
f
for functiont
for typea
for argumentc
for commentT
for test
-
pairs
{
(
[
- etc
NOTE: The pairs matching first looks for any surrounding pair and if not found, will search for the next one forward
-
-
ct
andcf
- i.e.
ct"
orcT"
to change until"
forward or backwards - i.e.
cf"
orcF"
to change to"
forward or backwards - using a count like
3cf"
- i.e.
-
yy
yanks entire line- accepts counts like
3yy
to yank 3 lines
- accepts counts like
-
y
w/W
b/B
e/E
-
yi
(select inside textobject) andya
(select around textobject)-
w/W
-
p
-
treesitter objects
f
for functiont
for typea
for argumentc
for commentT
for test
-
pairs
{
(
[
- etc
NOTE: The pairs matching first looks for any surrounding pair and if not found, will search for the next one forward
-
-
yt
andyf
- i.e.
yt"
oryT"
to yank until"
forward or backwards - i.e.
yf"
oryF"
to yank to"
forward or backwards - using a count like
3yf"
- i.e.
- Normal and Insert modes no longer selects as you go (removes Helix default behavior)
- Helix shows available options for keys as you press them
w/W
,e/E
, andb/B
all go to the correct spot of wordt
andf
- i.e.
t"
orT"
to move until"
forward or backwards - i.e.
f"
orF"
to move to"
forward or backwards - using a count like
3f"
- i.e.
S
to change entire line$
to go to end of line^
to go to first non-whitespace of line0
to go to beginning of line%
to go to matching pair beneath cursor
- Enter Visual mode by pressing
vv
because I haven't figured out how to set a timer to default to Visual mode if nothing is pressed immediately afterv
- Currently there is no Visual Block mode because I think Visual mode combined with multicursor does the same thing
- Helix seems to add an additional block that the cursor can be moved to at the end of every line
- When using
dd
oryy
commands, the cursor position is not kept - Motions like
cip
orcif
do not search for next occurence of paragraph or function - Motions with pairs like
ci{
do not work with a count - Comments
- Implement
gcc
to comment in Normal mode - Implement
gc
to comment in Visual mode - Implement
gb
to block comment in Visual mode
- Implement
- Probably lots of motions with counts that don't work
- Refactor evil functions to match Helix architecture (i.e.
_impl
functions) - Refactor tests for new motions and behavior (very long term goal)
Contributing guidelines can be found here.
I reserve the right to reject any suggestions or PRs for this fork.