-
Notifications
You must be signed in to change notification settings - Fork 330
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
Shell expansions passing to commands #1175
Comments
I don't really understand your question, but you can use
|
This edits the currently selected file. I want to edit a file in another directory. |
@avidseeker You can use |
This is I'm basically trying to mimic |
@avidseeker I forgot to comment on the expansion part. I agree it is unusual for completion to work in this case. Either we should expand the parameters or completion should not work. On the top of my head, expanding all parameters might be problematic if there is no way to avoid the expansion. For example, shell expands |
Sorry, you are right. I'm a little confused because I have been chain commenting on multiple issues and PRs at the same time. |
@avidseeker The reason why I guess it would be possible to have Anyway even if # Substituting text via ${parameter/pattern/string} is specific to bash, using sed probably works too
cmd e $nvim ${1/#~/$HOME} |
I'm getting
The reason for proposing this is that typing |
I think that might be because you don't use
When you type When you define Regarding the part about quoting the tilde, the quotes only apply on |
I think it's worth mentioning the issue #1219 here as well. There seems to be a desire for Currently Lines 2081 to 2087 in f04401b
While I think it's possible to have |
I was playing around with the parser, and it turns out it's not too difficult to expand the tilde during the parsing stage after all. I have submitted a PR: #1246 I am not a huge fan of having the parser depend on the |
Turns out @gokcehan isn't a fan of this either 😂. Instead we have agreed on an alternative approach where the tilde is expanded during the autocompletion stage (e.g. |
I think #1254 is related. Though, the auto-completion mechanism doesn't immediately solve that. We could, in principle, have some special syntax for expanding environment variables and ~ in the command line. At the moment, I don't have a great idea of what that would look like exactly. The simplest option would be to have a special prefix from shell commands - so |
If we go with auto-completion, an awkward way to use it inside a config would be
|
i don't thank that that is related, as that issue is due to the % signs being hardcoded in the os_windows.go file |
I think what @ilyagr meant was that even if the value
Because the shell is already capable of substituting variables, Regarding #1254, the default settings are catered towards users with a default setup (i.e. CMD as the shell). If you have gone to the trouble of installing a different shell on Windows then I guess it's reasonable to expect that the default settings may no longer work out of the box? At the end of the day they are just defaults, so you can override them in your config file, that is what config files are there for. Of course, this is just my own opinion, but I'm not really convinced that the default Windows shell syntax is much of an issue if it can be solved by configuration. |
My suggestion was that +1 to your other points. I'm quite unsure about this being a good direction to go in. |
Thank you for your work. The PR works great, but one minor nitpick: it doesn't seem to cover home user expansion. E.g: |
@avidseeker What is your use case exactly? Are you saying that you have a directory that is literally called And is this related to autocompletion at all? |
BTW I think the culprit might be this function: Lines 18 to 23 in a9d90bc
And perhaps the condition should be changed to |
Not all people know this type of autocompletion, that's why I said it's a minor nitpick, and so it's ok if not implemented. See: https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html E.g: |
It's a really weird kind of expansion; it seems to check whether the user exists:
|
Oh OK I actually had no idea that there was more to tilde expansion. I am not really sure whether it's worth implementing since the You're welcome to create a separate new issue for this though, if you think it warrants further discussion. |
cmd e $nvim $1
is defined in lfrc.Entering
:e /home/user/somefile
works. But:e ~/somefile
doesn't (although tab completion works).The text was updated successfully, but these errors were encountered: