diff --git a/.zsh_aliases b/.zsh_aliases index 145fe7c..802d0e1 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -71,6 +71,6 @@ alias git-st='git status' alias git-lg='git log --color --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit' alias git-remotes='git remote -v update' -# Makes work easier -alias rdp='/opt/freerdp-nightly/bin/xfreerdp /u:chawley2 /size:90% ' +# Edit files with vim/fzf +alias vfz='vim "`fzf`"' diff --git a/.zshrc b/.zshrc index 6aa4bc9..696bcd1 100644 --- a/.zshrc +++ b/.zshrc @@ -9,7 +9,7 @@ export ZSH=$HOME/.oh-my-zsh # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes # ZSH_THEME="robbyrussell" # ZSH_THEME="avit" -#ZSH_THEME="bureau" +# ZSH_THEME="bureau" ZSH_THEME=powerlevel10k/powerlevel10k # Uncomment the following line to use case-sensitive completion. @@ -54,7 +54,7 @@ COMPLETION_WAITING_DOTS="true" # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git zsh-autosuggestions zsh-completions vi-mode) +plugins=(git) # User configuration @@ -102,6 +102,21 @@ bindkey '^h' backward-delete-char bindkey '^w' backward-kill-word bindkey '^r' history-incremental-search-backward +bindkey "\e[1~" beginning-of-line +bindkey "\e[4~" end-of-line +bindkey "\e[5~" beginning-of-history +bindkey "\e[6~" end-of-history +bindkey "\e[3~" delete-char +bindkey "\e[2~" quoted-insert +bindkey "\e[5C" forward-word +bindkey "\eOc" emacs-forward-word +bindkey "\e[5D" backward-word +bindkey "\eOd" emacs-backward-word +bindkey "\ee[C" forward-word +bindkey "\ee[D" backward-word + +bindkey "^H" backward-delete-word + export KEYTIMEOUT=1 diff --git a/README.md b/README.md index f49ca80..0ef0ca5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # dotfiles-zsh -A dotfile repo for zsh-specific dotfiles. I've not yet put zsh on all my machines and I want to start segregating bash -and zsh configs so I can switch back and forth if need be. +A dotfile repo for zsh-specific dotfiles. Includes setting for [oh-my-zsh ](https://github.com/robbyrussell/oh-my-zsh) +(required) -The setup script will check for the presence of the `~/.oh-my-zsh/` directory and if not found will install oh-my-zsh -from the [ohmyz.sh](http://ohmyz.sh/) website. - -If oh-my-zsh needs to be installed the script will end after the installation. Re-run it to then link the dotfiles. diff --git a/setup.sh b/setup.sh deleted file mode 100755 index 21434b7..0000000 --- a/setup.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/usr/bin/env bash -#=============================================================================== -# -# FILE: setup.sh -# USAGE: ./setup.sh -# DESCRIPTION: after pulling/cloning dotfiles repo, this script will check/create -# symlinks for for dotfiles. It checks for the presence of installed -# software (i.e. won't symlink a dotfile for applications that aren't -# installed) and will remove links for applications that are no longer -# installed. Safe to run after every git pull -# OPTIONS: -# REQUIREMENTS: This script replies on the 'command' command. Basically, it will run -# `command -v ` and if there is no output, it assumes the app -# isn't installed. So this won't work for apps that aren't in your $PATH -# reference: http://www.cyberciti.biz/faq/unix-linux-shell-find-out-posixcommand-exists-or-not/ -# NOTES: -# AUTHOR: C Hawley -# CREATED: 2015-10 -# REVISION: Mon 09 Oct 2017 04:14:39 PM EDT -# -#=============================================================================== - -set -o nounset # Treat unset variables as an error - -# specify where your dotfiles live -dotfiledir="$HOME/dotfiles-zsh" - -# function to handle checking for existings links/files and updating -link() { - echo "symlinking ${1}" - # check for existing symlinks - if [ -h "${HOME}"/"${1}" ]; then - echo " - There's already a symlink named ${1}. Diff'ing." - # If there's an existing sylink, check if it's different than the dotfile - if [[ $(diff --brief "${HOME}"/"${1}" "${dotfiledir}"/"${1}") ]]; then - # If the links are different, ask if it should be replaced - echo " - Old link and new link are different:" - echo -n " - Replace existing symlink "${1}"? [Y/N] " - read replace - if [ "${replace}" = "Y" ] || [ "${replace}" = "y" ]; then - # If yes, unlink the old file and link the new one and exit - echo " - Unlinking old file and linking new file" - unlink "${HOME}"/"${1}" - ln -s "${dotfiledir}"/"${1}" "${HOME}"/"${1}" - fi - else - # If the link is the same, just exit function - echo " - Old link and new link are the same." - fi - # check for existing file/directory - elif [ -f "${HOME}"/"${1}" ] || [ -d "${HOME}"/"${1}" ]; then - echo " - There's already a file or directory named ${1}. Diff'ing." - if [[ $(diff --brief "${HOME}"/"${1}" "${dotfiledir}"/"${1}") ]]; then - echo " - Old file/dir and new link are different:" - echo -n " - Rename "${1}" and create new link? [Y/N] " - read replace - if [ "${replace}" = "Y" ] || [ "${replace}" = "y" ]; then - echo " - Renaming old file/dir and linking new file" - mv "${HOME}"/"${1}" "${HOME}"/"${1}"_original - ln -s "${dotfiledir}"/"${1}" "${HOME}"/"${1}" - fi - fi - else - # If there is no existing file, create one and exit - echo " - Creating link for ${1}" - ln -s "${dotfiledir}"/"${1}" "${HOME}"/"${1}" - fi -} - -# function to handle checking for existings links/files and updating -copy() { - echo "copying ${1}" - # check for existing symlinks - if [ -h "${HOME}"/"${1}" ]; then - echo " - There's already a symlink named ${1}. Diff'ing." - # If there's an existing sylink, check if it's different than the dotfile - if [[ $(diff --brief "${HOME}"/"${1}" "${dotfiledir}"/"${1}") ]]; then - # If the links are different, ask if it should be replaced - echo " - Old link and new link are different:" - echo -n " - Replace existing symlink "${1}"? [Y/N] " - read replace - if [ "${replace}" = "Y" ] || [ "${replace}" = "y" ]; then - # If yes, unlink the old file and link the new one and exit - echo " - Unlinking old file and copying new file" - unlink "${HOME}"/"${1}" - cp -rv "${dotfiledir}"/"${1}" "${HOME}"/"${1}" - fi - else - # If the link is the same, just exit function - echo " - Old link and new link are the same." - fi - # check for existing file/directory - elif [ -f "${HOME}"/"${1}" ] || [ -d "${HOME}"/"${1}" ]; then - echo " - There's already a file or directory named ${1}. Diff'ing." - if [[ $(diff --brief "${HOME}"/"${1}" "${dotfiledir}"/"${1}") ]]; then - echo " - Old file/dir and new link are different:" - echo -n " - Rename "${1}" and copy newer? [Y/N] " - read replace - if [ "${replace}" = "Y" ] || [ "${replace}" = "y" ]; then - echo " - Renaming old file/dir and copying new file" - mv "${HOME}"/"${1}" "${HOME}"/"${1}"_original - cp -rv "${dotfiledir}"/"${1}" "${HOME}"/"${1}" - fi - fi - else - # If there is no existing file, create one and exit - echo " - Copying ${1}" - cp -rv "${dotfiledir}"/"${1}" "${HOME}"/"${1}" - fi -} -clear - -echo "------------------------------------------" -echo " dotfiles repo setup script " -echo "------------------------------------------" -echo " Setting up symlinks " -echo "------------------------------------------" -echo "" - - -# Check/Install Oh-My-ZSH! -#------------------------------------------------------------------------------- -if [ ! -d $HOME/.oh-my-zsh ]; then - echo "OH NO! You don't have Oh-my-ZSH installed! I'll do it now!" - echo "" - echo "" - echo "When install is finished, re-run this setup script to symlink your dotfiles" - echo "" - echo "Press a key when ready" - read anykey - sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" - exit 0 -else - echo "... nevermind - oh-my-zsh already installed!" -fi - -# link .zshrc -#------------------------------------------------------------------------------- -link .zshrc - -# link .zsh_aliases -#------------------------------------------------------------------------------- -link .zsh_aliases - -# link .zsh_functions -#------------------------------------------------------------------------------- -link .zsh_functions - - - -# Report on backed up files -#------------------------------------------------------------------------------- -echo "These original files were backed up as '*_original'" -ofiles=$(find "${HOME}" -maxdepth 1 -regex ".*_original$" | wc -l) -if [ "${ofiles}" -gt 0 ]; then - find "${HOME}" -maxdepth 1 -regex ".*_original$" -else - echo "" -fi - -echo "" -echo "------------------------------------------" -echo "Done. " -echo "source ${HOME}/.zshrc " -echo "or " -echo "logout and login to enable .zshrc changes " -echo "------------------------------------------"