revamp .zshrc a bit.
This commit is contained in:
parent
73aa17f319
commit
6aabb86c2c
1 changed files with 147 additions and 131 deletions
48
zsh/.zshrc
48
zsh/.zshrc
|
@ -20,8 +20,6 @@
|
||||||
#default options for less
|
#default options for less
|
||||||
export LESS="-R"
|
export LESS="-R"
|
||||||
export LESSHISTFILE="/dev/null"
|
export LESSHISTFILE="/dev/null"
|
||||||
#set the w3m homepage
|
|
||||||
export WWW_HOME="duckduckgo.com/lite/"
|
|
||||||
#set ssh-agent to play nice with systemd.
|
#set ssh-agent to play nice with systemd.
|
||||||
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
|
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
|
||||||
export TIMEFMT="%J %*U user %*S system %P cpu %*E total"
|
export TIMEFMT="%J %*U user %*S system %P cpu %*E total"
|
||||||
|
@ -45,7 +43,7 @@ setprompt() {
|
||||||
|
|
||||||
setopt prompt_subst
|
setopt prompt_subst
|
||||||
|
|
||||||
precmd_vcs() {vcs_info}
|
precmd_vcs() { vcs_info; }
|
||||||
|
|
||||||
#when not in a repo, show full path to current directory. when in one, show path from base direcory of the repo.
|
#when not in a repo, show full path to current directory. when in one, show path from base direcory of the repo.
|
||||||
zstyle ':vcs_info:*' nvcsformats '%~'
|
zstyle ':vcs_info:*' nvcsformats '%~'
|
||||||
|
@ -53,9 +51,7 @@ setprompt() {
|
||||||
zstyle ':vcs_info:*' actionformats '%r/%S %F{green}[%b] %F{red}<%a>%f'
|
zstyle ':vcs_info:*' actionformats '%r/%S %F{green}[%b] %F{red}<%a>%f'
|
||||||
|
|
||||||
#the precmd function, called just before printing the prompt.
|
#the precmd function, called just before printing the prompt.
|
||||||
function precmd() {
|
function precmd() { precmd_vcs; }
|
||||||
precmd_vcs
|
|
||||||
}
|
|
||||||
|
|
||||||
#Make the right prompt blank, just to be sure.
|
#Make the right prompt blank, just to be sure.
|
||||||
RPROMPT=''
|
RPROMPT=''
|
||||||
|
@ -91,6 +87,8 @@ setprompt() {
|
||||||
#misc
|
#misc
|
||||||
# Sends cd commands without the need for 'cd'
|
# Sends cd commands without the need for 'cd'
|
||||||
setopt AUTO_CD
|
setopt AUTO_CD
|
||||||
|
# Turn off terminal beep on autocomplete.
|
||||||
|
unsetopt BEEP
|
||||||
# Kill all child processes when we exit, dont leave them running
|
# Kill all child processes when we exit, dont leave them running
|
||||||
unsetopt NO_HUP
|
unsetopt NO_HUP
|
||||||
#Allows comments in interactive shell.
|
#Allows comments in interactive shell.
|
||||||
|
@ -177,22 +175,40 @@ setprompt() {
|
||||||
|
|
||||||
#fzf stuff
|
#fzf stuff
|
||||||
testPath="/usr/share/fzf/key-bindings.zsh"
|
testPath="/usr/share/fzf/key-bindings.zsh"
|
||||||
[ -f "$testPath" ] && source $testPath
|
[ -f "$testPath" ] && source "$testPath"
|
||||||
testPath="/usr/share/fzf/completion.zsh"
|
testPath="/usr/share/fzf/completion.zsh"
|
||||||
[ -f "$testPath" ] && source $testPath
|
[ -f "$testPath" ] && source "$testPath"
|
||||||
#if it was installed using git, can just source the one file:
|
#if it was installed using git, can just source the one file:
|
||||||
testPath="$HOME/.fzf.zsh"
|
testPath="$HOME/.fzf.zsh"
|
||||||
[ -f "$testPath" ] && source $testPath
|
[ -f "$testPath" ] && source "$testPath"
|
||||||
|
|
||||||
#zoxide stuff
|
#zoxide stuff
|
||||||
command -v zoxide &> /dev/null && eval "$(zoxide init zsh)"
|
command -v zoxide &> /dev/null && eval "$(zoxide init zsh)"
|
||||||
|
|
||||||
#check for existence of pyenv before setting it up.
|
#cheat.sh is a wonderful tool, the less typing needed the better.
|
||||||
if command -v pyenv &> /dev/null; then
|
cheat(){
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
for i in "$@"; do
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
curl cheat.sh/"$i"
|
||||||
eval "$(pyenv init -)"
|
done
|
||||||
|
}
|
||||||
|
#the tre command has some shell integration.
|
||||||
|
tre() { command tre "$@" --editor && source "/tmp/tre_aliases_$USER" 2>/dev/null; }
|
||||||
|
tred() { command tre "$@" --editor=z --directories && source "/tmp/tre_aliases_$USER" 2>/dev/null; }
|
||||||
|
|
||||||
|
#moves a file, leaving a symlink in its place.
|
||||||
|
mvln(){
|
||||||
|
# Check for correct number of arguments
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "Usage: $0 <source> <destination>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
source="$1" destination="$2"
|
||||||
|
# Check if source exists
|
||||||
|
if [ ! -e "$source" ]; then
|
||||||
|
echo "$source does not exist."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#fancy way of testing if a command exists
|
mv -- "$source" "$destination"
|
||||||
command -v ruby &>/dev/null && export PATH="$PATH:$(ruby -e 'puts Gem.user_dir' 2> /dev/null)/bin/"
|
ln -s -- "$(realpath "$destination/$(basename "$source")")" "$(realpath "$source")"
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue