Comments (3)
That would be a great feature. I was wondering if I could already implement this on my own when using the fzf command for the shell history.
For me the perfect workflow would look like this:
- hit
Ctrl+R
to start the fzf command histroy - do a fuzzy search and select the correct entry
- hit a (configurable) shortcut like
Ctrl+H
- command is automatically sent to hoard and the hoard asks for additional stuff (like description and so on)
- done
from hoard.
Would be a nice way to have a fast integration with fzf or similar shell history explorer!
We could add a section in the readme here, how to create a binding like this.
The result of that can be used with hoard new --name $RESULT
to start the process of adding a new command.
Potentially, a more long term feature to target would be an integrated shell history explorer inside of hoard
from hoard.
I found some time on the weekend to play around with fzf and the history widget.
To enable the feature as described above one can add the following part to the default fzf-history-widget()
function in the zsh config:
--bind=\"ctrl-h:execute@cmd=\$(echo {} | cut -c 8-) && hoard new --command \${cmd} @+abort\"
This runs the command hoard new --command
with the result that was selected by fzf.
However I'm not happy with the echo {} | cut
part yet, as this seems a little hacky to me. It is used to cut off the number of the history output (see screenshot below)
The entire new fzf-history-widget()
function (which comes by default if you're installing fzf and the zsh completitions) looks like this:
fzf-history-widget() {
local selected num
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2> /dev/null
selected=( $(fc -rl 1 | awk '{ cmd=$0; sub(/^[ \t]*[0-9]+\**[ \t]+/, "", cmd); if (!seen[cmd]++) print $0 }' |
FZF_DEFAULT_OPTS="--height ${FZF_TMUX_HEIGHT:-40%} ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort,ctrl-z:ignore --bind=\"ctrl-h:execute@cmd=\$(echo {} | cut -c 8-) && hoard new --command \${cmd} @+abort\" ${FZF_CTRL_R_OPTS-} --query=${(qqq)LBUFFER} +m" $(__fzfcmd)) )
local ret=$?
if [ -n "$selected" ]; then
num=$selected[1]
if [ -n "$num" ]; then
zle vi-fetch-history -n $num
fi
fi
zle reset-prompt
return $ret
}
from hoard.
Related Issues (20)
- Feature request: Make it compatible with Windows HOT 4
- Update trove.yaml when changing command parameter token
- suggest: read trove.yml in the current directory (or load with option) HOT 6
- Add flag to trove model wether its a local file or not global
- add Cargo.lock file to the repo HOT 2
- Allow name-based / num-based parameter tokens HOT 3
- Probably doesn't work on zsh+macos HOT 1
- add command to print shell configs HOT 2
- fix clippy lints
- Use struct arguments HOT 1
- Allow ending parameter token HOT 6
- Allow escape character HOT 2
- GUI command edit HOT 1
- Ubuntu .deb packages missing from releases HOT 3
- install.sh write BASH config to .zshrc not .bashrc HOT 3
- Customize tab highlight color HOT 1
- Select name space for new command HOT 1
- Named parameters using `hoard pick` are not interpreted as expected HOT 3
- Allow api_url to be configured that gets used in chatgpt_rs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hoard.