simple system for saving directories to files for later loading
This commit is contained in:
parent
7a3c7d5b53
commit
9c6edd5ea0
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ colors/gen/tmp
|
||||||
*.lock
|
*.lock
|
||||||
*.log
|
*.log
|
||||||
*.pid
|
*.pid
|
||||||
|
*.tmp
|
||||||
|
|
|
@ -28,4 +28,3 @@ source "$DOTFILES_PATH/vim/link.bash"
|
||||||
source "$DOTFILES_PATH/sh/link.bash"
|
source "$DOTFILES_PATH/sh/link.bash"
|
||||||
source "$DOTFILES_PATH/x/link.bash"
|
source "$DOTFILES_PATH/x/link.bash"
|
||||||
source "$DOTFILES_PATH/wm/link.bash"
|
source "$DOTFILES_PATH/wm/link.bash"
|
||||||
|
|
||||||
|
|
26
sh/bashrc
26
sh/bashrc
|
@ -54,6 +54,9 @@ if [ -t 0 ]; then
|
||||||
# wm aliases
|
# wm aliases
|
||||||
alias startbar="source $DOTFILES_PATH/wm/extras/bar/start.bash"
|
alias startbar="source $DOTFILES_PATH/wm/extras/bar/start.bash"
|
||||||
|
|
||||||
|
# misc aliases
|
||||||
|
alias keyrepeat="xset r rate 250 80"
|
||||||
|
|
||||||
export EDITOR="vim"
|
export EDITOR="vim"
|
||||||
if command -v nvim >/dev/null 2>&1; then
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
alias vim="nvim"
|
alias vim="nvim"
|
||||||
|
@ -66,6 +69,7 @@ if [ -t 0 ]; then
|
||||||
PROMPT_SUCCESS_COLOR='\[\e[0;34m\]'
|
PROMPT_SUCCESS_COLOR='\[\e[0;34m\]'
|
||||||
PROMPT_FAILURE_COLOR='\[\e[0;31m\]'
|
PROMPT_FAILURE_COLOR='\[\e[0;31m\]'
|
||||||
DIR_COLOR='\[\e[0;33m\]'
|
DIR_COLOR='\[\e[0;33m\]'
|
||||||
|
# prompt rendering functions
|
||||||
sps() {
|
sps() {
|
||||||
name="$PWD"
|
name="$PWD"
|
||||||
[[ "$name" =~ ^"$HOME"(/|$) ]] && name="~${name#$HOME}"
|
[[ "$name" =~ ^"$HOME"(/|$) ]] && name="~${name#$HOME}"
|
||||||
|
@ -97,6 +101,28 @@ if [ -t 0 ]; then
|
||||||
alias _man="man"
|
alias _man="man"
|
||||||
alias man="vman"
|
alias man="vman"
|
||||||
|
|
||||||
|
# save the current directory for later retrieval
|
||||||
|
scwd() {
|
||||||
|
addon=""
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
addon="-$1"
|
||||||
|
fi
|
||||||
|
echo "$PWD" > "$DOTFILES_PATH/cwd$addon.tmp"
|
||||||
|
}
|
||||||
|
export -f scwd
|
||||||
|
bind '"\C-s"':"@\"scwd\C-m\""
|
||||||
|
|
||||||
|
# go to the saved current directory
|
||||||
|
gcwd() {
|
||||||
|
addon=""
|
||||||
|
if [[ -n $1 ]]; then
|
||||||
|
addon="-$1"
|
||||||
|
fi
|
||||||
|
cd $(cat $DOTFILES_PATH/cwd$addon.tmp)
|
||||||
|
}
|
||||||
|
export -f gcwd
|
||||||
|
bind '"\C-g"':"\"gcwd\C-m\""
|
||||||
|
|
||||||
complete -cf sudo
|
complete -cf sudo
|
||||||
complete -cf man
|
complete -cf man
|
||||||
|
|
||||||
|
|
Reference in a new issue