-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helix-term: introduce cdf / change-directory-to-current-file #3523
Conversation
It's been a while since I last contributed here, so please don't be shy on telling me how I can improve / make this better :) |
IMHO |
I don't mind if there's a command for going to the project root, but I would really like a command like this that allows me to go to the directory a file is in, and not the project root. I usually start helix from the project root anyways, so that would be a completely useless no-op in almost every case of mine. Here's an example where I would find this supremely useful: in Nix, where relative paths are relative to the file referencing the path, it's nice to be able to make a new file just by I'd be glad to introduce another command with this ability ( If there is no interest in this functionality whatsoever, please let me know and I'll move on. (I'll fix the docs if we decide to merge this feature either as |
I think Adding a |
I think it would be a useful command that we want, but I’m a bit unsure about the naming. What about
I agree with that, it feels more natural to me. I also expect this behavior to come in handy once a command such as
I really like the |
I've rebased on the latest EDIT: |
42e0f0a
to
c833187
Compare
I think the change here looks good. I wonder if it's necessary to optimize this use-case so much though? There are a few other ways that I think could be fast enough:
|
I'd be somewhat OK with 2. I don't really manually use registers, so 1 would be inconvenient for me. Maybe I'm misunderstanding 3, but I also wouldn't want helix to need to call out to a shell in order to support this. An unmentioned 4th option that I would also be happy with, is allowing |
This will set the current working directory to that of the current file's parent.
Hi there! Now that 23.10 has released, is there anything I can do to help get this merged? |
this has been added in the latest release, with the command expansion PR we want to implement soon it will be possible to add a keymap for this without a dedicated builtin command so I would lean towards not merging this |
Good to know, thanks! I'll close this and carry the patch locally until that comes about :) |
Now that #4709 has merged, here's a macro you can use to get this functionality! [keys.normal.space]
"c" = "@:cd <C-r>%<C-w><ret>" Pressing spacec will |
Fixes: #3519.