This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
forked from ChrisTitusTech/zsh
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: Update README.md
- Loading branch information
Jiří Štefka
committed
Jan 9, 2022
1 parent
dc4dd64
commit e1244d4
Showing
8 changed files
with
264 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,15 @@ | |
[submodule "powerlevel10k"] | ||
path = powerlevel10k | ||
url = https://github.com/romkatv/powerlevel10k.git | ||
[submodule "zsh-you-should-use"] | ||
path = zsh-you-should-use | ||
url = [email protected]:MichaelAquilina/zsh-you-should-use.git | ||
[submodule "ssh-connect"] | ||
path = ssh-connect | ||
url = [email protected]:gko/ssh-connect.git | ||
[submodule "web-search"] | ||
path = web-search | ||
url = [email protected]:sineto/web-search.git | ||
[submodule "git"] | ||
path = git | ||
url = [email protected]:davidde/git.git |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ export EDITOR=nano | |
|
||
alias pacman-update='sudo reflector -c $country -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist' | ||
|
||
alias ls='ls' | ||
alias ls='ls --color' | ||
alias ll='ls -l' | ||
# ls, the common ones I use a lot shortened for rapid fire usage | ||
alias l='ls -lFh' #size,show type,human readable | ||
|
@@ -95,20 +95,22 @@ alias wallpaper=/home/$USER/.local/bin/wallpaper | |
|
||
#alias vim='vim' | ||
#alias vi='vim' | ||
gitpush() { | ||
git add . | ||
git commit -m "$*" | ||
git pull | ||
git push | ||
} | ||
gitupdate() { | ||
eval "$(ssh-agent -s)" | ||
ssh-add ~/.ssh/github | ||
ssh -T [email protected] | ||
} | ||
alias gp=gitpush | ||
alias gu=gitupdate | ||
#gitpush() { | ||
# git add . | ||
# git commit -m "$*" | ||
# git pull | ||
# git push | ||
#} | ||
#gitupdate() { | ||
# eval "$(ssh-agent -s)" | ||
# ssh-add ~/.ssh/github | ||
# ssh -T [email protected] | ||
#} | ||
#alias gp=gitpush | ||
#alias gu=gitupdate | ||
|
||
alias update-grub='sudo grub-mkconfig -o /boot/grub/grub.cfg' | ||
#alias firefox='GTK_USE_PORTAL=1 firefox' | ||
alias cls="clear" | ||
|
||
alias sshc='ssh-connect' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
## | ||
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories | ||
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. | ||
# | ||
# Navigate directory hierarchy using ALT-UP and ALT-DOWN. | ||
# ALT-UP moves to higher hierarchy (cd ..) | ||
# ALT-DOWN moves into the first directory found in alphabetical order | ||
# | ||
|
||
dirhistory_past=($PWD) | ||
dirhistory_future=() | ||
export dirhistory_past | ||
export dirhistory_future | ||
|
||
export DIRHISTORY_SIZE=30 | ||
|
||
# Pop the last element of dirhistory_past. | ||
# Pass the name of the variable to return the result in. | ||
# Returns the element if the array was not empty, | ||
# otherwise returns empty string. | ||
function pop_past() { | ||
typeset -g $1="${dirhistory_past[$#dirhistory_past]}" | ||
if [[ $#dirhistory_past -gt 0 ]]; then | ||
dirhistory_past[$#dirhistory_past]=() | ||
fi | ||
} | ||
|
||
function pop_future() { | ||
typeset -g $1="${dirhistory_future[$#dirhistory_future]}" | ||
if [[ $#dirhistory_future -gt 0 ]]; then | ||
dirhistory_future[$#dirhistory_future]=() | ||
fi | ||
} | ||
|
||
# Push a new element onto the end of dirhistory_past. If the size of the array | ||
# is >= DIRHISTORY_SIZE, the array is shifted | ||
function push_past() { | ||
if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then | ||
shift dirhistory_past | ||
fi | ||
if [[ $#dirhistory_past -eq 0 || $dirhistory_past[$#dirhistory_past] != "$1" ]]; then | ||
dirhistory_past+=($1) | ||
fi | ||
} | ||
|
||
function push_future() { | ||
if [[ $#dirhistory_future -ge $DIRHISTORY_SIZE ]]; then | ||
shift dirhistory_future | ||
fi | ||
if [[ $#dirhistory_future -eq 0 || $dirhistory_futuret[$#dirhistory_future] != "$1" ]]; then | ||
dirhistory_future+=($1) | ||
fi | ||
} | ||
|
||
# Called by zsh when directory changes | ||
autoload -U add-zsh-hook | ||
add-zsh-hook chpwd chpwd_dirhistory | ||
function chpwd_dirhistory() { | ||
push_past $PWD | ||
# If DIRHISTORY_CD is not set... | ||
if [[ -z "${DIRHISTORY_CD+x}" ]]; then | ||
# ... clear future. | ||
dirhistory_future=() | ||
fi | ||
} | ||
|
||
function dirhistory_cd(){ | ||
DIRHISTORY_CD="1" | ||
cd $1 | ||
unset DIRHISTORY_CD | ||
} | ||
|
||
# Move backward in directory history | ||
function dirhistory_back() { | ||
local cw="" | ||
local d="" | ||
# Last element in dirhistory_past is the cwd. | ||
|
||
pop_past cw | ||
if [[ "" == "$cw" ]]; then | ||
# Someone overwrote our variable. Recover it. | ||
dirhistory_past=($PWD) | ||
return | ||
fi | ||
|
||
pop_past d | ||
if [[ "" != "$d" ]]; then | ||
dirhistory_cd $d | ||
push_future $cw | ||
else | ||
push_past $cw | ||
fi | ||
} | ||
|
||
|
||
# Move forward in directory history | ||
function dirhistory_forward() { | ||
local d="" | ||
|
||
pop_future d | ||
if [[ "" != "$d" ]]; then | ||
dirhistory_cd $d | ||
push_past $d | ||
fi | ||
} | ||
|
||
|
||
# Bind keys to history navigation | ||
function dirhistory_zle_dirhistory_back() { | ||
# Erase current line in buffer | ||
zle .kill-buffer | ||
dirhistory_back | ||
zle .accept-line | ||
} | ||
|
||
function dirhistory_zle_dirhistory_future() { | ||
# Erase current line in buffer | ||
zle .kill-buffer | ||
dirhistory_forward | ||
zle .accept-line | ||
} | ||
|
||
zle -N dirhistory_zle_dirhistory_back | ||
zle -N dirhistory_zle_dirhistory_future | ||
|
||
for keymap in emacs vicmd viins; do | ||
# dirhistory_back | ||
bindkey -M $keymap "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode | ||
bindkey -M $keymap "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode | ||
bindkey -M $keymap "\e\e[D" dirhistory_zle_dirhistory_back # Putty | ||
bindkey -M $keymap "\eO3D" dirhistory_zle_dirhistory_back # GNU screen | ||
|
||
case "$TERM_PROGRAM" in | ||
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app | ||
iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2 | ||
esac | ||
|
||
if (( ${+terminfo[kcub1]} )); then | ||
bindkey -M $keymap "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt | ||
fi | ||
|
||
# dirhistory_future | ||
bindkey -M $keymap "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode | ||
bindkey -M $keymap "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode | ||
bindkey -M $keymap "\e\e[C" dirhistory_zle_dirhistory_future # Putty | ||
bindkey -M $keymap "\eO3C" dirhistory_zle_dirhistory_future # GNU screen | ||
|
||
case "$TERM_PROGRAM" in | ||
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app | ||
iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2 | ||
esac | ||
|
||
if (( ${+terminfo[kcuf1]} )); then | ||
bindkey -M $keymap "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt | ||
fi | ||
done | ||
|
||
# | ||
# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings | ||
# | ||
|
||
# Move up in hierarchy | ||
function dirhistory_up() { | ||
cd .. || return 1 | ||
} | ||
|
||
# Move down in hierarchy | ||
function dirhistory_down() { | ||
cd "$(find . -mindepth 1 -maxdepth 1 -type d | sort -n | head -n 1)" || return 1 | ||
} | ||
|
||
|
||
# Bind keys to hierarchy navigation | ||
function dirhistory_zle_dirhistory_up() { | ||
zle .kill-buffer # Erase current line in buffer | ||
dirhistory_up | ||
zle .accept-line | ||
} | ||
|
||
function dirhistory_zle_dirhistory_down() { | ||
zle .kill-buffer # Erase current line in buffer | ||
dirhistory_down | ||
zle .accept-line | ||
} | ||
|
||
zle -N dirhistory_zle_dirhistory_up | ||
zle -N dirhistory_zle_dirhistory_down | ||
|
||
for keymap in emacs vicmd viins; do | ||
# dirhistory_up | ||
bindkey -M $keymap "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode | ||
bindkey -M $keymap "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode | ||
bindkey -M $keymap "\e\e[A" dirhistory_zle_dirhistory_up # Putty | ||
bindkey -M $keymap "\eO3A" dirhistory_zle_dirhistory_up # GNU screen | ||
|
||
case "$TERM_PROGRAM" in | ||
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app | ||
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2 | ||
esac | ||
|
||
if (( ${+terminfo[kcuu1]} )); then | ||
bindkey -M $keymap "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt | ||
fi | ||
|
||
# dirhistory_down | ||
bindkey -M $keymap "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode | ||
bindkey -M $keymap "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode | ||
bindkey -M $keymap "\e\e[B" dirhistory_zle_dirhistory_down # Putty | ||
bindkey -M $keymap "\eO3B" dirhistory_zle_dirhistory_down # GNU screen | ||
|
||
case "$TERM_PROGRAM" in | ||
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app | ||
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2 | ||
esac | ||
|
||
if (( ${+terminfo[kcud1]} )); then | ||
bindkey -M $keymap "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt | ||
fi | ||
done | ||
|
||
unset keymap |
Submodule ssh-connect
added at
788d90
Submodule web-search
added at
e2c498
Submodule zsh-you-should-use
added at
773ae5
This file contains 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