4 ms·
Set a huuuuuuuge shell history https://github.com/craigjperry2/dotfiles/blob/aa77ddcbde63bf3a0a61a2c218bf36f8e146a3c9/dotfiles/zshrc#L44 https://github.com/crai
by CraigJPerry 4y ago
Set a huuuuuuuge shell history https://github.com/craigjperry2/dotfiles/blob/aa77ddcbde63bf3a0a61a2c218bf36f8e146a3c9/dotfiles/zshrc#L44 https://github.com/craigjperry2/dotfiles/blob/aa77ddcbde63bf... then fzf ctrl+r bindings mean you can recall anything right where you need it.
If you’re going to do this then have an escape hatch for commands you don’t want memorised https://github.com/craigjperry2/dotfiles/blob/aa77ddcbde63bf3a0a61a2c218bf36f8e146a3c9/dotfiles/zshrc#L52 https://github.com/craigjperry2/dotfiles/blob/aa77ddcbde63bf...
- swah 4y agoYour file just reminded me I have "broot" installed.. Its sad how I install all those things, forget about them the next day and cd/ls/vi like a caveman. The problem is much deeper than you think, OP...
- chrbr 4y agoYep, this is my real problem. Install something that looks cool, then get wrapped up in the day-to-day and never make it muscle memory. Sounds like I should be focusing on "one new workflow thing a week" and make it a daily habit to practice, or something.
- swah 4y agoTo be honest, its not like the current way is slower - its just not that "cool". I seem to be using "zoxide" (ie "z prj") to jump to one of my projects after opening a terminal, and mostly stay on that folder for a few days. Some other things I'll do in Finder, etc.
- submeta 4y agoI‘ve been doing this ever since I migrated from Windows to Mac in 2015. My bash history has over 40k lines, datestamped. I can recall any command I have typed in my terminal in the past seven years. Extremely helpful whenever I need to repeat anything in the terminal. # Edit I sometimes add comments to commands via `# This‘ll do this and that` so that I can find the command by those keywords in the bash history.
- _tom_ 4y agoMaybe I'm doing something wrong, but my bash history is missing many of my commands. I assumed it was due to poor handling of multiple open terminal windows and tabs. Is there something you are doing so the different sessions don't clobber each other?
- kinduff 4y agoThis. I've been doing this for a couple of years now, I'm really used to it. I've been "traveling" with my history that is over 70k lines. My dot alias file has only 3 aliases (c=clear, q=exit, gti=git). Hope there's a project out there that helps parse, rank, or do something with a file like this. There must be interesting information.
- deleted 4y ago[deleted]
- tailspin2019 4y agoIs gti=git for capturing typos or some other reason?
- kinduff 4y agoIt's a typo, but I make it a lot!
- gpmcadam 4y agoprotip: use comments to remind yourself or make commands searchable, e.g. $ find . -iname 'package.json' -exec jq .version {} \; # get npm module version numbers for all packages now when you search history you can do so with plain text: $ history | grep 'npm module version' you could of course take this further by 'tagging' commands if you wish and then grep for that tag later to return longer cheatsheets
- exyi 4y agoI also use `history | vim -` to search through the history in the context of other things I was attempting to do. Say, if I try some command and it does not work, chances are it's not the first time and I have the correct version on the line bellow :)
- corytheboyd 4y agoHistory search is the way, especially with fzf. I love using fzf to pick git branches as well, so long as you use intelligible branch names :)
- ra7 4y agoHow do you use fzf for git branches? I didn’t know you could do that.
- CraigJPerry 4y agohttps://github.com/craigjperry2/dotfiles/blob/main/dotfiles/gitconfig#L33 https://github.com/craigjperry2/dotfiles/blob/main/dotfiles/...
- corytheboyd 4y agoExactly like that :)
- smegsicle 4y agoa good idea, some notes: 1. 10,000 isn't 'huuuuge' for long lived workstations, but 100k ought to be good for a while (bash, but not zsh, allows disabling truncation entirely with SAVEHIST=-1) 2. if using bash, make sure that this init stuff is sourced by both login and non-login shells (from ~/.bash_profile vs ~/.bashrc respectively) 3. specifying a non-default HISTFILE near your SAVEHIST (as shown in that zshrc link) can go a long way toward avoiding an improperly-configured shell truncating your huge history log, eg point 2