zsh rc cleanup

This commit is contained in:
Wryn Wagner 2020-11-04 12:57:36 -07:00
parent 3455457999
commit 891aec3ee6
7 changed files with 94 additions and 77 deletions

26
zsh/config Normal file
View File

@ -0,0 +1,26 @@
# --- General ZSH Settings -----------------------------------
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep notify
unsetopt nomatch
bindkey -v
# --- Autocompletion Settings --------------------------------
zmodload -i zsh/complist;
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' max-errors 4
zstyle ':completion:*' menu select;
bindkey -M menuselect '^M' .accept-line; # don't require 'return' to select menu item
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
# --- Enable completion in kitty-terminal --------------------
which kitty >/dev/null && kitty + complete setup zsh | source /dev/stdin

13
zsh/google Normal file
View File

@ -0,0 +1,13 @@
#!/bin/zsh
alias gdrive="RCLONE_GOOGLE_DRIVE_MOUNT"
RCLONE_GOOGLE_DRIVE_MOUNT() {
local RCLONE_REMOTE_NAME='google-drive';
clear;
figlet GOOGLE DRIVE CONNECTION | lolcat;
echo -e "\e[3m(C-c to close)\e[0m";
rclone mount "$RCLONE_REMOTE_NAME:$1" "$HOME/GoogleDrive"
}

View File

@ -1,6 +0,0 @@
#!/bin/zsh
# dependency :: feh
alias bgrandomizer="feh --randomize --bg-fill $HOME/.wallpaper/1/* $HOME/.wallpaper/2/* $HOME/.wallpaper/3/*";
# temp
alias bgrandomizer="feh --randomize --bg-fill $HOME/.wallpaper/* $HOME/.wallpaper/* $HOME/.wallpaper/*";

28
zsh/linux/dmenu Normal file
View File

@ -0,0 +1,28 @@
#!/bin/zsh
function DMENU__NEW_COMMAND() {
local BIN="$HOME/.local/custom_dmenu";
local HELP_STRING='\ncorrect syntax:\nDMENU__NEW_COMMAND [ name or "test" ] [ command .. args ]\n';
[[ "$1" == help ]] && {
echo $HELP_STRING;
return 0;
}
[ ! -d $BIN ] && mkdir $BIN;
# fail if no command is provided
[ ! $2 ] && return 1;
[[ "$1" != "test" ]] && {
echo "${@:2}" > "$BIN/$1" 2>/dev/null \
&& chmod +x "$BIN/$1" \
&& echo "Command '$1' saved! ('${@:2}')" \
|| { echo "Something went wrong :c \n"; echo "$HELP_STRING"; }
} || {
echo;
echo -e "saved to : \e[32m$BIN/$1\e[0m";
echo -e "executes : \e[31m${@:2}\e[0m";
echo;
}
}

View File

@ -1,17 +0,0 @@
#!/bin/zsh
# Make a new dmenu shortcut
DMENU_CUSTOM_BIN="$HOME/.local/custom_dmenu";
[ ! -d $DMENU_CUSTOM_BIN ] && mkdir $DMENU_CUSTOM_BIN;
function new_dmenu_command() {
local DMENU_BIN="$HOME/.local/custom_dmenu";
# fail withouut both arguments
[ ! $2 ] && return 1;
echo "${@:2}"
echo "${@:2}" > $DMENU_BIN/$1 2>/dev/null
chmod +x $DMENU_BIN/$1
}

73
zsh/rc
View File

@ -1,67 +1,34 @@
#!/bin/zsh
#
#
# The following lines were added by compinstall
zstyle ':completion:*' completer _complete _ignored _approximate
zstyle ':completion:*' max-errors 4
zstyle :compinstall filename '/home/w0ryn/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep notify
unsetopt nomatch
bindkey -v
# End of lines configured by zsh-newuser-install
zmodload -i zsh/complist;
bindkey -M menuselect '^M' .accept-line;
# Completion for Kitty
which kitty >/dev/null && kitty + complete setup zsh | source /dev/stdin
#
#
source "$HOME/.wryn/env/env.zsh"
RC_DIR="$DOTWRYN/zsh"
# source .wryn/zsh files
# zsh plugins
for file in $(find $RC_DIR -maxdepth 1 -type f ! -name 'rc'); do source $file; done;
# osx
if [[ "$OSTYPE" == "darwin"* ]]; then
for file in $(find $RC_DIR/osx -type f); do source $file; done;
fi
# linux
# linux-specific plugins
if [[ "$OSTYPE" == "linux-gnu" ]]; then
for file in $(find $RC_DIR/linux -type f); do source $file; done;
fi
# --- ViM as default editor -----------------------------------
export EDITOR='vim'
export VISUAL='vim'
# osx-specific plugins
if [[ "$OSTYPE" == "darwin"* ]]; then
for file in $(find $RC_DIR/osx -type f); do source $file; done;
fi
# --- Welcome message -----------------------------------------
# --- vi / vim as default editor (vim preferred) -------------------
which vi >/dev/null 2>&1 && {
export EDITOR='vi';
export VISUAL='vi';
}
which vim >/dev/null 2>&1 && {
export EDITOR='vim';
export VISUAL='vim';
}
# --- welcome message ----------------------------------------------
exec figlet "Welcome, beautiful" | lolcat; echo; cowsay -p "damn u sexy" | lolcat;
alias restart='clear; source ~/.zshrc; echo'
# --- !@#$ Aliases --------------------------------------------
alias clera='clear';
alias sl='sl -alF | lolcat';
# --- ZSH Completion Styles -----------------------------------
zmodload -i zsh/complist;
zstyle ':completion:*' menu select;
bindkey -M menuselect '^M' .accept-line; # don't require 'return' to select menu item

View File

@ -1,6 +1,8 @@
#!/bin/zsh
# --- Basic Alias ---------------------------------------------
alias restart='clear; source ~/.zshrc; echo'
alias pd='pushd';
alias qd='popd';
alias lspd='dirs';
@ -11,6 +13,10 @@ alias cdo='cd $(xclip -o)'; # [cd] to directory [o]n clipboard
alias color_demo='msgcat --color=test'
# --- !@#$ Aliases --------------------------------------------
alias sl='sl -alF | lolcat';
# --- GIT -----------------------------------------------------
alias gitbranchcleanup='git branch -d $(git branch | sed -E "/develop|master|\*/d")'
alias fix='vim $(git diff --name-only | uniq) -p';
@ -30,7 +36,7 @@ OPEN_CURRENT_GIT_REPOSITORY_IN_WEB_BROWSER() {
# --- Miscellaneous -------------------------------------------
alias rgv='EDIT_RIP_GREP_FILE_MATCHES';
alias erg='EDIT_RIP_GREP_FILE_MATCHES';
EDIT_RIP_GREP_FILE_MATCHES() {
[ $EDITOR = "vim" ] \
&& $EDITOR -p $(rg -l $1) \