Terminal Hyper and ZSH configuration with Git shortcuts bonus.
- Download Debian version on Hyper Terminal
- To change default terminal on Ctrl + Alt + T shortcut, run this command
sudo update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /opt/Hyper/hyper 50
- Open Omni Theme and install
git clone https://github.com/getomni/hyper-omni ~/.hyper_plugins/local/hyper-omni
- Press Ctrl + Comma and configure hyper
- On local plugins set
// to load it and avoid it being `npm install`ed
localPlugins: ["hyper-omni"],
- Download and install Operator Mono Lig font.
- On font family set
// font family with optional fallbacks
fontFamily:
'"Operator Mono Lig", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
- Install some plugins
hyper i hyper-fading-scrollbar
hyper i hypercwd
hyper i hyper-pane
- Install ZSH and Curl
sudo apt install zsh -y && sudo apt install curl -y
- From Oh My Zsh run
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
- Will be asked if transform ZSH as default shell, say yes
- From Zinit run
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)"
- Will be asked if want to install some default plugins, say no
- From Spaceship run
git clone https://github.com/denysdovhan/spaceship-prompt.git "$ZSH_CUSTOM/themes/spaceship-prompt" --depth=1
ln -s "$ZSH_CUSTOM/themes/spaceship-prompt/spaceship.zsh-theme" "$ZSH_CUSTOM/themes/spaceship.zsh-theme"
- Edit ZSH source file
code ~/.zshrc
- Edit theme
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="spaceship"
- Add Plugins on the last line
# Plugins
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
zinit light zdharma/fast-syntax-highlighting
- Add theme options
# Theme
LS_COLORS=$LS_COLORS:'ow=01;34:' ; export LS_COLORS
SPACESHIP_PROMPT_ORDER=(
user # Username section
dir # Current directory section
host # Hostname section
git # Git section (git_branch + git_status)
hg # Mercurial section (hg_branch + hg_status)
exec_time # Execution time
line_sep # Line break
vi_mode # Vi-mode indicator
jobs # Background jobs indicator
exit_code # Exit code section
char # Prompt character
)
SPACESHIP_USER_SHOW="always" # Shows System user name before directory name
SPACESHIP_PROMPT_ADD_NEWLINE=false
# SPACESHIP_PROMPT_SEPARATE_LINE=false # Make the prompt span across two lines
# SPACESHIP_DIR_TRUNC=1 # Shows only the last directory folder name
SPACESHIP_CHAR_SYMBOL="❯"
SPACESHIP_CHAR_SUFFIX=" "
- Hide % on start for Hyper Terminal
# Hide % on start
unsetopt PROMPT_SP
- Yarn and Android SDK paths (optional)
# Yarn Global Package Setup
export PATH="$PATH:$(yarn global bin)"
# Android SDK
export ANDROID_HOME=~/android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
# Apply global scripts from ~/home/bin
export PATH=$HOME/bin:/usr/local/bin:$PATH
- Force ZSH to be default shell
chsh -s $(which zsh)
- Edit ZProfile source file
code /etc/zsh/zprofile
- Add lines to load Snapcraft apps with ZSH
# Global Order: zshenv, zprofile, zshrc, zlogin
emulate sh -c 'source /etc/profile'
emulate sh -c 'source /etc/profile.d/apps-bin-path.sh'
- Restart computer
- Edit ZSH source file
code ~/.zshrc
- On the end of the file copy and paste
# Active to move hidden files
alias dot="setopt -s glob_dots"
alias ll="ls -lah"
# Sys configuration
alias repoconfig="sudo nano /etc/apt/sources.list"
alias zshconfig="nano ~/.zshrc && source ~/.zshrc"
alias zshsource="source ~/.zshrc"
alias ohmyzsh="nano ~/.oh-my-zsh"
# WSL aliases
# alias db="cd /mnt/c/Users/mkuch/Dropbox"
# alias ws="cd /mnt/d/Workspaces"
# alias ~ws="cd /home/mkuchak/Workspaces"
# alias open="explorer.exe"
# WSL fix terminal ctrl
bindkey -e
bindkey '^H' backward-kill-word # Control + backspace
bindkey ";5C" forward-word # Control + arrows
bindkey ";5D" backward-word
# bind '"\C-H":backward-kill-word' # Bash fix
# Linux aliases
alias ws="cd ~/Workspaces"
alias dw="cd ~/Downloads"
alias pc="cd ~/Pictures"
alias vd="cd ~/Videos"
alias dm="cd ~/Documents"
alias ms="cd ~/Music"
alias dk="cd ~/Desktop"
alias open="dolphin"
alias ssh="ssh -o ServerAliveInterval=60"
alias ssh-reset="ssh-keygen -R"
alias nid="npm install -D"
alias nis="npm install -S"
alias nig="sudo npm install -g"
alias nug="sudo npm uninstall -g"
alias ni="npm install"
alias nu="npm uninstall"
alias nr="npm run"
# sitespeed.io
alias ssio='ssio'
function ssio() {
if [ $# -eq 0 ]; then
echo "cd ~/sitespeed-result";
cd ~/sitespeed-result;
else
if [ "$1" = "." ]; then
dolphin ~/sitespeed-result
elif [[ "$1" =~ .*http.* ]]; then
echo "sudo docker run --rm -v "$(echo $HOME):/sitespeed.io" sitespeedio/sitespeed.io:15.4.0 $1";
sudo docker run --rm -v "$(echo $HOME):/sitespeed.io" sitespeedio/sitespeed.io:15.4.0 $1;
else
echo "sudo docker run --rm -v "$(echo $HOME):/sitespeed.io" sitespeedio/sitespeed.io:15.4.0 https://$1";
sudo docker run --rm -v "$(echo $HOME):/sitespeed.io" sitespeedio/sitespeed.io:15.4.0 https://$1;
fi
fi
}
# Docker
alias dc="docker-compose" # Docker-compose shortcut as 'dc'
alias dc-rebuild="dc down -v --remove-orphans; dc build --force-rm --no-cache; dc up -d" # Default docker-compose rebuild
alias d="docker" # Docker shortcut as 'd'
alias d-stop="sudo docker stop $(sudo docker ps -a -q)" # Stop all containers
alias d-restart="sudo docker restart $(sudo docker ps -q)" # Restart all containers
alias d-reset="dockerreset" # Reset the entire docker as if it had been reinstalled
alias d-clear="dockerclear" # Cleans the entire docker without removing the images
function dockerreset() {
d stop $(d ps -aq);
d rm -f $(d ps -aq);
d volume rm -f $(d volume ls -q);
d network rm $(d network ls -q)
d rmi -f $(d images -q);
d system prune -fa --volumes;
d container prune -f;
d volume prune -f;
d network prune -f;
d image prune -fa;
}
function dockerclear() {
d stop $(d ps -aq);
d rm -f $(d ps -aq);
d volume rm -f $(d volume ls -q);
d network rm $(d network ls -q)
d container prune -f;
d volume prune -f;
d network prune -f;
}
# Laravel
alias artisan-serve='artisanserve'
function artisanserve() {
if [ $# -eq 0 ]; then
echo "sudo php artisan serve --host 0.0.0.0 --port 80";
sudo php artisan serve --host 0.0.0.0 --port 80;
else
echo "sudo php artisan serve --host 0.0.0.0 --port $1";
sudo php artisan serve --host 0.0.0.0 --port $1;
fi
}
# System aliases
alias hib='syshibernate'
alias hibernate='syshibernate'
# https://askubuntu.com/questions/1240123/how-to-enable-hibernate-option-in-ubuntu-20-04
function syshibernate() {
echo "${YELLOW}ATTENTION, YOU WILL HIBERNATE YOUR COMPUTER!${NC}";
echo "Are you sure you want to ${RED}hibernate${NC} your computer? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
sudo systemctl hibernate
fi
}
# Git commands aliases (nano ~/.zshrc && source ~/.zshrc)
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
alias gi='git init'
alias grun='git clean -f -d'
alias gf='git fetch origin'
alias gr='gr'
function gr() {
echo "Are you sure you want to ${RED}hard reset \"$(git rev-parse --abbrev-ref HEAD)\"${NC} branch? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
if [ $# -eq 0 ]; then
echo "git reset --hard origin/$(git rev-parse --abbrev-ref HEAD)";
git reset --hard origin/$(git rev-parse --abbrev-ref HEAD);
else
echo "git reset --hard origin/$1";
git reset --hard origin/$1;
fi
fi
}
alias gs='git status'
alias gl='git log'
alias ga='git add .'
alias gaa='git add --all'
alias gc='gc'
function gc() {
echo "git add . && git commit -am \"$*\"";
git add . && git commit -am "$*";
}
alias gca='git commit --amend'
alias gcr='git reset --hard'
alias gcrv='gcrv'
function gcrv() {
echo "Revert the changes specified by the ${RED}$1 last commit${NC} in HEAD and create a new commit with the reverted changes?";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo "git revert HEAD~$1";
git revert HEAD~$1;
fi
}
alias gg='gg'
function gg() {
if [ $# -eq 0 ]; then
echo "${GREEN}Getting:${NC} git pull origin $(git rev-parse --abbrev-ref HEAD)";
git pull origin $(git rev-parse --abbrev-ref HEAD);
else
echo "git pull origin $1";
git pull origin $1;
fi
}
alias ggf='ggf'
function ggf() {
if [ $# -eq 0 ]; then
echo "${GREEN}Getting:${NC} git pull -f origin $(git rev-parse --abbrev-ref HEAD)";
git pull -f origin $(git rev-parse --abbrev-ref HEAD);
else
echo "git pull -f origin $1";
git pull -f origin $1;
fi
}
alias gp='gp'
function gp() {
if [ $# -eq 0 ]; then
echo "${BLUE}Putting:${NC} git push origin $(git rev-parse --abbrev-ref HEAD)";
git push origin $(git rev-parse --abbrev-ref HEAD);
else
echo "git push origin $1";
git push origin $1;
fi
}
alias gcp='gcp'
function gcp() {
echo "${BLUE}Putting:${NC} git add . && git commit -am \"$*\" && git push origin $(git rev-parse --abbrev-ref HEAD)";
git add . && git commit -am "$*" && git push origin $(git rev-parse --abbrev-ref HEAD);
}
alias gpf='gpf'
function gpf() {
if [ $# -eq 0 ]; then
echo "${BLUE}Putting:${NC} git push -f origin $(git rev-parse --abbrev-ref HEAD)";
git push -f origin $(git rev-parse --abbrev-ref HEAD);
else
echo "git push -f origin $1";
git push -f origin $1;
fi
}
alias gb='gb'
function gb() {
if [ $# -eq 0 ]; then
echo "git checkout master";
git checkout master;
else
if [ $# -eq 2 ]; then
echo "git branch -m $1 $2";
git branch -m $1 $2;
else
echo "git checkout $1";
git checkout $1;
fi
fi
}
alias gbm='gbm'
function gbm() {
if [ $# -eq 0 ]; then
echo "Send all commits from ${RED}\"$(git rev-parse --abbrev-ref HEAD)\"${NC} to ${RED}\"master\"${NC}? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo "git merge master $(git rev-parse --abbrev-ref HEAD)";
git merge master $(git rev-parse --abbrev-ref HEAD);
fi
else
if [ $# -eq 2 ]; then
echo "Send all commits from ${RED}\"$1\"${NC} to ${RED}\"$2\"${NC}? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo "git merge $2 $1";
git merge $2 $1;
fi
else
echo "Receive all commits from ${RED}\"$1\"${NC}? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo "git merge $(git rev-parse --abbrev-ref HEAD) $1";
git merge $(git rev-parse --abbrev-ref HEAD) $1;
fi
fi
fi
}
alias gbl='echo $(git branch -l) | xargs -n1'
alias gbla='echo $(git branch -a) | xargs -n1'
alias gblr='echo $(git branch -r) | xargs -n1'
alias gbn='git checkout -b'
alias gbno='gbno'
function gbno() {
echo "git branch $1 origin/$1";
git branch $1 origin/$1;
git checkout $1;
}
alias gbd='gbd'
function gbd() {
echo "${YELLOW}ATTENTION, THIS IS DANGER!${NC}";
echo "Are you sure you want to ${RED}delete \"$1\"${NC} branch? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo "git checkout master && git branch -D $1";
git checkout master && git branch -D $1;
fi
}
alias gbdo='gbdo'
function gbdo() {
echo "${YELLOW}ATTENTION, THIS IS DANGER! (remote delete)${NC}";
echo "Are you sure you want to ${RED}delete \"$1\"${NC} remote branch? (y/N)";
read REPLY
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
echo "git push origin --delete $1";
git push origin --delete $1;
fi
}
alias gd='gd'
function gd() {
git diff $1..$2;
}
alias grv='git remote -v'
alias grro='git remote rm origin'
alias grao='grao'
function grao() {
echo "git remote add origin $1";
git remote add origin $1;
}
alias gsc='git config credential.helper store'
- Run on terminal
sudo apt install xbindkeys xvkbd -y
nano ~/.xbindkeysrc
- Copy and paste this commands
"xvkbd -xsendevent -text '\[backslash]'"
m:0xc + c:24
Control+Alt + q
"xvkbd -xsendevent -text '?'"
m:0xc + c:25
Control+Alt + w
"xvkbd -xsendevent -text '|'"
m:0xc + c:52
Control+Alt + z
- Then reload keys
xbindkeys -f ~/.xbindkeysrc
- Edit user previlege specification
sudo visudo
- Change the user (mkuchak) and put the line at end of the file
mkuchak ALL=(ALL) NOPASSWD:ALL
- Run on terminal
sudo apt install python3 python3-pip python3-setuptools python3-gi python3-xlib python3-dbus gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-wnck-3.0 -y
sudo pip3 install https://github.com/ssokolow/quicktile/archive/master.zip
- Edit QuickTile configuration
code ~/.config/quicktile.cfg
- Remove all code and paste the below
[general]
cfg_schema = 1
ModMask = <Mod4><Control>
MovementsWrap = True
ColumnCount = 3
[keys]
# Pin window
KP_Enter = always-above
# Move window between screen
KP_0 = maximize
KP_1 = bottom-left
KP_2 = bottom
KP_3 = bottom-right
KP_4 = left
KP_5 = center
KP_6 = right
KP_7 = top-left
KP_8 = top
KP_9 = top-right
# Move window between workspaces
Right = workspace-go-next
Left = workspace-go-prev
Up = workspace-send-prev
Down = workspace-send-next
# Move window without resize
<Shift>KP_1 = move-to-bottom-left
<Shift>KP_2 = move-to-bottom
<Shift>KP_3 = move-to-bottom-right
<Shift>KP_4 = move-to-left
<Shift>KP_5 = move-to-center
<Shift>KP_6 = move-to-right
<Shift>KP_7 = move-to-top-left
<Shift>KP_8 = move-to-top
<Shift>KP_9 = move-to-top-right
# Usual keys
<Shift>V = vertical-maximize
<Shift>H = horizontal-maximize
<Shift>C = move-to-center
- On Autostart programs put to launch and run on login "quicktile --daemonize"
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile