Giter Club home page Giter Club logo

iterm-tab-color-oh-my-zsh's Introduction

Oh My Zsh Plugin for Setting iTerm2 Custom Tab Colors

Installation

cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/bernardop/iterm-tab-color-oh-my-zsh.git iterm-tab-color

Enable it by adding iterm-tab-color to your plugins array in $HOME/.zshrc

plugins=(git iterm-tab-color)

Usage

Explicitly using the command

After adding it to your plugins and restarting your current terminal you'll have a new alias available tc

Passing separate Red, Green, Blue values

tc 255 198 0

Passing a Hex value

tc '#0078ae`

- or -

tc 0078ae

Set tab color based on current working directory or current command

You can modify the .tc-config file located in ~/.oh-my-zsh/custom/plugins/iterm-tab-color and add directory=hexValue or command=hexValue pairs to automatically set the color of your tab to hexValue when your current working directory matches directory or the current executing command matches command (you can use regular expressions)

Example .tc-config file

/Users/me/projects/personal*=#065535
/Users/me/projects/work*=#3399ff
npm*=#CB3837
brew*=#BE862D

iterm-tab-color-oh-my-zsh's People

Contributors

bernardop avatar volovar 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

Watchers

 avatar  avatar  avatar  avatar

iterm-tab-color-oh-my-zsh's Issues

This suddenly stopped working with my iterm

Please let me know how to debug this because I used it a lot in doing ssh to different machines and I coded each ssh machine with new color.
tc color code is working but .tc-config in plugins folder is not.

Iterm version - Build 3.4.19

Errors "no such file or directory" for a number of files

Upon startup I'm getting the following errors:

lib/bzr.zsh
_omz_source:source:23: no such file or directory: lib/bzr.zsh
lib/cli.zsh
_omz_source:source:23: no such file or directory: lib/cli.zsh
lib/clipboard.zsh
_omz_source:source:23: no such file or directory: lib/clipboard.zsh
lib/compfix.zsh
_omz_source:source:23: no such file or directory: lib/compfix.zsh
lib/completion.zsh
_omz_source:source:23: no such file or directory: lib/completion.zsh
lib/correction.zsh
_omz_source:source:23: no such file or directory: lib/correction.zsh
lib/diagnostics.zsh
_omz_source:source:23: no such file or directory: lib/diagnostics.zsh
lib/directories.zsh
_omz_source:source:23: no such file or directory: lib/directories.zsh
lib/functions.zsh
_omz_source:source:23: no such file or directory: lib/functions.zsh
lib/git.zsh
_omz_source:source:23: no such file or directory: lib/git.zsh
lib/grep.zsh
_omz_source:source:23: no such file or directory: lib/grep.zsh
lib/history.zsh
_omz_source:source:23: no such file or directory: lib/history.zsh
lib/key-bindings.zsh
_omz_source:source:23: no such file or directory: lib/key-bindings.zsh
lib/misc.zsh
_omz_source:source:23: no such file or directory: lib/misc.zsh
lib/nvm.zsh
_omz_source:source:23: no such file or directory: lib/nvm.zsh
lib/prompt_info_functions.zsh
_omz_source:source:23: no such file or directory: lib/prompt_info_functions.zsh
lib/spectrum.zsh
_omz_source:source:23: no such file or directory: lib/spectrum.zsh
lib/termsupport.zsh
_omz_source:source:23: no such file or directory: lib/termsupport.zsh
lib/theme-and-appearance.zsh
_omz_source:source:23: no such file or directory: lib/theme-and-appearance.zsh
lib/vcs_info.zsh
_omz_source:source:23: no such file or directory: lib/vcs_info.zsh
plugins/git/git.plugin.zsh
_omz_source:source:23: no such file or directory: plugins/git/git.plugin.zsh
plugins/iterm-tab-color/iterm-tab-color.plugin.zsh
_omz_source:source:21: no such file or directory: plugins/iterm-tab-color/iterm-tab-color.plugin.zsh

Config loading but not held in memory

At least on my machine, the configuration would not stay in memory unless I explicitly forced tcConfigColors and orderedConfig to be global by adding the -g option to declare.

My system:

Here is my patch:

diff --git a/iterm-tab-color.plugin.zsh b/iterm-tab-color.plugin.zsh
index 625ab19..f6c3021 100644
--- a/iterm-tab-color.plugin.zsh
+++ b/iterm-tab-color.plugin.zsh
@@ -1,6 +1,6 @@
 tcConfigFilePath="$(dirname "$0")/.tc-config"
-declare -A tcConfigColors
-declare -a orderedConfig
+declare -gA tcConfigColors
+declare -ga orderedConfig
 while IFS="=" read -r configKey hexValue || [ -n "$hexValue" ]; do
   if ! ( [[ $configKey == \#* ]]); then
     orderedConfig+=( $configKey )

Thoughts? Do you want a PR with this?

changing .tc-config in git repo?

I'm a bit confused by the suggestion to change the .tc-config in the repo. Won't this constantly conflict with pulls?

Wouldn't it be more standard to put this in ~/.tc-config ?

Automatically set color based on some conditions

This project is actually a brilliant idea. ๐Ÿ‘
However I think that it would be incredibly more useful, if we could automatically set tab colors based on different stuff that is happening within the tab.

The use case I'm thinking of, is when I have multiple tabs open, the colorization would make them easily scannable. Possible conditions:

  • Set color whenever the cwd is a specified directory. Eg. all my blue tabs are my open-source development tabs, while all my green tabs are my work related development.
  • Set color based on current running job - Eg. yarn test sets the color to white, yarn start is green, docker-compose up is red, etc.
  • Set color based on last command exit code - Eg. I ran a command that exited with an error, therefore set the tab to a red color.

(I noticed a similar discussion in your tweet, I just wanted to jot this down quickly). ๐Ÿ™‚

Good job!

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.