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

Comments

@denisidoro
Copy link
Owner

@denisidoro 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
Related: #37
@denisidoro

This comment has been minimized.

Copy link
Owner Author

@denisidoro denisidoro commented Sep 23, 2019

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

This comment has been minimized.

Copy link
Owner Author

@denisidoro 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
@tfriedel

This comment has been minimized.

Copy link
Contributor

@tfriedel tfriedel commented Sep 25, 2019

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

@adworacz

This comment has been minimized.

Copy link

@adworacz adworacz commented Sep 26, 2019

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

This comment has been minimized.

Copy link
Owner Author

@denisidoro denisidoro commented Sep 26, 2019

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

@adworacz

This comment has been minimized.

Copy link

@adworacz 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

This comment has been minimized.

Copy link
Owner Author

@denisidoro denisidoro commented Sep 27, 2019

  • 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

This comment has been minimized.

Copy link

@aminehmida aminehmida commented Oct 1, 2019

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
Partially solves #37
@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

This comment has been minimized.

Copy link
Owner Author

@denisidoro denisidoro commented Oct 11, 2019

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
@denisidoro denisidoro closed this Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.