diff --git a/README.md b/README.md index 159ac88..655aabc 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ - **Shell prompt:** [starship](https://starship.rs/) - **Anime/Manga/Wallpaper:** [gallery-dl](https://github.com/mikf/gallery-dl) / [mangadl-bash](https://github.com/Akianonymus/mangadl-bash), [anime-downloader](https://github.com/anime-dl/anime-downloader) + [trackma](https://github.com/z411/trackma) + [adl](https://github.com/RaitaroH/adl) / [anigrab](https://github.com/ngomile/anigrab) - **CLI/TUI for the Internet:** [translate-shell](https://github.com/soimort/translate-shell) / [argos-translate](https://github.com/argosopentech/argos-translate), [ddgr](https://github.com/jarun/ddgr), [howdoi](https://github.com/gleitz/howdoi), [amfora](https://github.com/makeworld-the-better-one/amfora), [cointop](https://github.com/miguelmota/cointop), [newsboat](https://github.com/newsboat/newsboat), [youtube-dl](https://github.com/ytdl-org/youtube-dl) + [ytmdl](https://github.com/deepjyoti30/ytmdl), [github-cli](https://github.com/cli/cli), [pup](https://github.com/ericchiang/pup), [weechat](https://github.com/weechat/weechat), [curl](https://curl.haxx.se) / [wget](https://www.gnu.org/software/wget/wget.html) / [aria2](https://github.com/aria2/aria2), [tremc](https://github.com/tremc/tremc) + [transmission](https://github.com/transmission/transmission) / [rtorrent](https://github.com/rakshasa/rtorrent), [goaccess](https://github.com/allinurl/goaccess) - - **CLI/TUI for other things:** [tt](https://github.com/runrin/tt), [forgit](https://github.com/wfxr/forgit), [borg](https://github.com/borgbackup/borg), [wendy](https://git.z3bra.org/wendy/log.html), [tokei](https://github.com/XAMPPRocky/tokei), [onefetch](https://github.com/o2sh/onefetch), [calcurse](https://github.com/lfos/calcurse), [qalculate](https://github.com/Qalculate/libqalculate), [fzf](https://github.com/junegunn/fzf), [fd](https://github.com/sharkdp/fd), [ripgrep](https://github.com/BurntSushi/ripgrep), [atool](http://www.nongnu.org/atool/), [rsync](https://rsync.samba.org/), [bottom](https://github.com/clementtsang/bottom), [hyperfine](https://github.com/sharkdp/hyperfine), [delta](https://github.com/dandavison/delta), [bat](https://github.com/sharkdp/bat), [glow](https://github.com/charmbracelet/glow) / [mdcat](https://github.com/lunaryorn/mdcat) / [mdr](https://github.com/MichaelMure/mdr), [exa](https://github.com/ogham/exa), [pandoc](https://github.com/jgm/pandoc), [csview](https://github.com/wfxr/csview), [libsixel](https://github.com/saitoha/libsixel), [buku](https://github.com/jarun/buku), [jq](https://github.com/stedolan/jq), sysstat, psmisc, wireless_tools, tree + - **CLI/TUI for other things:** [tt](https://github.com/runrin/tt), [forgit](https://github.com/wfxr/forgit), [borg](https://github.com/borgbackup/borg), [wendy](https://git.z3bra.org/wendy/log.html), [tokei](https://github.com/XAMPPRocky/tokei), [onefetch](https://github.com/o2sh/onefetch), [calcurse](https://github.com/lfos/calcurse), [qalculate](https://github.com/Qalculate/libqalculate), [fzf](https://github.com/junegunn/fzf), [fd](https://github.com/sharkdp/fd), [ripgrep](https://github.com/BurntSushi/ripgrep), [atool](http://www.nongnu.org/atool/), [rsync](https://rsync.samba.org/), [bottom](https://github.com/clementtsang/bottom), [hyperfine](https://github.com/sharkdp/hyperfine), [delta](https://github.com/dandavison/delta), [bat](https://github.com/sharkdp/bat), [glow](https://github.com/charmbracelet/glow) / [mdcat](https://github.com/lunaryorn/mdcat) / [mdr](https://github.com/MichaelMure/mdr), [exa](https://github.com/ogham/exa), [pandoc](https://github.com/jgm/pandoc), [csview](https://github.com/wfxr/csview), [libsixel](https://github.com/saitoha/libsixel), [buku](https://github.com/jarun/buku), [jq](https://github.com/stedolan/jq), [zoxide](https://github.com/ajeetdsouza/zoxide) / [z.lua](https://github.com/skywind3000/z.lua), sysstat, psmisc, wireless_tools, tree - **Selfhosted service:** [LibreTranslate](https://github.com/uav4geo/LibreTranslate), [searx](https://github.com/searx/searx), [yacy](https://github.com/yacy/yacy_search_server), [synapse](https://github.com/matrix-org/synapse), [mastodon](https://github.com/tootsuite/mastodon), [gitea](https://gitea.io/) > `Emacs` deserves its own set of dependencies listed, but I'm lazy -> Check my Doom config for details diff --git a/home/.bashrc-bloated b/home/.bashrc-bloated index d4799c2..bac22ab 100644 --- a/home/.bashrc-bloated +++ b/home/.bashrc-bloated @@ -74,14 +74,19 @@ export QT_QPA_PLATFORMTHEME=qt5ct export QT_PLATFORM_PLUGIN=qt5ct # .NET export DOTNET_CLI_TELEMETRY_OPTOUT=1 +# zoxide +export _ZO_DATA_DIR="$HOME/.local/share/zoxide" +export _ZO_ECHO=1 +export _ZO_FZF_OPTS="--no-multi" +export _ZO_RESOLVE_SYMLINKS=1 # z.lua -export _ZL_DATA="$HOME/.local/share/zlua/zlua" -export _ZL_HYPHEN=1 -export _ZL_MATCH_MODE=1 -export _ZL_FZF_FLAG="-e" -export _ZL_INT_SORT=1 -export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro" -export RANGER_ZLUA="$HOME/.local/share/bash/z.lua" +# export _ZL_DATA="$HOME/.local/share/zlua/zlua" +# export _ZL_HYPHEN=1 +# export _ZL_MATCH_MODE=1 +# export _ZL_FZF_FLAG="-e" +# export _ZL_INT_SORT=1 +# export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro" +# export RANGER_ZLUA="$HOME/.local/share/bash/z.lua" # Basher export BASHER_ROOT="$HOME/.local/share/bash/basher" # nodenv @@ -380,7 +385,7 @@ alias mkdir="mkdir -pv" alias no="grep -viP" alias wttr="curl wttr.in" alias myip="curl ipinfo.io/geo" -alias latest_pkg="expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 30" +# alias latest_pkg="expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 30" alias yarn="yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config" alias tmux="TERM=screen-256color tmux" alias catc="bat --style plain --color=always" @@ -408,14 +413,6 @@ alias yoump3="youtube-dl --extract-audio --audio-format mp3 --embed-thumbnail" alias youflac="youtube-dl --extract-audio --audio-format flac" alias youbest="youtube-dl -f bestvideo+bestaudio" alias youlist="youtube-dl -f bestvideo+bestaudio --yes-playlist" -# z.lua -alias zz='z -c' # restrict matches to subdirs of $PWD -alias zi='z -i' # cd with interactive selection -alias zf='z -I' # use fzf to select in multiple matches -alias zb='z -b' # quickly cd to the parent directory -# nnn -alias nnn="nnn -Hc" -alias ncp="cat ${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | tr '\0' '\n'" # Lazy cd-ing alias ..='cd ..' @@ -528,40 +525,44 @@ basherpacks_update() { } # nnn with cd on quit -n () -{ - # Block nesting of nnn in subshells - if [[ -n $NNNLVL ]] && [ "${NNNLVL:-0}" -ge 1 ]; then - echo "nnn is already running" - return - fi +if command -v nnn >/dev/null; then + alias nnn="nnn -Hc" + alias ncp="cat ${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | tr '\0' '\n'" - # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) - # To cd on quit only on ^G, remove the "export" as in: - # NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" - # NOTE: NNN_TMPFILE is fixed, should not be modified - export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" + n () { + # Block nesting of nnn in subshells + if [[ -n $NNNLVL ]] && [ "${NNNLVL:-0}" -ge 1 ]; then + echo "nnn is already running" + return + fi - # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn - # stty start undef - # stty stop undef - # stty lwrap undef - # stty lnext undef + # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) + # To cd on quit only on ^G, remove the "export" as in: + # NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" + # NOTE: NNN_TMPFILE is fixed, should not be modified + export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" - nnn "$@" + # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn + # stty start undef + # stty stop undef + # stty lwrap undef + # stty lnext undef - if [ -f "$NNN_TMPFILE" ]; then - . "$NNN_TMPFILE" - rm -f "$NNN_TMPFILE" > /dev/null - fi -} + nnn "$@" -# nnn in dual pane mode (tmux) -n2() { - tmux new-session -d -s nnn -n nnn "nnn -Hc" - tmux split-window -h "nnn -Hc" - TERM=screen-256color tmux attach -t nnn:nnn -} + if [ -f "$NNN_TMPFILE" ]; then + . "$NNN_TMPFILE" + rm -f "$NNN_TMPFILE" > /dev/null + fi + } + + # nnn in dual pane mode (tmux) + n2() { + tmux new-session -d -s nnn -n nnn "nnn -Hc" + tmux split-window -h "nnn -Hc" + TERM=screen-256color tmux attach -t nnn:nnn + } +fi # typing speed testing tt() { @@ -605,18 +606,22 @@ mkdir -p "$BASH_COMPLETION_USER_DIR/completions" if command -v gh >/dev/null && [ ! -f "$BASH_COMPLETION_USER_DIR/completions/gh" ]; then gh completion -s bash > "$BASH_COMPLETION_USER_DIR/completions/gh" fi + # kitten from kitty if command -v kitty > /dev/null; then source <(kitty + complete setup bash) fi + # Starship prompt if command -v starship > /dev/null; then eval "$(starship init bash --print-full-init)" fi + # direnv if command -v direnv >/dev/null ; then eval "$(direnv hook bash)" fi + # poetry # if [ ! -d "$POETRY_HOME" ]; then # curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - @@ -624,6 +629,7 @@ fi # if [[ ! -f $BASH_COMPLETION_USER_DIR/completions/poetry ]]; then # poetry completions bash > "$BASH_COMPLETION_USER_DIR/completions/poetry" # fi + # pyenv # if [[ ! -d $PYENV_ROOT ]]; then # git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT @@ -632,6 +638,7 @@ fi # fi # eval "$(pyenv init -)" # eval "$(pyenv virtualenv-init -)" + # nodenv # if [[ ! -d $NODENV_ROOT ]]; then # git clone https://github.com/nodenv/nodenv.git $NODENV_ROOT @@ -645,12 +652,35 @@ fi # git clone https://github.com/nodenv/nodenv-vars.git $NODENV_ROOT/plugins/nodenv-vars # fi # eval "$(nodenv init -)" + # z.lua -if [[ ! -f "$HOME/.local/share/bash/z.lua" ]]; then - curl -sfLo $HOME/.local/share/bash/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua - mkdir -p $HOME/.local/share/zlua +# if [[ ! -f "$HOME/.local/share/bash/z.lua" ]]; then +# curl -fLo $HOME/.local/share/bash/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua +# mkdir -p $HOME/.local/share/zlua +# fi +# eval "$(lua $HOME/.local/share/bash/z.lua --init bash fzf)" +# if command -v ranger >/dev/null; then +# if [ ! -f "$HOME/.config/ranger/plugins/ranger_zlua.py" ]; then +# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py +# chmod 755 $HOME/.config/ranger/plugins/ranger_zlua.py +# fi +# fi +# alias zz='z -c' # restrict matches to subdirs of $PWD +# alias zi='z -i' # cd with interactive selection +# alias zf='z -I' # use fzf to select in multiple matches +# alias zb='z -b' # quickly cd to the parent directory + +# zoxide +if command -v zoxide >/dev/null; then + eval "$(zoxide init bash)" + if command -v ranger >/dev/null; then + if [ ! -f "$HOME/.config/ranger/plugins/ranger_zoxide.py" ]; then + curl -fLo $HOME/.config/ranger/plugins/ranger_zoxide.py https://github.com/ajeetdsouza/zoxide/raw/master/contrib/ranger.py + chmod 755 $HOME/.config/ranger/plugins/ranger_zoxide.py + fi + fi fi -eval "$(lua $HOME/.local/share/bash/z.lua --init bash fzf)" + # autostart gpg-agent at login if ! pgrep -u "$USER" gpg-agent >/dev/null; then gpg-agent --daemon --enable-ssh-support >/dev/null diff --git a/home/.config/doom/config.el b/home/.config/doom/config.el index 773d7d4..9d8015b 100644 --- a/home/.config/doom/config.el +++ b/home/.config/doom/config.el @@ -10,7 +10,7 @@ ;; Font settings (setq doom-font (font-spec :family "Iosevka" :size 16) - doom-variable-pitch-font (font-spec :family "sans" :size 16) + doom-variable-pitch-font (font-spec :family "Iosevka Aile" :size 16) doom-big-font (font-spec :family "Iosevka" :size 24)) ;;(setq inhibit-compacting-font-caches t) (custom-set-faces! @@ -74,8 +74,7 @@ ;; Use ranger.el instead of default dired (after! ranger - (setq ranger-override-dired-mode t - ranger-parent-depth 0 + (setq ranger-parent-depth 0 ranger-cleanup-eagerly t ranger-show-hidden t ranger-max-preview-size 20 diff --git a/home/.config/doom/init.el b/home/.config/doom/init.el index 68a2ad6..f2b4f6e 100644 --- a/home/.config/doom/init.el +++ b/home/.config/doom/init.el @@ -36,8 +36,8 @@ doom-quit ; DOOM quit-message prompts when you quit Emacs (emoji ; :) +unicode - +github - +ascii) + ;;+ascii + +github) ;;fill-column ; a `fill-column' indicator hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW ;;hydra diff --git a/home/.config/fish/conf.d/aliases.fish b/home/.config/fish/conf.d/aliases.fish index 9deb367..08c6ef4 100644 --- a/home/.config/fish/conf.d/aliases.fish +++ b/home/.config/fish/conf.d/aliases.fish @@ -17,7 +17,7 @@ alias mv='mv -vi' alias rm='rm -vr' alias mkdir='mkdir -pv' abbr no 'grep -viP' -abbr latest_pkg "expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 30" +# abbr latest_pkg "expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 30" alias yarn='yarn --use-yarnrc $HOME/.config/yarn/config' abbr tmux 'TERM=screen-256color command tmux' alias catc='bat --style plain --color=always' @@ -47,13 +47,6 @@ abbr youlist 'youtube-dl -f bestvideo+bestaudio --yes-playlist' # nnn abbr nnn 'nnn -Hc' alias ncp="cat $XDG_CONFIG_HOME/nnn/.selection | tr '\0' '\n'" -# zlua -alias zc='z -c' # restrict matches to subdirs of $PWD -alias zz='z -i' # cd with interactive selection -alias zf='z -I' # use fzf to select in multiple matches -alias zb='z -b' # quickly cd to the parent directory -alias zbi='z -b -i' # interactive jump backward -alias zbf='z -b -I' # interactive jump backward with fzf # Lazy cd-ing function .. ; cd .. ; end diff --git a/home/.config/fish/conf.d/env.fish b/home/.config/fish/conf.d/env.fish index 5ed465a..2d061d0 100644 --- a/home/.config/fish/conf.d/env.fish +++ b/home/.config/fish/conf.d/env.fish @@ -12,7 +12,7 @@ set -g fish_cursor_visual block set -g fish_vi_force_cursor # no greeting -set -g fish_greeting +# set -g fish_greeting # XDG thingy set -gx XDG_CONFIG_HOME $HOME/.config @@ -86,14 +86,19 @@ set -gx NODENV_ROOT $XDG_DATA_HOME/nodenv set -gx PYENV_ROOT $XDG_DATA_HOME/pyenv # poetry set -gx POETRY_HOME $XDG_DATA_HOME/poetry +# zoxide +set -gx _ZO_DATA_DIR $HOME/.local/share/zoxide +set -gx _ZO_ECHO 1 +set -gx _ZO_FZF_OPTS "--no-multi" +set -gx _ZO_RESOLVE_SYMLINKS 1 # z.lua -set -gx _ZL_DATA $HOME/.local/share/zlua/zlua -set -gx _ZL_HYPHEN 1 -set -gx _ZL_MATCH_MODE 1 -set -gx _ZL_FZF_FLAG '-e' -set -gx _ZL_INT_SORT 1 -set -gx _ZL_ROOT_MARKERS ".git,.svn,.hg,.root,package.json,.projectile,.pro" -set -gx RANGER_ZLUA $HOME/.config/fish/z.lua +# set -gx _ZL_DATA $HOME/.local/share/zlua/zlua +# set -gx _ZL_HYPHEN 1 +# set -gx _ZL_MATCH_MODE 1 +# set -gx _ZL_FZF_FLAG '-e' +# set -gx _ZL_INT_SORT 1 +# set -gx _ZL_ROOT_MARKERS ".git,.svn,.hg,.root,package.json,.projectile,.pro" +# set -gx RANGER_ZLUA $HOME/.config/fish/z.lua # nnn if command -v nnn >/dev/null set -gx TERMINAL alacritty diff --git a/home/.config/fish/conf.d/evaluate.fish b/home/.config/fish/conf.d/evaluate.fish index 2aca6a2..e1bc8be 100644 --- a/home/.config/fish/conf.d/evaluate.fish +++ b/home/.config/fish/conf.d/evaluate.fish @@ -54,13 +54,36 @@ fish_vi_key_bindings # fzf if not test -f "$HOME/.config/fish/functions/fzf_key_bindings.fish" - curl -sfLo $HOME/.config/fish/functions/fzf_key_bindings.fish https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.fish + curl -fLo $HOME/.config/fish/functions/fzf_key_bindings.fish https://raw.githubusercontent.com/junegunn/fzf/master/shell/key-bindings.fish end fzf_key_bindings # z.lua -if not test -f "$HOME/.config/fish/z.lua" - curl -sfLo $HOME/.config/fish/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua - mkdir -p $HOME/.local/share/zlua +# if not test -f "$HOME/.config/fish/z.lua" +# curl -fLo $HOME/.config/fish/z.lua https://raw.githubusercontent.com/skywind3000/z.lua/master/z.lua +# mkdir -p $HOME/.local/share/zlua +# end +# lua $HOME/.config/fish/z.lua --init fish | source +# if command -v ranger >/dev/null +# if not test -f "$HOME/.config/ranger/plugins/ranger_zlua.py" +# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py +# chmod 755 $HOME/.config/ranger/plugins/ranger_zlua.py +# end +# end +# alias zc='z -c' # restrict matches to subdirs of $PWD +# alias zz='z -i' # cd with interactive selection +# alias zf='z -I' # use fzf to select in multiple matches +# alias zb='z -b' # quickly cd to the parent directory +# alias zbi='z -b -i' # interactive jump backward +# alias zbf='z -b -I' # interactive jump backward with fzf + +# zoxide +if command -v zoxide >/dev/null + zoxide init fish | source + if command -v ranger >/dev/null + if not test -f "$HOME/.config/ranger/plugins/ranger_zoxide.py" + curl -fLo $HOME/.config/ranger/plugins/ranger_zoxide.py https://github.com/ajeetdsouza/zoxide/raw/master/contrib/ranger.py + chmod 755 $HOME/.config/ranger/plugins/ranger_zoxide.py + end + end end -lua $HOME/.config/fish/z.lua --init fish | source diff --git a/home/.config/ranger/plugins/ranger-lame.py b/home/.config/ranger/plugins/ranger_lame.py similarity index 100% rename from home/.config/ranger/plugins/ranger-lame.py rename to home/.config/ranger/plugins/ranger_lame.py diff --git a/home/.config/ranger/plugins/ranger_zlua.py b/home/.config/ranger/plugins/ranger_zlua.py deleted file mode 100755 index 321a5eb..0000000 --- a/home/.config/ranger/plugins/ranger_zlua.py +++ /dev/null @@ -1,87 +0,0 @@ -import time, sys, os -import ranger.api -import subprocess - -old_hook_init = ranger.api.hook_init - -PATH_LUA = os.environ.get('RANGER_LUA') -PATH_ZLUA = os.environ.get('RANGER_ZLUA') - -if not PATH_LUA: - for path in os.environ.get('PATH', '').split(os.path.pathsep): - for name in ('lua', 'luajit', 'lua5.3', 'lua5.2', 'lua5.1'): - test = os.path.join(path, name) - test = test + (sys.platform[:3] == 'win' and ".exe" or "") - if os.path.exists(test): - PATH_LUA = test - break - -if not PATH_LUA: - sys.stderr.write('Please install lua or set $RANGER_LUA.\n') - sys.exit() - -if (not PATH_ZLUA) or (not os.path.exists(PATH_ZLUA)): - sys.stderr.write('Not find z.lua, please set $RANGER_ZLUA to absolute path of z.lua.\n') - sys.exit() - - -def hook_init(fm): - def update_zlua(signal): - import os, random - os.environ['_ZL_RANDOM'] = str(random.randint(0, 0x7fffffff)) - p = subprocess.Popen([PATH_LUA, PATH_ZLUA, "--add", signal.new.path]) - p.wait() - if PATH_ZLUA and PATH_LUA and os.path.exists(PATH_ZLUA): - fm.signal_bind('cd', update_zlua) - return old_hook_init(fm) - -ranger.api.hook_init = hook_init - -class z(ranger.api.commands.Command): - def execute (self): - import sys, os, time - args = self.args[1:] - if args: - mode = '' - for arg in args: - if arg in ('-l', '-e', '-x', '-h', '--help', '--'): - mode = arg - break - elif arg in ('-I', '-i'): - mode = arg - elif arg[:1] != '-': - break - if mode: - cmd = '"%s" "%s" '%(PATH_LUA, PATH_ZLUA) - if mode in ('-I', '-i', '--'): - cmd += ' --cd' - for arg in args: - cmd += ' "%s"'%arg - if mode in ('-e', '-x'): - path = subprocess.check_output([PATH_LUA, PATH_ZLUA, '--cd'] + args) - path = path.decode("utf-8", "ignore") - path = path.rstrip('\n') - self.fm.notify(path) - elif mode in ('-h', '-l', '--help'): - p = self.fm.execute_command(cmd + '| less +G', universal_newlines=True) - stdout, stderr = p.communicate() - elif mode == '--': - p = self.fm.execute_command(cmd + ' 2>&1 | less +G', universal_newlines=True) - stdout, stderr = p.communicate() - else: - p = self.fm.execute_command(cmd, universal_newlines=True, stdout=subprocess.PIPE) - stdout, stderr = p.communicate() - path = stdout.rstrip('\n') - self.fm.execute_console('redraw_window') - if path and os.path.exists(path): - self.fm.cd(path) - else: - path = subprocess.check_output([PATH_LUA, PATH_ZLUA, '--cd'] + args) - path = path.decode("utf-8", "ignore") - path = path.rstrip('\n') - if path and os.path.exists(path): - self.fm.cd(path) - else: - self.fm.notify('No matching found', bad = True) - return True - diff --git a/home/.config/zsh/.zshenv b/home/.config/zsh/.zshenv index da34a93..52efcf4 100644 --- a/home/.config/zsh/.zshenv +++ b/home/.config/zsh/.zshenv @@ -76,6 +76,11 @@ export NODENV_ROOT=$XDG_DATA_HOME/nodenv export PYENV_ROOT=$XDG_DATA_HOME/pyenv # poetry export POETRY_HOME=$XDG_DATA_HOME/poetry +# zoxide +export _ZO_DATA_DIR="$HOME/.local/share/zoxide" +export _ZO_ECHO=1 +export _ZO_FZF_OPTS="--no-multi" +export _ZO_RESOLVE_SYMLINKS=1 # nnn if command -v nnn >/dev/null then @@ -368,13 +373,13 @@ export ZSH_PLUGINS_ALIAS_TIPS_TEXT="💡 => " export ZSH_AUTOSUGGEST_STRATEGY=(history completion) export ZSH_AUTOSUGGEST_USE_ASYNC=1 # z.lua -export _ZL_DATA="$HOME/.local/share/zlua/zlua" -export _ZL_HYPHEN=1 -export _ZL_MATCH_MODE=1 -export _ZL_FZF_FLAG="-e" -export _ZL_INT_SORT=1 -export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro" -export RANGER_ZLUA="$HOME/.local/share/zsh/zinit/plugins/skywind3000---z.lua/z.lua" +# export _ZL_DATA="$HOME/.local/share/zlua/zlua" +# export _ZL_HYPHEN=1 +# export _ZL_MATCH_MODE=1 +# export _ZL_FZF_FLAG="-e" +# export _ZL_INT_SORT=1 +# export _ZL_ROOT_MARKERS=".git,.svn,.hg,.root,package.json,.projectile,.pro" +# export RANGER_ZLUA="$HOME/.local/share/zsh/zinit/plugins/skywind3000---z.lua/z.lua" # zsh-abbr export ABBR_USER_ABBREVIATIONS_FILE="$HOME/.local/share/zsh/abbreviations" # gencomp diff --git a/home/.config/zsh/.zshrc b/home/.config/zsh/.zshrc index 53d74ba..52783a8 100644 --- a/home/.config/zsh/.zshrc +++ b/home/.config/zsh/.zshrc @@ -40,6 +40,17 @@ if command -v direnv > /dev/null; then eval "$(direnv hook zsh)" fi +# zoxide +if command -v zoxide >/dev/null; then + eval "$(zoxide init zsh)" + if command -v ranger >/dev/null; then + if [ ! -f "$HOME/.config/ranger/plugins/ranger_zoxide.py" ]; then + curl -fLo $HOME/.config/ranger/plugins/ranger_zoxide.py https://github.com/ajeetdsouza/zoxide/raw/master/contrib/ranger.py + chmod 755 $HOME/.config/ranger/plugins/ranger_zoxide.py + fi + fi +fi + # poetry # if [ ! -d $POETRY_HOME ]; then # curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - @@ -150,8 +161,14 @@ zinit light unixorn/git-extra-commands zinit light olets/zsh-abbr # zinit light djui/alias-tips -# cd around faster -zinit light skywind3000/z.lua +# cd around faster with zlua +# zinit light skywind3000/z.lua +# if command -v ranger >/dev/null; then +# if [ ! -f "$HOME/.config/ranger/plugins/ranger_zlua.py" ]; then +# curl -fLo $HOME/.config/ranger/plugins/ranger_zlua.py https://github.com/skywind3000/z.lua/raw/master/ranger_zlua.py +# chmod 755 $HOME/.config/ranger/plugins/ranger_zlua.py +# fi +# fi # Plugins' configurations source $ZDOTDIR/plugins.zsh diff --git a/home/.config/zsh/aliases.zsh b/home/.config/zsh/aliases.zsh index 8b5ee01..80f00ec 100644 --- a/home/.config/zsh/aliases.zsh +++ b/home/.config/zsh/aliases.zsh @@ -12,7 +12,7 @@ alias rm="rm -vr" alias mkdir="mkdir -pv" alias no="grep -viP" alias wttr="curl wttr.in" -alias latest_pkg="expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 30" +# alias latest_pkg="expac --timefmt='%Y-%m-%d %T' '%l\t%n' | sort | tail -n 30" alias yarn="yarn --use-yarnrc $HOME/.config/yarn/config" alias tmux="TERM=screen-256color tmux" alias catc="bat --style plain --color=always" @@ -39,9 +39,6 @@ alias yoump3="youtube-dl --extract-audio --audio-format mp3 --embed-thumbnail" alias youflac="youtube-dl --extract-audio --audio-format flac" alias youbest="youtube-dl -f bestvideo+bestaudio" alias youlist="youtube-dl -f bestvideo+bestaudio --yes-playlist" -# nnn -alias nnn="nnn -Hc" -alias ncp="cat ${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | tr '\0' '\n'" # Lazy cd-ing alias ..='cd ..' @@ -66,40 +63,44 @@ zman() { } # nnn with cd on quit -n () -{ - # Block nesting of nnn in subshells - if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then - echo "nnn is already running" - return - fi +if command -v nnn >/dev/null; then + alias nnn="nnn -Hc" + alias ncp="cat ${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} | tr '\0' '\n'" - # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) - # To cd on quit only on ^G, remove the "export" as in: - # NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" - # NOTE: NNN_TMPFILE is fixed, should not be modified - export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" + n () { + # Block nesting of nnn in subshells + if [ -n $NNNLVL ] && [ "${NNNLVL:-0}" -ge 1 ]; then + echo "nnn is already running" + return + fi - # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn - # stty start undef - # stty stop undef - # stty lwrap undef - # stty lnext undef + # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) + # To cd on quit only on ^G, remove the "export" as in: + # NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" + # NOTE: NNN_TMPFILE is fixed, should not be modified + export NNN_TMPFILE="${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.lastd" - nnn "$@" + # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn + # stty start undef + # stty stop undef + # stty lwrap undef + # stty lnext undef - if [ -f "$NNN_TMPFILE" ]; then - . "$NNN_TMPFILE" - rm -f "$NNN_TMPFILE" > /dev/null - fi -} + nnn "$@" -# nnn in dual pane mode (tmux) -n2() { - tmux new-session -d -s nnn -n nnn "nnn -Hc" - tmux split-window -h "nnn -Hc" - TERM=screen-256color tmux attach -t nnn:nnn -} + if [ -f "$NNN_TMPFILE" ]; then + . "$NNN_TMPFILE" + rm -f "$NNN_TMPFILE" > /dev/null + fi + } + + # nnn in dual pane mode (tmux) + n2() { + tmux new-session -d -s nnn -n nnn "nnn -Hc" + tmux split-window -h "nnn -Hc" + TERM=screen-256color tmux attach -t nnn:nnn + } +fi # typing speed testing tt() {