Skip to content

Commit

Permalink
Adding zsh-autosuggestion plugin via bootstrap config
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackjacx committed Nov 13, 2023
1 parent 85731cb commit a4b45e1
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 23 deletions.
48 changes: 31 additions & 17 deletions bootstrap/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,22 +231,37 @@ configureSoftware() {
printf "Configure Sotware\n"
printf "#################################################################\n\n"

command -v bat > /dev/null 2>&1 && {
printf "Install Catppuccin for Bat\n"

tmp=$(mktemp -d)
git clone [email protected]:catppuccin/bat.git "$tmp"
mkdir -p "$(bat --config-dir)/themes"
cp "$tmp/*.tmTheme" "$(bat --config-dir)/themes"
bat cache --build
printf 'Preview themes using `bat --list-themes | fzf --preview="bat --theme={} --color=always <path to file>"`\n'
}

fzf_tab_dir="${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/fzf-tab"
if [ ! -d "${HOME}/.oh-my-zsh" ]; then
printf "Install `fzf-tab` ZSH plugin\n"
git clone https://github.com/Aloxaf/fzf-tab "$fzf_tab_dir"
fi
command -v ls &>/dev/null && {
log "Install 'Catppuccin' theme for Bat"

local tmp="$(mktemp -d)"
local config_dir="$(bat --config-dir)"
git clone -v [email protected]:catppuccin/bat.git $tmp
mkdir -p "$config_dir/themes"
cp -f "${tmp}"/*.tmTheme "${config_dir}/themes/" && \
bat cache --build && \
log 'Preview themes using $ bat --list-themes | fzf --preview="bat --theme={} --color=always <path to file>"'
}

#-----------------------------------------------------------------------------
# ZSH Plugins Platform Independent
# e.g. no homebrew on Raspberry Pi
#-----------------------------------------------------------------------------

github_plugins=(
"aloxaf/fzf-tab"
"zsh-users/zsh-autosuggestions"
)

for plugin in "${github_plugins[@]}"; do
plugin_name=$(echo $plugin | cut -d"/" -f2)
plugin_dir="${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/$plugin_name"

if [[ ! -d $plugin_dir ]]; then
log "Installing ZSH plugin '$plugin'"
git clone "https://github.com/$plugin" "$plugin_dir"
fi
done
}

#
Expand All @@ -258,7 +273,6 @@ installSoftware() {
printf "\n\n#################################################################\n"
printf "Setting up ZSH with Oh-My-Zsh\n"
printf "#################################################################\n\n"

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
fi

Expand Down
29 changes: 23 additions & 6 deletions bootstrap/dotfiles/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ export DEFAULT_USER=`whoami`
# 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 git-extras swiftpm bundler common-aliases colored-man-pages direnv bgnotify zsh-autosuggestions fzf fzf-tab)
plugins=(
git
git-extras
swiftpm
bundler
common-aliases
colored-man-pages
direnv
bgnotify
zsh-autosuggestions
fzf
fzf-tab
)

# User configuration

Expand Down Expand Up @@ -128,7 +140,7 @@ zstyle ':fzf-tab:complete:exa:*' fzf-preview '

# ignore these commands
export HISTORY_IGNORE="(la|ls|ll|cd|pwd|exit|cd ..)"
# increase history to the last 10000 commands
# increase maximum history entry count
export HISTSIZE=500000
# The maximum number of lines that are kept in the history file.
export SAVEHIST=$HISTSIZE
Expand Down Expand Up @@ -163,10 +175,11 @@ export EDITOR="nano"
# export SSH_KEY_PATH="~/.ssh/dsa_id"

#-------------------------------------------------------------------------------
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
# Aliases
#
# Aliases can be placed here, though oh-my-zsh users are encouraged to
# define aliases within the ZSH_CUSTOM folder. For a full list of active
# aliases, run `alias`.
#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -321,3 +334,7 @@ eval "$(rbenv init - zsh)"

# zoxide
command -v zoxide > /dev/null 2>&1 && eval "$(zoxide init zsh)"




0 comments on commit a4b45e1

Please sign in to comment.