Compare commits
6 Commits
d99aa241fe
...
9da7b6babf
| Author | SHA1 | Date | |
|---|---|---|---|
| 9da7b6babf | |||
| 43e3ce2765 | |||
| c2f60ba7fd | |||
| ef86f64945 | |||
| 7ad661267e | |||
| a79e9e988f |
15
Readme.md
15
Readme.md
|
|
@ -63,6 +63,12 @@ and how it works.
|
||||||
- Automatic use of the directory stack `popd` to go back whence you came
|
- Automatic use of the directory stack `popd` to go back whence you came
|
||||||
- Smart history
|
- Smart history
|
||||||
- Plug-ins chosen for greatness
|
- Plug-ins chosen for greatness
|
||||||
|
- Extended Globbing enabled.
|
||||||
|
- 10 second thinking time enforced for big deletes
|
||||||
|
- Expanded directories automatically have `/` appended
|
||||||
|
- Allow comments in interactive mode (this may be useful to mark history
|
||||||
|
items)
|
||||||
|
- Neaten paths like `../foo/..` to `..` (ChaseDots)
|
||||||
|
|
||||||
## Breakdown
|
## Breakdown
|
||||||
The following sections break down what is in the repository and what
|
The following sections break down what is in the repository and what
|
||||||
|
|
@ -102,11 +108,6 @@ program.
|
||||||
in that order of preference.
|
in that order of preference.
|
||||||
`pdf` files are mapped to `zathura` when it's installed.
|
`pdf` files are mapped to `zathura` when it's installed.
|
||||||
|
|
||||||
#### `./chpwd`
|
|
||||||
This module sets the `chpwd` hook and makes ZSH display any (markdown
|
|
||||||
formatted) readme files
|
|
||||||
found in the current directory using glow.
|
|
||||||
|
|
||||||
#### `./completion`
|
#### `./completion`
|
||||||
This file configures the powerful completion engine of
|
This file configures the powerful completion engine of
|
||||||
ZSH.
|
ZSH.
|
||||||
|
|
@ -139,6 +140,10 @@ This makes a few changes:
|
||||||
- Ignores duplicates when searching history
|
- Ignores duplicates when searching history
|
||||||
- Requires you press enter after expanding `!!`
|
- Requires you press enter after expanding `!!`
|
||||||
|
|
||||||
|
#### './hooks'
|
||||||
|
This file loads hook functions found in './hooks.d'
|
||||||
|
and makes it easier to assign hooks where necessary.
|
||||||
|
|
||||||
#### `./keyboard`
|
#### `./keyboard`
|
||||||
This file uses `zkbd`(see `man zshcontrib`) to get information about your
|
This file uses `zkbd`(see `man zshcontrib`) to get information about your
|
||||||
keyboard and how your terminal handles it. This can fix issues with keys
|
keyboard and how your terminal handles it. This can fix issues with keys
|
||||||
|
|
|
||||||
21
history
21
history
|
|
@ -1,19 +1,25 @@
|
||||||
## History Configuration
|
## History Configuration
|
||||||
|
|
||||||
|
[ ! -d $XDG_STATE_HOME/zsh ] && mkdir -p $XDG_STATE_HOME/zsh
|
||||||
|
|
||||||
## Options relating to saving history
|
## Options relating to saving history
|
||||||
export HISTSIZE=10000
|
export HISTSIZE=10000
|
||||||
export SAVEHIST=6000
|
export SAVEHIST=6000
|
||||||
export HISTFILE=$XDG_STATE_HOME/zsh/history
|
export HISTFILE=$XDG_STATE_HOME/zsh/history
|
||||||
|
|
||||||
set hist_ignore_dups ## Don't log the same thing twice
|
setopt extended_history ## Save timestamp in history
|
||||||
set hist_ignore_space ## Don't log things that start with space
|
setopt inc_append_history_time ## incrementally append to history
|
||||||
set hist_reduce_blanks ## Compact unnecessary white-space
|
## This option means that the history is updated by all shell sessions
|
||||||
set hist_expire_dups_first ## Remove duplicates first (if any exist) when compacting history
|
## However it doesn't load them in like share_history does
|
||||||
set hist_save_no_dups ## Remove duplicates from history when writing
|
setopt hist_ignore_dups ## Don't log the same thing twice
|
||||||
|
setopt hist_ignore_space ## Don't log things that start with space
|
||||||
|
setopt hist_reduce_blanks ## Compact unnecessary white-space
|
||||||
|
setopt hist_expire_dups_first ## Remove duplicates first (if any exist) when compacting history
|
||||||
|
setopt hist_save_no_dups ## Remove duplicates from history when writing
|
||||||
|
|
||||||
## Options relating to history use
|
## Options relating to history use
|
||||||
set hist_find_no_dups ## Don't show duplicates when searching history
|
setopt hist_find_no_dups ## Don't show duplicates when searching history
|
||||||
set hist_verify ## Dont' immediately execute expanded history `eg: sudo !!`
|
setopt hist_verify ## Dont' immediately execute expanded history `eg: sudo !!`
|
||||||
|
|
||||||
## This stops certain commands saving into the history file
|
## This stops certain commands saving into the history file
|
||||||
export HISTORY_IGNORE='(cd(| *)|ls(| *)|pushd(| *)|popd(| *))'
|
export HISTORY_IGNORE='(cd(| *)|ls(| *)|pushd(| *)|popd(| *))'
|
||||||
|
|
@ -24,3 +30,4 @@ zshaddhistory() {
|
||||||
emulate -L zsh
|
emulate -L zsh
|
||||||
[[ ${1%%$'\n'} != ${~HISTORY_IGNORE} ]]
|
[[ ${1%%$'\n'} != ${~HISTORY_IGNORE} ]]
|
||||||
}
|
}
|
||||||
|
# vim: ft=zsh
|
||||||
|
|
|
||||||
11
hooks
Normal file
11
hooks
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#This file manages hooks so I can have multiple functions hooked the way I want
|
||||||
|
for file in $(find $ZDOTDIR/hooks.d -type f); do
|
||||||
|
source "$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
add-zsh-hook -Uz chpwd glow
|
||||||
|
add-zsh-hook -Uz chpwd osc7
|
||||||
|
add-zsh-hook -Uz precmd termtitle
|
||||||
|
add-zsh-hook -Uz precmd osc113
|
||||||
|
|
||||||
|
# vim: ft=zsh
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
chpwd() {
|
## Load readme with glow (if available)
|
||||||
|
glow() {
|
||||||
has glow || return 0
|
has glow || return 0
|
||||||
find $PWD -maxdepth 1 -iname 'readme.md' -exec glow {} \;
|
find $PWD -maxdepth 1 -iname 'readme.md' -exec glow {} \;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## vim: ft=zsh
|
||||||
7
hooks.d/osc113
Normal file
7
hooks.d/osc113
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
## output OSC-113;A to tell foot how to jump between prompts
|
||||||
|
|
||||||
|
osc113() {
|
||||||
|
print -Pn "\e]133;A\e\\"
|
||||||
|
}
|
||||||
|
|
||||||
|
## vim: ft=zsh
|
||||||
13
hooks.d/osc7
Normal file
13
hooks.d/osc7
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
## output the current directory in the correct format for foot.
|
||||||
|
|
||||||
|
function osc7 {
|
||||||
|
local LC_ALL=C
|
||||||
|
export LC_ALL
|
||||||
|
|
||||||
|
setopt localoptions extendedglob
|
||||||
|
input=( ${(s::)PWD} )
|
||||||
|
uri=${(j::)input/(#b)([^A-Za-z0-9_.\!~*\'\(\)-\/])/%${(l:2::0:)$(([##16]#match))}}
|
||||||
|
print -n "\e]7;file://${HOSTNAME}${uri}\e\\"
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: ft=zsh
|
||||||
6
hooks.d/termtitle
Normal file
6
hooks.d/termtitle
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
## set terminal title
|
||||||
|
termtitle () {
|
||||||
|
setTermTitle "($(whoami)@$(hostname) $(pwd))"
|
||||||
|
}
|
||||||
|
|
||||||
|
## vim: ft=zsh
|
||||||
8
prompt
8
prompt
|
|
@ -22,12 +22,12 @@ zstyle ':vcs_info:git*' check-for-changes true
|
||||||
zstyle ':vcs_info:git*' formats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)"
|
zstyle ':vcs_info:git*' formats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)"
|
||||||
zstyle ':vcs_info:git*' actionformats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)(%a)"
|
zstyle ':vcs_info:git*' actionformats "-(%{%F{203}%} %{%f%}%s:%{%F{2}%}שׂ %{%f%}%b %u%c)(%a)"
|
||||||
|
|
||||||
## set precmd to get vcs_info
|
## do precmd stuff
|
||||||
## precmd runs before every prompt
|
_vcsinfo() {
|
||||||
precmd() {
|
|
||||||
vcs_info
|
vcs_info
|
||||||
setTermTitle "($(whoami)@$(hostname) $(pwd))"
|
|
||||||
}
|
}
|
||||||
|
add-zsh-hook precmd _vcsinfo
|
||||||
|
|
||||||
|
|
||||||
PROMPT="╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%2~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤"
|
PROMPT="╭╼(%{%F{81}%}%n%{%F{245}%}@%{%F{206}%}%m %{%F{245}%}%2~%{%F{259}%})─(%(?.😎.😞 %?))"$'\n'"╰┤"
|
||||||
export RPROMPT='${vcs_info_msg_0_}'
|
export RPROMPT='${vcs_info_msg_0_}'
|
||||||
|
|
|
||||||
29
zshrc
29
zshrc
|
|
@ -13,6 +13,7 @@ autoload -U calendar
|
||||||
autoload -U run-help
|
autoload -U run-help
|
||||||
autoload -U +X compinit
|
autoload -U +X compinit
|
||||||
autoload -U edit-command-line
|
autoload -U edit-command-line
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
|
||||||
## zmodload Modules
|
## zmodload Modules
|
||||||
zmodload zsh/complist
|
zmodload zsh/complist
|
||||||
|
|
@ -24,21 +25,31 @@ autoload setTermTitle
|
||||||
autoload tempPersist
|
autoload tempPersist
|
||||||
autoload has
|
autoload has
|
||||||
|
|
||||||
|
## check for and load .local/share/zsh/site-functions
|
||||||
|
[ -d "$HOME/.local/share/zsh/site-functions" ] && fpath=("$HOME/.local/share/zsh/site-functions" $fpath)
|
||||||
|
|
||||||
## Source Other files
|
## Source Other files
|
||||||
source ${ZDOTDIR}/aliases
|
source ${ZDOTDIR}/aliases
|
||||||
source ${ZDOTDIR}/dir_aliases
|
source ${ZDOTDIR}/dir_aliases
|
||||||
source ${ZDOTDIR}/prompt
|
source ${ZDOTDIR}/prompt
|
||||||
source ${ZDOTDIR}/keyboard
|
source ${ZDOTDIR}/keyboard
|
||||||
source ${ZDOTDIR}/history
|
source ${ZDOTDIR}/history
|
||||||
source ${ZDOTDIR}/chpwd
|
source ${ZDOTDIR}/hooks
|
||||||
|
|
||||||
|
|
||||||
|
## Set options
|
||||||
|
## NOTE: zsh ignores case and underscores
|
||||||
|
setopt vi ## Use vi style keybinds
|
||||||
|
setopt autoCd ## Change to directory if given as command
|
||||||
|
setopt autoPushd ## Automatically use pushd and stack
|
||||||
|
setopt chaseDots ## Remove contradictory .. from cd path (e.g cd foo/bar/.. -> cd foo)
|
||||||
|
setopt correct ## Pick up on Spelling errors
|
||||||
|
setopt extendedGlob ## Allow extended globbing (see man zshexpn)
|
||||||
|
setopt markDirs ## Add a trailing '/' to directories when globbing
|
||||||
|
setopt interactiveComments ## allow comments in interactive shells
|
||||||
|
setopt rmStarWait ## wait 10 seconds when confirming large deletes
|
||||||
|
|
||||||
|
|
||||||
## Set option
|
|
||||||
#setopt emacs ## Emacs style keybinds
|
|
||||||
setopt vi
|
|
||||||
setopt autocd ## Change to directory if given as command
|
|
||||||
setopt autopushd ## Automatically use pushd and stack
|
|
||||||
setopt correct ## Pick up on Spelling errors
|
|
||||||
|
|
||||||
source ${ZDOTDIR}/completion
|
source ${ZDOTDIR}/completion
|
||||||
|
|
||||||
|
|
@ -57,7 +68,9 @@ fi
|
||||||
## Load external stuff
|
## Load external stuff
|
||||||
|
|
||||||
##Configure for homebrew
|
##Configure for homebrew
|
||||||
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
if [[ -d "/home/linuxbrew" ]]; then
|
||||||
|
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
|
||||||
|
fi
|
||||||
|
|
||||||
## Configure Plugins
|
## Configure Plugins
|
||||||
export ZSH_AUTOSUGGEST_STRATEGY=(completion history) # suggest from completion then history
|
export ZSH_AUTOSUGGEST_STRATEGY=(completion history) # suggest from completion then history
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user