Added lfcd keybind
This commit is contained in:
parent
da812d75de
commit
e6155942cc
1 changed files with 27 additions and 3 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
## ALIASES ##
|
||||||
|
|
||||||
# The rice repo
|
# The rice repo
|
||||||
alias config='git --git-dir $HOME/repos/archrice/ --work-tree=$HOME'
|
alias config='git --git-dir $HOME/repos/archrice/ --work-tree=$HOME'
|
||||||
|
|
||||||
|
|
@ -5,6 +9,7 @@ alias ll='ls -l'
|
||||||
alias la='ls -A'
|
alias la='ls -A'
|
||||||
alias l='ls -CF'
|
alias l='ls -CF'
|
||||||
alias python='python3'
|
alias python='python3'
|
||||||
|
alias xournal='xournalpp'
|
||||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
||||||
alias javafx='java --module-path /usr/lib/jvm/default/lib/ --add-modules javafx.base,javafx.controls,javafx.graphics,javafx.media,javafx.swing,javafx.web'
|
alias javafx='java --module-path /usr/lib/jvm/default/lib/ --add-modules javafx.base,javafx.controls,javafx.graphics,javafx.media,javafx.swing,javafx.web'
|
||||||
|
|
||||||
|
|
@ -27,6 +32,25 @@ alias egrep='egrep --color=auto'
|
||||||
alias diff='diff --color=auto'
|
alias diff='diff --color=auto'
|
||||||
alias ip='ip --color=auto'
|
alias ip='ip --color=auto'
|
||||||
|
|
||||||
|
## KEYBINDS ##
|
||||||
|
|
||||||
|
# Use lf to switch directories and bind it to ctrl-o
|
||||||
|
lfcd () {
|
||||||
|
tmp="$(mktemp)"
|
||||||
|
# `command` is needed in case `lfcd` is aliased to `lf`
|
||||||
|
command lf -last-dir-path="$tmp" "$@"
|
||||||
|
if [ -f "$tmp" ]; then
|
||||||
|
dir="$(cat "$tmp")"
|
||||||
|
rm -f "$tmp"
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
if [ "$dir" != "$(pwd)" ]; then
|
||||||
|
cd "$dir"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
bindkey -s '^o' 'lfcd\n'
|
||||||
|
|
||||||
# Enable completion features
|
# Enable completion features
|
||||||
autoload -Uz compinit
|
autoload -Uz compinit
|
||||||
compinit -d ~/.cache/zcompdump
|
compinit -d ~/.cache/zcompdump
|
||||||
|
|
@ -54,11 +78,11 @@ C_CONDA="%F{009}"
|
||||||
C_DIR="%F{yellow}"
|
C_DIR="%F{yellow}"
|
||||||
C_RESET="%F{reset}"
|
C_RESET="%F{reset}"
|
||||||
RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})'
|
RPROMPT=$'%(?.. %? %F{red}%B⨯%b%F{reset})'
|
||||||
|
|
||||||
|
function precmd {
|
||||||
err="$?"
|
err="$?"
|
||||||
curr_time="%*"
|
curr_time="%*"
|
||||||
dir='%(4~|.../%3~|%~)' # 3 deep, or truncation
|
dir='%(4~|.../%3~|%~)' # 3 deep, or truncation
|
||||||
|
|
||||||
function precmd {
|
|
||||||
PROMPT="${C_PROMPT}[$USERNAME@$(sed 1q /etc/hostname)${C_DIR}:${dir}${C_PROMPT}]"
|
PROMPT="${C_PROMPT}[$USERNAME@$(sed 1q /etc/hostname)${C_DIR}:${dir}${C_PROMPT}]"
|
||||||
extra="$(parse_conda)$(parse_git)"
|
extra="$(parse_conda)$(parse_git)"
|
||||||
if [ ! -z "$extra" ]; then
|
if [ ! -z "$extra" ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue