#!/usr/bin/env bash set -x #set -Eeu -o -pipefail ## Completions for Debian 9.0 - may be included in zgen # files included from .zshrc # ~/.zsh-completions # directories included from .zshrc # ~/.zshrc.pre-plugins.d # ~/.zsh-completions.d # ~/.zshrc.d # ~/.macos_aliases.d # ~/.osx_aliases.d # #sudo bash -c "cat > /etc/apt/sources.list.d/shells:zsh-users:zsh-completions.list" << 'EOF' #deb http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-completions/Debian_9.0/ / #EOF # # KEY_DIR=/etc/apt/keyrings #wget -qO - https://download.opensuse.org/repositories/shells:zsh-users:zsh-completions/Debian_9.0/Release.key | sudo tee ${KEY_DIR}/zsh-completions.gpg # #sudo apt update #sudo apt install zsh-completions sudo apt install -y zsh nodejs zsh-theme-powerlevel9k git fonts-powerline powerline fzf golang-chroma python3-argcomplete # compaudit # There are insecure directories: /usr/local/share/zsh/site-functions # compaudit | xargs chmod g-w # compaudit 2>&1 | sed -n '1d; p' mkdir -p /usr/local/share/zsh/site-functions chmod g-w /usr/local/share/zsh/site-functions #DEST=$HOME DEST=${1:-/etc/skel} HOME="${DEST}" # KEY_DIR=/etc/apt/keyrings ALIAS_DIR=".zshrc.d" cd "${DEST}" || exit cp /var/tmp/automate/.p10k.zsh "${DEST}" chsh -s "$(which zsh)" "${USER}" # Install zgenom plugin manager and zsh quickstart to get a default setup for zsh # .zgen-setup pulls zgenom automatically and puts it in .zqs-zgenom, plugins in .zgenom git clone https://github.com/unixorn/zsh-quickstart-kit "${DEST}"/zsh-quickstart-kit ln -rsf "${DEST}"/zsh-quickstart-kit/zsh/.zshrc "${DEST}"/.zshrc ln -rsf "${DEST}"/zsh-quickstart-kit/zsh/.zsh_functions "${DEST}"/.zsh_functions #ln -rsf "${DEST}"/zsh-quickstart-kit/zsh/.zsh_aliases "${DEST}"/.zsh_aliases ln -rsf "${DEST}"/zsh-quickstart-kit/zsh/.zgen-setup "${DEST}"/.zgen-setup #ln -rsf ~/zsh-quickstart-kit/zsh/.zsh_completions ~/.zsh_completions mkdir -p "${DEST}"/"${ALIAS_DIR}" touch "${DEST}"/.zshrc echo "setopt PROMPT_SUBST" >>"${DEST}"/.zshrc echo "NVIM_PYTHON_LOG_FILE=/var/tmp/nvim_python.log" >>"${DEST}"/"${ALIAS_DIR}"/008_nvim.zsh echo "NVIM_PYTHON_LOG_LEVEL=DEBUG" >>"${DEST}"/"${ALIAS_DIR}"/008_nvim.zsh sudo touch /var/tmp/nvim_python.log # fix path error in .zshrc #sed -i 's|pushd $(dirname "${HOME}/$(readlink "${DEST}"/.zshrc)")|pushd $(dirname "$(readlink "${DEST}"/.zshrc)")|' "${DEST}"/zsh-quickstart-kit/zsh/.zshrc # debians locate db locate # sed -i 's,^\(export LOCATE_PATH=\).*,\1'/var/lib/mlocate/mlocate.db',' "${DEST}"/.zshrc echo "export LOCATE_PATH=/var/lib/mlocate/mlocate.db" >"${DEST}"/"${ALIAS_DIR}"/005_locatedb.zsh # add plugins to the load-starter-plugin-list() function in ~/.zgen-setup ~/zsh-quickstart-kit/zsh/.zgen-setup # FIXED: create a file named .zgen-local-plugins and add your zgenom load commands there. # Don't forget to run `zgenom save` at the end of your .zgen-local-plugins file. # Warning: .zgen-local-plugins REPLACES the starter list setup, it doesn't add to it. # Comment out default docker plugin and replace with omz docker and compose plugins sed -i -e "s|zgenom load srijanshetty/docker-zsh|# zgenom load srijanshetty/docker-zsh|" "${DEST}"/zsh-quickstart-kit/zsh/.zgen-setup #sed -i '/\# zgenom load srijanshetty\/docker-zsh/a\ \ zgenom load ohmyzsh plugins\/docker\n\ \ zgenom load ohmyzsh plugins\/docker-compose' "${DEST}"/zsh-quickstart-kit/zsh/.zgen-setup # zsh quickstart created this file if missing expecting fzf to be installed in ${HOME} # we have it installed via apt so the executables are in the path and the key-bindings # and completitions are in examples fom the package. cat <<-EOF | sudo tee "${DEST}/.fzf.zsh" # Setup fzf # --------- #if [[ ! "\$PATH" == *\${HOME}/.vim/bundle/fzf/bin/* ]]; then # export PATH="\$PATH:\${HOME}/.vim/bundle/fzf/bin" #fi # auto-completion # --------------- [[ \$- == *i* ]] && source "/usr/share/doc/fzf/examples/completion.zsh" 2> /dev/null # Key bindings # ------------ source "/usr/share/doc/fzf/examples/key-bindings.zsh" EOF # The contents of the starter plugin function with changes above, pulling from upstream git with now not squash local changes. cat <<-EOF | tee "${DEST}"/.zgen-local-plugins echo "creating a zgen save" ZGEN_LOADED=() ZGEN_COMPLETIONS=() # Load ohmyzsh base zgenom ohmyzsh # zman fzf to quickly find and browse Zsh manuals in a webbrowser zgenom load mattmc3/zman # .zgen-local-plugins is sourced during startup *instead* of running .zgen-setup load-starter-plugin-list function, # so make sure to include everything from this function that you want to keep. # If zsh-syntax-highlighting is bundled after zsh-history-substring-search, # they break, so get the order right. zgenom load zsh-users/zsh-syntax-highlighting zgenom load zsh-users/zsh-history-substring-search zgenom load fdellwing/zsh-bat # Set keystrokes for substring searching zmodload zsh/terminfo bindkey "\$terminfo[kcuu1]" history-substring-search-up bindkey "\$terminfo[kcud1]" history-substring-search-down # Tab complete rakefile targets #zgenom load unixorn/rake-completion.zshplugin # Automatically run zgen update and zgen selfupdate every 7 days #zgenom load unixorn/autoupdate-zgen zgenom load unixorn/jpb.zshplugin # Colorize the things if you have grc installed. Well, some of the # things, anyway. zgenom load unixorn/warhol.plugin.zsh # OS X helpers zgenom load unixorn/tumult.plugin.zsh # Warn you when you run a command that you've got an alias for # zgenom load djui/alias-tips # Add my collection of git helper scripts zgenom load unixorn/git-extra-commands # Add my bitbucket git helpers plugin zgenom load unixorn/bitbucket-git-helpers.plugin.zsh # A collection of scripts that might be useful to sysadmins zgenom load skx/sysadmin-util # Adds aliases to open your current repo & branch on github. zgenom load peterhurford/git-it-on.zsh # Tom Limoncelli's tooling for storing private information (keys, etc) # in a repository securely by encrypting them with gnupg zgenom load StackExchange/blackbox # Load some ohmyzsh plugins zgenom ohmyzsh plugins/aws #zgenom ohmyzsh plugins/chruby zgenom ohmyzsh plugins/colored-man-pages zgenom ohmyzsh plugins/colorize zgenom ohmyzsh plugins/git zgenom ohmyzsh plugins/github zgenom ohmyzsh plugins/golang zgenom ohmyzsh plugins/pip zgenom ohmyzsh plugins/python zgenom ohmyzsh plugins/rsync zgenom ohmyzsh plugins/tmux zgenom ohmyzsh plugins/screen zgenom ohmyzsh plugins/ssh-agent zgenom ohmyzsh plugins/sudo zgenom ohmyzsh plugins/vagrant zgenom ohmyzsh plugins/docker if [ \$(uname -a | grep -ci Darwin) = 1 ]; then # Load OSX-specific plugins zgenom ohmyzsh plugins/brew zgenom ohmyzsh plugins/osx fi # pipx completitons zgenom load thuandt/zsh-pipx # A set of shell functions to make it easy to install small apps and # utilities distributed with pip. zgenom load sharat87/pip-app zgenom load chrissicool/zsh-256color # ZVM - A better and friendly vi(vim) mode plugin for ZSH.' zgenom load jeffreytse/zsh-vi-mode # Load more completion files for zsh from the zsh-lovers github repo #zgenom load zsh-users/zsh-completions src # aggregates zsh completions from: zsh-users/zsh-completions, zchee/zsh-completions, # nilsonholger/osx-zsh-completions and various other custom or third-party sources. zgenom load clarketm/zsh-completions # Docker completion # zgenom load srijanshetty/docker-zsh #zgenom load akarzim/zsh-docker-aliases #zgenom load robbyrussell/oh-my-zsh plugins/docker #zgenom load robbyrussell/oh-my-zsh plugins/docker-compose # Very cool plugin that generates zsh completion functions for commands # if they have getopt-style help text. It doesn't generate them on the fly, # you'll have to explicitly generate a completion, but it's still quite cool. zgenom load RobSis/zsh-completion-generator # Add Fish-like autosuggestions to your ZSH zgenom load zsh-users/zsh-autosuggestions # Add support for autoswitching conda/python venv # zgenom load MichaelAquilina/zsh-autoswitch-virtualenv # zgenom load bckim92/zsh-autoswitch-conda # Add functional testing for zsh zgenom load molovo/revolver zgenom load olets/zsh-test-runner zgenom load zunit-zsh/zunit # IDE-like type-ahead completion for Zsh, asynchronous/non-blocking #zgenom load marlonrichert/zsh-autocomplete # k is a zsh script / plugin to make directory listings more readable, # adding a bit of color and some git status information on files and directories zgenom load rimraf/k # Bullet train prompt setup #zgenom load caiogondim/bullet-train-ohmyzsh-theme bullet-train zgenom load robbyrussell/oh-my-zsh themes/agnoster ## Load Prezto # zgen prezto ## Load prezto plugins # zgen prezto