submeta
2 days ago
Nice! I use a combination of an endless bash (zsh) history with timestamps that I navigate via fzf and ctr+r and comments I occasionally add to commands via # at the end followed by my annotation so that I can rediscover the command.
I do this ever since I switched to a Mac in 2015 and my history has over 60,000 lines. So that’s basically my knowledge base :)
But your project looks nice. Will check out.
reddit_clone
2 days ago
Exactly my setup including the #tag's. It is my second brain.
What I love about this is the fzf's fuzzy narrow down. You don't have to start at the beginning of command, you don't have to worry about exact spelling. Just a few snippets you remember, it will narrow it down really fast.
I use the same fuzzy search narrow downs in Emacs.
I miss it everywhere else.
afefers
2 days ago
Can you explain how you achieve this?
WalterGR
2 days ago
Shells that use readline (such as bash) may have a history search feature built-in and on by default. Try pressing Ctrl-r or Cmd-r and see if a prompt pops up.
You can build your own workflow by hand by doing something like:
1. Turn on your shell’s feature to record command history.
2. Look into its feature set to control things such as how many entries it remembers, whether it remembers duplicate entries, and whether it timestamps each entry. (Don’t forget to restart each instance of your shell, if needed, for changes to take effect.)
3. Install a tool such as fzf that allows interactive filtering of arbitrary text. (Via Homebrew it’s `brew install fzf`. It’s likely something similar for other package managers.) These tools usually: read lines of input, prompt the user to optionally filter but eventually select a line, then just print that line.
4. Write the necessary shell script(s) / functions / aliases to do things like:
+ invoke the fuzzy-finder on the shell’s history file or a modified version of that file (for example, a modified version that excludes bash’s timestamp lines, or that joins them - perhaps in a human-readable format - with the command it timestamps.)
+ process the output of the fuzzy-finder tool (for example, to copy the command to the clipboard, paste it into the shell, or execute it immediately - which will necessitate things like removing any timestamps or additional notation added in the previous step.)
Step 4 can be easy as something approximating (I’m on mobile right now):
fzf “$HOME/.bash_history” | copy-to-clipboard
porridgeraisin
4 hours ago
Fzf installs hooks automatically for ctrl+r and a bunch of other stuff
Search for `fzf --bash`. Note that the version in the ubuntu repos is too old to have this feature (I think)
import
2 days ago
Not op but you need fzf and you need to increase the history size of your bash/ssh whatever