Compare commits
3 Commits
c20d18e62d
...
e9f9ce6193
Author | SHA1 | Date | |
---|---|---|---|
e9f9ce6193 | |||
766ac3c5bf | |||
2d56207f1e |
@ -207,3 +207,23 @@ build-debug() {
|
||||
local target=$1; shift 1
|
||||
eval build $target && debug ~build/bin/$target "$@"
|
||||
}
|
||||
|
||||
# Interactively view CMake variables
|
||||
.build-var() {
|
||||
if [[ ! -n $build_dir ]]; then
|
||||
build-dir
|
||||
fi
|
||||
local var=$(
|
||||
cat $build_dir/CMakeCache.txt |
|
||||
grep --color=never -Ex '^\w+:\w+=.*$' |
|
||||
fzf --layout=reverse --info=hidden --border=rounded \
|
||||
--cycle --height=50%
|
||||
)
|
||||
if [[ -n "$var" ]]; then
|
||||
BUFFER="cmake -B\$build_dir -D$var"
|
||||
zle end-of-line
|
||||
fi
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N .build-var
|
||||
bindkey '^B' .build-var
|
||||
|
@ -148,3 +148,22 @@ fi
|
||||
ls-iommu() {
|
||||
$HOME/.config/zsh/ls-iommu.sh | sort -n
|
||||
}
|
||||
|
||||
# Fuzzy history search with fzf
|
||||
function .fzf-history-search() {
|
||||
local selected
|
||||
selected=$(
|
||||
cat $HISTFILE | # get entire history
|
||||
sed 's/ *[0-9]* *//' | # remove cruft
|
||||
awk '!seen[$0]++' | # remove duplicates
|
||||
fzf --layout=reverse --tac --cycle --info=hidden \
|
||||
--border=rounded --height=50%
|
||||
)
|
||||
if [[ -n "$selected" ]]; then
|
||||
BUFFER="$selected"
|
||||
zle end-of-line
|
||||
fi
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N .fzf-history-search
|
||||
bindkey '^R' .fzf-history-search
|
||||
|
22
zshrc
22
zshrc
@ -126,9 +126,6 @@ bindkey -M vicmd 'j' history-substring-search-down
|
||||
bindkey -r '^[h'
|
||||
bindkey -M vicmd 'K' run-help
|
||||
|
||||
# Disable Ex mode with ':'
|
||||
bindkey -rM vicmd ':'
|
||||
|
||||
# Enable '<Shirt><Tab>' reverse order completions
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
|
||||
@ -146,25 +143,6 @@ if [[ `uname` = Linux ]]; then
|
||||
[[ -n ${key[End]} ]] && bindkey "${key[End]}" end-of-line
|
||||
fi
|
||||
|
||||
# Fuzzy history search with fzf
|
||||
function fzf-history-search() {
|
||||
local selected
|
||||
selected=$(
|
||||
cat $HISTFILE | # get entire history
|
||||
sed 's/ *[0-9]* *//' | # remove cruft
|
||||
awk '!seen[$0]++' | # remove duplicates
|
||||
fzf --layout=reverse --tac --cycle --info=hidden \
|
||||
--border=rounded --height=50%
|
||||
)
|
||||
if [[ -n "$selected" ]]; then
|
||||
BUFFER="$selected"
|
||||
zle end-of-line
|
||||
fi
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N fzf-history-search
|
||||
bindkey '^R' fzf-history-search
|
||||
|
||||
# Enable changing cursor shape based on vi mode
|
||||
if [ "$ITERM_PROFILE" != "" ] && [ "$TMUX" = "" ]; then
|
||||
# iTerm2 cursor shape escape sequences outside tmux
|
||||
|
Loading…
x
Reference in New Issue
Block a user