Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to zgenom #88

Merged
merged 23 commits into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
de71ff2
Update to use zgenom instead of zgen
unixorn Nov 13, 2020
a188239
Update readme to reflect switch to zgenom
unixorn Nov 13, 2020
d687fba
TOC update after switch to zgenom
unixorn Nov 13, 2020
34c172f
Add faq for garbled prompt separators
unixorn Nov 13, 2020
1ea505d
Add superlinter github action
unixorn Nov 14, 2020
879456a
Add markdown link check github action
unixorn Nov 14, 2020
6901e04
Fix lint bugs in .codeclimate.yml
unixorn Nov 14, 2020
9ef5c7d
Disable overzealous shellcheck warnings
unixorn Nov 14, 2020
9e222a6
Clean up markdown formatting
unixorn Nov 14, 2020
d4af44b
Update toc
unixorn Nov 14, 2020
5ba2c5e
Update github checks
unixorn Nov 16, 2020
d4966a5
Remove unneeded circleci config any more
unixorn Nov 24, 2020
f33dea5
Added GH actions in another branch, make the merge less painful
unixorn Nov 26, 2020
4232b39
Merge remote-tracking branch 'origin/master' into switch-to-zgenom
unixorn Nov 26, 2020
e3f8677
Merge remote-tracking branch 'origin/master' into switch-to-zgenom
unixorn Dec 1, 2020
14dd8fe
Merge remote-tracking branch 'origin/master' into switch-to-zgenom
unixorn Dec 12, 2020
2989c91
Merge remote-tracking branch 'origin/master' into switch-to-zgenom
unixorn Dec 30, 2020
7d7cc9c
Merge remote-tracking branch 'origin/master' into switch-to-zgenom
unixorn Dec 30, 2020
e834b20
Fix bug in ssh-agent handling
unixorn Mar 27, 2021
9623a7d
Clean up readme
unixorn Mar 27, 2021
a44e049
Update copyrights
unixorn Mar 27, 2021
96f2495
Add warning about zgenom switch
unixorn Mar 27, 2021
587081c
Update toc in readme
unixorn Mar 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions .circleci/config.yml

This file was deleted.

8 changes: 3 additions & 5 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
engines:
pep8:
enabled: true
duplication:
enabled: true
config:
Expand Down Expand Up @@ -31,9 +29,9 @@ engines:
enabled: true
ratings:
paths:
- "bin/**/*"
- "**.py"
- "**.md"
- "bin/**/*"
- "**.py"
- "**.md"
exclude_paths:
- .bundle/
- benchmarks/**/*
Expand Down
51 changes: 29 additions & 22 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
## Table of Contents

- [Announcement](#announcement)
- [Installation](#installation)
- [Prerequisites](#prerequisites)
- [Fonts](#fonts)
- [OS-specific setup](#os-specific-setup)
- [macOS](#macos)
- [Linux](#linux)
- [Set up Zgen and the starter kit](#set-up-zgen-and-the-starter-kit)
- [Set up Zgenom and the starter kit](#set-up-zgenom-and-the-starter-kit)
- [Contents of the kit](#contents-of-the-kit)
- [Included plugins](#included-plugins)
- [Customizing the kit](#customizing-the-kit)
Expand All @@ -26,21 +27,24 @@
- [I like a plugin, but the aliases it installs overwrite other commands or aliases](#i-like-a-plugin-but-the-aliases-it-installs-overwrite-other-commands-or-aliases)
- [ZSH options](#zsh-options)
- [Self-update Settings](#self-update-settings)
- [Changing the zgen plugin list](#changing-the-zgen-plugin-list)
- [Changing the plugin list](#changing-the-plugin-list)
- [Disabling zmv](#disabling-zmv)
- [Disabling oh-my-zsh](#disabling-oh-my-zsh)
- [FAQ](#faq)
- [How do I reconfigure the prompt](#how-do-i-reconfigure-the-prompt)
- [How do I reconfigure the prompt?](#how-do-i-reconfigure-the-prompt)
- [I added a new completion plugin and it isn't working](#i-added-a-new-completion-plugin-and-it-isnt-working)
- [I get a git error when I try to update the kit](#i-get-a-git-error-when-i-try-to-update-the-kit)
- [Stow complains with a warning that stowing zsh would cause conflicts](#stow-complains-with-a-warning-that-stowing-zsh-would-cause-conflicts)
- [GNU stow complains with a warning that stowing zsh would cause conflicts](#gnu-stow-complains-with-a-warning-that-stowing-zsh-would-cause-conflicts)
- [Other Resources](#other-resources)
- [ZSH](#zsh)
- [Dotfiles in general](#dotfiles-in-general)
- [Vim](#vim)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Announcement

I've switched the quickstart kit to use [zgenom](https://github.com/jandamm/zgenom.git) instead of zgen. This should be a painless update since zgenom is a superset of zgen.
## Installation

### Prerequisites
Expand Down Expand Up @@ -97,13 +101,13 @@ If you still can’t see the new fonts then double-check that the font has been

If you get garbled branch glyphs, make sure there isn't a separate font setting for non-ASCII characters in your terminal application that you also need to set to use a Powerline-compatible font. Konsole needs to be set to use UTF-8 encoding, for example.

### Set up Zgen and the starter kit
### Set up Zgenom and the starter kit

Now that your fonts and default shell have been set up, install [zgen](https://github.com/tarjoilija/zgen) and the dotfiles from this starter kit repository.
Now that your fonts and default shell have been set up, install [zgenom](https://github.com/jandamm/zgenom.git) and the dotfiles from this starter kit repository.

1. Install [Zgen](https://github.com/tarjoilija/zgen)
1. Install [Zgenom](https://github.com/jandamm/zgenom.git)
1. `cd ~`
2. `git clone git@github.com:tarjoilija/zgen.git`
2. `git clone https://github.com/jandamm/zgenom.git`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation for list items at the same level

2. Install the starter kit
1. `cd ~`
2. `git clone [email protected]:unixorn/zsh-quickstart-kit.git`
Expand All @@ -118,15 +122,15 @@ The `.zshrc`, `.zsh_aliases` & `.zsh_functions` files included in this kit enabl

The zsh-quickstart-kit configures your ZSH environment so that it includes:

* Automatic periodic updates of both zgen and your plugins
* Automatic periodic updates of both `zgenom` and your plugins
* Cross-session shared history so commands typed in one terminal window can be seen and searched in all your other `zsh` sessions on the same machine.
* Automatic deduplication of your command history.
* Many more tab completions, courtesy of the [zsh-users/zsh-completions](https://github.com/zsh-users/zsh-completions) repository, and periodic updating to tip of master of that repository so you get updates to the extra tab completions.
* Supercharged command history search with [fzf](https://github.com/junegunn/fzf).
* Syntax highlighting at the command line.
* Tab completion of Rakefile targets.
* Enabling [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)-compatible plugins and themes (via the [zgen](https://github.com/tarjoilija/zgen) framework).
* Various helper functions for interacting with macOS's clipboard, audio volume, Spotlight and Quicklook. For your convenience, these will only load if you are on a macOS machine so you can use the same plugin list on any *NIX system.
* Enabling [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)-compatible plugins and themes (via the [zgenom](https://github.com/jandamm/zgenom.git) framework).
* Various helper functions for interacting with macOS' clipboard, audio volume, Spotlight and Quicklook. For your convenience, these will only load if you are on a macOS machine so you can use the same plugin list on any *NIX system.
* If you've installed iTerm2's shell integration, it will automatically be loaded during shell startup.

### Included plugins
Expand All @@ -152,7 +156,7 @@ The zsh-quickstart-kit configures your ZSH environment so that it includes:
* [zsh-users/zsh-history-substring-search](https://github.com/zsh-users/zsh-history-substring-search) - Better history search.
* [zsh-users/zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) - Syntax highlighting as you type.

The quickstart kit also uses `zgen` to load oh-my-zsh and these plugins:
The quickstart kit also uses `zgenom` to load oh-my-zsh and these plugins:

* aws
* brew - only loaded on macOS
Expand Down Expand Up @@ -183,9 +187,11 @@ Running the following commands will toggle behavior the next time you start a sh

### Functions and Aliases

The `.zshrc` included in this kit will automatically source any files it finds in `~/.zshrc.d`. This is to make it easy for you to add extra functions and aliases without having to maintain a separate fork of this repository, and also allows you to configure behavior of some of the plugins by setting environment variables.
The `.zshrc` included in this kit will automatically source any files it finds in `~/.zshrc.d`.

This is to make it easy for you to add extra functions and aliases without having to maintain a separate fork of this repository, and also allows you to configure behavior of some of the plugins by setting environment variables.

The files in `.zshrc.d` will be sourced in alphanumeric order after loading all the plugins and I suggest you use a naming scheme of `001-onething`, `002-something-else` etc to ensure they're loaded in the order you expect.
The files will be sourced in alphanumeric order after loading all the plugins and I suggest you use a naming scheme of `001-onething`, `002-something-else` etc to ensure they're loaded in the order you expect.

### I like a plugin, but the aliases it installs overwrite other commands or aliases

Expand All @@ -199,29 +205,29 @@ The quickstart kit does an opinionated (i.e. my way) setup of ZSH options and ad

The quickstart kit will automatically check for updates every seven days. If you want to change the interval, set `QUICKSTART_KIT_REFRESH_IN_DAYS` in a file in `~/.zshrc.d`. If you want to disable self updating entirely, add `unset QUICKSTART_KIT_REFRESH_IN_DAYS` in a file in `~/.zshrc.d`.

### Changing the zgen plugin list
### Changing the plugin list

I've included what I think is a good starter set of zsh plugins in this repository. However, everyone has their own preferences for their environment.
I've included what I think is a good starter set of ZSH plugins in this repository. However, everyone has their own preferences for their own environment.

To make the list easier to customize without having to maintain a separate fork of this kit, if you create a file named `~/.zgen-local-plugins`, the `.zshrc` from this starter kit will source that **instead** of running the `load-starter-plugin-list` function defined in `~/.zgen-setup`.
To make the list easier to customize without having to maintain a separate fork of the quickstart kit, if you create a file named `~/.zgen-local-plugins`, the `.zshrc` from this starter kit will source that **instead** of running the `load-starter-plugin-list` function defined in `~/.zgen-setup`.

**Using `~/.zgen-local-plugins` is not additive, it will _completely replace_ the kit-provided list of plugins.**

I know that it's a pain to create `.zgen-local-plugins` from scratch, so to make customizing your plugins easier, I've included a `.zgen-local-plugins-example` file at the root of the repository that will install the same plugin list that the kit does by default that you can use as a starting point for your own customizations.
I realize that it would be a pain to create `.zgen-local-plugins` from scratch, so to make customizing your plugins easier, I've included a `.zgen-local-plugins-example` file at the root of the repository that will install the same plugin list that the kit does by default that you can use as a starting point for your own customizations.

Copy that to your `$HOME/.zgen-local-plugins`, change the list and the next time you start a terminal session you'll get your list instead of mine.
Copy that to your `$HOME/.zgen-local-plugins`, change the list and the next time you start a terminal session you'll get your plugin list loaded instead of the kit's defaults.

### Disabling zmv

The quickstart automatically autoloads zmv. If you want to disable that, create a file named `.zsh-quickstart-no-zmv` in your home directory.

### Disabling oh-my-zsh

If you don't want zgen to load the oh-my-zsh defaults, create `.zsh-quickstart-no-omz` in your home directory.
If you don't want `zgenom` to load the oh-my-zsh defaults, create `.zsh-quickstart-no-omz` in your home directory.

## FAQ

### How do I reconfigure the prompt
### How do I reconfigure the prompt?

You may want to reconfigure your prompt after using it. The quickstart uses the [powerlevel10k](https://github.com/romkatv/powerlevel10k) theme, so you can reconfigure your prompt by running `p10k configure`.

Expand Down Expand Up @@ -250,9 +256,10 @@ From https://github.com/unixorn/zsh-quickstart-kit
Aborting

```

This happens when you edit a file provided by the quickstart kit, in this case, `.zshrc`. This is annoying, and in order to let you customize your ZSH settings without having to maintain your own fork, the kit-provided `.zshrc` will load any files it finds in `~/.zshrc.d`.

### Stow complains with a warning that stowing zsh would cause conflicts
### GNU stow complains with a warning that stowing zsh would cause conflicts

You ran `stow --target=/Users/YourUsername zsh` in the top level of the repo, and stow printed the following error:

Expand Down
43 changes: 30 additions & 13 deletions zsh/.zgen-setup
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
#!/bin/zsh
#!/usr/bin/env zsh
#
# Only including a shebang to trigger Sublime Text to use shell
# Only including a shebang to trigger editors to use shell
# syntax highlighting.
#
# Copyright 2006-2019 Joseph Block <[email protected]>
# Copyright 2006-2021 Joseph Block <[email protected]>
#
# BSD licensed, see LICENSE.txt

# Clone zgen if you haven't already
if [[ -z "$ZGEN_PARENT_DIR" ]]; then
ZGEN_PARENT_DIR=$HOME
# Clone zgenom if you haven't already
if [[ -z "$ZGENOM_PARENT_DIR" ]]; then
ZGENOM_PARENT_DIR=$HOME
fi
if [[ ! -f $ZGEN_PARENT_DIR/zgen/zgen.zsh ]]; then
if [[ ! -d "$ZGEN_PARENT_DIR" ]]; then
mkdir -p "$ZGEN_PARENT_DIR"

# zgenom stores the clones plugins & themes in $ZGEN_DIR when it
# is set. Otherwise it stuffs everything in the source tree, which
# is unclean.
ZGEN_DIR=${ZGEN_DIR:-$HOME/.zgenom}

# echo "ZGEN_DIR: $ZGEN_DIR"

if [[ ! -f $ZGENOM_PARENT_DIR/zgenom/zgenom.zsh ]]; then
if [[ ! -d "$ZGENOM_PARENT_DIR" ]]; then
mkdir -p "$ZGENOM_PARENT_DIR"
fi
pushd $ZGEN_PARENT_DIR
git clone git@github.com:tarjoilija/zgen.git
pushd $ZGENOM_PARENT_DIR
git clone https://github.com/jandamm/zgenom.git
popd
fi
source $ZGEN_PARENT_DIR/zgen/zgen.zsh
unset ZGEN_PARENT_DIR

if [[ ! -f "$ZGENOM_PARENT_DIR/zgenom/zgenom.zsh" ]]; then
echo "Can't find zgenom.zsh"
else
# echo "Loading zgenom"
source "$ZGENOM_PARENT_DIR/zgenom/zgenom.zsh"
fi

unset ZGENOM_PARENT_DIR

warn-about-prompt-change() {
if [[ ! -f ~/.zsh-quickstart-kit-prompt-switch-warning ]]; then
Expand Down Expand Up @@ -235,6 +250,8 @@ if [[ -L ~/.zgen-local-plugins ]]; then
REAL_ZGEN_SETUP="${HOME}/$(readlink ~/.zgen-local-plugins)"
fi

# echo "REAL_ZGEN_ZETUP: $REAL_ZGEN_SETUP"

# If .zgen-setup is newer than init.zsh, regenerate init.zsh
if [ $(get_file_modification_time ${REAL_ZGEN_SETUP}) -gt $(get_file_modification_time ~/.zgen/init.zsh) ]; then
echo "$(basename ${REAL_ZGEN_SETUP}) updated; creating a new init.zsh from plugin list in ${REAL_ZGEN_SETUP}"
Expand Down
7 changes: 5 additions & 2 deletions zsh/.zsh_aliases
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Only including a shebang to trigger Sublime Text to use shell syntax highlighting
#
# Copyright 2006-2018 Joseph Block <[email protected]>
# Copyright 2006-2021 Joseph Block <[email protected]>
#
# BSD licensed, see LICENSE.txt in this repository.

Expand All @@ -15,7 +15,7 @@ if [[ -x /usr/local/bin/subl ]]; then
alias s="subl"
fi

# yes, these tests are ugly. They do however, work.
# Yes, these tests are ugly. They do however, work.
if [[ "$(uname -s)" == "Darwin" ]]; then
# do OS X specific things

Expand All @@ -36,6 +36,7 @@ fi

export CVS_RSH=ssh

# shellcheck disable=SC2142
alias historysummary="history | awk '{a[\$2]++} END{for(i in a){printf \"%5d\t%s\n\",a[i],i}}' | sort -rn | head"

if [ -x /bin/vim ]; then
Expand Down Expand Up @@ -76,6 +77,7 @@ alias external_ip="curl -s icanhazip.com"
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"

# Show laptop's IP addresses
# shellcheck disable=2139
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"

alias reattach="screen -r"
Expand Down Expand Up @@ -151,6 +153,7 @@ alias ...="cd ../.."

# Honor old .zsh_aliases.local customizations, but print depecation warning.
if [ -f ~/.zsh_aliases.local ]; then
# shellcheck disable=SC1090
source ~/.zsh_aliases.local
echo ".zsh_aliases.local is deprecated. Make entries in files in ~/.zshrc.d instead."
fi
2 changes: 1 addition & 1 deletion zsh/.zsh_functions
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Only including a shebang to trigger editors shell syntax highlighting
#
# Copyright 2006-2020 Joseph Block <[email protected]>
# Copyright 2006-2021 Joseph Block <[email protected]>
#
# BSD licensed, see LICENSE.txt
#
Expand Down
Loading