Compare commits

..

No commits in common. "9da7b6babf05c25f8e61554bb1350b7fbadae7f3" and "d99aa241fe420ec480017fca77a95f159bdc0496" have entirely different histories.

9 changed files with 25 additions and 90 deletions

View File

@ -63,12 +63,6 @@ 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
@ -108,6 +102,11 @@ 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.
@ -140,10 +139,6 @@ 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

View File

@ -1,7 +1,4 @@
## Load readme with glow (if available) chpwd() {
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

21
history
View File

@ -1,25 +1,19 @@
## 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
setopt extended_history ## Save timestamp in history set hist_ignore_dups ## Don't log the same thing twice
setopt inc_append_history_time ## incrementally append to history set hist_ignore_space ## Don't log things that start with space
## This option means that the history is updated by all shell sessions set hist_reduce_blanks ## Compact unnecessary white-space
## However it doesn't load them in like share_history does set hist_expire_dups_first ## Remove duplicates first (if any exist) when compacting history
setopt hist_ignore_dups ## Don't log the same thing twice set hist_save_no_dups ## Remove duplicates from history when writing
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
setopt hist_find_no_dups ## Don't show duplicates when searching history set hist_find_no_dups ## Don't show duplicates when searching history
setopt hist_verify ## Dont' immediately execute expanded history `eg: sudo !!` set 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(| *))'
@ -30,4 +24,3 @@ zshaddhistory() {
emulate -L zsh emulate -L zsh
[[ ${1%%$'\n'} != ${~HISTORY_IGNORE} ]] [[ ${1%%$'\n'} != ${~HISTORY_IGNORE} ]]
} }
# vim: ft=zsh

11
hooks
View File

@ -1,11 +0,0 @@
#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

View File

@ -1,7 +0,0 @@
## output OSC-113;A to tell foot how to jump between prompts
osc113() {
print -Pn "\e]133;A\e\\"
}
## vim: ft=zsh

View File

@ -1,13 +0,0 @@
## 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

View File

@ -1,6 +0,0 @@
## set terminal title
termtitle () {
setTermTitle "($(whoami)@$(hostname) $(pwd))"
}
## vim: ft=zsh

8
prompt
View File

@ -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)"
## do precmd stuff ## set precmd to get vcs_info
_vcsinfo() { ## precmd runs before every prompt
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_}'

27
zshrc
View File

@ -13,7 +13,6 @@ 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
@ -25,31 +24,21 @@ 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}/hooks source ${ZDOTDIR}/chpwd
## Set options ## Set option
## NOTE: zsh ignores case and underscores #setopt emacs ## Emacs style keybinds
setopt vi ## Use vi style keybinds setopt vi
setopt autoCd ## Change to directory if given as command setopt autocd ## Change to directory if given as command
setopt autoPushd ## Automatically use pushd and stack 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 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
source ${ZDOTDIR}/completion source ${ZDOTDIR}/completion
@ -68,9 +57,7 @@ fi
## Load external stuff ## Load external stuff
##Configure for homebrew ##Configure for homebrew
if [[ -d "/home/linuxbrew" ]]; then eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
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