dotfiles/shell/.zshrc

118 lines
3.2 KiB
Bash

#!/bin/zsh
# Load basic settings
source ${HOME}/.basic.zshrc
# Path to oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# This is faster than loading all of oh-my-zsh
source $ZSH/lib/functions.zsh
source $ZSH/lib/theme-and-appearance.zsh
source $ZSH/lib/git.zsh
source $ZSH/lib/history.zsh
source $ZSH/lib/key-bindings.zsh
source $ZSH/lib/completion.zsh
source $ZSH/lib/misc.zsh
source $ZSH/plugins/gitfast/gitfast.plugin.zsh
# Use vi mode
bindkey -v
# Vi mode settings
# Better searching in command mode
bindkey -M vicmd '?' history-incremental-search-backward
bindkey -M vicmd '/' history-incremental-search-forward
# Beginning search with arrow keys
bindkey "^[OA" up-line-or-beginning-search
bindkey "^[OB" down-line-or-beginning-search
bindkey -M vicmd "k" up-line-or-beginning-search
bindkey -M vicmd "j" down-line-or-beginning-search
# Easier, more vim-like editor opening
# `v` is already mapped to visual mode, so we need to use a different key to
# open Vim
bindkey -M vicmd "^V" edit-command-line
# Make Vi mode transitions faster (KEYTIMEOUT is in hundredths of a second)
export KEYTIMEOUT=1
autoload -Uz compinit
compinit
# Completion for kitty
kitty + complete setup zsh | source /dev/stdin
# Theme: https://github.com/Stratus3D/dotfiles/blob/master/zsh/blinks-modified.zsh-theme
#
# https://github.com/blinks zsh theme
# I have modified the blinks theme to make it more lightweight. There is no
# right prompt, and the exit code is displayed on the left just before Git
# prompt character.
function _prompt_char() {
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
echo "%{%F{blue}%}±%{%f%k%b%}"
else
echo ' '
fi
}
# This theme works with both the "dark" and "light" variants of the
# Solarized color schema. Set the SOLARIZED_THEME variable to one of
# these two values to choose. If you don't specify, we'll assume you're
# using the "dark" variant.
case ${SOLARIZED_THEME:-dark} in
light) bkg=white;;
*) bkg=black;;
esac
ZSH_THEME_GIT_PROMPT_PREFIX=" [%{%B%F{blue}%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{%f%k%b%B%F{green}%}]"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{%F{red}%}*%{%f%k%b%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""
PROMPT='%{%f%k%b%}
%{%B%F{green}%}%n%{%B%F{blue}%}@%{%B%F{cyan}%}%m%{%B%F{green}%} %{%b%F{yellow}%}%~%{%B%F{green}%}$(git_prompt_info)%E %{%}%{$fg_bold[red]%}%(?..%?)%{%f%b%}%{%f%k%b%}
$(_prompt_char)%{%} %#%{%f%k%b%} '
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/xellos/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/xellos/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/xellos/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/xellos/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# ROS 2
source /opt/ros/humble/setup.zsh
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.zsh
mp4() {
if [ "$2" == "" ]; then
out="${1%.*}".mp4
else
out="$2"
fi
ffmpeg -i "$1" -crf 28 -movflags +faststart -c:v libx264 "$out"
}
gif() {
if [ "$2" == "" ]; then
out="${1%.*}".gif
else
out="$2"
fi
ffmpeg -i "$1" -vf "scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" "$out"
}