Last active
August 5, 2021 16:24
-
-
Save trygveaa/e3970b89f043788aeef4017eabdeea2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Default programs | |
export TERMINAL='kitty -1' | |
export BROWSER='browser' | |
export EDITOR='vim' | |
export PAGER='less -RS' | |
export LESS='FRS' | |
export SYSTEMD_LESS='FRSM' | |
export RIPGREP_CONFIG_PATH=~/.config/ripgrep/config | |
export FZF_DEFAULT_COMMAND='fd --hidden --follow --exclude .git' | |
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" | |
export JQ_COLORS="0;90:0;39:0;39:0;39:0;32:1;39:1;39" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following lines were added by compinstall | |
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' | |
zstyle :compinstall filename '/home/trygve/.zshrc' | |
autoload -Uz compinit | |
compinit | |
# End of lines added by compinstall | |
# Lines configured by zsh-newuser-install | |
HISTFILE=~/.histfile | |
HISTSIZE=1000000 | |
SAVEHIST=1000000 | |
setopt appendhistory | |
bindkey -e | |
# End of lines configured by zsh-newuser-install | |
# Various options | |
# Disable ^S and ^Q for flow control | |
stty -ixon -ixoff | |
# Set options for history | |
setopt extendedhistory histignoredups histignorespace | |
# Use variables in prompt | |
setopt prompt_subst | |
# Use case insensitive globbing | |
unsetopt case_glob | |
# Allow using * and ? when no files match | |
unsetopt nomatch | |
# Complete . and .. directories | |
zstyle ':completion:*' special-dirs true | |
# Make Esc-Backspace and ^Arrows only traverse words | |
WORDCHARS= | |
# Don't remove space before & and | | |
ZLE_SPACE_SUFFIX_CHARS=$'&|' | |
# Enable automatic directory stack | |
DIRSTACKSIZE=20 | |
setopt autopushd pushdsilent pushdtohome pushdminus | |
setopt interactivecomments | |
# enable color support of ls | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
fi | |
# Prompt line | |
GIT_PS1_SHOWDIRTYSTATE=1 | |
GIT_PS1_SHOWUNTRACKEDFILES=1 | |
[ -r /usr/lib/git-core/git-sh-prompt ] && source /usr/lib/git-core/git-sh-prompt | |
[ -r /usr/share/git/git-prompt.sh ] && source /usr/share/git/git-prompt.sh | |
precmd() { | |
# Set terminal title | |
print -Pn "\e]2;%n@%m:%~\e\\" | |
vcs_info_msg_0_=$(__git_ps1 " [%s]") | |
} | |
PS1=$'%{%F{red}%}%n%{%f%}@%{%F{blue}%}%m%{%f%}:%{%F{green}%}%~%{%f%}%{%F{magenta}%}${vcs_info_msg_0_}%{%f%}\n%(!.#.$) ' | |
RPS1='%? %D{%T}' | |
# Key bindings | |
bindkey "${terminfo[khome]}" beginning-of-line | |
bindkey "${terminfo[kend]}" end-of-line | |
bindkey "\e[H" beginning-of-line | |
bindkey "\e[F" end-of-line | |
bindkey "\e[1~" beginning-of-line | |
bindkey "\e[4~" end-of-line | |
bindkey "\e[2~" quoted-insert | |
bindkey "\e[3~" delete-char | |
bindkey "\e[5~" history-beginning-search-backward | |
bindkey "\e[6~" history-beginning-search-forward | |
bindkey "\e[1;5C" emacs-forward-word | |
bindkey "\e[1;5D" emacs-backward-word | |
bindkey '^R' history-incremental-pattern-search-backward | |
bindkey "^S" history-incremental-pattern-search-forward | |
autoload -Uz copy-earlier-word | |
zle -N copy-earlier-word | |
bindkey "^[m" copy-earlier-word | |
autoload -U backward-kill-word-match | |
zle -N backward-kill-word-space backward-kill-word-match | |
zstyle ':zle:backward-kill-word-space' word-style space | |
bindkey '^W' backward-kill-word-space | |
bindkey -s '^Z' ' fg\n' | |
# Aliases | |
alias g='git' | |
alias ls='ls --color=auto' | |
alias -g statopen='--stat=1000 | grep "|" | awk "{print \$1}" | parallel --will-cite -j1 -n1000 --tty $EDITOR' | |
alias editall='parallel --will-cite -j1 -n1000 --tty $EDITOR' | |
# Plugins | |
source /usr/share/fzf/key-bindings.zsh | |
source /usr/share/fzf/completion.zsh | |
bindkey '^R' history-incremental-pattern-search-backward | |
bindkey '^[r' fzf-history-widget | |
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh | |
scroll-and-clear-screen() { | |
local i=1 | |
while read; do ((i++)); done <<< $PS1 | |
printf '\n%.0s' {$i..$LINES} | |
zle clear-screen | |
} | |
zle -N scroll-and-clear-screen | |
bindkey '^l' scroll-and-clear-screen | |
# BEGIN_KITTY_SHELL_INTEGRATION | |
if test -e "$HOME/dev/kitty/shell-integration/kitty.zsh"; then source "$HOME/dev/kitty/shell-integration/kitty.zsh"; fi | |
# END_KITTY_SHELL_INTEGRATION |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment