helix
helix copied to clipboard
Add command to read file contents into current buffer (vim's `:r`)
I often use :r filename.txt to read a file into the current buffer on vim, but I could't find this feature in helix. There is shell_insert_output and shell_append_output which can be used together with cat to simulate this, but that has the drawback of not supporting things like tab-completion for paths and seems too complicated for such a basic feature.
My suggestion would be to either add a file_insert/append_contents or even better to use the existing file-picker dialog (<space>-f) and expand it's functionality with a shortcut to paste in the contents of the selected file, e.g.:
- Open picker
<space>-f - Type part of filename until it's selected
- Press
<Ctrl>-oor<Ctrl>-O>to paste contents of selected file at end/beginning of current buffer (or any other choosen key)
Furthermore, the :r (or :read) commands don't exist yet and would therefore not interfere with anything existing, I think it would be good idea to add those.
Yes please!
I will give this issue a shot 👍 Could I just clarify the requirements? @pinpox Based on my understanding, you seem to have 2 different ideas of solving this issue.
- opening the picker and then using ctrl-o
- using the vim style of :read
Are you proposing to do both?
Thank you!
edit: Only realised after submitting a PR that there are already 2 ongoing PRs for this issue. But I'll leave this here nonetheless(: Happy to receive any feedback.