Skip to content
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

Create widgets for bash+zsh+fish #37

Closed
denisidoro opened this issue Sep 22, 2019 · 9 comments
Closed

Create widgets for bash+zsh+fish #37

denisidoro opened this issue Sep 22, 2019 · 9 comments
Labels
help wanted Extra attention is needed new feature New feature or request

Comments

@denisidoro
Copy link
Owner

denisidoro commented Sep 22, 2019

Hitting Ctrl-G for example could start the script.

When selecting an entry, instead of executing it, it could fill the prompt (similarly to ctrl-r).

This way the history will be kept clean and there will be the possibility to edit the command as you like.

Edit: this is done for zsh, bash and zsh already!
Please refer to README.md.

Widget

denisidoro added a commit that referenced this issue Sep 23, 2019
@denisidoro
Copy link
Owner Author

Problem: I don't know how to get input from user in a ZSH widget
Workaround: use fzf with --print-query

@denisidoro denisidoro changed the title Create plug-ins for bash and zsh Create widgets for bash and zsh Sep 23, 2019
@denisidoro
Copy link
Owner Author

denisidoro commented Sep 24, 2019

In case anyone is interested in trying it out (for zsh):

navi_home="$(echo "$(brew --prefix navi 2>/dev/null)/libexec" || echo "/opt/navi")"
source "${navi_home}/shell/widget.zsh"

# hit alt+g

@denisidoro denisidoro added help wanted Extra attention is needed security new feature New feature or request and removed security labels Sep 24, 2019
@tfriedel
Copy link
Contributor

this is cool! I would love to have this for the fish shell.

@adworacz
Copy link

Looks like this isn't working for navi installed via Linuxbrew:

zshrc:source:176: no such file or directory: /home/linuxbrew/.linuxbrew/navi/shell/widget.zsh
(19-09-26 10:48:13) <0> [~]
u662b1ab6f1175f % which navi
/home/linuxbrew/.linuxbrew/bin/navi

(19-09-26 10:48:15) <0> [~]
u662b1ab6f1175f % brew --prefix
/home/linuxbrew/.linuxbrew

(19-09-26 10:51:02) <0> [~]
u662b1ab6f1175f % brew info navi
denisidoro/tools/navi: stable 0.9.4
An interactive cheatsheet tool for the command-line
https://github.com/denisidoro/navi
/home/linuxbrew/.linuxbrew/Cellar/navi/0.9.4 (43 files, 107.9KB) *
  Built from source on 2019-09-26 at 10:31:23
From: https://github.com/denisidoro/homebrew-tools/blob/master/navi.rb
==> Dependencies
Build: fzf ✔

(19-09-26 10:51:13) <0> [~]
u662b1ab6f1175f %

@denisidoro
Copy link
Owner Author

@adworacz the path in the instructions were wrong. I've just updated it. Could you confirm if it's working now?

@adworacz
Copy link

adworacz commented Sep 26, 2019

I'll do you one better - instead of having the user embed the navi version into their .zshrc, it looks like we can use brew --prefix navi to handle things.

navi_home="$(echo "$(brew --prefix navi 2>/dev/null)" || echo "/opt/navi")"
source "${navi_home}/libexec/shell/widget.zsh"

That just worked for me, using the 0.9.4 version installed via brew install denis.../navi, (not HEAD).

Note that I had to add libexec to the source path, just FYI.

@denisidoro denisidoro changed the title Create widgets for bash and zsh Create widgets for zsh and fish Sep 27, 2019
@denisidoro
Copy link
Owner Author

  • zsh: ✅
  • bash: help needed!
  • fish: help needed!

@denisidoro denisidoro changed the title Create widgets for zsh and fish Create widgets for bash and fish Sep 30, 2019
@aminehmida
Copy link

Just want to share this question and this one from stackexchange

The second answer from the first question has an excellent detailed description of how to achieve this in Bash.

I hope this is helpful.

denisidoro added a commit that referenced this issue Oct 2, 2019
@denisidoro denisidoro changed the title Create widgets for bash and fish Create widgets for fish Oct 2, 2019
@denisidoro denisidoro changed the title Create widgets for fish Create widget for fish Oct 2, 2019
@denisidoro
Copy link
Owner Author

There's an initial version for a fish widget here.

It doesn't allow editing the command before executing it, though.

Could anyone help me?

@denisidoro denisidoro changed the title Create widget for fish Create widgets for bash+zsh+fish Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed new feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants