helix
helix copied to clipboard
feat: add `workspace_directory` and `current_working_directory` variable expansions
Use case: Recently Yazi added out-of-the-box support for usage inside of Helix with with command:
[keys.normal]
space.E = [
':sh rm -f /tmp/unique-file',
':insert-output yazi %{buffer_name} --chooser-file=/tmp/unique-file',
':insert-output echo "\x1b[?1049h" > /dev/tty',
':open %sh{cat /tmp/unique-file}',
':redraw',
]
This replaces file_explorer_in_current_buffer_directory for me with a Yazi picker
I would like to be able to replace these two commands with Yazi as well:
file_explorer(uses workspace root)file_explorer_in_current_directory(cwd)
This PR allows for that. Now you can do this too:
# file_explorer
space.e = [
':sh rm -f /tmp/unique-file2',
':insert-output yazi %{workspace_directory} --chooser-file=/tmp/unique-file2',
':insert-output echo "\x1b[?1049h" > /dev/tty',
':open %sh{cat /tmp/unique-file2}',
':redraw',
]
# file_explorer_in_current_working_dir
space.X = [
':sh rm -f /tmp/unique-file3',
':insert-output yazi %{workspace_directory} --chooser-file=/tmp/unique-file3',
':insert-output echo "\x1b[?1049h" > /dev/tty',
':open %sh{cat /tmp/unique-file3}',
':redraw',
]
Regarding the recipe site this is already included.
I would consider that a bug in the wiki. The wiki should not suggest things that aren't merged yet.
I would consider that a bug in the wiki. The wiki should not suggest things that aren't merged yet.
Fixed by removing from the wiki
I would consider that a bug in the wiki. The wiki should not suggest things that aren't merged yet.
Fixed by removing from the wiki
@nik-rev Now this is merged should it be added back or wait till it's in a release?
Also wonder if your space.e example above had a typo in it using %{buffer_name}(from your config) makes more sense to me because it takes you to the current buffer directory and highlights the file you're in.
Other random suggestion:
":open %sh{cat /tmp/unique-file-u41ae14 | head -n1}",
If you mark multiple files with yazi and press enter, :open won't be able to handle it. The above just uses the first one. Perhaps it could do something more clever to actually handle opening multiple buffers at once