From 10bf2e49c07d9fcf16033da821ff1b247792deaa Mon Sep 17 00:00:00 2001 From: ziro Date: Fri, 26 Jun 2020 09:26:08 +0700 Subject: [PATCH] + Added zsh completion (from O-M-Z) --- .config/dwm/autostart.sh | 16 +++++----- .config/mutt/muttrc | 4 +++ .config/vim/vimrc | 16 +++++----- .config/zsh/.zshrc | 9 ++++++ .config/zsh/aliases | 9 ++++++ .config/zsh/completion | 66 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 16 deletions(-) create mode 100644 .config/zsh/completion diff --git a/.config/dwm/autostart.sh b/.config/dwm/autostart.sh index 5ca7bec..36ecb61 100755 --- a/.config/dwm/autostart.sh +++ b/.config/dwm/autostart.sh @@ -1,14 +1,14 @@ #!/bin/sh -$XDG_CONFIG_HOME/polybar/launch-dwm.sh & +# $XDG_CONFIG_HOME/polybar/launch-dwm.sh & picom & nitrogen --restore & $HOME/.scripts/launch-conky_dwm.sh & sxhkd -c $HOME/.config/sxhkd/dwm & -#if [ x$(pidof dwmblocks) = "x" ] -#then -# dwmblocks & -# pkill -RTMIN+1 dwmblocks -#else -# echo 'dwmblocks is running, skipped.' -#fi +if [ x$(pidof dwmblocks) = "x" ] +then + dwmblocks & + pkill -RTMIN+1 dwmblocks +else + echo 'dwmblocks is running, skipped.' +fi diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc index 0687adc..edc6ce0 100644 --- a/.config/mutt/muttrc +++ b/.config/mutt/muttrc @@ -1,6 +1,10 @@ # custom bind bind index,pager \Cl sidebar-open macro index 'c' '?^K=' +macro index 'q' 'O' + +# custom config +set copy = no # prevent mutt from sending a mail twice # mutt-wizard stuff source /usr/local/share/mutt-wizard/mutt-wizard.muttrc # mw-autogenerated diff --git a/.config/vim/vimrc b/.config/vim/vimrc index 2836c2e..85b95ec 100755 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -77,15 +77,15 @@ Plug 'autozimu/LanguageClient-neovim', { \ } Plug 'SirVer/ultisnips' Plug 'honza/vim-snippets' -"if has('nvim') -" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -"else -" Plug 'Shougo/deoplete.nvim' -" Plug 'roxma/nvim-yarp' -" Plug 'roxma/vim-hug-neovim-rpc' -"endif +" if has('nvim') +" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +" else +" Plug 'Shougo/deoplete.nvim' +" Plug 'roxma/nvim-yarp' +" Plug 'roxma/vim-hug-neovim-rpc' +" endif Plug 'preservim/nerdcommenter' -Plug 'ycm-core/YouCompleteMe' +" Plug 'ycm-core/YouCompleteMe' Plug 'preservim/nerdtree' Plug 'ryanoasis/vim-devicons' if !has('nvim') diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index c4c36b3..7435e5a 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -10,6 +10,15 @@ rateUSD #python ~/Currency/USD2IDR/rate.py #PYTHON IS JUST TOO SLOW FOR TERMINAL #sh ~/.scripts/motd.sh +setopt auto_cd # auto cd if directory +# highlight on tab (completion) +[ -f ~/.config/zsh/completion ] && source ~/.config/zsh/completion +# zstyle ':completion:*:*:git:*' script /usr/local/etc/bash_completion.d/git-completion.bash +# fpath=(/usr/local/share/zsh-completions $fpath) +# autoload -U compinit && compinit +# zmodload -i zsh/complist +# zstyle ':completion:*' menu select + # Alias [ -f ~/.config/zsh/aliases ] && source ~/.config/zsh/aliases diff --git a/.config/zsh/aliases b/.config/zsh/aliases index 4423a74..0527d5d 100644 --- a/.config/zsh/aliases +++ b/.config/zsh/aliases @@ -48,12 +48,16 @@ alias storagelist='lsblk -f' alias ..='cd ..' alias ...='cd ../..' alias q='exit' + alias l='exa --color=always --group-directories-first' # my preferred listing alias ls='exa --color=always --group-directories-first' # my preferred listing alias la='exa -a --color=always --group-directories-first' # all files and dirs alias ll='exa -l --color=always --group-directories-first' # long format alias lla='exa -al --color=always --group-directories-first' # long format alias lt='exa -aT --color=always --group-directories-first' # tree listing +alias md='mkdir -p' +alias rd='rmdir' + alias reUSD='rm -rf /tmp/rate.html /tmp/rateUSD.txt' alias upElearn='sh $HOME/.scripts/elearning-isitup.sh' # alias old-ranger='ranger' @@ -76,6 +80,7 @@ alias cfxprofile='vim $XDG_CONFIG_HOME/xprofile' alias cfcompt='vim $XDG_CONFIG_HOME/picom/picom.conf' alias cfenv='vim $XDG_CONFIG_HOME/zsh/.zshenv' alias cfmutt='vim $XDG_CONFIG_HOME/mutt/muttrc' +alias cfnews='vim $XDG_CONFIG_HOME/newsboat/urls' #more shortcuts alias htop='htop -t' @@ -93,6 +98,10 @@ alias cdwine='cd "$HOME/.local/share/wineprefixes/"' #Git Aliases alias gca='git commit --all' +alias gr='git rm' alias gR='git restore' alias gs='git status' +alias gp='git push' +alias gP='git pull' +alias gcl='git clone' alias config='/usr/bin/git --git-dir=$HOME/dotfiles/ --work-tree=$HOME' diff --git a/.config/zsh/completion b/.config/zsh/completion new file mode 100644 index 0000000..3392dc6 --- /dev/null +++ b/.config/zsh/completion @@ -0,0 +1,66 @@ +# vim: filetype=zsh +zstyle ':completion:*:*:git:*' script /usr/local/etc/bash_completion.d/git-completion.bash +fpath=(/usr/local/share/zsh-completions $fpath) +autoload -U compinit && compinit +zmodload -i zsh/complist +zstyle ':completion:*' menu select + +# case insensitive (all), partial-word and substring completion +if [[ "$CASE_SENSITIVE" = true ]]; then + zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*' +else + if [[ "$HYPHEN_INSENSITIVE" = true ]]; then + zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' + else + zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*' + fi +fi +unset CASE_SENSITIVE HYPHEN_INSENSITIVE + +# Complete . and .. special directories +zstyle ':completion:*' special-dirs true + +zstyle ':completion:*' list-colors '' +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' + +if [[ "$OSTYPE" = solaris* ]]; then + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm" +else + zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w" +fi + +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories + +# Use caching so that commands like apt and dpkg complete are useable +zstyle ':completion:*' use-cache yes +zstyle ':completion:*' cache-path $ZSH_CACHE_DIR + +# Don't complete uninteresting users +zstyle ':completion:*:*:*:users' ignored-patterns \ + adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \ + clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \ + gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \ + ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \ + named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \ + operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \ + rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \ + usbmux uucp vcsa wwwrun xfs '_*' + +# ... unless we really want to. +zstyle '*' single-ignored show + +if [[ $COMPLETION_WAITING_DOTS = true ]]; then + expand-or-complete-with-dots() { + # toggle line-wrapping off and back on again + [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam + print -Pn "%{%F{red}......%f%}" + [[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam + + zle expand-or-complete + zle redisplay + } + zle -N expand-or-complete-with-dots + bindkey "^I" expand-or-complete-with-dots +fi +