Coder Social home page Coder Social logo

zsh-iterm-touchbar's Introduction

zsh iTerm Touchbar

Display feedback of terminal in the ๐Ÿ Touchbar

preview1

preview2

Currently it shows:

  • F1 - Current directory ๐Ÿ‘‰
  • F2 - Current git branch, press to display all branches and switch between them ๐ŸŽ‹
  • F3 - Current git repo status ๐Ÿ”ฅ / ๐Ÿ™Œ
    • + โ€” uncommitted changes in the index;
    • ! โ€” unstaged changes;
    • ? โ€” untracked changes;
    • $ โ€” stashed changes;
    • โ‡ฃ โ€” unpulled commits;
    • โ‡ก โ€” unpushed commits.
  • F4 - Push to origin branch (git push origin [branch]) โœ‰๏ธ
  • F5 - Display npm-run or yarn-run scripts from package.json โšก๏ธ /๐Ÿฑ

Requirements

  • iTerm2 3.1.beta.3 (OS 10.10+) - Download
  • zsh shell
  • a zsh-framework like antigen or zgen
  • node (brew install node)

Into iterm2: Go into View -> Customize Tool Bar... and drag & drop the Fn module

Installing plugin

For oh-my-zsh users

Clone the repo in your plugins directory:

  • $ cd ${ZSH_CUSTOM1:-$ZSH/custom}/plugins
  • $ git clone https://github.com/iam4x/zsh-iterm-touchbar.git

Then add the plugin into your ~/.zshrc:

plugins=(... zsh-iterm-touchbar)

For antigen users

Add the following snippet ~/.zshrc after the line antigen use oh-my-zsh:

antigen theme https://github.com/iam4x/zsh-iterm-touchbar

For Zgen users

Add the following line to your ~/.zshrc where you're adding your other zsh plugins:

zgen load iam4x/zsh-iterm-touchbar

Customize

ENV variables to enable or disable git:

TOUCHBAR_GIT_ENABLED=true

ENV variables for git icons:

GIT_UNCOMMITTED="+"
GIT_UNSTAGED="!"
GIT_UNTRACKED="?"
GIT_STASHED="$"
GIT_UNPULLED="โ‡ฃ"
GIT_UNPUSHED="โ‡ก"

ENV variables to enable or disable yarn:

YARN_ENABLED=true

Read more / Credits

zsh-iterm-touchbar's People

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

zsh-iterm-touchbar's Issues

'node' missing from requirements

The requirements section of the Readme doesn't mention node as a requirement in order to use some features of this plugin (and doesn't gracefully downgrade when it's not available).

Adding this to the requirements, or disabling branch searching/switching, etc. when it's not available on PATH would be ideal.

No PR submitted as not sure on which approach is preferred.

Doesn't seem to work under tmux

Inside tmux screen plugin stops working, buttons seem to be stuck, and clicking them does nothing.
Stuck meaning if outside tmux I was in dir /x/y inside tmux it still shows /x/y even if I've navigated away.

Any ideas?

I'm running tmux inside a vagrant box (centos7).

This is my box: http://github.com/wearede/DevCeption

Disable git actions on per repo basis?

Hi, when using this plugin and navigating a really large git repo it causes a huge delay as it appears to be doing a git status every time.

I know it is possible to disable git actions using an env var, but is there any way to disable on a per repo basis?

How to speed up the plugin?

Just tried this plugin and my overall zsh experience noticeable slowed. And noticed the following by calling zprof:

53)    3        4057.82  1352.61   68.36%      0.23     0.08    0.00%  precmd_iterm_touchbar

Any ideas why it took ~4sec?

Labelled Touch Bar keys should do something

Touch Bar items that are updated with current working directory, git branch, and git status should actually do something when pressed. As a suggestion:

๐Ÿ‘‰ Print out full path (pwd)
๐ŸŽ‹ Do git branch -a
๐Ÿ”ฅ / ๐Ÿ™Œ Do git status

tmux support

These features don't seem to work when in a tmux session. Is this a limitation of iTerm2 or is there some way support can be added to this project?

Hide functions keys

Is it possible to hide the extra unused function keys? Perhaps behind an option?

CD Shortcuts don't escape spaces in path

When I click the leftmost button in the touch bar and then attempt to tap on a folder name to CD into it, the path does not include escaped spaces and thus fails. My folder names contain spaces, and thus the CD command thinks there are "too many arguments" when I simple use the touchbar button from this plugin.

Suggested fix: When preparing the CD command, the plugin should append a \ before every space in the target path.

Thanks!

Thanks for cool tools!

I have a few questions:

  • Can we use some system tools for checking git status? On large repos, it might be slow. Can we check, for example, for zsh's vcs_info or check OMZ git-tools and otherwise use builtin checks.
  • As an author of Spaceship ZSH prompt I'm super interested in having touch bar support in our prompt. Can you explain how this project works or help us with integration?

"git push" to the tracking repo

This looks cool, but I find the "git push origin" surprising and not very useful in general.

I most often work against a fork that is not the origin. When I create a new branch I set it up to track a remote branch, and then do "git push" to push to that remote. That would make more sense as the default.

Yarn run error

Reporting error when i try to run "yarn run" from touch bar, if i execute from zsh all works perfectly

console.log({"type":"info","data":"Project commands"}.data.items.filter(name => !name.includes(':')).sort((a, b) => a.localeCompare(b)).filter((name, idx) => idx < 12).join(' '))
^

TypeError: Cannot read property 'filter' of undefined
at eval:1:65
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at Object. (eval-wrapper:6:22)
at Module._compile (module.js:624:30)
at evalScript (bootstrap_node.js:461:27)
at startup (bootstrap_node.js:163:9)
at bootstrap_node.js:607:3

tapping [yarn-run] results in an error

Tapping [yarn-run] results in the following error displayed on the console:

console.log({"type":"error","data":"No command specified."}.data.items.filter(name => !name.includes(':')).sort((a, b) => a.localeCompare(b)).filter((name, idx) => idx < 12).join(' '))
                                                                      ^

TypeError: Cannot read property 'filter' of undefined
    at [eval]:1:71
    at ContextifyScript.Script.runInThisContext (vm.js:25:33)
    at Object.exports.runInThisContext (vm.js:77:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:541:32)
    at bootstrap_node.js:315:29
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

I do run export YARN_ENABLED=true in my .zshrc.
Using npm-run either displays no scripts or everything works fine.
I am running the latest version of zsh, oh-my-zsh, iTerm2 and zsh-iterm-touchbar is freshly cloned to ~/.oh-my-zsh/custom/plugins/

oh-my-zsh compatibility

Is there a way to install this with oh-my-zsh? If so, can you add it to the readme? If not, any plans to add compatibility?

if I'm not on the function layer on the touchbar, I get errors

here's what I see:

precmd:23: command not found: spaceship_git_uncomitted
precmd:24: command not found: spaceship_git_unstaged
precmd:25: command not found: spaceship_git_untracked
precmd:26: command not found: spaceship_git_stashed
precmd:27: command not found: spaceship_git_unpushed_unpulled

once I switch to the function layer, these go away. It's bothersome because if I leave iterm and come back, I'm kicked out of the function keys layer on the touch bar.

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.