xonecas.io
5119
Lh

lazy-history / commit ecef95c

chore: zsh integration

Sean2025-05-12 ecef95c5eec501eeb8f0ea91712a478c90db2a3b parent 1fa844b

4 files changed

README.md+1−0
@@ -6,6 +6,7 @@ Currently still in early development.
66
77 ## TODO:
88
9+- [ ] -> When used with the keybind, there is no query, there should be a way to add a query from the tui.
910 - [ ] -> Pinned/Favorite commands? Able to add/remove a command from the list to a favorites/pinned list
1011
1112 ## How to use:
scripts/install-zsh.sh+25−0
@@ -0,0 +1,25 @@
1+#! /bin/zsh
2+
3+# set shell options to print commands as they are executed
4+set -e
5+
6+# Install the lazy-history command using go install
7+echo "Installing lazy-history"
8+go install github.com/sacenox/lazy-history@latest
9+
10+# Add the lazy-history command to the PATH if it's not already there
11+echo "Adding lazy-history to PATH"
12+if ! echo "$PATH" | grep -q "$HOME/go/bin"; then
13+ export PATH="$PATH:$HOME/go/bin"
14+fi
15+
16+# TODO: Uncomment this when we have a way to add query with the tui
17+# Get the directory where this script is located
18+#SCRIPT_DIR="$(cd "$(dirname "${(%):-%x}")" && pwd)"
19+
20+# Source the rc.sh file from the same directory as this script
21+# into the zsh rc file
22+#echo "adding rc-zsh.sh to ~/.zshrc"
23+#cat "$SCRIPT_DIR/rc-zsh.sh" >> ~/.zshrc
24+
25+echo "Done! Please restart your shell.\nOr source the ~/.zshrc file directly."
scripts/install.sh+0−15
@@ -1,15 +0,0 @@
1-#! /bin/sh
2-
3-# set shell options to print commands as they are executed
4-set -xe
5-
6-# Install the lazy-history command using go install
7-go install github.com/sacenox/lazy-history@latest
8-
9-# Add the lazy-history command to the PATH if it's not already there
10-if ! echo "$PATH" | grep -q "$HOME/go/bin"; then
11- export PATH="$PATH:$HOME/go/bin"
12-fi
13-
14-# bind the command to ctrl+r
15-bind -x '"\C-r": lazy-history'
scripts/rc-zsh.sh+13−0
@@ -0,0 +1,13 @@
1+
2+
3+# Define the lazy-history widget function
4+lazy-history-widget() {
5+ BUFFER="lazy-history"
6+ zle accept-line
7+}
8+
9+# Create the widget
10+zle -N lazy-history-widget
11+
12+# Bind the widget to Ctrl+R
13+bindkey '^R' lazy-history-widget