Comments (1)
Here are the settings I use for the history:
setopt append_history # Allows new commands to be appended to the history file, instead of overwriting it.
setopt inc_append_history # each command is added to the history file immediately after it's executed, not just when the session ends.
setopt share_history # synchronizes the command history between multiple zsh sessions. Commands entered in one session will be available in others.
setopt hist_ignore_dups # Prevents consecutive duplicates from being saved in the command history.
setopt hist_ignore_all_dups # Ignores all duplicate entries in the history, not just consecutive ones.
setopt hist_expire_dups_first # When the history file reaches its size limit, remove older duplicate entries before removing unique commands.
setopt hist_find_no_dups # When searching through history, prevent showing duplicate entries.
setopt hist_save_no_dups # When saving the history, omit duplicate entries, so only unique commands are saved.
setopt hist_reduce_blanks # Removes extra blanks from each command line being added to the history.
setopt hist_verify # After a history expansion (like using ! commands), this option prompts for verification before executing the command.
Additionally; here below is the little function I wrote. You can search your history using fzf by hitting CTRL + R. For example if you write "pacman" and hit CTRL + R, you will see all pacman commands you entered before in fzf menu.
fzf-history-widget-with-date() {
initial_query="$LBUFFER"
setopt noglobsubst noposixbuiltins pipefail 2>/dev/null
entry=$(fc -lir 1 |
sed -E 's/^[[:space:]]+[0-9]+\*?[[:space:]]+//' |
awk '{cmd=$0; $1=$2=$3=""; sub(/^[ \t]+/, ""); if (!seen[$0]++) print cmd}' |
fzf --query="$initial_query" +s)
[ -n "$entry" ] && LBUFFER=${entry#* * * }
zle redisplay
}
zle -N fzf-history-widget-with-date
bindkey '^R' fzf-history-widget-with-date
There are also nice plugins you can use called fzf-tab (tab completion using fzf instead of default), fzf-autosuggestions (fish-like suggestions based on history) and zsh-completions (complete commands in a very detailed way for example pressing tab after "grep -" will give you all possible options with explanations).
from voidrice.
Related Issues (20)
- font overwrite HOT 1
- Potential issue with ncmpcpp no longer being maintained! HOT 1
- Question: vim config
- Bug in dmenulinkhandler with lynx
- Shortcuts expandibility HOT 1
- changing font size in st terminal HOT 1
- iconv wrong implementation on termux booksplit script
- dmenurecord error with two displays
- Translate ID error: '-1' is not a valid ID (returned by default-nodes-api) HOT 3
- keyhandler doesnt work with nsxiv
- pacman update libimagequant breaks ueberzug
- Cannot take fullscreen screenshot (maim) while dmenu is active HOT 2
- Failed to connect to pulseaudio when booting with headphone already connected HOT 5
- Doppler Radar Not working (https://api.sat24.com website is down) HOT 4
- lf "delete file" command doesn't work with files containing spaces HOT 1
- muttwizard cron doesnt work with larbs
- Failed to install AUR helper. HOT 3
- Super N HOT 2
- LS DIRECTORY BACKGROUND 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 voidrice.