From bb361c8aa2ce1e21b734e560be868f0bbe5dcdba Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Sat, 23 Jul 2022 14:06:10 -0700 Subject: [PATCH] update ranger and zshrc --- dotfiles/.environment | 51 +++++ dotfiles/.zshrc | 337 ++++++++------------------------- ranger/plugins/__init__.py | 0 ranger/plugins/ranger_devicons | 1 + ranger/rc.conf | 14 +- ranger/rifle.conf | 10 +- 6 files changed, 144 insertions(+), 269 deletions(-) create mode 100644 dotfiles/.environment create mode 100644 ranger/plugins/__init__.py create mode 160000 ranger/plugins/ranger_devicons diff --git a/dotfiles/.environment b/dotfiles/.environment new file mode 100644 index 0000000..2e92411 --- /dev/null +++ b/dotfiles/.environment @@ -0,0 +1,51 @@ +export XDG_CACHE_DIR="$HOME/.cache" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_STATE_HOME="$HOME/.local/state" +export ARCHFLAGS="-arch x86_64" +export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv +export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker +export EDITOR=nvim +export GNUPGHOME="$HOME"/.gnupg +export GOPATH="$XDG_DATA_HOME"/go +export GRIPHOME="$XDG_CONFIG_HOME/grip" +export GTK2_RC_FILES="$XDG_CONFIG_HOME"/gtk-2.0/gtkrc +export GTK_RC_FILES="$XDG_CONFIG_HOME"/gtk-1.0/gtkrc +export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME"/jupyter +export LANG=en_US.UTF-8 +export MANPAGER='nvim +Man!' +export MANPATH="/usr/local/man:$MANPATH" +export MINIKUBE_HOME="$XDG_DATA_HOME"/minikube +export MPLAYER_HOME="$XDG_CONFIG_HOME"/mplayer +export MYSQL_HISTFILE="$XDG_DATA_HOME"/mysql_history +export NODE_REPL_HISTORY="$XDG_DATA_HOME"/node_repl_history +export PATH="$HOME/.bin:$PATH" +export PATH="$HOME/.local/bin:$PATH" +export PATH="$HOME/Projects/Python/Sudasong/src/:$PATH" +export PATH="$HOME/Work/rofi/:$PATH" +export PATH="$HOME/Work/scripts:$PATH" +export PATH="$HOME/scripts:$PATH" +export PATH=$PATH:/home/sudacode/.emacs.d/bin +export PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/pythonrc" +export RUSTUP_HOME="$XDG_DATA_HOME"/rustup +export SQLITE_HISTORY="$XDG_CACHE_HOME"/sqlite_history +export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/yubikey-agent/yubikey-agent.sock" +export TERM=xterm-256color +export TERMINFO="$XDG_DATA_HOME"/terminfo +export TERMINFO_DIRS="$XDG_DATA_HOME"/terminfo:/usr/share/terminfo +export VISUAL=nvim +export WORKON_HOME="$XDG_DATA_HOME/virtualenvs" +export ZSH="$HOME/.oh-my-zsh" +export _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME"/java +export _Z_DATA="$XDG_DATA_HOME/z" +## ibus config +# export GTK_IM_MODULE=ibus +# # will make libreoffice work +export XMODIFIERS=@im=ibus +export QT_IM_MODULE=ibus +export QT4_IM_MODULE=xim +export GLFW_IM_MODULE=ibus +ibus-daemon -drx + +# vim: ft=zsh diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index b287d80..0583126 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -1,180 +1,16 @@ -# ZSH_THEME="spaceship" # set by `omz` +[ -f ~/.environment ] && . ~/.environment -# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. -# Initialization code that may require console input (password prompts, [y/n] -# confirmations, etc.) must go above this block, everything else may go below. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi -#If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH - -export ZSH="$HOME/.oh-my-zsh" -export PATH="$HOME/scripts:$PATH" -export PATH="$HOME/Work/scripts:$PATH" -export PATH="$HOME/Work/rofi/:$PATH" -export PATH="$HOME/.bin:$PATH" -export PATH="$HOME/Projects/Python/Sudasong/src/:$PATH" -export PATH="$HOME/.local/bin:$PATH" -# export EDITOR=vim -# export VISUAL=vim -export EDITOR=nvim -export VISUAL=nvim -# export MANPAGER="sh -c 'col -bx | bat -l man -p'" -export MANPAGER='nvim +Man!' - -# export FZF_DEFAULT_COMMAND='fd --type f' -# follow symbolic links and no git -# export FZF_DEFAULT_COMMAND='fd --type f --follow --exclude .git' - -if [ -f ~/.bash_aliases ]; then - . $HOME/.bash_aliases -fi - -if [ -f ~/.aliases ]; then - . $HOME/.aliases -fi - -if [ -f ~/Work/.aliases ]; then - . $HOME/Work/.aliases -fi - -source ~/.bash_aliases - -#POWERLEVEL9K_MODE='nerdfont' -#POWERLEVEL9K_MODE='awesome-fontconfig' -POWERLEVEL9K_MODE='nerdfont-complete' -#POWERLEVEL9K_MODE='awesome-patched, nerdfont-complete' - -# Set name of the theme to load --- if set to "random", it will -# load a random theme each time oh-my-zsh is loaded, in which case, -# to know which specific one was loaded, run: echo $RANDOM_THEME -# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes -#ZSH_THEME="powerlevel9k/powerlevel9k" -ZSH_THEME="powerlevel10k/powerlevel10k" -# ZSH_THEME="random" # set by `omz` -#ZSH_THEME="agnoster" -# ZSH_THEMES="spaceship" - -# Set list of themes to pick from when loading at random -# Setting this variable when ZSH_THEME=random will cause zsh to load -# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ -# If set to an empty array, this variable will have no effect. -# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) - -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. -# Case-sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to automatically update without prompting. -# DISABLE_UPDATE_PROMPT="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 - -# Uncomment the following line if pasting URLs and other text is messed up. -# DISABLE_MAGIC_FUNCTIONS=true - -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" - -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment the following line to enable command auto-correction. -ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# You can set one of the optional three formats: -# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# or set a custom format using the strftime function format specifications, -# see 'man strftime' for details. -# HIST_STAMPS="mm/dd/yyyy" -HISTSIZE=1000 -HISTFILESIZE=2000 -HISTCONTROL=ignoreboth - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - - -# Which plugins would you like to load? -# Standard plugins can be found in ~/.oh-my-zsh/plugins/* -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -plugins=(zsh-autosuggestions zsh-syntax-highlighting vi-mode git zsh-z) -# plugins=(zsh-syntax-highlighting vi-mode git zsh-z) - -source $ZSH/oh-my-zsh.sh -#source ~/.oh-my-zsh/plugins/git/git.plugin.zsh - - -# User configuration - -export MANPATH="/usr/local/man:$MANPATH" - -# You may need to manually set your language environment -export LANG=en_US.UTF-8 - -# Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='vim' -# fi - -# Compilation flags -export ARCHFLAGS="-arch x86_64" - -# Set personal aliases, overriding those provided by oh-my-zsh libs, -# plugins, and themes. Aliases can be placed here, though oh-my-zsh -# users are encouraged to define aliases within the ZSH_CUSTOM folder. -# For a full list of active aliases, run `alias`. -# -# Example aliases -# alias zshconfig="mate ~/.zshrc" -# alias ohmyzsh="mate ~/.oh-my-zsh" - - -export PATH=$PATH:/home/linuxbrew/.linuxbrew/bin - -# set battery stages and colors -POWERLEVEL9K_BATTERY_STAGES=( - $'▏ ▏' $'▎ ▏' $'▍ ▏' $'▌ ▏' $'▋ ▏' $'▊ ▏' $'▉ ▏' $'█ ▏' - $'█▏ ▏' $'█▎ ▏' $'█▍ ▏' $'█▌ ▏' $'█▋ ▏' $'█▊ ▏' $'█▉ ▏' $'██ ▏' - $'██ ▏' $'██▎ ▏' $'██▍ ▏' $'██▌ ▏' $'██▋ ▏' $'██▊ ▏' $'██▉ ▏' $'███ ▏' - $'███ ▏' $'███▎ ▏' $'███▍ ▏' $'███▌ ▏' $'███▋ ▏' $'███▊ ▏' $'███▉ ▏' $'████ ▏' - $'████ ▏' $'████▎▏' $'████▍▏' $'████▌▏' $'████▋▏' $'████▊▏' $'████▉▏' $'█████▏' ) - -POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(red3 darkorange3 darkgoldenrod gold3 yellow3 chartreuse2 mediumspringgreen green3 green3 green4 darkgreen) -POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=green3 -POWERLEVEL9K_BATTERY_LOW_FOREGROUND='226' -POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND='021' -POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND='021' -POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 -POWERLEVEL9K_BATTERY_VERBOSE=true - LS_COLORS="di=42;1;90:*.mp3=1;32;41:fi=0;91:*.c=1;96:*.js=1;93:*.h=1;35:ex=1;32:*.html=1;36:*.cpp=1;96:*.txt=1;91:*Makefile=1;95:*.css=1;36:*.as=1;36:ow=1;42;93:*.ttf=0;91:*.png=0;91:*README=4;31:*.jpg=0;91:*.md=4;31:*.json=1;94:*.as=0;35:*.obj=0;35:*.correct=1;94:*.py=1;91:*.ipynb=3;91" +PS2="===>" -# # ex = EXtractor for all kinds of archives -# # usage: ex +bindkey '^ ' autosuggest-accept + +# ex = EXtractor for all kinds of archives +# usage: ex ex () { if [ -f $1 ] ; then @@ -199,109 +35,90 @@ ex () fi } -# Codi -# Usage: codi [filetype] [filename] -codi() { - local syntax="${1:-python}" - shift - vim -c \ - "let g:startify_disable_at_vimenter = 1 |\ - set bt=nofile ls=0 noru nonu nornu |\ - hi ColorColumn ctermbg=NONE |\ - hi VertSplit ctermbg=NONE |\ - Codi $syntax" "$@" -} - get_git_commit_hash() { git rev-parse HEAD | cut -c -12 } -export SPACESHIP_TIME_SHOW=true -export SPACESHIP_GCLOUD_SHOW=false -export SPACESHIP_EXIT_CODE_SHOW=true -export SPACESHIP_TIME_COLOR=blue -export SPACESHIP_VENV_PREFIX=" " -export SPACESHIP_DIR_TRUNC=0 -# eval spaceship_vi_mode_enable +if [ -f ~/.bash_aliases ]; then + . $HOME/.bash_aliases +fi +if [ -f ~/.aliases ]; then + . $HOME/.aliases +fi +if [ -f ~/Work/.aliases ]; then + . $HOME/Work/.aliases +fi -### for use with xserver... causes screenfetch and neofetch to not work unless xserver is running -#export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0 -# -#sudo /etc/init.d/dbus start &> /dev/null +[[ "$TERM" == "xterm-kitty" ]] && alias ssh='kitty +kitten ssh' -PS2="===>" +#POWERLEVEL9K_MODE='nerdfont' +#POWERLEVEL9K_MODE='awesome-fontconfig' +POWERLEVEL9K_MODE='nerdfont-complete' +#POWERLEVEL9K_MODE='awesome-patched, nerdfont-complete' + +ZSH_THEME="powerlevel10k/powerlevel10k" +# ZSH_THEME="random" +# ZSH_THEMES="spaceship" +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" +# DISABLE_AUTO_UPDATE="true" +# DISABLE_UPDATE_PROMPT="true" +# export UPDATE_ZSH_DAYS=13 +# DISABLE_MAGIC_FUNCTIONS=true +# DISABLE_LS_COLORS="true" +# DISABLE_AUTO_TITLE="true" +ENABLE_CORRECTION="false" +COMPLETION_WAITING_DOTS="true" +DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" +HISTSIZE=1000 +HISTFILESIZE=2000 +HISTCONTROL=ignoreboth + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in ~/.oh-my-zsh/plugins/* +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(zsh-autosuggestions zsh-syntax-highlighting vi-mode git zsh-z) + +source $ZSH/oh-my-zsh.sh + +# set battery stages and colors +POWERLEVEL9K_BATTERY_STAGES=( + $'▏ ▏' $'▎ ▏' $'▍ ▏' $'▌ ▏' $'▋ ▏' $'▊ ▏' $'▉ ▏' $'█ ▏' + $'█▏ ▏' $'█▎ ▏' $'█▍ ▏' $'█▌ ▏' $'█▋ ▏' $'█▊ ▏' $'█▉ ▏' $'██ ▏' + $'██ ▏' $'██▎ ▏' $'██▍ ▏' $'██▌ ▏' $'██▋ ▏' $'██▊ ▏' $'██▉ ▏' $'███ ▏' + $'███ ▏' $'███▎ ▏' $'███▍ ▏' $'███▌ ▏' $'███▋ ▏' $'███▊ ▏' $'███▉ ▏' $'████ ▏' + $'████ ▏' $'████▎▏' $'████▍▏' $'████▌▏' $'████▋▏' $'████▊▏' $'████▉▏' $'█████▏' ) + +POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(red3 darkorange3 darkgoldenrod gold3 yellow3 chartreuse2 mediumspringgreen green3 green3 green4 darkgreen) +POWERLEVEL9K_BATTERY_CHARGING_FOREGROUND=green3 +POWERLEVEL9K_BATTERY_LOW_FOREGROUND='226' +POWERLEVEL9K_BATTERY_CHARGED_FOREGROUND='021' +POWERLEVEL9K_BATTERY_DISCONNECTED_FOREGROUND='021' +POWERLEVEL9K_BATTERY_LOW_THRESHOLD=20 +POWERLEVEL9K_BATTERY_VERBOSE=true -# # Add gem to PATH -# export PATH=$PATH:/home/sudacode/.gem/ruby/2.7.0/bin -# -# # Add go to PATH -# export PATH=$PATH:/home/sudacode/go/bin -# -# alias freud='cd /home/sudacode/' -# -# # Add yarn to PATH -# export PATH="$PATH:`yarn global bin`" -# -# # set terminal color to 256 color -export TERM=xterm-256color -# -# export PATH=$PATH:/home/sudacode/.local/bin -# -# add emacs to path -export PATH=$PATH:/home/sudacode/.emacs.d/bin -# -#Enable tab completions for flags in colorls source $(dirname $(gem which colorls))/tab_complete.sh -# -# # add pythno to PATH -# export PATH="$PATH:/usr/bin/python" -# -# # add jdk-8 to path -# export PATH="$PATH:/usr/lib/jvm/java-8-openjdk/bin" -# export CLASSPATH="$CLASSPATH:/usr/share/java/mariadb-jdbc/mariadb-java-client.jar" - -## ibus config -# export GTK_IM_MODULE=ibus -# # will make libreoffice work -export XMODIFIERS=@im=ibus -export QT_IM_MODULE=ibus -export QT4_IM_MODULE=xim -ibus-daemon -drx - -export XDG_CONFIG_HOME="$HOME/.config" -export XDG_CACHE_DIR="$HOME/.cache" -# export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" - -bindkey '^ ' autosuggest-accept - - -# source the Xmodmap file to get custom keybindings -# [[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh -# ~/scripts/random_starter.sh - -# >>> conda initialize >>> -# # !! Contents within this block are managed by 'conda init' !! -# __conda_setup="$('/home/sudacode/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" -# if [ $? -eq 0 ]; then -# eval "$__conda_setup" -# else -# if [ -f "/home/sudacode/anaconda3/etc/profile.d/conda.sh" ]; then -# . "/home/sudacode/anaconda3/etc/profile.d/conda.sh" -# else -# export PATH="/home/sudacode/anaconda3/bin:$PATH" -# fi -# fi -# unset __conda_setup -# # <<< conda initialize <<< - -# neofetch # added by Snowflake SnowSQL installer export PATH=/home/sudacode/.bin:$PATH -export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR}/yubikey-agent/yubikey-agent.sock" - eval $(thefuck --alias) diff --git a/ranger/plugins/__init__.py b/ranger/plugins/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ranger/plugins/ranger_devicons b/ranger/plugins/ranger_devicons new file mode 160000 index 0000000..1194161 --- /dev/null +++ b/ranger/plugins/ranger_devicons @@ -0,0 +1 @@ +Subproject commit 11941619b853e9608a41028ac8ebde2e6ca7d934 diff --git a/ranger/rc.conf b/ranger/rc.conf index 1952e5d..f6e66ae 100644 --- a/ranger/rc.conf +++ b/ranger/rc.conf @@ -448,21 +448,25 @@ map } traverse map { traverse_backwards map ) jump_non +map ga cd ~/Projects/Scripts/aniwrapper +map gb cd /boxshare +map g. cd ~/.config map gh cd ~ map ge cd /etc map gu cd /usr map gd cd /dev +map gj cd /jellyfin map gl cd -r . map gL cd -r %f map go cd /opt -map gv cd /var -map gm cd /media +map gv edit ~/.config/nvim/init.vim +map gm cd /jellyfin/music map gi eval fm.cd('/run/media/' + os.getenv('USER')) map gM cd /mnt map gs cd /srv -map gp cd /tmp -map gr cd / -map gR eval fm.cd(ranger.RANGERDIR) +map gP cd ~/Pictures +map gp cd ~/Projects +map gr eval fm.cd(os.getenv('XDG_CONFIG_HOME') + '/ranger') map g/ cd / map g? cd /usr/share/doc/ranger diff --git a/ranger/rifle.conf b/ranger/rifle.conf index 0bf1260..eb7d12c 100644 --- a/ranger/rifle.conf +++ b/ranger/rifle.conf @@ -85,10 +85,11 @@ ext x?html?, has w3m, terminal = w3m "$@" # Misc #------------------------------------------- # Define the "editor" for text files as first action -mime ^text, label editor = vim "$@" +# mime ^text, label editor = vim "$@" +mime ^text, label editor = nvim "$@" mime ^text, label pager = "$PAGER" -- "$@" -!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@" -!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@" +!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php|sql = ${VISUAL:-$EDITOR} -- "$@" +!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php|sql = "$PAGER" -- "$@" ext 1 = man "$1" ext s[wmf]c, has zsnes, X = zsnes "$1" @@ -140,7 +141,7 @@ mime ^video, terminal, !X, has mplayer = mplayer -- "$@" #------------------------------------------- # Documents #------------------------------------------- -ext pdf, has llpp, X, flag f = llpp "$@" +ext pdf, has llpp, X, flag f = okular "$@" ext pdf, has zathura, X, flag f = zathura -- "$@" ext pdf, has mupdf, X, flag f = mupdf "$@" ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@" @@ -183,6 +184,7 @@ mime ^image/svg, has display, X, flag f = display -- "$@" mime ^image, has imv, X, flag f = imv -- "$@" mime ^image, has pqiv, X, flag f = pqiv -- "$@" mime ^image, has sxiv, X, flag f = sxiv -- "$@" +mime ^image, has gthumb, X, flag f = gthumb -- "$@" mime ^image, has feh, X, flag f = feh -- "$@" mime ^image, has mirage, X, flag f = mirage -- "$@" mime ^image, has ristretto, X, flag f = ristretto "$@"