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
Enhanced prepending commands to command line #7905
Conversation
I finally simplified the function as @faho asked me and there's no |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry if I made the changes the wrong way... It should be ok this time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has not been marked as done (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is misspelled as __fish_commandlin_prepend
, also there's still a use of __fish_prepend
which doesn't exist. Please squash your commits into one. Thanks!
Can we have a similar function for appending? We already have |
This looks ready for 3.3.0? |
No, there are some issues remaining - spurious The two functions are not fully symmetrical. The "append" one ought to add to a whole job, but the "prepend" one is just for the current process. This also needs some changes. I started working on this but I'm not done yet. |
I ended up rewriting the functions a bit, let me know if I should add rationale. |
I almost always use this on the last/only job in a commandline, so the semicolon is usually not needed. We have always added it but I prefer not dropping it: this feels cleaner because it's what you'd type without the shortcut.
No behavior change intended. Will use the "buffer_part" computation in the next commit.
…ss/job With a command line like a | b <cursor> | c "commandline -C 0 --current-process" will place the cursor just left of "b".
This introduces two functions to - toggle a process prefix, used for adding "sudo" - add a job suffix, used for adding "&| less" Not sure if they are very useful; we'll see. Closes #7905
Merging just in time for 3.3.0, thanks! |
Description
There was a function called
__fish_prepend_sudo
which is very useful and I made some others for commands likegit
,nvim
and so. But it is a bit messy to define myself a whole lot of functions with just a word changing between them. I just created a "super-prepending" function :__fish_prepend
. There's no more need for__fish_prepend_sudo
so I deleted it and changed its occurences in the other files.This function is some lines longer than
__fish_prepend_sudo
because it needs to read arguments so it's obviously a little bit slower, but it doesn't affect the user experience and it has also a lot more features :-p
or--previous
flags, you can add the last command in the history to the command line (Let__fish_prepend_sudo
use the last commandline if there is no current one #7079)sudo
acts smartly with prepending (prepends/removes after the wordsudo
if the value is notsudo
👍)-h
and--help
All it needs is at least one argument that isn't one of
-h
,--help
,-p
or--previous
and it manages itself how to prepend or remove the value to/from the beginning of the lines. I put comments in the code so it's more readable, feel free to take a look!TODOs:
Changes to fish usage are reflected in user documentation/manpages.There's no place in the doc for this function. However, fish users should know__fish_prepend
replaces__fish_prepend
...