Clean up modules and loading
This commit is contained in:
		
							parent
							
								
									4af5440511
								
							
						
					
					
						commit
						6c3826e32d
					
				
					 11 changed files with 57 additions and 174 deletions
				
			
		| 
						 | 
				
			
			@ -6,17 +6,45 @@ fpath=( "${ZDOTDIR:+$ZDOTDIR/compdef}" "/etc/zsh/compdef" $fpath )
 | 
			
		|||
 | 
			
		||||
autoload -Uz compinit && compinit -u
 | 
			
		||||
 | 
			
		||||
zstyle ':completion:*' verbose yes
 | 
			
		||||
zstyle ':completion:*:descriptions' format ‘%B%d%b’
 | 
			
		||||
zstyle ':completion:*:messages' format ‘%d’
 | 
			
		||||
zstyle ':completion:*:warnings' format ‘No matches for: %d’
 | 
			
		||||
zstyle ':completion:*' use-cache on                                       
 | 
			
		||||
zstyle ':completion:*' cache-path ~/.zsh/cache
 | 
			
		||||
zstyle ':completion:*' completer _complete _ignored _match _approximate _correct 
 | 
			
		||||
zstyle ':completion:*:match:*' original only
 | 
			
		||||
zstyle ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
 | 
			
		||||
zstyle ':completion:*:functions' ignored-patterns '_*'
 | 
			
		||||
zstyle ':completion:*' squeeze-slashes true                           
 | 
			
		||||
zstyle ':completion:*' expand prefix suffix
 | 
			
		||||
zstyle ':completion:*' group-name ''
 | 
			
		||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
 | 
			
		||||
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
 | 
			
		||||
zstyle ':completion:*' list-suffixes true
 | 
			
		||||
zstyle ':completion:*' preserve-prefix '//[^/]##/'
 | 
			
		||||
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
 | 
			
		||||
zstyle ':completion:*' special-dirs true
 | 
			
		||||
zstyle ':completion:*' verbose true
 | 
			
		||||
zstyle :compinstall filename '/etc/zsh/completion'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# completion for programs with standard gnu --help
 | 
			
		||||
for prog in amm tapestry; do
 | 
			
		||||
for prog in amm tapestry virtualenv; do
 | 
			
		||||
	compdef _gnu_generic $prog
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# custom compdefs
 | 
			
		||||
 | 
			
		||||
compdef _xbps xi=xbps-install
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
	local _myhosts
 | 
			
		||||
	_myhosts=( $(awk '/^Host/ {for (i=2; i<=NF; i++) print $i}' ~/.ssh/config) )
 | 
			
		||||
	zstyle ':completion:*' hosts $_myhosts
 | 
			
		||||
}&>/dev/null
 | 
			
		||||
 | 
			
		||||
zstyle ':completion:*:processes-names' command  'ps c -u ${USER} -o command | uniq'
 | 
			
		||||
 | 
			
		||||
compdef _command fork
 | 
			
		||||
compdef _command detach
 | 
			
		||||
compdef _command ontv
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ done
 | 
			
		|||
for dir in $ZFUNCTIONPATH; do
 | 
			
		||||
	if [ -d $dir ]; then
 | 
			
		||||
		for i in $dir/*~*.zwc(N:t); do
 | 
			
		||||
			autoload -Uz $i && $i
 | 
			
		||||
			autoload -Uz $i
 | 
			
		||||
		done
 | 
			
		||||
	fi
 | 
			
		||||
done
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,39 +0,0 @@
 | 
			
		|||
 | 
			
		||||
# The following lines were added by compinstall
 | 
			
		||||
 | 
			
		||||
#zstyle ':completion::complete:*' completer _complete _ignored  _correct 
 | 
			
		||||
 | 
			
		||||
zstyle ':completion:*' use-cache on                                       
 | 
			
		||||
zstyle ':completion:*' cache-path ~/.zsh/cache
 | 
			
		||||
zstyle ':completion:*' completer _complete _ignored _match _approximate _correct 
 | 
			
		||||
zstyle ':completion:*:match:*' original only
 | 
			
		||||
zstyle ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
 | 
			
		||||
zstyle ':completion:*:functions' ignored-patterns '_*'
 | 
			
		||||
zstyle ':completion:*' squeeze-slashes true                           
 | 
			
		||||
zstyle ':completion:*' expand prefix suffix
 | 
			
		||||
zstyle ':completion:*' group-name ''
 | 
			
		||||
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
 | 
			
		||||
zstyle ':completion:*' list-prompt '%SAt %p: Hit TAB for more, or the character to insert%s'
 | 
			
		||||
zstyle ':completion:*' list-suffixes true
 | 
			
		||||
zstyle ':completion:*' preserve-prefix '//[^/]##/'
 | 
			
		||||
zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s'
 | 
			
		||||
zstyle ':completion:*' special-dirs true
 | 
			
		||||
zstyle ':completion:*' verbose true
 | 
			
		||||
zstyle :compinstall filename '/etc/zsh/completion'
 | 
			
		||||
 | 
			
		||||
autoload -Uz compinit
 | 
			
		||||
compinit
 | 
			
		||||
# End of lines added by compinstall
 | 
			
		||||
 | 
			
		||||
# ssh known hosts complete
 | 
			
		||||
{
 | 
			
		||||
	local _myhosts
 | 
			
		||||
	_myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} )
 | 
			
		||||
	zstyle ':completion:*' hosts $_myhosts
 | 
			
		||||
}&>/dev/null
 | 
			
		||||
 | 
			
		||||
zstyle ':completion:*:processes-names' command  'ps c -u ${USER} -o command | uniq'
 | 
			
		||||
 | 
			
		||||
compdef _command fork
 | 
			
		||||
compdef _command detach
 | 
			
		||||
compdef _command ontv
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +1,26 @@
 | 
			
		|||
#!/bin/zsh
 | 
			
		||||
 | 
			
		||||
typeset -Ax conf_locations
 | 
			
		||||
 | 
			
		||||
conf() {
 | 
			
		||||
	local target=${conf_locations[${1}]}
 | 
			
		||||
	if [[ $1 == -r ]]; then
 | 
			
		||||
		local confconf=$(zdotfile confs)
 | 
			
		||||
		if [[ -e $confconf ]]; then
 | 
			
		||||
			conf_locations[conf]=$confconf
 | 
			
		||||
			conf_locations+=( $(<$confconf) )
 | 
			
		||||
		fi
 | 
			
		||||
		return
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [[ -z $1 ]]; then
 | 
			
		||||
		echo "Available configs:"
 | 
			
		||||
		for k v in ${(kv)conf_locations}; do
 | 
			
		||||
			printf "%-20s %s\n" ${k}: ${(e)v}
 | 
			
		||||
		done
 | 
			
		||||
		return 1
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	local target=${(e)conf_locations[${1}]}
 | 
			
		||||
	if [[ -d ${target} ]]; then
 | 
			
		||||
		cd ${target}
 | 
			
		||||
		if ! [[ -w ${target} ]]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -20,3 +39,5 @@ conf() {
 | 
			
		|||
	fi
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
conf -r
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +0,0 @@
 | 
			
		|||
if exists thefuck; then
 | 
			
		||||
	eval "$(thefuck --alias)"
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
. $MPATH/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 | 
			
		||||
. /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
 | 
			
		||||
 | 
			
		||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,14 +0,0 @@
 | 
			
		|||
#!/bin/zsh
 | 
			
		||||
 | 
			
		||||
if exists percol; then
 | 
			
		||||
    function percol_select_history() {
 | 
			
		||||
        local tac
 | 
			
		||||
        exists gtac && tac="gtac" || { exists tac && tac="tac" || { tac="tail -r" } }
 | 
			
		||||
        BUFFER=$(fc -l -n 1 | eval $tac | percol --query "$LBUFFER")
 | 
			
		||||
        CURSOR=$#BUFFER         # move cursor
 | 
			
		||||
        zle -R -c               # refresh
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    zle -N percol_select_history
 | 
			
		||||
    bindkey '^R' percol_select_history
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			@ -1,56 +0,0 @@
 | 
			
		|||
#!/bin/zsh
 | 
			
		||||
 | 
			
		||||
typeset -ag ZP_LIST
 | 
			
		||||
 | 
			
		||||
local load-project-list() {
 | 
			
		||||
	ZP_LIST=( $ZDOTDIR/projects/*(N:t) )
 | 
			
		||||
}
 | 
			
		||||
load-project-list
 | 
			
		||||
 | 
			
		||||
project() {
 | 
			
		||||
	case "$1" in
 | 
			
		||||
		reload)
 | 
			
		||||
			load-project-list
 | 
			
		||||
			echo "${(j:\n:)ZP_LIST}"
 | 
			
		||||
			;;
 | 
			
		||||
		close)
 | 
			
		||||
			unset ZPROJECT
 | 
			
		||||
			;;
 | 
			
		||||
		open)
 | 
			
		||||
			shift
 | 
			
		||||
			open-project "$@"
 | 
			
		||||
			;;
 | 
			
		||||
	esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_project_open() {
 | 
			
		||||
	_arguments "2:project:($ZP_LIST)" 
 | 
			
		||||
	#_alternative "project:project:($ZP_LIST)" 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_project() {
 | 
			
		||||
	_arguments "1:Action:->action" \
 | 
			
		||||
		"*: :->args"
 | 
			
		||||
	case "$state" in
 | 
			
		||||
		action)
 | 
			
		||||
			_arguments '1:action:(open close reload)'
 | 
			
		||||
			;;
 | 
			
		||||
		args)
 | 
			
		||||
			_project_$words[2]
 | 
			
		||||
			;;
 | 
			
		||||
	esac
 | 
			
		||||
}
 | 
			
		||||
compdef _project project
 | 
			
		||||
 | 
			
		||||
local open-project() {
 | 
			
		||||
	typeset -gA ZPROJECT
 | 
			
		||||
	ZPROJECT[name]="$1"
 | 
			
		||||
	source $ZDOTDIR/projects/$1
 | 
			
		||||
	pcd
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pcd() {
 | 
			
		||||
	cd ${ZPROJECT[path]}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alias pp=project
 | 
			
		||||
| 
						 | 
				
			
			@ -1,27 +0,0 @@
 | 
			
		|||
#!/bin/zsh
 | 
			
		||||
# start ssh-agent on first opened shell, retrieve information on all others from
 | 
			
		||||
# file
 | 
			
		||||
SSH_ENV="$HOME/.ssh/environment"
 | 
			
		||||
 | 
			
		||||
[ -e "${SSH_ENV:h}" ] || mkdir -p "${SSH_ENV:h}"
 | 
			
		||||
 | 
			
		||||
function start_agent {
 | 
			
		||||
     echo "Initialising new SSH agent..."
 | 
			
		||||
     /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
 | 
			
		||||
     echo succeeded
 | 
			
		||||
     chmod 600 "${SSH_ENV}"
 | 
			
		||||
     . "${SSH_ENV}" > /dev/null
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Source SSH settings, if applicable
 | 
			
		||||
 | 
			
		||||
if [ -f "${SSH_ENV}" ]; then
 | 
			
		||||
     . "${SSH_ENV}" > /dev/null
 | 
			
		||||
     #ps ${SSH_AGENT_PID} doesn't work under cywgin
 | 
			
		||||
     ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
 | 
			
		||||
         start_agent;
 | 
			
		||||
     }
 | 
			
		||||
else
 | 
			
		||||
     start_agent;
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,12 +0,0 @@
 | 
			
		|||
#!/bin/zsh
 | 
			
		||||
h=()
 | 
			
		||||
if [[ -r ~/.ssh/config ]]; then
 | 
			
		||||
	h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
 | 
			
		||||
fi
 | 
			
		||||
if [[ -r ~/.ssh/known_hosts ]]; then
 | 
			
		||||
	h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
 | 
			
		||||
fi
 | 
			
		||||
if [[ $#h -gt 0 ]]; then
 | 
			
		||||
	zstyle ':completion:*:ssh:*' hosts $h
 | 
			
		||||
	zstyle ':completion:*:slogin:*' hosts $h
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										21
									
								
								zshrc
									
										
									
									
									
								
							
							
						
						
									
										21
									
								
								zshrc
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -25,8 +25,10 @@ zdotfile() {
 | 
			
		|||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
. $(zdotfile completion.zsh)
 | 
			
		||||
source $(zdotfile zplug.zsh)
 | 
			
		||||
 | 
			
		||||
bindkey -v
 | 
			
		||||
autoload -Uz zmv
 | 
			
		||||
 | 
			
		||||
function exists { command -v "$@" >/dev/null }
 | 
			
		||||
ZMODLOAD_BLACKLIST=( ssh-agent )
 | 
			
		||||
| 
						 | 
				
			
			@ -43,23 +45,6 @@ echo $PATH | grep -q 'local' || . /etc/zsh/zprofile
 | 
			
		|||
echo $PATH | grep -q 'sbin' || . /etc/zsh/zprofile
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
typeset -A conf_locations
 | 
			
		||||
conf_locations=(
 | 
			
		||||
	vim         $XDG_CONFIG_HOME/vim
 | 
			
		||||
	awesome     $XDG_CONFIG_HOME/awesome
 | 
			
		||||
	mutt        $HOME/.mutt/muttrc
 | 
			
		||||
	xd          $XDG_CONFIG_HOME/xd.conf
 | 
			
		||||
	zsh         /etc/zsh
 | 
			
		||||
	offlineimap $XDG_CONFIG_HOME/offlineimap/config
 | 
			
		||||
	compose     $HOME/.XCompose.long
 | 
			
		||||
	vdirsyncer  $HOME/.vdirsyncer/config
 | 
			
		||||
	xd			$XDG_CONFIG_HOME/xd.conf
 | 
			
		||||
	ssh			$HOME/.ssh/config
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
. $(zdotfile completion.zsh)
 | 
			
		||||
 | 
			
		||||
FZF_ALT_C_COMMAND="fd -t d"
 | 
			
		||||
[[ -e /usr/share/doc/fzf/key-bindings.zsh ]] && . /usr/share/doc/fzf/key-bindings.zsh
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue