From 62fda062b9999e9bd0735f69401e71864339d8f9 Mon Sep 17 00:00:00 2001 From: Bruno21 Date: Sun, 6 Feb 2022 08:26:22 +0100 Subject: [PATCH] 06-02-2022 --- .bash_profile | 1 + .bashrc | 1 + .diractions | 1 + .zshrc | 103 ++++++++++++++++++++++++++++++++++++++------------ 4 files changed, 82 insertions(+), 24 deletions(-) diff --git a/.bash_profile b/.bash_profile index 1a5c5f6..adca0f5 100755 --- a/.bash_profile +++ b/.bash_profile @@ -225,3 +225,4 @@ fi # A mettre après 'source /usr/local/bin/activate.sh' cd() { builtin cd "$@" && ls -la; } +. "$HOME/.cargo/env" diff --git a/.bashrc b/.bashrc index b7d20c4..b5f25cc 100644 --- a/.bashrc +++ b/.bashrc @@ -3,3 +3,4 @@ export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +. "$HOME/.cargo/env" diff --git a/.diractions b/.diractions index 28ce3ee..1e5706b 100644 --- a/.diractions +++ b/.diractions @@ -4,3 +4,4 @@ docs "$HOME/Documents/docs" 74ini /opt/homebrew/etc/php/7.4 80ini /opt/homebrew/etc/php/8.0 apache /opt/homebrew/etc/httpd +kymsu "$HOME/Documents/Scripts/kymsu2/plugins.d" diff --git a/.zshrc b/.zshrc index 73f75f3..f10c429 100644 --- a/.zshrc +++ b/.zshrc @@ -20,14 +20,15 @@ export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow' export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border' bindkey "ç" fzf-cd-widget -fif() { +# find-in-file - usage: fif or fif "string with spaces" or fif "regex" + +fif2() { if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi rg --files-with-matches --no-messages "$1" | fzf --preview "highlight -O ansi -l {} 2> /dev/null | rg --colors 'match:bg:yellow' --ignore-case --pretty --context 10 '$1' || rg --ignore-case --pretty --context 10 '$1' {}" } -# find-in-file - usage: fif or fif "string with spaces" or fif "regex" fif() { - if [ ! "$#" -gt 0 ]; then echo "Need a string to search for!"; return 1; fi + if [ ! "$#" -gt 0 ]; then echo "we Need a string to search for!"; return 1; fi local file file="$(rga --max-count=1 --ignore-case --files-with-matches --no-messages "$*" | fzf-tmux +m --preview="rga --ignore-case --pretty --context 10 '"$*"' {}")" && echo "opening $file" && open "$file" || return 1; } @@ -48,6 +49,13 @@ PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH" # poetry export PATH="/Users/bruno/Library/Python/3.9/bin:$PATH" +# Created by `pipx` on 2021-08-17 08:22:20 +export PATH="$PATH:/Users/bruno/.local/bin" + +# GOBIN +#export PATH="$PATH:$HOME/go/bin" +export PATH=$PATH:$(go env GOPATH)/bin + coreutils=false if [ -d '/opt/homebrew/opt/coreutils/libexec/gnubin' ]; then #PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" @@ -90,28 +98,44 @@ upd_nvm() {( # 4. Features (Z command, thefuck) # --------------------------------------- -# Allow the use of the z plugin to easily navigate directories +# z plugin to easily navigate directories # z directory => cd /Users/bruno/directory # https://github.com/rupa/z #. /usr/local/etc/profile.d/z/z.sh + # zoxide # https://github.com/ajeetdsouza/zoxide +# usage: j folder +# previous: p eval "$(zoxide init --cmd j zsh)" alias p="j -" + +# diractions +# https://github.com/AdrieanKhisbe/diractions +# usage: goto folder + +if [ -d "$HOME/.bookmarks" ]; then + export CDPATH=".:$HOME/.bookmarks:/" + alias goto="cd -P" +fi + + # thefuck # https://github.com/nvbn/thefuck eval $(thefuck --alias) + # dircolors # coreutils doit être installé eval $(gdircolors -b $HOME/.dircolors) + # tldr #https://github.com/raylee/tldr-sh-client @@ -123,9 +147,28 @@ export TLDR_DESCRIPTION='green' export TLDR_CODE='red' export TLDR_PARAM='blue' +# perl eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)" +# rga +#https://github.com/phiresky/ripgrep-all + +rga-fzf() { + RG_PREFIX="rga --files-with-matches" + local file + file="$( + FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \ + fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \ + --phony -q "$1" \ + --bind "change:reload:$RG_PREFIX {q}" \ + --preview-window="70%:wrap" + )" && + echo "opening $file" && + #xdg-open "$file" + open "$file" +} + # --------------------------------------- # 5. History # --------------------------------------- @@ -190,7 +233,12 @@ zstyle ':completion:::::' completer _expand _complete _ignored _approximate # en alias reload='source ~/.zshrc' alias change="bbedit ~/.zshrc" -if $coreutils; then +if [ -x "$(command -v exa)" ]; then + alias l='exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons' + alias ltree='exa -lbhgUma@ --time-style=default --git --color-scale --icons --tree --level=3' + cd() { builtin cd "$@" && exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons; } + +elif $coreutils; then cd() { builtin cd "$@" && gls -lA --color; } alias l='gls -lA --color' # + récent d'abord @@ -207,8 +255,8 @@ else alias lh='ls -a | grep "^\."' fi -alias l='exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons' -alias ltree='exa -lbhgUma@ --time-style=default --git --color-scale --icons --tree --level=3' +#alias l='exa -lbhgUmaFG@ --time-style=default --git --color-scale --icons' +#alias ltree='exa -lbhgUma@ --time-style=default --git --color-scale --icons --tree --level=3' alias backupzsh="cd && tar -czvf - .zshrc .zsh_plugins.txt .zsh_plugins.sh .sh_aliases | ssh funnymac@ftp.cluster011.ovh.net 'cat > www/backup/zsh_airbook.tar.gz'" alias restorezsh="cd && curl https://clicclac.info/backup/zsh_airbook.tar.gz | tar -xzv && reload" @@ -313,10 +361,10 @@ alias gp='git push' alias gl='git log' alias gs='git status' alias gd='git diff' -alias gc='git commit -m' +alias gcm='git commit -m' alias gca='git commit -am' alias gb='git branch' -alias gh='git checkout' +alias gc='git checkout' alias gra='git remote add' alias grr='git remote rm' alias gpu='git pull' @@ -330,6 +378,12 @@ function acp() { git push } +get_latest_release() { + curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api + #grep '"tag_name":' | # Get tag line + grep '"body":' #| + #sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value +} # --------------------------------------- # 7.c PYTHON @@ -347,7 +401,7 @@ alias sonos='$HOME/Documents/venv/soco-cli/bin/soco' # Mkdocs #alias mkdocs='$HOME/Documents/venv/mkdocs/bin/mkdocs' # servir Mkdocs (Python3) à 127.0.0.1 (-v verbose) -#alias mkserve="cd $HOME/Documents/docs ; mkdocs serve" +alias mkserve="cd $HOME/Documents/docs ; mkdocs serve" # construire et envoyer les docs sur le serveur alias mkbuild="/Users/bruno/Documents/Scripts/bash/mkbuild.sh" @@ -360,6 +414,7 @@ alias bo='brew info' alias bs='brew search' alias bi='brew install' alias bu='brew uninstall' +alias bk='$HOME/.kymsu/plugins.d/homebrew.sh' # brew restart apache alias bra='brew services restart httpd' @@ -396,7 +451,9 @@ alias nextcloud='cd $HOME/Nextcloud' # 7.f SEARCHING # --------------------------- -alias qfind="find / -name " # qfind: Quickly search for file +alias qfind="find / 2>/dev/null -name " # qfind: Quickly search for file +alias find="find / 2>/dev/null " + ff () { /usr/bin/find . -name "$@" ; } # ff: Find file under the current directory ffs () { /usr/bin/find . -name "$@"'*' ; } # ffs: Find file whose name starts with a given string ffe () { /usr/bin/find . -name '*'"$@" ; } # ffe: Find file whose name ends with a given string @@ -572,6 +629,8 @@ alias mailoptimiser="curl -sS https://raw.githubusercontent.com/pbihq/tools/mast # Multitail alias mt='multitail -F /usr/local/etc/multitail.conf' +# Convert video to Plex AppleTV +alias atv="$HOME/.local/bin/convert-videos-for-plex.sh -fr" # --------------------------------------- # 7.l Backup (dotbare...) @@ -640,12 +699,11 @@ function gpg-decrypt() { # 10. Zinit # --------------------------------------- - ### Added by Zinit's installer if [[ ! -f $HOME/.zinit/bin/zinit.zsh ]]; then - print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma/zinit%F{220})…%f" + print -P "%F{33}▓▒░ %F{220}Installing %F{33}DHARMA%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" command mkdir -p "$HOME/.zinit" && command chmod g-rwX "$HOME/.zinit" - command git clone https://github.com/zdharma/zinit "$HOME/.zinit/bin" && \ + command git clone https://github.com/zdharma-continuum/zinit "$HOME/.zinit/bin" && \ print -P "%F{33}▓▒░ %F{34}Installation successful.%f%b" || \ print -P "%F{160}▓▒░ The clone has failed.%f%b" fi @@ -657,10 +715,10 @@ autoload -Uz _zinit # Load a few important annexes, without Turbo # (this is currently required for annexes) zinit light-mode for \ - zinit-zsh/z-a-rust \ - zinit-zsh/z-a-as-monitor \ - zinit-zsh/z-a-patch-dl \ - zinit-zsh/z-a-bin-gem-node + zdharma-continuum/z-a-rust \ + zdharma-continuum/z-a-as-monitor \ + zdharma-continuum/z-a-patch-dl \ + zdharma-continuum/z-a-bin-gem-node ### End of Zinit's installer chunk @@ -669,11 +727,11 @@ zinit ice depth"1" # git clone depth zinit light romkatv/powerlevel10k # Plugin history-search-multi-word loaded with investigating. -zinit load zdharma/history-search-multi-word +zinit load zdharma-continuum/history-search-multi-word # Two regular plugins loaded without investigating. zinit light zsh-users/zsh-autosuggestions -zinit light zdharma/fast-syntax-highlighting +zinit light zdharma-continuum/fast-syntax-highlighting zinit light ael-code/zsh-colored-man-pages zinit light zsh-users/zsh-completions zinit light marzocchi/zsh-notify @@ -684,7 +742,7 @@ zinit ice from'gh-r' as'program' zinit light sei40kr/fast-alias-tips-bin zinit light sei40kr/zsh-fast-alias-tips # -zinit light zinit-zsh/z-a-man +zinit light zdharma-continuum/z-a-man zinit light glostis/venv-wrapper #zinit light mafredri/zsh-async # ikhurramraza/bol et owenvoke/quoter-zsh incompatibles avec mafredri/zsh-async @@ -717,6 +775,3 @@ export GPG_ID=bruno@clicclac.info # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh - -# Created by `pipx` on 2021-08-17 08:22:20 -export PATH="$PATH:/Users/bruno/.local/bin"