Skip to content

Instantly share code, notes, and snippets.

@isapir
Last active May 10, 2025 02:41
Show Gist options
  • Save isapir/8006da9414f2653676600c3ee09b8d3f to your computer and use it in GitHub Desktop.
Save isapir/8006da9414f2653676600c3ee09b8d3f to your computer and use it in GitHub Desktop.
ZSHRC Additions
## this file should be sourced in .bashrc or .zshrc
alias archivemgr='file-roller'
alias cls='printf "\ec"'
alias cleanup-snaps='snap list --all | while read snapname ver rev trk pub notes; do if [[ $notes = *disabled* ]]; then sudo snap remove "$snapname" --revision="$rev"; fi; done'
alias cleanup-vscode='rm -rf .config/Code/Cache/* .config/Code/CachedData/* .config/Code/CachedExtensions/* .config/Code/CachedExtensionVSIXs/*'
alias copypwd='pwd | tr -d "\n" | pbcopy' ## copies current working directory to clipboard, requires apt install xclip
alias date-utc='date --utc -d' ## e.g. date-utc @1710720000, or date-utc 2024-03-18
alias date-epoch='date --utc +%s -d' ## e.g. date-epoch 2024-03-18
alias dell-servicetag='sudo dmidecode -s system-serial-number'
alias files='nautilus'
alias finddir="find . -type d -iname" ## e.g. finddir *phone*
alias findfiles="ag -Q"
alias fixmouseclick='sudo udevadm trigger' ## when mouse left click stops working after wakeup from sleep
alias grep='grep --color'
alias ll='ls -alhG --color=auto'
alias myip='curl -4 icanhazip.com'
alias ncdu='ncdu -e'
alias nmgui='nm-connection-editor'
alias nutty='com.github.babluboy.nutty'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias sslcert-info='nmap -p 443 --script ssl-cert' ## follow by domain name
alias sudo='sudo ' ## enable aliases for sudo per https://askubuntu.com/a/22043/
alias uxplay='/workspace/src/UxPlay/uxplay -p 65444'
alias awswasabi='aws --profile=wasabi --endpoint-url=https://s3.wasabisys.com' ## e.g. awswasabi s3 ls
alias wasabi='aws --profile=wasabi --endpoint-url=https://s3.wasabisys.com s3' ## e.g. wasabi ls
export EDITOR=vim
export PATH=$PATH:~/.local/bin
export JAVA_HOME_21=/opt/java/zulu21.42.19-ca-jdk21.0.7-linux_x64
export JAVA_HOME=$JAVA_HOME_21
export ANT_HOME=/opt/java/apache-ant-1.10.15
export MVN_HOME=/opt/java/apache-maven-3.9.9
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin:$MVN_HOME/bin
export NODE_HOME=/opt/nodejs/node-v22.15.0-linux-x64
export PATH=$PATH:$NODE_HOME/bin
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=100000
## allow ? symbols in strings e.g. URLs per https://stackoverflow.com/a/42679697/968244
unsetopt no_match
## do not add to history if starts with space per https://stackoverflow.com/a/7478584/968244
setopt hist_ignore_space
## do not include duplicates in history file
setopt hist_ignore_all_dups
## https://ohmyposh.dev/ saved to ~/.local/bin
eval "$(~/.local/bin/oh-my-posh init zsh)"
source ~/.local/zsh-plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.local/zsh-plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
if [ -f ~/.setenv.sh ]; then
source ~/.setenv.sh
fi
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
bindkey "^U" backward-kill-line
bindkey "^R" history-incremental-search-backward
bindkey "^S" history-incremental-search-forward
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
## zsh-history-substring-search.zsh key bindings SHIFT+UP and SHIFT+DOWN
bindkey "^[[1;2A" history-substring-search-up
bindkey "^[[1;2B" history-substring-search-down
## set delimiters for CTRL+W or ALT+BACKSPACE like bash
autoload -U select-word-style
select-word-style bash
export WORDCHARS='.-'
## edit the current line in $EDITOR by clicking Ctrl+X, Ctrl+E
autoload -U edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
// VS Code key bindings at ~/.config/Code/User/keybindings.json
[
{
"key": "ctrl+shift+d",
"command": "-workbench.view.debug"
},
{
"key": "ctrl+shift+d",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+k ctrl+u",
"command": "-editor.action.removeCommentLine",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+k ctrl+u",
"command": "editor.action.transformToUppercase"
},
{
"key": "ctrl+alt+[",
"command": "editor.toggleFold",
"when": "editorTextFocus && foldingEnabled"
},
{
"key": "ctrl+k ctrl+l",
"command": "-editor.toggleFold",
"when": "editorTextFocus && foldingEnabled"
},
{
"key": "ctrl+k ctrl+l",
"command": "editor.action.transformToLowercase"
},
{
"key": "alt+left",
"command": "workbench.action.navigateBack"
},
{
"key": "ctrl+alt+-",
"command": "-workbench.action.navigateBack"
},
{
"key": "alt+right",
"command": "workbench.action.navigateForward"
},
{
"key": "ctrl+shift+-",
"command": "-workbench.action.navigateForward"
},
{
"key": "ctrl+shift+alt+d",
"command": "editor.action.selectHighlights",
"when": "editorFocus"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment