Giter VIP home page Giter VIP logo

unixorn / zsh-quickstart-kit Goto Github PK

View Code? Open in Web Editor NEW
742.0 16.0 93.0 517 KB

A simple ZSH quickstart for using ZSH, zgenom, oh-my-zsh and a curated list of extra plugins. It is designed to be easy to customize without requiring you to maintain your own fork.

License: BSD 3-Clause "New" or "Revised" License

Shell 100.00%
zsh-quickstart-kit zsh-options zsh-plugins zsh-completions zsh-theme dotfiles zsh zshrc zshrc-enhancements zgenom

zsh-quickstart-kit's Introduction

ZSH Quickstart Kit

License Build Status Awesomebot Megalinter GitHub last commit (branch)

Table of Contents

Announcement

I've switched the quickstart kit to use zgenom instead of zgen. This should be a painless update since zgenom is a superset of zgen.

Installation

Prerequisites

Fonts

This quickstart includes the powerlevel10k ZSH theme, which requires a Powerline-compatible font in your terminal to display status glyphs. Powerline-compatible fonts include many useful glyphs, including the nice branch icon that the theme in this .zshrc uses.

Here are a few good Powerline-compatible fonts:

  • Awesome Terminal Fonts - A family of fonts that include some nice monospaced Icons.
  • Cascadia Code - Microsoft's Cascadia Code
  • Fantasque Awesome Font - A nice monospaced font, patched with Font-Awesome, Octoicons, and Powerline-Glyphs.
  • Fira Mono - Mozilla's Fira type family.
  • Hack - Another Powerline-compatible font designed for source code and terminal usage.
  • Input Mono - A family of fonts designed specifically for code. It offers both monospaced and proportional fonts and includes Powerline glyphs.
  • Iosevka - Iosevka is an open source slender monospace sans-serif and slab-serif typeface inspired by Pragmata Pro, M+ and PF DIN Mono, designed to be the ideal font for programming.
  • Monoid - Monoid is customizable and optimized for coding with bitmap-like sharpness at 15px line-height even on low res displays.
  • Mononoki - Mononoki is a typeface by Matthias Tellen, created to enhance code formatting.
  • More Nerd Fonts - Another site to download nerd fonts.
  • Nerd fonts - A collection of over 20 patched fonts (over 1,700 variations) & the fontforge font patcher python script for Powerline, devicons, and vim-devicons: includes Droid Sans, Meslo, AnonymousPro, ProFont, Inconsolta, and many more. These can be installed with brew - do brew tap homebrew/cask-fonts && brew install --cask fontname
  • Powerline patched font collection - A collection of a dozen or so fonts patched to include Powerline glyphs.
  • Victor Mono - Victor Mono is a free programming font with semi-connected cursive italics, symbol ligatures (!=, ->>, =>, ===, <=, >=, ++) and Latin, Cyrillic and Greek characters.
  • spacemono - Google's new original monospace display typeface family.

OS-specific setup

fzf

To enable the enhanced history search, you'll need to install fzf. Manual install instructions can be found at fzf and os-specific instructions below.

macOS

macOS instructions
  1. Download iTerm2 from http://www.iterm2.com (optional). In my opinion, it is considerably nicer than the stock Terminal application that comes with macOS. There is an RCE flaw in all versions of iTerm 2 before 3.3.6, so update if you're using an affected version.
  2. Install the current version of Homebrew from http://brew.sh/.
  3. Install GNU Stow with brew install stow
  4. Homebrew has a newer version of zsh than the one Apple shipped with the OS before 11.6, so brew install zsh to install it.
  5. Switch your shell to zsh if necessary - Apple has defaulted the shell for new users to zsh since macOS Catalina (10.15):
    1. System Preferences -> Users & Groups.
    2. Unlock the preferences
    3. Select your user
    4. Select advanced options
    5. Set your login shell to /bin/zsh (or /usr/local/bin/zsh if you decided to use the version packaged by brew)
  6. Install some Powerline-compatible or NerdFont fonts from one of the links in the Fonts section above.
    1. In iTerm 2, go to Preferences->Profile in your iTerm 2 preferences, then select one of the Powerline-compatible fonts you just installed.
    2. Make sure you also specify a Powerline-compatible font for non-ASCII in your iTerm 2 preferences or the prompt separators and branch glyphs will show up garbled.
  7. Install fzf
    1. Install fzf with brew install fzf
    2. Run the sh "$(brew --prefix fzf)/install" command to configure fzf
    3. Press Enter (y default) for all questions except Do you want to update your shell configuration files? ([y]/n). For this question, select n and press Enter.

Linux

Linux instructions
  1. Switch your shell to zsh with chsh -s /bin/zsh
  2. Install GNU Stow - sudo yum install -y stow on Red Hat / CentOS systems, sudo apt-get -y install stow on Debian / Ubuntu.
  3. Install fzf - sudo apt-get install -y fzf on Debian / Ubuntu, do a manual install on Red Hat / Centos - instructions are at fzf.
  4. Install the patched font in a valid X font path. Valid font paths can be listed with xset q: mv YourChosenPowerlineFont.otf ~/.fonts
  5. Update the font cache for the path the font was installed in (root privileges may be needed for updating the font cache for some paths): fc-cache -vf ~/.fonts/

After installing a Nerdfont or Powerline-compatible font, you will need to configure your terminal emulator to use your selected Powerline-compatible font. The name of the correct font usually ends with for Powerline.

If the Powerline symbols can't be seen or are garbled, try closing all instances of the terminal emulator. The X Server may also need to be restarted for the new font to load correctly.

If you still can’t see the new fonts, confirm that the font has been installed to a valid X font path.

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 Zgenom and the starter kit

Now that your fonts and default shell have been set up, install zgenom and the dotfiles from this starter kit repository.

  1. Install Zgenom
    1. cd ~
    2. git clone https://github.com/jandamm/zgenom.git
  2. Install the starter kit
    1. cd ~
    2. git clone https://github.com/unixorn/zsh-quickstart-kit.git
  3. Configure zsh by symlinking the .zshrc, .zsh-functions, .zgen-setup and .zsh_aliases from this repository into your ~.
    1. You can do this with stow by:
      1. cd zsh-quickstart-kit
      2. stow --target=~ zsh. If you have issues using ~ as a target, do stow --target="$HOME" zsh. If you still have errors, symlink the files in the kit's zsh directory into your home directory.

The .zshrc, .zsh_aliases & .zsh_functions files included in this kit enable the plugins listed below.

Contents of the kit

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

  • 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 repository, and periodic updating to the tip of master of that repository, so you get updates to the extra tab completions.
  • Supercharged command history search with fzf.
  • Syntax highlighting at the command line.
  • Tab completion of Rakefile targets.
  • Enabling oh-my-zsh-compatible plugins and themes (via the zgenom 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 that 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

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

  • aws
  • brew - only loaded on macOS
  • chruby
  • colored-man
  • git
  • github
  • osx - only loaded on macOS
  • pip
  • python
  • rsync
  • screen
  • sudo
  • vagrant

Customizing the kit

Behavior toggles

Running the following commands will toggle behavior the next time you start a shell session:

  • Prompt selectors - We now use the powerlevel10k prompt. I won't change the prompt out from under people without a way for them to get the old behavior, so there are commands to switch back and forth.
    • zsh-quickstart-select-powerlevel10k - Switch to the powerlevel10k prompt now used as the kit's default.
    • zsh-quickstart-select-bullet-train - Switch back to the bullet-train prompt originally used in the kit.
  • You can disable printing the list of ssh keys by executing zqs disable-ssh-key-listing.
  • bash prints ^C when you're typing a command and hit control-c to cancel it, so it is easy to see it wasn't executed. By default, ZSH doesn't print the ^C. I prefer seeing the ^C, so by default, the quickstart traps SIGINT and prints the ^C. You can disable this behavior by running zqs disable-control-c-decorator and enable it with zqs enable-control-c-decorator.

zqs

As of 2021-11-13, I've added a zqs command to start exposing some of the configurable parts in a more user-friendly way. The zqs command has the following subcommands:

zqs check-for-updates

Updates the quickstart kit if it has been longer than seven days since the last update.

zqs disable-bindkey-handling

Disable bindkey setup and alias expansion in the quickstart .zshrc so people can use plugins like globalias to handle it instead.

zqs disable-1password-agent

Disable using 1Password's ssh agent

zqs enable-1password-agent

Enable using 1Password's ssh agent starting with the next new ZSH session. This is the default behavior when op is in your $PATH.

zqs enable-bindkey-handling

Let the quickstart's .zshrc configure bindkey setup and alias expansion. This is the default behavior.

zqs disable-diff-so-fancy

Stop loading the diff-so-fancy plugin starting with the next ZSH session.

zqs enable-diff-so-fancy

Start loading the diff-so-fancy plugin starting with the next ZSH session. This is the default behavior.

zqs disable-omz-plugins

Set the quickstart to not include any oh-my-zsh plugins from the standard plugin list. Loading omz plugins can make terminal startup significantly slower.

zqs enable-control-c-decorator

Set the quickstart to create a TRAPINT handler in future zsh sessions to also display control-C when you type control-c. This is the default behavior.

zqs disable-control-c-decorator

Set the quickstart to not create the TRAPINT handler to display control-C when you type control-c in future zsh sessions.

zqs enable-omz-plugins

Sets the quickstart to include the oh-my-zsh plugins from the standard plugin list.

zqs enable-ssh-askpass-require

Enable the quickstart to prompt for your ssh passphrase on the command line.

zqs disable-ssh-askpass-require

The quickstart will prompt for your ssh passphrase via a gui program. Default behavior.

zqs-disable-ssh-key-listing

Don't print the loaded ssh keys when creating a new session.

zqs-enable-ssh-key-listing

Print the loaded ssh keys when creating a new session. This is the default behavior.

zqs-disable-ssh-key-loading

Don't load ssh keys when creating a new session. Useful if you're storing your private keys in a yubikey.

zqs-enable-ssh-key-loading

Load missing ssh private keys when creating a new session. This is the default behavior.

zqs-disable-zmv-autoloading

Don't run autoload -U zmv when creating a new session.

zqs-enable-zmv-autoloading

Run autoload -U zmv when creating a new session. This is the default behavior.

`zqs-disable-zsh-profiling

Disable ZSH's profiler. This is the default.

`zqs-enable-zsh-profiling

Turn on ZSH's profiler

zqs selfupdate

Force an immediate update of the quickstart kit.

zqs update

Update the quickstart kit and all your plugins.

zqs update-plugins

Updates all your plugins.

zqs cleanup

Cleanup unused plugins after removing them from the list

zqs get-setting

zqs get-setting NAME [OPTIONAL default value] prints the value of a zqs setting, or if unset and a default value was passed, the specified default.

zqs set-setting

zqs set-setting NAME VALUE writes a setting.

zqs delete-setting

zqs delete-setting NAME deletes a setting from zqs's crude parameter store.

Functions and Aliases

Customizing with ~/.zshrc.d

The .zshrc included in this kit will automatically source any files it finds in ~/.zshrc.d. This happens after plugins are loaded. If you need to set variables or aliases before plugins are loaded, create files in ~/.zshrc.pre-plugins.d.

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

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 some of the aliases and functions it installs overwrite other commands or aliases I use

Make a file in ~/.zshrc.d named something like 999-reset-aliases. Because files in ~/.zshrc.d are loaded after all the ZSH plugins, you can add lines like unalias xyzzy to remove an alias named xyzzy, or unset -f abcd to remove a function named abcd.

Once you've cleared all the unwanted aliases and functions, you can add new ones with your preferred names.

ZSH options

The quickstart kit does an opinionated (i.e., my way) setup of ZSH options and adds some functions and aliases I like on my systems. I don't want you to have to maintain a separate fork if you don't like them and/or want to add your own, so the kit allows you to override or add behavior by creating fragment files that it will load during session startup.

Fragment file directories

You can customize the quickstart by adding files to its various zshrc.d directories.

If you want to set variables before the quickstart starts loading plugins to alter their behavior, stick your fragment files in ~/.zshrc.pre-plugins.d.

After the quickstart sets up its aliases, functions, plugins and ZSH options, it will source every fragment file in ~/.zshrc.d.

To make it easier to have macOS, FreeBSD or Linux-specific settings tweaks, the quickstart also supports OS-specific pre & post .zshrc.d directories. If you want a file to only be sourced on a single OS, the quickstart also checks for .zshrc.pre-plugins.$(uname).d and ~/.zshrc.$(uname).d during loading.

Self-update Settings

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're going to disable self-updating entirely, add unset QUICKSTART_KIT_REFRESH_IN_DAYS in a file in ~/.zshrc.d.

Customizing the plugin list

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

To make things easier to customize without users having to maintain their own forks, the kit provides two ways to customize the list of plugins it will load.

You can either add a fragment file to ~/.zshrc.add-plugins.d, or you can make a ~/.zsh-quickstart-local-plugin file.

Using fragment files

If all you want to do is add plugins to the standard list and you want to still automatically get any new changes I make to that standard list (new plugins, new locations when existing plugins are moved, etc) then adding a file into ~/.zshrc.add-plugins.d with your extra plugins listed as zgenom load githubuser/pluginrepo (one line per plugin) is the way to go. The kit will load its plugins, then add yours on the end. You can add separate files with plugins in the ~/.zshrc.add-plugins.d directory - my personal use case is having one file with all the plugins I use everywhere, and one that has extra plugins I only need on my work machines. This is the easiest option.

Complete plugin list replacement

If you don't care about future changes to the kit's plugins and want to fully replace the built-in list, then create a ~/.zsh-quickstart-local-plugins file. When the kit detects a file named ~/.zsh-quickstart-local-plugins, its .zshrc will source that instead of running the load-starter-plugin-list function defined in ~/.zgen-setup.

Using ~/.zsh-quickstart-local-plugins is not additive. It will completely replace the kit-provided list of plugins. If you want to just add more plugins, use the fragment file method above.

Creating a .zsh-quickstart-local-plugins from scratch is a pain, so to make customizing your plugin list easier, I've included a .zsh-quickstart-local-plugins-example file at the root of the repository that installs the same plugin list that the kit does by default that you can use as a starting point for your own .zsh-quickstart-local-plugins file.

Copy that to your $HOME/.zsh-quickstart-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 so you can configure it with another plugin or on your own, run zqs disable-zmv-autoloading.

Disabling oh-my-zsh

If you don't want zgenom to load the oh-my-zsh defaults, run zqs-disable-omz-plugins.

FAQ

How do I reconfigure the prompt?

You may want to reconfigure your prompt after using it. The quickstart uses the powerlevel10k theme, so you can reconfigure your prompt by running p10k configure.

Powerlevel 10k warns that there is console output during startup

You see a warning during session startup -

[WARNING]: Console output during zsh initialization detected.
When using Powerlevel10k with instant prompt, console output during zsh
initialization may indicate issues.

You can stifle this output by adding typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet in a fragment file in ~/.zshrc.pre-plugins.d.

I added a new completion plugin, and it isn't working

I've had reports that sometimes you may need to reset your completions after adding a new plugin.

rm ~/.zcompdump*
compinit

I get a git error when I try to update the kit

You try to update the kit, and you get an error similar to this:

From https://github.com/unixorn/zsh-quickstart-kit
0c5bad9..2064c6b master -> origin/master

    755f689...e3f8677 switch-to-zgenom -> origin/switch-to-zgenom (forced update)
    Updating 0c5bad9..2064c6b
    error: Your local changes to the following files would be overwritten by merge:
    zsh/.zshrc
    Please commit your changes or stash them before you merge.
    Aborting

This happens when you edit a file provided by the quickstart kit, in this case, .zshrc. This is annoying, and to let you customize your ZSH settings without being forced to maintain your own fork of the kit, the kit-provided .zshrc will load any files it finds in the various ~/.zshrc.d directories. See Fragment File Directories for more details.

GNU stow is 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:

WARNING! stowing zsh would cause conflicts:
  * existing target is neither a link nor a directory: .zshrc
All operations aborted.

Per @jefheaton, this is caused when trying to replace an existing .zshrc file. He fixed it by closing ~ in Finder so Finder wouldn't create a .DS_Store file, deleting the existing .DS_Store and removing the old .zshrc. You may have to rename it first if ZSH is keeping the file open, then delete it after closing all your Terminal/iTerm 2 windows.

_arguments:comparguments:325: can only be called from completion function

This has been solved by running zgen update or switching to zgenom. New users of the kit should already be running zgenom. Thanks @RonanJackson, for reporting the fix.

Could not open a connection to your authentication agent

Confirm that ssh-agent is running. If not, Rob Montero has a good blog post on setting up ssh-agent on macOS, and here are instructions for starting ssh-agent with systemd on Linux.

I want to pin a plugin version

The plugin standard doesn't include a standard way of determining a version. If you need to pin a version of a plugin, the easiest way to do it is to fork the plugin's repository and then have your ~/.zsh-quickstart-local-plugins refer to that.

If you don't want to maintain a fork, you can also have zgenom load from a local directory. So clone the repository, then add something like

zgenom load ~/path/to/your/copy/of/example.plugin.zsh

Then you can tag working versions, pull from upstream for testing, and if the upstream doesn't work for you, check out your last-working-version tag, and zgenom will use your tagged version instead of the tip of the default branch.

Other Resources

ZSH

Dotfiles in general

dotfiles.github.io/ has a lot of great resources for dotfiles - frameworks for managing them, configurations for editors, and other bootstraps with initial configurations to start from.

Vim

If you're using vim, spf13 is an excellent starter configuration and plugin collection.

Thanks

Many thanks to all the contributors over the years who've helped make the quickstart better.

Made with contributors-img.

zsh-quickstart-kit's People

Contributors

armarquez avatar briangilbert avatar chiqomar avatar dependabot[bot] avatar dglynn avatar dobbs avatar docwhat avatar dotcomstar avatar dotcoyote avatar genevera avatar harshcurious avatar jaredweiss avatar jasehadd avatar jfmcdowell avatar lenart12 avatar mariozig avatar matthiasr avatar mdhooge avatar mingaldrichgan avatar neiromaster avatar qoreqyas avatar reduxionist avatar tam1m avatar twnaing avatar unixorn avatar zswanson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zsh-quickstart-kit's Issues

zsh-quickstart-kit should either warn fzf not installed or not install fzf-zsh-plugin

I upgraded my zsh-quickstart-kit a few weeks back, and my ^R keybinding has been broken ever since. I finally tracked down the issue, and after much banging of head, it turns out that I didn't have fzf installed. It had been quite awhile since I'd updated zsh-quickstart-kit; the previous version must have been a pre- fzf version.

Maybe the quickstart kit (or the plugin?) should warn that fzf is not installed; or not override the existing bindings, or something?

(fzf is pretty cool at first glance, but it was a frustrating few weeks not having search history!)

Zgenom OSX plugin is deprecated

Zgenom throws the following error:
-- zgenom: Deleting /Users/jfmcdowell/.zgenom/init.zsh ...
The osx plugin is deprecated and has been renamed to macos.
Please update your .zshrc to use the macos plugin instead.

This is because Oh My ZSH deprecated the plugin.

Default zgen directory to hidden

Hi, thanks for the awesome zsh kit. No doubt this is the best kit around.

I'd like to make a suggestion to use /.zgen instead of zgen, because no point seeing a boilerplate zgen directory for most users.

Add 1password ssh-agent support

1Password 8 beta supports storing ssh keys in your 1Password vault. Add support not starting ssh-agent if 1Password is enabled.

Describe the solution you'd like

Detect 1Password ssh and skip ssh-agent launch.

Had to modify .zgen-setup to point to proper files

Had to modify these lines:

if [ ! -f ~/zgen/zgen.zsh ]; then
  pushd ~
  git clone [email protected]:tarjoilija/zgen.git
  popd
fi
source ~/zgen/zgen.zsh

To this

if [ ! -f ~/zgen.zsh ]; then
  pushd ~
  git clone [email protected]:tarjoilija/zgen.git
  popd
fi
source ~/zgen.zsh

To get it to work. Stow didn't appear to create a symlink for the zsh folder itself. Is that standard behavior?

Stow throws Warning! about targest

Ran through instructions per the readme and got this error when running the stow --target=/Users/YourUsername zsh in the top level of the repo

WARNING! stowing zsh would cause conflicts:
  * existing target is neither a link nor a directory: .zshrc
All operations aborted.

powerlevel 10k keeps appending to .zshrc

Hi there, powerlevel 10k keeps appending the following line to my .zshrc:

POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true

I'm only using powerlevel 10k because it comes with the quickstart kit, and I used the wizard to customize the prompt, but that's it.

Stuck on zgen setup part of readme

It's not clear to me, when reading the readme on github, that you are supposed to download the quickstart repo, or where would be a good location to download it to.

I read step 2 as referring to the repo downloaded in step 1, but I think it's referring to downloaded version of the quickstart repo..?

Do you have a suggested location to download the quickstart repo?

watch command broken

My watch command is broken when using this kit.
It flashes very quickly and is impossible to read.

Do you have similar issues?
Any ideas whats causing this?

Error loading zshrc

After the latest OSX update I'm getting the following error to load my terminal session:

.zshrc:78: parse error near ;'`

Looking at the code this is what I'm seeing on this code block:


 76 if has brew; then
 77   BREW_PREFIX=$(brew --prefix)
 78   if [[ -d "${BREW_PREFIX}/bin"]]; then
 79     export PATH="$PATH:${BREW_PREFIX}/bin"
 80   fi
 81   if [[ -d "${BREW_PREFIX}/sbin"]]; then
 82     export PATH="$PATH:${BREW_PREFIX}/sbin"
 83   fi
 84 fi

OS details:

macOS Big Sur
version 11.3.1

Very slow

I installed zsh-quickstart-kit with spf13, and the loading time is very slow. I haven't customized it, so it appears to be the default setting that slows down my system.

Using iTerm2 on OS X 10.11.

I was hoping that zgen would solve slowliness issues I was experiencing with antigen, but that's not the case. Do you have any recommendations for speeding up the system?

/usr/local/bin comes after /usr/bin in PATH variable

which python 

returns /usr/bin/python instead of brewed python, causing package import problems.

Error when opening new terminal:

/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
set properly.

Problems with load-our-ssh-keys()

Adding ssh keys prints some things to stdout which makes p10k unhappy. Also ssh-agent isnt started by default. Also the find command is missing an -o between id_dsa and id_ecdsa
Recommended fix:

load-our-ssh-keys() {
  eval `ssh-agent -s` &> /dev/null
  # Fun with SSH
  if [ $(ssh-add -l | grep -c "The agent has no identities." ) -eq 1 ]; then
    if [[ "$(uname -s)" == "Darwin" ]]; then
      # macOS allows us to store ssh key pass phrases in the keychain, so try
      # to load ssh keys using pass phrases stored in the macOS keychain.
      #
      # You can use ssh-add -K /path/to/key to store pass phrases into
      # the macOS keychain
      ssh-add -A # load all ssh keys that have pass phrases stored in macOS keychain
    fi

    for key in $(find ~/.ssh -type f -a \( -name '*id_rsa' -o -name '*id_dsa' -o -name '*id_ecdsa' \))
    do
      if [ -f ${key} -a $(ssh-add -l | grep -c "${key//$HOME\//}" ) -eq 0 ]; then
        ssh-add ${key} &> /dev/null
      fi
    done
  fi
}

I would also make DONT_PRINT_SSH_KEY_LIST enabled by default.

Broken sourcing from ~/.zshrc.d

.zshrc does not source dotfiles correctly from ~/.zshrc as it doesnt find actual dotfiles.
Reccomended fix (made in #102):

mkdir -p ~/.zshrc.d
# ..... Changes
if [ -n "$(/bin/ls -A ~/.zshrc.d)" ]; then
  for dotfile in $(find ~/.zshrc.d -type f)
# .....
  do
    if [ -r "${dotfile}" ]; then
      source "${dotfile}"
    fi
  done
fi

Use -A swich with ls to list dotfiles and find to enumerate all files (including dotfiles)

noisy output from ssh-add on startup

The default behavior for ssh-add is to print all identities found. Using the -q flag silences this and only prints errors, successful operations are hidden.

Current SSH Keys: Could not open a connection to your authentication agent.

I've installed the quickstart kit. Now whenever I start ZSH I am greeted by the following message:

Current SSH Keys:                                         
Could not open a connection to your authentication agent. 

I'm using Manjaro Linux over ssh. I have verified that ssh-agent is running.

I'd be happy to provide any additional info you need to help troubleshoot this. Thanks for the cool project.

Powerlevel10k Startup Wizard opens each terminal launch

Something related to the complex of symlinks included in this startup kit causes P10K to not recognize the config file it places in the home directory on startup, leading it to open the extremely annoying startup wizard each time the terminal is opened, as well as not reading the saved config. I fixed this by placing ./p10k.zsh in my .zshrc.d but this obviously shouldn't be necessary out the box.

I'm on MacOS 11.5.2.

Add a selfupdate command

Add a quickstart-selfupdate command to force an update of the quickstart kit and update the ticket file to reset the timer till the next selfupdate.

Git Clone Issue

git clone [email protected]:unixorn/zsh-quickstart-kit.git
Cloning into 'zsh-quickstart-kit'...
The authenticity of host 'github.com (140.82.113.4)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com,140.82.113.4' (RSA) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Always recompiling

When using .zgen-local-plugins files I always get this message when I start a new shell (without touching the file). I tried with the default example and got the same issue.

.zgen-local-plugins updated; creating a new init.zsh from plugin list in /home/rif/.zgen-local-plugins
-- zgenom: Creating `/home/rif/.zgenom/init.zsh` ...
-- zgenom: Compiling files ...

I am using zsh 5.8 (x86_64-pc-linux-gnu) on arch linux

.zgen-setup still points to ~/.zgen/init.zsh instead of ~/.zgenom/init.zsh

Since the switch to fully support zgenom, I was noticing that zgenom save was always being run in Linux whenever a new session was started, even though the files hadn't been modified. I ran zsh with --xtrace and noticed that init.zsh was getting a 0 for modification time and saw that the get_file_modification_time function was still pointing to ~/.zgen/init.zsh instead of ~/.zgenom/init.zsh
Selection_002

fzf: [Command failed: find . -type f (-path .git -o -path node_modules ) -prune]

Describe the bug
fzf fails to start after a fresh install of zsh-quickstart-kit.

To Reproduce
Steps to reproduce the behavior:

  1. $stow --target="$HOME" zsh on bash
  2. zsh
  3. fzf
  4. fzf produces output: [Command failed: find . -type f ( -path .git -o -path node_modules ) -prune]

Expected behavior
fzf should run.

Screenshots
Self-explanatory one-liner error prompt.

Desktop (please complete the following information):

  • OS/disto: Arch Linux
  • Version: 5.16.12-arch-1-1

Additional context
Problem occurs on a fresh install of Arch Linux.
fzf was installed with sudo pacman -S fzf , with no further configurations.
fzf runs properly on bash and zsh without zsh-quickstart-kit installed.
fzf produces the same error when running in bash started by zsh.
Manually run find . -type f (-path .git -o -path node_modules ) -prune gives an output of zsh: unknown file attribute:

zsh/.zsh_functions 'chgext' function conflicts with default unixorn/jpb.zshplugin 'chgext' alias to 'change-extension' function

Last login: Fri Jan 25 12:35:53 on ttys005
Identity added: /Users/jmcculloch/.ssh/id_rsa (...)
/Users/jmcculloch/.zsh_functions:161: defining function based on alias `chgext'
/Users/jmcculloch/.zsh_functions:161: parse error near `()'

This appears to be conflicting with the chgext alias defined in the plugin unixorn/jpb.zshplugin

zsh/.zgen-setup

  # Add my collection of miscellaneous utility functions.
  zgen load unixorn/jpb.zshplugin
$ grep -r 'change-extension' .
Binary file ./unixorn/jpb.zshplugin-master/.git/index matches
./unixorn/jpb.zshplugin-master/bin/change-extension:# Usage: change-extension jpeg jpg
./unixorn/jpb.zshplugin-master/jpb.plugin.zsh:#   change-extension erb haml
./unixorn/jpb.zshplugin-master/jpb.plugin.zsh:function change-extension() {
./unixorn/jpb.zshplugin-master/jpb.plugin.zsh:alias chgext='change-extension'
./unixorn/jpb.zshplugin-master/README.md:* change-extension - ?

This was resolved with the fix in issue #40 and reintroduced by commit commit 5d2ae03 (Don't use function keyword)

Assistance with font's instructions.

Install the patched font in a valid X font path. Valid font paths can be listed with xset q: mv YourChosenPowerlineFont.otf ~/.fonts
Update the font cache for the path the font was installed in (root privileges may be needed for updating the font cache for some paths): fc-cache -vf ~/.fonts/

Can you assist a little more in these instructions. I have installed powerline and nerdfonts. I searched using catfish and only found this one file. PowerlineSymbols.otf in /usr/share/fonts/OTF/

I cannot find anything labled with powerline and file type of otf besides that.

In the past with Arch and installing Oh-My-Zsh I don't recall having to mv powerline fonts to my local fonts. Maybe these instructions do not apply to Arch.

New starter-kit error

New starter kit shows these following errors
-- zgen: Failed to load /home/arafat/.zgen/robbyrussell/oh-my-zsh-master -- oh-my-zsh.sh
And
It has been 17781 days since your zsh quickstart kit was updated Checking for zsh-quickstart-kit updates... ~/.zsh-quickstart-kit-master/zsh ~ fatal: not a git repository (or any of the parent directories): .git No quickstart marker found, is your quickstart a valid git checkout?

Walk through setup/quickstart again to change settings (or toggle them after initially setting up)

Hey,

I started using this quickstart kit to quickly setup ZSH with loads of features, and I absolutely love it!
One thing I did misconfigure though was to have the more compact terminal view:

image

I want to change it back to show the full powerline visual instead of compacting the log of commands previously executed, but I am unsure where to look or where to toggle individual settings.

Is there a way to run the initial setup again, or toggle individual choices that were made during the initial setup?

.zgen-setup needs to be updated

L69 needs to be updated from:
zgen oh-my-zsh plugins/colored-man
to:
zgen oh-my-zsh plugins/colored-man-pages

following oh-my-zsh's renaming of the plugin

symbolic-linked .zgen-local-plugins does not regenerate .zgen/init.zsh

I have my .zgen-local-plugins placed under Dropbox folder. Then I place a symbolic link under my user profile by running the following.

ln ~\Dropbox\zsh\.zgen-local-plugins \Users\me\.zgen-local-plugins

After I had made changes to the file, the file changes was not picked up and no updated init.zsh.

Have to manually run setup-zgen-repos.

Powerline warning in new tab

Hello,

I've been using this starter kit for a few days. I love it mainly because of async loading of plugins. Few problems I encountered:

  • I see these logs: Identity added: ... listing down path to my ssh key every time I open a new terminal window. I have added export DONT_PRINT_SSH_KEY_LIST=true in ~/.zshrc.d/my-conf.sh but still see this log.
  • Due to above print output, powerline gives a huge log on every new terminal window that looks like this:
[WARNING]: Console output during zsh initialization detected.
When using Powerlevel10k with instant prompt, console output during zsh
initialization may indicate issues.

You can:

  - Recommended: Change ~/.zshrc so that it does not perform console I/O
    after the instant prompt preamble. See the link below for details.

    * You will not see this error message again.
    * Zsh will start quickly and prompt will update smoothly.

  - Suppress this warning either by running p10k configure or by manually
    defining the following parameter:

      typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet

    * You will not see this error message again.
    * Zsh will start quickly but prompt will jump down after initialization.

  - Disable instant prompt either by running p10k configure or by manually
    defining the following parameter:

      typeset -g POWERLEVEL9K_INSTANT_PROMPT=off

    * You will not see this error message again.
    * Zsh will start slowly.

  - Do nothing.

    * You will see this error message every time you start zsh.
    * Zsh will start quickly but prompt will jump down after initialization.

I tried adding typeset statement in ~/.zshrc.d/my-conf.sh but that doesn't work..

  • Not sure about this but I always get this warning in startup of Visual Studio Code: Resolving your shell environment is taking very long. Please review your shell configuration.

I'm on OSX Catalina 10.15.7. My zsh version is zsh 5.8 (x86_64-apple-darwin19.6.0)

n00b question about zgen vs oh-my-zsh

Why does this setup load oh-my-zsh when it already is using zgen?
Cannot zgen alone + straight zsh config provide the same functionality?
I'm asking because people write ohmy is slow. I've read zgen is good, and thats how I found this repo. Is it not an issue anymore?

MacOS: Deprecated flags in ssh-add

After upgrading to MacOs Monterey I am presented with the following warning:

WARNING: The -K and -A flags are deprecated and have been replaced
by the --apple-use-keychain and --apple-load-keychain
flags, respectively. To suppress this warning, set the
environment variable APPLE_SSH_ADD_BEHAVIOR as described in
the ssh-add(1) manual page.

I believe this warning can be suppressed without the use of the environment variable by changing line 116 in the ZSHRC file with ssh-add --apple-load-keychain

I'll submit a PR for consideration.

use can_haz instead of canhaz

This commit recently introduced support for exa, but may be using canhaz instead of can_haz. Whenever I open a new shell canhaz creates two files (exa and tree) in my working directory.

❯ which canhaz
canhaz () {
	mkdir -p $(dirname "${1}") && touch "${1}"
}
❯ which can_haz
can_haz () {
	which "$@" > /dev/null 2>&1
}

load-our-ssh-keys() function doesn't work on Arch Linux

I am not sure if this is Arch specific but my ssh key is never loaded during the start-up of a new shell/terminal.

I see output like this:

-- console output produced during zsh initialization follows --

load-our-ssh-keys:6: no such file or directory: .ssh/ssh-agent
cat: .ssh/ssh-agent: No such file or directory
Could not open a connection to your authentication agent.

Current SSH Keys:
Could not open a connection to your authentication agent.

I have tried debugging and because the kit redirects the ssh-add cmd to /dev/null I never see the actual error message:

-- console output produced during zsh initialization follows --

Agent pid 40928
ssh_askpass: exec(/usr/lib/ssh/ssh-askpass): No such file or directory```

If I add the ssh-add command to my config in the ~/.zshrc.d/ folder it gives the same askpass error as above. From reading up on this on a few SO pages its to do with the env var SSH_ASKPASS

I have installed this package but it still fails: community/openssh-askpass 2.1.0-3 [0B 2.61MiB] [Installed]

I found this link on StackExchange, it may be helpful.

Create mirrors of the base plugins

Make mirrors of the base plugins used by the kit to prevent annoyances like when psprint took all their plugin repos offline from breaking users.

Include some tooling to periodically pull the upstreams and push to the mirrors to keep them from getting stale.

.zsh_functions:161: defining function based on alias `chgext'

I get the following error every time I open a terminal window

/Users/brian/.zsh_functions:161: defining function based on alias `chgext'
/Users/brian/.zsh_functions:161: parse error near `()'

Made the following change which seems to fix it:

# Batch change extension from $1 to $2
chgext() {
  for file in *.$1
  do
    mv $file $(echo $file | sed "s/\(.*\.\)$1/\1$2/")
  done
}

became

# Batch change extension from $1 to $2
function chgext {
  for file in *.$1
  do
    mv $file $(echo $file | sed "s/\(.*\.\)$1/\1$2/")
  done
}

Removing SSH key echo in .zshrc

I could be missing something but is there a way to do this without modifying .zshrc directly (would rather not)?

I don't currently see anything in source or docs.

[Suggestion] Disable OMZ's built-in auto-update

Since zsh-quickstart-kit includes autoupdate-zgen by default, would you consider adding DISABLE_AUTO_UPDATE=true to the included .zshrc to avoid getting prompted by Oh-My-Zsh to update itself? (Obviously, we can add it to our own custom configurations but it seems like a reasonable inclusion in the default config.) Thanks for your consideration!

Avoid Launching Unnecessary SSHAgents on MacOS

The current version of the .zshrc file creates a new ssh-agent process whenever the load-our-ssh-keys() function is run, which is almost everytime except when on not remote machines.

However, for MacOS platform there is no need to create a new ssh-agent as there should be one already running by the OS. So instead of creating news, you can use the one created by the OS. But to keep this code portable for Zshells on Linux and Windows you have to add in some other code for checks.

I fixed this on my git subtree version of this repo by using some code that I snagged from VS Code docs:

if [ -z "$SSH_AUTH_SOCK" ]; then
   # Check for a currently running instance of the agent
   RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`"
   if [ "$RUNNING_AGENT" = "0" ]; then
        # Launch a new instance of the agent
        ssh-agent -s &> .ssh/ssh-agent
   fi
   eval `cat .ssh/ssh-agent`
fi

Will add a MR with this fix.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.