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

Option for retain_last_search to include arguments #220

Closed
syserr0r opened this Issue Jul 31, 2017 · 19 comments

Comments

Projects
None yet
2 participants
@syserr0r

syserr0r commented Jul 31, 2017

I frequently open multiple PuTTY sessions to the same host and when using launchy it would remember the whole command (ssh 127.0.0.1) so all I needed to do was press Enter; with Keypirinha it only remembers the command not the arguments (ssh) so I need to enter the full host again.

It would be great if Keypirinha had an option to remember the arguments too (as far as I can tell this does not currently exist)!

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Jul 31, 2017

Member

By command, you mean the remote command that is to be launched by the SSH server once connected, or the command line used to launch PuTTY itself?

Member

polyvertex commented Jul 31, 2017

By command, you mean the remote command that is to be launched by the SSH server once connected, or the command line used to launch PuTTY itself?

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Jul 31, 2017

I mean the command line launched to use PuTTY itself.

For example, I might open an ssh session to 192.168.1.1:

  1. [Keypirinha hotkey]
  2. ssh
  3. [tab]
  4. 192.168.1.1
  5. [enter]

Then if I want to open another PuTTY session to 192.168.1.1 (for tailing a log or something) I would want to just:

  1. [Keypirinha hotkey] (showing ssh 192.168.1.1 as the last command)
  2. [enter]

At the moment I have to:

  1. [Keypirinha hotkey] (showing ssh as the last command)
  2. [tab]
  3. 192.168.1.1
  4. [enter]

syserr0r commented Jul 31, 2017

I mean the command line launched to use PuTTY itself.

For example, I might open an ssh session to 192.168.1.1:

  1. [Keypirinha hotkey]
  2. ssh
  3. [tab]
  4. 192.168.1.1
  5. [enter]

Then if I want to open another PuTTY session to 192.168.1.1 (for tailing a log or something) I would want to just:

  1. [Keypirinha hotkey] (showing ssh 192.168.1.1 as the last command)
  2. [enter]

At the moment I have to:

  1. [Keypirinha hotkey] (showing ssh as the last command)
  2. [tab]
  3. 192.168.1.1
  4. [enter]
@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Jul 31, 2017

Member

Keypirinha's PuTTY plugin allows you to do just that. Just ensure it is enabled (it is by default) and properly configured. It will then automatically detect the PuTTY sessions you have configured and add one item for each to KP's catalog (named like PuTTY: My Session Name, depending on the PuTTY flavor you have installed).

Member

polyvertex commented Jul 31, 2017

Keypirinha's PuTTY plugin allows you to do just that. Just ensure it is enabled (it is by default) and properly configured. It will then automatically detect the PuTTY sessions you have configured and add one item for each to KP's catalog (named like PuTTY: My Session Name, depending on the PuTTY flavor you have installed).

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Jul 31, 2017

I'm using the PuTTY plugin (with a different label). I am not using sessions, hence why I am looking to have not just the last command remembered but the arguments too. This could apply to running any application with arguments, not just PuTTY

syserr0r commented Jul 31, 2017

I'm using the PuTTY plugin (with a different label). I am not using sessions, hence why I am looking to have not just the last command remembered but the arguments too. This could apply to running any application with arguments, not just PuTTY

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Jul 31, 2017

Member

Then just rely on the Apps plugin. Ensure your PuTTY executable is included by referencing its path to your system's PATH or by adding it to the extra_paths setting of the Apps plugin. Then launch PuTTY with the desired args. Your args will be kept in history so a new PuTTY item will be visible at search time with those args.

Member

polyvertex commented Jul 31, 2017

Then just rely on the Apps plugin. Ensure your PuTTY executable is included by referencing its path to your system's PATH or by adding it to the extra_paths setting of the Apps plugin. Then launch PuTTY with the desired args. Your args will be kept in history so a new PuTTY item will be visible at search time with those args.

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Jul 31, 2017

I already have history for PuTTY sessions, having to hunt for the session in a list isn't what I'm looking for (especially since it isn't in 'most recent' order), I just want to be able to hit my Keypirinha shortcut and hit ENTER and have it run the last thing I did.

Is the source to Keypirinha avaiable somewhere, it sounds like a simple change?

syserr0r commented Jul 31, 2017

I already have history for PuTTY sessions, having to hunt for the session in a list isn't what I'm looking for (especially since it isn't in 'most recent' order), I just want to be able to hit my Keypirinha shortcut and hit ENTER and have it run the last thing I did.

Is the source to Keypirinha avaiable somewhere, it sounds like a simple change?

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Jul 31, 2017

Member

You do not have to "hunt" for the item with the args, just use the appropriate search term or associate a keyword to the desired item. I suggest you read carefully at least this part of the documentation.

Member

polyvertex commented Jul 31, 2017

You do not have to "hunt" for the item with the args, just use the appropriate search term or associate a keyword to the desired item. I suggest you read carefully at least this part of the documentation.

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Jul 31, 2017

The argument is not pre-populated, therfore I have to find it (hence "hunt"). Testing this just now shows I need to enter enough of the argument for it to appear and then use the arrow keys to highlight it (in which case I might as well re-type the whole argument).

To elaborate, after running: ssh foobar-db.example.com and launching Keypirinha again (which now has ssh) I need to type foobar to narrow the results down to even have the correct entry appear, then press the down arrow key twice to get to ssh foobar-db.example.com (from a list of ssh foo, ssh foobar.example.com, ssh foobar-db.example.com and foobar.other.example.com).

This means:

  • I need to type a command that I had just typed (even with the windows built in Win + R run box I can just press enter to run the last command I typed)
    • Involves typing a long hostname I just typed (slow/error prone due to typos)

or

  • I need to type enough of the command for it to appear and highlight it
    • Invoves typing enough to choose a historical command and selecting it (needs my explicit attention to find the right command/error prone due to typos or selecting the wrong entry)

The benefit to me of having the last command pre-populated is that:

  • There is no chance of errors from either selecting the wrong entry or mis-keying
  • It is incredibly fast as all that is needed is to launch Keypirinha and press enter
  • Because of the above, it does not require my focus so I can re-run a command while still focusing on another screen or task

Is there anything more I can do or explain to help?
If this isn't something you're willing or able to implement then I probably ought to stop here.

syserr0r commented Jul 31, 2017

The argument is not pre-populated, therfore I have to find it (hence "hunt"). Testing this just now shows I need to enter enough of the argument for it to appear and then use the arrow keys to highlight it (in which case I might as well re-type the whole argument).

To elaborate, after running: ssh foobar-db.example.com and launching Keypirinha again (which now has ssh) I need to type foobar to narrow the results down to even have the correct entry appear, then press the down arrow key twice to get to ssh foobar-db.example.com (from a list of ssh foo, ssh foobar.example.com, ssh foobar-db.example.com and foobar.other.example.com).

This means:

  • I need to type a command that I had just typed (even with the windows built in Win + R run box I can just press enter to run the last command I typed)
    • Involves typing a long hostname I just typed (slow/error prone due to typos)

or

  • I need to type enough of the command for it to appear and highlight it
    • Invoves typing enough to choose a historical command and selecting it (needs my explicit attention to find the right command/error prone due to typos or selecting the wrong entry)

The benefit to me of having the last command pre-populated is that:

  • There is no chance of errors from either selecting the wrong entry or mis-keying
  • It is incredibly fast as all that is needed is to launch Keypirinha and press enter
  • Because of the above, it does not require my focus so I can re-run a command while still focusing on another screen or task

Is there anything more I can do or explain to help?
If this isn't something you're willing or able to implement then I probably ought to stop here.

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Jul 31, 2017

To add, I deal with a large number of similar (but different) commands that change frequently, so making a keyword for each one isn't practical.

syserr0r commented Jul 31, 2017

To add, I deal with a large number of similar (but different) commands that change frequently, so making a keyword for each one isn't practical.

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Jul 31, 2017

Member

If this isn't something you're willing or able to implement then I probably ought to stop here.

No it's just that I fail to see what more could be implemented here. KP already offers what you asked but in different ways than what you are used to have with Launchy or Win+R:

  • If you want to launch the last executed item, access the history by pressing Down (or Ctrl+Down in your case since you seem to have enabled the retain_last_search option)
  • If you want to launch a specific item (for example, because you know that this is not the very last executed item you want to launch this time), using your example above, typing sshfoo for example would very probably narrow down the possibilities to something acceptable

Those two cases work regardless of the presence of arguments. Also, both can be achieved with pretty much the same number of keystrokes as long as you manage to use the right search term to differentiate them.

Now, if you feel like you would have to use the Ctrl+Down feature a lot, what I can do is to add a special hotkey that would launch KP with the history list shown directly so to eliminate the Ctrl+Down step. That, plus the two cases above, should cover your needs.

If every solution I offered so far does not fit because you think your use case is too extreme (... large number of similar (but different) commands that change frequently ...), I would probably suggest you to change/adapt that part of your workflow in order to automatize it in a different way. Either by creating a dedicated Keypirinha plugin, or by creating your own set of specialized trampoline scripts.

Member

polyvertex commented Jul 31, 2017

If this isn't something you're willing or able to implement then I probably ought to stop here.

No it's just that I fail to see what more could be implemented here. KP already offers what you asked but in different ways than what you are used to have with Launchy or Win+R:

  • If you want to launch the last executed item, access the history by pressing Down (or Ctrl+Down in your case since you seem to have enabled the retain_last_search option)
  • If you want to launch a specific item (for example, because you know that this is not the very last executed item you want to launch this time), using your example above, typing sshfoo for example would very probably narrow down the possibilities to something acceptable

Those two cases work regardless of the presence of arguments. Also, both can be achieved with pretty much the same number of keystrokes as long as you manage to use the right search term to differentiate them.

Now, if you feel like you would have to use the Ctrl+Down feature a lot, what I can do is to add a special hotkey that would launch KP with the history list shown directly so to eliminate the Ctrl+Down step. That, plus the two cases above, should cover your needs.

If every solution I offered so far does not fit because you think your use case is too extreme (... large number of similar (but different) commands that change frequently ...), I would probably suggest you to change/adapt that part of your workflow in order to automatize it in a different way. Either by creating a dedicated Keypirinha plugin, or by creating your own set of specialized trampoline scripts.

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Jul 31, 2017

That was helpful, I was not aware of the Ctrl+Down option to access history.

While not ideal, it could work if I could tweak it a bit:

  • Is there any way to make the default behaviour to populate the last executed item/first item in history?
  • If not, is there any way to change/customize Ctrl+Down to a key combintation that doesn't require moving my right hand to the arrow keys?

This still feels like an awkward way of aproaching what I am trying to achieve, part of the benefit is being able to alter the last command only slightly (or fix a typo).

For example, with my proposed modification, if I launch KP and run ssh very.long.subdomain.example.con (after dismissing the error from being unable to resolve the domain) I could launch KP, and correct it in a couple of key strokes [press Right or End followed by Backspace and m to correct the typo] instead of re-typing the whole domain.

Alternatively, if I launch KP and run command --arg=foo --arg2=bar c:\path\to\folderA I could then launch KP and change it to command --arg=foo --arg2=bar c:\path\to\folderB in 3 key-presses.

It seems like adding an option to keep the last arguments as well as the last command would be a simple change, is there a reason you're averse to this? Is it difficult change, not something you want to implement or something else?

If it is something I can achieve with a plugin I will certainly try, but I was under the impression I wouldn't be able to do this in a plugin.

syserr0r commented Jul 31, 2017

That was helpful, I was not aware of the Ctrl+Down option to access history.

While not ideal, it could work if I could tweak it a bit:

  • Is there any way to make the default behaviour to populate the last executed item/first item in history?
  • If not, is there any way to change/customize Ctrl+Down to a key combintation that doesn't require moving my right hand to the arrow keys?

This still feels like an awkward way of aproaching what I am trying to achieve, part of the benefit is being able to alter the last command only slightly (or fix a typo).

For example, with my proposed modification, if I launch KP and run ssh very.long.subdomain.example.con (after dismissing the error from being unable to resolve the domain) I could launch KP, and correct it in a couple of key strokes [press Right or End followed by Backspace and m to correct the typo] instead of re-typing the whole domain.

Alternatively, if I launch KP and run command --arg=foo --arg2=bar c:\path\to\folderA I could then launch KP and change it to command --arg=foo --arg2=bar c:\path\to\folderB in 3 key-presses.

It seems like adding an option to keep the last arguments as well as the last command would be a simple change, is there a reason you're averse to this? Is it difficult change, not something you want to implement or something else?

If it is something I can achieve with a plugin I will certainly try, but I was under the impression I wouldn't be able to do this in a plugin.

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Aug 1, 2017

Member

Is there any way to make the default behaviour to populate the last executed item/first item in history?

This is the default and only behavior of the history list ATM. Last executed items come first in the list.

This still feels like an awkward way of aproaching what I am trying to achieve, part of the benefit is being able to alter the last command only slightly (or fix a typo). ...

It is already possible to alter the args of an item by searching for it, either in normal mode or in history mode, then press Tab. KP will then offer you to edit item's args, if any, or to append some.

Really I fail to see what change there is to be done here. Everything you asked so far is already doable in KP (and documented) except the special feature to launch KP in history mode directly, that I mentioned in my previous comment, and that I'm willing to implement if needed.

Member

polyvertex commented Aug 1, 2017

Is there any way to make the default behaviour to populate the last executed item/first item in history?

This is the default and only behavior of the history list ATM. Last executed items come first in the list.

This still feels like an awkward way of aproaching what I am trying to achieve, part of the benefit is being able to alter the last command only slightly (or fix a typo). ...

It is already possible to alter the args of an item by searching for it, either in normal mode or in history mode, then press Tab. KP will then offer you to edit item's args, if any, or to append some.

Really I fail to see what change there is to be done here. Everything you asked so far is already doable in KP (and documented) except the special feature to launch KP in history mode directly, that I mentioned in my previous comment, and that I'm willing to implement if needed.

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Aug 1, 2017

My problem with KP cannot be fixed by any work-around provided, it can only be solved by populating the LaunchBox with the previous command in full, including command line arguments (or replacing me with someone else, but then it wouldn't be my problem...)

To say this problem does not exist, is not important or can be solved by another (longer) way is ignoring my very real problem.

I do not understand why this feature is unacceptable while in #219 you are happy to add a seemingly similarly trivial feature (other than that is a plugin while this is core app).

From #219:

Ok, I see no cons of adding this option. It will very probably be available in the next release.


I am saddened by this as it is probably the only remaining feature of KP that is missing for my use (that I cannot add myself via a plugin) and am reluctant to switch to another package (such as Wox or Executor; most launchers have this feature) as I would be giving up on some niceties that KP has; however I don't have much choice.

I wish I had some idea as to what the objection was -- it seems you are aruging that this feature already exists? Or am I expected to make some financial contribution? Do I need to contibute some new plugins to be taken seriously?

I also wish this project was open-source so I could make the change required without miscommunicating further (is it closed-source with any particular reason, such as monetization further down the line?)

Please help me understand the rationale even if you're unwilling to make the change.

syserr0r commented Aug 1, 2017

My problem with KP cannot be fixed by any work-around provided, it can only be solved by populating the LaunchBox with the previous command in full, including command line arguments (or replacing me with someone else, but then it wouldn't be my problem...)

To say this problem does not exist, is not important or can be solved by another (longer) way is ignoring my very real problem.

I do not understand why this feature is unacceptable while in #219 you are happy to add a seemingly similarly trivial feature (other than that is a plugin while this is core app).

From #219:

Ok, I see no cons of adding this option. It will very probably be available in the next release.


I am saddened by this as it is probably the only remaining feature of KP that is missing for my use (that I cannot add myself via a plugin) and am reluctant to switch to another package (such as Wox or Executor; most launchers have this feature) as I would be giving up on some niceties that KP has; however I don't have much choice.

I wish I had some idea as to what the objection was -- it seems you are aruging that this feature already exists? Or am I expected to make some financial contribution? Do I need to contibute some new plugins to be taken seriously?

I also wish this project was open-source so I could make the change required without miscommunicating further (is it closed-source with any particular reason, such as monetization further down the line?)

Please help me understand the rationale even if you're unwilling to make the change.

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Aug 1, 2017

Member

My problem with KP cannot be fixed by any work-around provided, it can only be solved by populating the LaunchBox with the previous command in full

Again, there is the history mode for that already. And I offered you to implement a hotkey_history setting to have direct access to it. An offer that you have ignored by asking for that very feature the next comment (is there any way to change/customize Ctrl+Down to a key combintation that doesn't require moving my right hand to the arrow keys).

  • You want to launch PuTTY sessions but for some reason, the official and generic PuTTY plugin does fit (no pun intended)

Nothing prevents you to roll your own plugin. But as I already suggested, I would first try to learn about the tool I use instead of arguing by making incorrect statements, and by doing so, demonstrating you haven't even tried the existing features.

Keypirinha is very much perfectible and as a matter of fact, this project has shown itself to be very open to suggestions. But it is also based on strong design choices that makes it quite different than Launchy, Wox or Executor you mentioned. It is very probably why it will never be as popular as a launcher like the so heavy and buggy Wox. I appreciate you took time to insist on your initial (biased) idea while trying to remain polite. In turn, I tried to emphasize you didn't grasp how to use this tool yet (you made that obvious really).

Member

polyvertex commented Aug 1, 2017

My problem with KP cannot be fixed by any work-around provided, it can only be solved by populating the LaunchBox with the previous command in full

Again, there is the history mode for that already. And I offered you to implement a hotkey_history setting to have direct access to it. An offer that you have ignored by asking for that very feature the next comment (is there any way to change/customize Ctrl+Down to a key combintation that doesn't require moving my right hand to the arrow keys).

  • You want to launch PuTTY sessions but for some reason, the official and generic PuTTY plugin does fit (no pun intended)

Nothing prevents you to roll your own plugin. But as I already suggested, I would first try to learn about the tool I use instead of arguing by making incorrect statements, and by doing so, demonstrating you haven't even tried the existing features.

Keypirinha is very much perfectible and as a matter of fact, this project has shown itself to be very open to suggestions. But it is also based on strong design choices that makes it quite different than Launchy, Wox or Executor you mentioned. It is very probably why it will never be as popular as a launcher like the so heavy and buggy Wox. I appreciate you took time to insist on your initial (biased) idea while trying to remain polite. In turn, I tried to emphasize you didn't grasp how to use this tool yet (you made that obvious really).

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Aug 1, 2017

Apologies, I realize I may have overlooked a way this could work. I didn't want to have two bindings, one for bringing up KP normally and one for the last command, however if I don't bind the normal KP launch key and instead bind your proposed hotkey_history that would have the desired effect of always opening the last command would it not?

syserr0r commented Aug 1, 2017

Apologies, I realize I may have overlooked a way this could work. I didn't want to have two bindings, one for bringing up KP normally and one for the last command, however if I don't bind the normal KP launch key and instead bind your proposed hotkey_history that would have the desired effect of always opening the last command would it not?

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Aug 2, 2017

Member

You will be able to bind your current hotkey_run value to hotkey_history and make hotkey_run blank if that is what you mean. It probably makes sense if you use the history mode more often than the normal search mode, considering you can always go back to normal mode by pressing Esc (or Backspace or Alt+Left).

Just to clarify, the new hotkey_history setting would bring you KP with the "History" list directly. Then it will be the same steps than now: to execute the last executed item, you would just have to press Enter. To edit its args first (the command line in your case), press Tab.

Considering the initial issue and the workflow you described vs. the current design, this is as close as it can get. Would that be an acceptable solution to the initial issue?

Member

polyvertex commented Aug 2, 2017

You will be able to bind your current hotkey_run value to hotkey_history and make hotkey_run blank if that is what you mean. It probably makes sense if you use the history mode more often than the normal search mode, considering you can always go back to normal mode by pressing Esc (or Backspace or Alt+Left).

Just to clarify, the new hotkey_history setting would bring you KP with the "History" list directly. Then it will be the same steps than now: to execute the last executed item, you would just have to press Enter. To edit its args first (the command line in your case), press Tab.

Considering the initial issue and the workflow you described vs. the current design, this is as close as it can get. Would that be an acceptable solution to the initial issue?

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Aug 2, 2017

Just to clarify, the new hotkey_history setting would bring you KP with the "History" list directly. Then it will be the same steps than now: to execute the last executed item, you would just have to press Enter. To edit its args first (the command line in your case), press Tab.

This sounds like almost exactly what I am looking for. When in the history, it doesn't allow me to enter a new command (as if I wasn't in history mode). Is there a solution to this?

The goal is to be able to perform one of 3 things after launching KP with a hotkey (and the hotkey_history would achieve the first two):

  • Press Enter to run the last command
  • Alter the last command (in this case by pressing Tab)
  • Start typing a new command/search (as in non-history mode)

The last one is the most frequent use, so it would be desirable to achieve this without using a different hotkey to launch KP or extra keys (such as prefixing my command with Backspace to return from history mode).

Possibly an option to return from history mode a non-keyboard shortcut key is pressed?

syserr0r commented Aug 2, 2017

Just to clarify, the new hotkey_history setting would bring you KP with the "History" list directly. Then it will be the same steps than now: to execute the last executed item, you would just have to press Enter. To edit its args first (the command line in your case), press Tab.

This sounds like almost exactly what I am looking for. When in the history, it doesn't allow me to enter a new command (as if I wasn't in history mode). Is there a solution to this?

The goal is to be able to perform one of 3 things after launching KP with a hotkey (and the hotkey_history would achieve the first two):

  • Press Enter to run the last command
  • Alter the last command (in this case by pressing Tab)
  • Start typing a new command/search (as in non-history mode)

The last one is the most frequent use, so it would be desirable to achieve this without using a different hotkey to launch KP or extra keys (such as prefixing my command with Backspace to return from history mode).

Possibly an option to return from history mode a non-keyboard shortcut key is pressed?

@polyvertex

This comment has been minimized.

Show comment
Hide comment
@polyvertex

polyvertex Aug 27, 2017

Member

hotkey_history setting now available in v2.15.4

Member

polyvertex commented Aug 27, 2017

hotkey_history setting now available in v2.15.4

@polyvertex polyvertex closed this Aug 27, 2017

@syserr0r

This comment has been minimized.

Show comment
Hide comment
@syserr0r

syserr0r Aug 27, 2017

Fantastic, thanks!

syserr0r commented Aug 27, 2017

Fantastic, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment