From 9d5d97d28e38e1f48065abb1803018a828be0e97 Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Mon, 26 Aug 2019 18:17:06 -0500 Subject: [PATCH 1/2] Wrote a README --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa59f8e --- /dev/null +++ b/README.md @@ -0,0 +1,68 @@ +# Aaron's ZSH Config + +This is the basis of my ZSH config for all of my systems. + +---------------------- +## Setup +#### Step 1: Clone this repository +I personally like to clone this into `~/git/zsh` and use symlinks from there, so that's how I will write this up. If you'd rather, you can just as well clone it straight to `~/.zsh` if you want. +``` +# If git directory doesn't exist: +mkdir ~/git + +git clone https://git.skyfall.tech/skyfall/tab-sorcery.git ~/git/zsh +``` +#### Step 2: Copy out example config files and edit to your preferences +Some variables of the shell configuratio nI don't keep the same across the board, so I have created a `zsh.conf` file for things such as shell options and prompt styles/colours. I have also added a [very] basic "custom" template file as an example as well. Both of these files, once copied to to the repo's root dir, will be ignored by git. +``` +cd ~/git/zsh +cp -v example_configs/* ./ +``` +**IMPORTANT:** +The defaults in zsh/conf will work well for most systems, but if you are using any kind of BSD-derived system, including Mac OS-X, you will definitely need to set `BSD_MODE=true` in zsh.conf. +#### Step 3: Deploy symlinks to load the configuration +Even if you opted to clone the repo straight to `~/.zsh`, you will still need to at least make the symlink for the `zshrc` file. +``` +cd +ln -s git/zsh .zsh +ln -s git/zsh/zshrc ./zshrc + +# Test deployment by opening a new zsh instance +zsh +``` +## Customization +Other than the `zsh.conf` options, you can perform any sort of customization you want easily by placing the configuration in the `custom` file. The `custom` file is loaded last, and so will overwrite anything set up by the default shell configuration here. You can also source other outside files from the `custom` files as well. If you don't care for any of the pre-defined prompts provided, just set up a new on in `custom`! +## Notable Features +### HISTORY_HIDE_SPACE +This option will let any command starting with an empty space character be omitted from `.zsh_history`. This is very useful for things such as running commands that contain passwords, for instance. +### AUTO_CD +If you just name a path, the shell will assume you intended to change directories. +``` +ajohnson@helios:~ % git/zsh +ajohnson@helios:~/git/zsh [add_readme]% +``` +### `cd` Search and Replace +You can substitute one word for another in your current working directory by using the cd syntax: +``` +cd [old_word] [new_word] +``` +Here is an example where I `cd` from a Confluence Tomcat log dir to a Jira Tomcat log dir, which you can see by looking at the current working directory in the prompt: +``` +ajohnson@atlas:/opt/j2ee/domains/skyfall.tech/wiki/current/logs % cd wiki jira +/opt/j2ee/domains/skyfall.tech/jira/current/logs +ajohnson@atlas:/opt/j2ee/domains/skyfall.tech/jira/current/logs % +``` +### Display Current VCS Branch in Prompt +This feature is my favourite one on the list. It works with Git and Subversion at least, though I have never tested it with Mercurial. +In this example, I start out in the 'rewrite' branch and switch to 'dev'. +``` +ajohnson@helios:~/git/heatbot [rewrite]% git checkout dev +Switched to branch 'dev' +Your branch is up to date with 'origin/dev'. +ajohnson@helios:~/git/heatbot [dev]% + +``` + +## Epilogue +If there are other prompt layouts/styles that you'd like to share, let me know and I'll be happy taking a look and considering adding them as options. + From f40d17e2a54064785894e7175c0c32784403d49b Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Mon, 26 Aug 2019 18:19:51 -0500 Subject: [PATCH 2/2] adjusted headings --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index aa59f8e..29db4bd 100644 --- a/README.md +++ b/README.md @@ -33,15 +33,15 @@ zsh ## Customization Other than the `zsh.conf` options, you can perform any sort of customization you want easily by placing the configuration in the `custom` file. The `custom` file is loaded last, and so will overwrite anything set up by the default shell configuration here. You can also source other outside files from the `custom` files as well. If you don't care for any of the pre-defined prompts provided, just set up a new on in `custom`! ## Notable Features -### HISTORY_HIDE_SPACE +#### HISTORY_HIDE_SPACE This option will let any command starting with an empty space character be omitted from `.zsh_history`. This is very useful for things such as running commands that contain passwords, for instance. -### AUTO_CD +#### AUTO_CD If you just name a path, the shell will assume you intended to change directories. ``` ajohnson@helios:~ % git/zsh ajohnson@helios:~/git/zsh [add_readme]% ``` -### `cd` Search and Replace +#### cd Search and Replace You can substitute one word for another in your current working directory by using the cd syntax: ``` cd [old_word] [new_word] @@ -52,7 +52,7 @@ ajohnson@atlas:/opt/j2ee/domains/skyfall.tech/wiki/current/logs % cd wiki jira /opt/j2ee/domains/skyfall.tech/jira/current/logs ajohnson@atlas:/opt/j2ee/domains/skyfall.tech/jira/current/logs % ``` -### Display Current VCS Branch in Prompt +#### Display Current VCS Branch in Prompt This feature is my favourite one on the list. It works with Git and Subversion at least, though I have never tested it with Mercurial. In this example, I start out in the 'rewrite' branch and switch to 'dev'. ```