Commit 76f59c43 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Complete rework of awit-zsh-superawesome for IDMS Linux Rolling

parent 66f1058c
......@@ -10,30 +10,12 @@
cd ~
git clone ssh://git@gitlab.devlabs.linuxassist.net:608/allworldit/awit-zsh-superawesome.git .zsh
# Activate ZSH
# Activate the configuration
ln -s .zsh/zshrc .zshrc
# Install fonts
mkdir ~/.fonts
cp fonts/*.ttf ~/.fonts/
fc-cache -fv ~/.fonts
# For Konsole
cp AWIT-ZSH-SuperAwesome.profile ~/.local/share/konsole/
cp AWIT-ZSH-SuperAwesome.colorscheme ~/.local/share/konsole/
Select the "AWIT-ZSH-SuperAwesome" profile as default in Konsole's profile manager.
# Customizing
Customizing can be done by adding files to ~/.zsh/zshrc_local.d/ directory and editing the ~/.zsh/zshrc.local file.
If you have something awesome to contribute, please consider adding it to zshrc.d/.
# Updating
The fonts/ is a download of the complete fonts in https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/Hack
# Ignore everything in this directory
*
# Except this file
!.gitignore
# compsys initialization
autoload -U compinit
compinit
# Get an array of known SSH host names after deleting:
# - Everything after the first column of host names or IPs
# - Square brackets and attached port numbers
# - IP addresses
# - Encrypted host names
hosts=( `sed -e 's/[, ].*//g' -e 's/\[\([^]]*\)\].*/\1/' -e '/^[0-9]\+/d' -e '/^|1|/d' $HOME/.ssh/known_hosts` )
zstyle ':completion:*:hosts' hosts $hosts
#!/bin/zsh
die() {
echo "$1"
exit 1
}
grep -q '^|1|' ~/.ssh/known_hosts && die "ERROR: ~/.ssh/known_hosts is hashed. Aborting!
Please see this contributions README.md for more information."
if [ ! -e ~/.zsh/completion/_awit-ssh ]; then
# Install
ln -s ~/.zsh/contrib/awit-ssh-completion/_awit-ssh ~/.zsh/completion/
echo "Installed ~/.zsh/completion/_awit-ssh"
else
# Uninstall
rm -f ~/.zsh/completion/_awit-ssh
echo "Uninstalled ~/.zsh/completion/_awit-ssh"
fi
if [ ! -e ~/.zsh/zshrc.d/51-completion-awit-ssh.zsh ]; then
# Install
ln -s ~/.zsh/contrib/awit-ssh-completion/51-completion-awit-ssh.zsh ~/.zsh/zshrc_local.d/
echo "Installed ~/.zsh/zshrc.d/51-completion-awit-ssh.zsh"
else
# Uninstall
rm -f ~/.zsh/zshrc.d/51-completion-awit-ssh.zsh ~/.zsh/zshrc_local.d/51-completion-awit-ssh.zsh
echo "Uninstalled ~/.zsh/zshrc.d/51-completion-awit-ssh.zsh and ~/.zsh/zshrc_local.d/51-completion-awit-ssh.zsh"
fi
# awit-ssh Completion
If you want to use awit-ssh completion with zsh you first need to clean up your ~/.ssh/known_hosts file if it is hashed.
Run the follow and if you see any number other than zero, your ~/.ssh/known_hosts file is hashed
grep -c '^|1|' ~/.ssh/known_hosts
Since you need the file unencrypted make a backup of ~/.ssh/known_hosts and then add the following lines to the top of ~/.ssh/config
Host *
HashKnownHosts no
Then delete the hashed lines
sed -i '/^|1|/d' ~/.ssh/known_hosts
Going forward host names will be added in plain text. You'll be prompted to re-add the deleted hosts names as you log in to each server again.
#compdef awit-ssh
local curcontext="$curcontext" state line expl ret=1
local -a _comp_priv_prefix
_arguments -C \
'(-?)--help[display help information]' \
'--version[display version information]' \
'--forward-agent[forward the ssh-agent socket]' \
'--knock[knock on HOST:PORT to gain access]' \
'--rsync[use rsync to rsync data from remote server to DEST]' \
'--libvirt-vnc[connect to remote VNC server HOST:PORT]' \
'1:remote host name:->userhost' \
'*:::args:_normal' && ret=0
case $state in
userhost)
if compset -P '*@'; then
_wanted hosts expl 'remote host name' _ssh_hosts && ret=0
elif compset -S '@*'; then
_wanted users expl 'login name' _combination -s '[:@]' my-accounts users-hosts users -S '' && ret=0
else
_alternative \
'hosts:remote host name:_ssh_hosts' \
'users:login name:_combination -s "[:@]" my-accounts users-hosts users -qS@' && ret=0
fi
;;
esac
return ret
# https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-internals
*.zsh
# https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-internals
*.zsh
# https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-and-adding-plugins
#
# Ignore everything in this directory
*
# Except this file
!.gitignore
/usr/share/zsh/plugins/zsh-syntax-highlighting
\ No newline at end of file
# https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-and-adding-themes
#
# Ignore everything in this directory
*
# Except this file
!.gitignore
/usr/share/zsh-theme-powerlevel9k/powerlevel9k.zsh-theme
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment