From fdadbc2b15401cc077daadcd1239e81074ddb30c Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Fri, 4 Mar 2022 02:18:51 +0530 Subject: spring cleaning 0.2 --- .bashrc | 71 ++++++++----------------------------------------- .config/shell/aliasrc | 61 ++++++++++++++++++++++++++++++++++++++++++ .local/bin/dmenuhandler | 21 +++++++++++++++ .zshenv | 21 +++++++++++++++ .zshrc | 65 ++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 177 insertions(+), 62 deletions(-) create mode 100644 .config/shell/aliasrc create mode 100755 .local/bin/dmenuhandler create mode 100644 .zshenv diff --git a/.bashrc b/.bashrc index f9a543b..26bd8f2 100644 --- a/.bashrc +++ b/.bashrc @@ -14,10 +14,14 @@ alias ls='ls --color=auto' #PS1='[\u@\h \W]\$ ' + export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 3)\]\u\[$(tput setaf 2)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]" + #export PS1="[\u@\h ~]\\$\[$(tput sgr0)\]" + #susexport PS1="\[$(tput bold)\]\[$(tput setaf 1)\][\[$(tput setaf 6)\]\u\[$(tput setaf 1)\]@\[$(tput setaf 4)\]\h \[$(tput setaf 5)\]\W\[$(tput setaf 1)\]]\[$(tput setaf 7)\]\\$ \[$(tput sgr0)\]" + #auto cd ## Allows you to cd into directory merely by typing the directory name. shopt -s autocd @@ -29,9 +33,12 @@ shopt -s autocd #export IGNOREEOF=1000000000 set -o ignoreeof + export PATH="$PATH:$HOME/.scripts" # Adds `~/.local/bin` to $PATH export PATH="$PATH:$HOME/.local/bin" + + export SUDO_ASKPASS="$HOME/.local/bin/dpass" #infinite history @@ -42,63 +49,7 @@ HISTTIMEFORMAT="%F %T" #ignore dupes HISTCONTROL=ignoredups -#Some aliases -alias t="teams" -alias w="whatsapp-nativefier" -alias v="vim" -alias sv="sudo vim" -alias r="ranger" -alias sr="sudo ranger" -alias space="ncdu" -alias c='clear' -alias h='cat ~/.bash_history|fzf|xclip -sel c' -alias sha="shasum -a 256" -alias untar="tar -zxvf" -alias cp="cp -iv" -alias mv="mv -iv" -alias mkd="mkdir -pv" #make a parent and sub directory -alias myip="curl ipinfo.io/ip && echo """ -alias neofetch="neofetch --ascii .config/neofetch/arch-ascii.txt" - -#git -alias g1="git add ." -alias g2="git commit -m" -alias g3="git push origin HEAD --force" -alias gs="git status" -alias glg="git log --graph --abbrev-commit --decorate --format=format:'%C(bold green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all" - -alias jds="export _JAVA_AWT_WM_NONREPARENTING=1" -alias jd="jdownloader" -alias polkit="/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" -alias scr="ffmpeg -f x11grab -i :0.0 out.mp4" -alias ss="maim -D -u --select | tee ~/Pictures/Screenshots/pic-sel-$(date '+%y-%m-%d--%H-%M-%S').png | xclip -selection clipboard -t image/png" -alias pas="pulseaudio --start" -alias pak="pulseaudio --kill" -alias pm="pulsemixer" -alias sp="spotify" - -alias ssha="echo 'ssh-keygen -t ed25519 -a 100 -f ~/.ssh/ -C '" - -alias b="brave" -alias bb="brave --incognito" -alias bbb="brave --tor" -alias hab="brave habitica.com" -alias toggl="brave track.toggl.com/timer" -alias github="brave https://github.com/justsaumit" - -alias ff="librewolf" -alias br="brightnessctl set " -alias rs="redshift -P -O" -alias prime="prime-run " #enable hardware acceleration -#alias st="cd st" -alias dwm="cd dwm" -alias rm="trash" -alias listdel="trash-list" -alias restore="trash-restore" -alias empty="trash-empty" - -alias yt="ytfzf -t" -alias ytq="ytfzf -faH" -alias leaf="notepadqq" -alias qb="qbittorrent" -alias q="exit" +# Load aliases +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" +#partially supported XDG Base Directory +[ -f "$HOME/.config/env" ] && source "$HOME/.config/env" diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc new file mode 100644 index 0000000..019ab1d --- /dev/null +++ b/.config/shell/aliasrc @@ -0,0 +1,61 @@ +##aliases + +#some aliases for launching applications +alias \ + b="brave" + bb="brave --incognito" + bbb="brave --tor" + github="brave https://github.com/justsaumit" + ff="librewolf" + v="vim" + sv="sudo vim" + r="ranger" + sr="sudo ranger" + t="teams -no-sandbox" + w="whatsapp-nativefier" + space="ncdu" + sp=spotify + jds="export _JAVA_AWT_WM_NONREPARENTING=1" + jd="jdownloader" + yt="ytfzf -t" + ytq="ytfzf -faH" + leaf="notepadqq" + qb="qbittorrent" + +#git +alias \ + g1="git add ." + g2="git commit -S -m" + g3="git push origin HEAD --force" + glg="git log --graph --abbrev-commit --decorate --format=format:'%C(bold green)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold yellow)(%ar)%C(reset)%C(auto)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all" + +#useful command substitutions +alias \ + c='clear' + h='cat ~/.bash_history|fzf|xclip -sel c' + sha="shasum -a 256" + untar="tar -zxvf" + cp="cp -iv" + mv="mv -iv" + mkd="mkdir -pv" #make a parent and sub directory + myip="curl ipinfo.io/ip && echo """ + neofetch="neofetch --ascii .config/neofetch/arch-ascii.txt" + polkit="/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1" + scr="ffmpeg -f x11grab -i :0.0 out.mp4" + ss="maim -D -u --select | tee ~/Pictures/Screenshots/pic-sel-$(date '+%y-%m-%d--%H-%M-%S').png | xclip -selection clipboard -t image/png" + pas="pulseaudio --start" + pak="pulseaudio --kill" + pm="pulsemixer" + ssha="echo 'ssh-keygen -t ed25519 -a 100 -f ~/.ssh/ -C '" + br="brightnessctl set " + rs="redshift -P -O" + prime="prime-run " #enable hardware acceleration + st="cd .local/src/st" + dwm="cd .local/src/dwm" + rm="trash" + listdel="trash-list" + restore="trash-restore" + empty="trash-empty" + q="exit" + + diff --git a/.local/bin/dmenuhandler b/.local/bin/dmenuhandler new file mode 100755 index 0000000..ce9159d --- /dev/null +++ b/.local/bin/dmenuhandler @@ -0,0 +1,21 @@ +#!/bin/sh + +# Feed this script a link and it will give dmenu +# some choice programs to use to open it. +feed="${1:-$(printf "%s" | dmenu -p 'Paste URL or file path')}" + +case "$(printf "Copy URL\\nsxiv\\nsetbg\\nPDF\\nbrowser\\nlynx\\nvim\\nmpv\\nmpv loop\\nmpv float\\nqueue download\\nqueue yt-dl\\nqueue yt-dl audio" | dmenu -i -p "Open it with?")" in + "Copy URL") echo "$feed" | xclip -selection clipboard ;; + mpv) setsid -f mpv -quiet "$feed" >/dev/null 2>&1 ;; + "mpv loop") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;; + "mpv float") setsid -f "$TERMINAL" -e mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;; + "queue yt-dl") qndl "$feed" >/dev/null 2>&1 ;; + "queue yt-dl audio") qndl "$feed" 'youtube-dl --add-metadata -icx -f bestaudio/best' >/dev/null 2>&1 ;; + "queue download") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;; + PDF) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;; + setbg) curl -L "$feed" > $XDG_CACHE_HOME/pic ; xwallpaper --zoom $XDG_CACHE_HOME/pic >/dev/null 2>&1 ;; + browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1 ;; + lynx) lynx "$feed" >/dev/null 2>&1 ;; +esac diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..133c4d1 --- /dev/null +++ b/.zshenv @@ -0,0 +1,21 @@ +#!/bin/zsh +# Default Applications +export EDITOR="vim" +export READER="zathura" +export TERMINAL="st" +export BROWSER="brave" + +# Start blinking +export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green +# Start bold +export LESS_TERMCAP_md=$(tput bold; tput setaf 2) # green +# Start stand out +export LESS_TERMCAP_so=$(tput bold; tput setaf 3) # yellow +# End standout +export LESS_TERMCAP_se=$(tput rmso; tput sgr0) +# Start underline +export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 1) # red +# End Underline +export LESS_TERMCAP_ue=$(tput sgr0) +# End bold, blinking, standout, underline +export LESS_TERMCAP_me=$(tput sgr0) diff --git a/.zshrc b/.zshrc index b606dce..8085b2b 100644 --- a/.zshrc +++ b/.zshrc @@ -16,6 +16,9 @@ HISTFILE=~/.cache/zsh/zsh_history autoload -U compinit zstyle ':completion:*' menu select zstyle ':completion::complete:*' gain-privileges 1 +# Auto complete with case-insensitivity +zstyle ':completion::complete:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}''r:[._-]=* r:|=*' 'l:|=*' 'r:|=*' + zmodload zsh/complist compinit _comp_options+=(globdots) #include hidden files @@ -23,16 +26,22 @@ _comp_options+=(globdots) #include hidden files #auto cd setopt autocd extendedglob nomatch +# Load aliases +[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" + ##vi mode #bindkey -v #export KEYTIMEOUT=1 # Use vim keys in tab compete menu: bindkey -M menuselect 'h' vi-backward-char -bindkey -M menuselect 'j' vi-up-line-or-history -bindkey -M menuselect 'k' vi-down-line-or-history +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'k' vi-up-line-or-history bindkey -M menuselect 'l' vi-forward-char +# Fix backspace bug when switching modes +# bindkey ""^?" backward-delete-char + # Change cursor shape for different vi modes. #function zle-keymap-select { # if [[ ${KEYMAP} == vicmd ]] || @@ -53,6 +62,9 @@ bindkey -M menuselect 'l' vi-forward-char #zle -N zle-line-init #echo -ne '\e[1 q' #default to block cursor +# Open typed text in a vim buffer +autoload edit-command-line; zle -N edit-command-line +bindkey '^v' edit-command-line # Key Bindings @@ -80,3 +92,52 @@ bindkey -M menuselect 'l' vi-forward-char # Load aliases [ -f "$HOME/.config/aliasrc" ] && source "$HOME/.config/aliasrc" +# Load zsh-syntax-highlighting +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh +# Suggest aliases for commands +source /usr/share/zsh/plugins/zsh-you-should-use/you-should-use.plugin.zsh +# Search repos for programs that can't be found +source /usr/share/doc/find-the-command/ftc.zsh + +# Spaceship Prompt +autoload -U promptinit; promptinit +prompt spaceship + +SPACESHIP_PROMPT_ADD_NEWLINE=false +SPACESHIP_PROMPT_SEPARATE_LINE=false +SPACESHIP_CHAR_SYMBOL=❯ +SPACESHIP_CHAR_SYMBOL_ROOT=❯❯ +SPACESHIP_CHAR_SUFFIX=" " +SPACESHIP_CHAR_COLOR_SUCCESS=green +SPACESHIP_CHAR_COLOR_FAILURE=red + +SPACESHIP_HG_SHOW=false +SPACESHIP_PACKAGE_SHOW=false + +SPACESHIP_EXEC_TIME_SHOW=true +SPACESHIP_EXEC_TIME_PREFIX=took· +SPACESHIP_EXEC_TIME_COLOR=yellow + +SPACESHIP_NODE_SHOW=false +SPACESHIP_RUBY_SHOW=false +SPACESHIP_ELM_SHOW=false +SPACESHIP_ELIXIR_SHOW=false +SPACESHIP_XCODE_SHOW_LOCAL=false +SPACESHIP_SWIFT_SHOW_LOCAL=false +SPACESHIP_GOLANG_SHOW=false +SPACESHIP_PHP_SHOW=false +SPACESHIP_RUST_SHOW=true +SPACESHIP_JULIA_SHOW=false +SPACESHIP_DOCKER_SHOW=true +SPACESHIP_DOCKER_CONTEXT_SHOW=true +SPACESHIP_AWS_SHOW=false +SPACESHIP_CONDA_SHOW=false +SPACESHIP_VENV_SHOW=false +SPACESHIP_PYENV_SHOW=false +SPACESHIP_DOTNET_SHOW=false +SPACESHIP_EMBER_SHOW=false +SPACESHIP_KUBECONTEXT_SHOW=false +SPACESHIP_TERRAFORM_SHOW=false +SPACESHIP_TERRAFORM_SHOW=false +SPACESHIP_VI_MODE_SHOW=true +SPACESHIP_JOBS_SHOW=false -- cgit v1.2.3