For me another issue was that I needed to do more keystrokes for the same behaviour (search a previously ran command and execute it).
Fuzzy shell history search is just one of those mind-blowing things. I love my history, it's such a trove and I can trust it to work as some kind of external memory (it's enough to vaguely know the kubectl command, or that I want to "du -h | sort" to see what is using disk space, etc).
> backup and sync encrypted shell history
But it's up to you. You can disable any sync features by installing with `--no-default-features --features client` set. Your application won't have any networking features built into the binary then
It was quite annoying so we're sorry for that
* We use heuristic based searches whereas mcfly trains a neural network * We offer a sync functionality to share history on multiple machines
mcfly is a great project, although they are looking for new maintainers apparently!
Went back to FZF (in Zsh).
I have a seven year zsh history. That may be a contributing factor for the issues ?
We introduced this as we found a lot of people reporting bugs that had already been fixed + they just needed to update, or users on the sync server that were >1yr behind on updates (making improvements really difficult to introduce).
But if you can't get past the double-enter, then I understand.
I think there was some work to fix that, I'll check up on it. Thanks for the reminder
Zsh snippet below in case it's helpful to anybody. With this in your .zshrc ctrl-r will search your shell history with fzf+atuin and ctrl-e will bring up atuin's own fuzzy finder in case you still want it.
It only searches the last 5000 entries of your atuin history for speed, but you can tweak ATUIN_LIMIT to your desired value if that's not optimal.
atuin-setup() {
if ! which atuin &> /dev/null; then return 1; fi
bindkey '^E' _atuin_search_widget
export ATUIN_NOBIND="true"
eval "$(atuin init "$CUR_SHELL")"
fzf-atuin-history-widget() {
local selected num
setopt localoptions noglobsubst noposixbuiltins pipefail no_aliases 2>/dev/null
# local atuin_opts="--cmd-only --limit ${ATUIN_LIMIT:-5000}"
local atuin_opts="--cmd-only"
local fzf_opts=(
--height=${FZF_TMUX_HEIGHT:-80%}
--tac
"-n2..,.."
--tiebreak=index
"--query=${LBUFFER}"
"+m"
"--bind=ctrl-d:reload(atuin search $atuin_opts -c $PWD),ctrl-r:reload(atuin search $atuin_opts)"
)
selected=$(
eval "atuin search ${atuin_opts}" |
fzf "${fzf_opts[@]}"
)
local ret=$?
if [ -n "$selected" ]; then
# the += lets it insert at current pos instead of replacing
LBUFFER+="${selected}"
fi
zle reset-prompt
return $ret
}
zle -N fzf-atuin-history-widget
bindkey '^R' fzf-atuin-history-widget
}
atuin-setupI think what would be more useful is to record `env` or some similar context along with the time and command. That would probably get weird pretty fast, though. Maybe just a thing that could insert some useful bookmarking/state into the history record on-demand? `history-set-checkpoint` or something would save your pwd and local vars or something.
With the current directory you should be able to get the absolute path from your relative paths
Or maybe I'm just lazy.
Or at least I hope it is. :)
but that isn't sexy somehow. we'll have to settle on 'shag'.
"Ted, the change I suggest doesn't affect the independence of your sessions as you suggest. Each shell maintains a unique history in memory so modifying the history file has no affect on running terminals. The only time the history file is read is when you start a new terminal. I recommend you try my suggestion. Really, all I am doing is eliminating the race condition that causes the bash history file to have inconsistent data.
Thanks for the feedback."
If you do want to load the history persisted from other shells into the current one, all you have to do (if memory serves) is:
$ history -rPROMPT_COMMAND='history -a'
Has always worked for me. Goes in your .bashrc from the FM
PROMPT_COMMAND ¶ If this variable is set, and is an array, the value of each set element is interpreted as a command to execute before printing the primary prompt ($PS1). If this is set but not an array variable, its value is used as a command to execute instead.
To wit:
> It says to put those commands in the .bashrc config:
shopt -s histappend
PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
> The first command changes the history file mode to append and the second configures the history -a command to be run at each shell prompt. The -a option makes history immediately write the current/new lines to the history file.I used to have something like this set up on my Linux laptop - the downside is that seperate shell/terminals/windows/tabs don't keep seperate history - so if you eg start a server in shell one (rails s), start editor in two - then go back to one and ctrl-c out - up arrow will now give you "vim" not "rails s".
The problem compounds if you ping, or curl in another shell etc.
setopt inc_append_historySo, you revisit a window, and you want to start from where you left, but now, you might maybe wade through 100's of commands before you get back to that point in time. There are fixes for this too of course, my point is, that it doesn't come without side effects, and that is maybe why it isn't set as default behaviour. At least in a pre 'fzf/atuin/smenu' world.
I prefer smenu's history search, even if I consider myself a heavy fzf user.
I can't believe people still using a tree view of a deeply nested project and clicking though directories and finally finding a file.
I am not willing to type more than a few characters for any file in the project. Fuzzy finding with quick narrowing FTW.
Learning for me: Brew suggests to install the shortcuts but doesn’t automatically do this. Just activated this and Ctrl-R is a big improvement this way.
export CDPATH="$HOME:$HOME/code/:$(ls -d $HOME/work/*/| tr \\n :)"
so regardless of my cwd I can cd into pretty much any project I'd want to. ~/project% find -type d | wc -l
13946
I access files in a dozen or so folders in this hierarchy regularly, so fuzzy find is an extreme boost for me.I have a branch[0] where I'm trying to do things like reduce the user perceptible lag in search, the initial time of ingest, and add small features I need, etc (all done). I've tried to create PRs where I can, and they go unnoticed and unused.
One other thing I was trying to get a handle on is memory usage. The issue is -- you're implicitly creating objects with static lifetimes everywhere. Now try to refactor that, and there is a trait object held in a struct which depends on another trait object, so good luck figuring out the lifetimes. This is totally fine for a fuzzy finder tool, probably, but less fine when you drop a fuzzy find feature it into an app.
Love to have others interested in skim, and eager to work with anyone with big ideas about how to make it better. I'll have to try out atuin!
What do you mean by maintained? There are commits as recent as yesterday on the project: https://github.com/junegunn/fzf
I liked the way he covered just one function though, which at least might be starters for such operations, and are fully operational, and probably caters for better workflows for most, than without fzf.
Funny thing: I try to stop using Ctrl-R from fzf at the moment, and rather use the one that ships with smenu.
I'm now using atuin for shell history and fzf for fuzzy completion[0], works awesome! As Shell I use zsh with some plugins managed via antigen on my Linux Mint default terminal.
[0]: https://github.com/junegunn/fzf#fuzzy-completion-for-bash-an...
I use atuin[0] instead of fzf as I find the experience a bit nicer and it has history backups built in (disclaimer, I am a maintainer)
Some of our users still prefer fzf because they are used to how it fuzzy finds, but we're running an experiment with skim[1] which allows us to embed the fuzzy engine without much overhead - hopefully giving them back that fzf-like experience
[0]: https://github.com/ellie/atuin [1]: https://github.com/lotabout/skim