From 068c3c9b13d8de51c1a1438b96f6392c4944b118 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Fri, 4 Dec 2020 00:14:01 +0100 Subject: [PATCH] Add fzf tools and deps --- .vimrc | 5 ++++ .zsh/host:spacemarine/Environment.zsh | 21 ++++++++++++++ .zsh/host:spacemarine/basic.zsh | 40 +++++++++++++++++++++++++++ README.md | 3 ++ 4 files changed, 69 insertions(+) create mode 100755 .zsh/host:spacemarine/Environment.zsh create mode 100644 .zsh/host:spacemarine/basic.zsh diff --git a/.vimrc b/.vimrc index f50c622..cdd9965 100644 --- a/.vimrc +++ b/.vimrc @@ -559,6 +559,11 @@ Plugin 'gitlab@gitlab.mathux.org:Mathieu/taglist.git' " Tagbar look like a maintened taglist Plugin 'majutsushi/tagbar' +" Fuzzy finder +Plugin 'junegunn/fzf' +nnoremap o :FZF +nnoremap O :FZF! + if v:version >= 800 " Async lint Plugin 'w0rp/ale' diff --git a/.zsh/host:spacemarine/Environment.zsh b/.zsh/host:spacemarine/Environment.zsh new file mode 100755 index 0000000..107ba16 --- /dev/null +++ b/.zsh/host:spacemarine/Environment.zsh @@ -0,0 +1,21 @@ +export ECLIPSE_HOME= +export ANDROID_HOME=/opt/android-sdk/ +export NDK_HOME=/opt/android-ndk/ +export MY_PROJECT=$HOME/Projects/genymotion +export MY_PROJECT_TOOLCHAIN=$MY_PROJECT/src/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin +#export JAVA_HOME=$HOME/local/jdk1.7.0_21 +export GENYMOTION_HOME=$HOME/local/genymotion +export DEBEMAIL=mmaret@genymobile.com +export DEBFULLNAME=Mathieu Maret +export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/build-tools/android-4.2.2:$NDK_HOME:$GENYMOTION_HOME:$PATH:$MY_PROJECT_TOOLCHAIN:$HOME/local/bin +export PATH=$PATH:/home/mathieu/.local/bin +source /etc/profile.d/vte.sh +#export CCACHE_DIR=/backup/mmaret/ccache/ + +source /usr/share/fzf/key-bindings.zsh +source /usr/share/fzf/completion.zsh +export FZF_COMPLETION_TRIGGER='²²' +export FZF_DEFAULT_OPTS="--preview='[[ \$(file --mime {}) =~ binary ]] && echo no preview for {} || (bat --style==numbers --color=always {} || cat {}) 2>/dev/null | head -300' --bind='f3:execute(bat --style=numbers {} || less -f {}),f2:toggle-preview' --preview-window='right:hidden:wrap' --height 80% --reverse" +FD_OPTIONS="--follow --exclude .git" +export FZF_DEFAULT_COMMAND="git ls-files --cached --others --exclude-standard | fd --type f --type l ${FD_OPTIONS}" + diff --git a/.zsh/host:spacemarine/basic.zsh b/.zsh/host:spacemarine/basic.zsh new file mode 100644 index 0000000..024923e --- /dev/null +++ b/.zsh/host:spacemarine/basic.zsh @@ -0,0 +1,40 @@ +# create a zkbd compatible hash; +# to add other keys to this hash, see: man 5 terminfo +typeset -A key + +key[Home]=${terminfo[khome]} + +key[End]=${terminfo[kend]} +key[Insert]=${terminfo[kich1]} +key[Delete]=${terminfo[kdch1]} +key[Up]=${terminfo[kcuu1]} +key[Down]=${terminfo[kcud1]} +key[Left]=${terminfo[kcub1]} +key[Right]=${terminfo[kcuf1]} +key[PageUp]=${terminfo[kpp]} +key[PageDown]=${terminfo[knp]} + +# setup key accordingly +[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line +[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line +[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode +[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char +[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" history-search-backward +[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" history-search-forward +[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char +[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char +[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history +[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history + +# Finally, make sure the terminal is in application mode, when zle is +# active. Only then are the values from $terminfo valid. +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init () { + printf '%s' "${terminfo[smkx]}" + } + function zle-line-finish () { + printf '%s' "${terminfo[rmkx]}" + } + zle -N zle-line-init + zle -N zle-line-finish +fi diff --git a/README.md b/README.md index 8fb9951..3dbfba2 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,9 @@ Vim plugins are managed by vundle. So at first lunch you have to run in vim * firefox * flake8 * flashplugin +* fzf +* bat +* fd * gcc-multilib * gedit * gnome-calculator