Giter Site home page Giter Site logo

z-shell / zconvey Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 4.0 169 KB

⚙️ Integrates multiple Zsh sessions with unique ID

Home Page: https://wiki.zshell.dev

License: GNU General Public License v2.0

Shell 70.70% Makefile 0.27% C 29.03%
zsh zsh-plugin oh-my-zsh shell bash zplugin session-management session-manager

zconvey's Introduction

Logo ❮ ZI ❯ Plugin - ZConvey

You can resize the video by pressing Ctrl-+ or Cmd-+

Zconvey integrates multiple Zsh sessions. They are given an ID, optionally a NAME (both unique), and can send commands to each other. Use this to switch all your Zshells to given directory, via zc-all cd $PWD! Also, there's zc-bg-notify script (not a function), that will show notification under prompt of every active Zsh session. You can call this script from any program, Bash or GUI.

Zstyles

The values being set are the defaults. They must be set before loading the plugin.

zstyle ":plugin:zconvey" check_interval "2"         # How often to check if there are new commands (in seconds)
zstyle ":plugin:zconvey" expire_seconds "22"        # If shell is busy for 22 seconds, the received command will expire and not run
zstyle ":plugin:zconvey" greeting "logo"            # Display logo at Zsh start ("text" – display text, "none" – no greeting)
zstyle ":plugin:zconvey" ask "0"                    # zc won't ask for missing data ("1" has the same effect as always using -a option)
zstyle ":plugin:zconvey" ls_after_rename "0"        # Don't execute zc-ls after doing rename (with zc-rename or zc-take)
zstyle ":plugin:zconvey" use_zsystem_flock "1"      # Should use faster zsystem's flock when it's possible?
                                                    # (default true on Zsh >= 5.3, will revert to mixed zsystem/flock on older Zshells)
zstyle ":plugin:zconvey" output_method "feeder"     # To put commands on command line, Zconvey can use small program "feeder". Or "zsh"
                                                    # method, which currently doesn't automatically run the command – to use when e.g.
                                                    # feeder doesn't build (unlikely) or when occurring any problems with it
zstyle ":plugin:zconvey" timestamp_from "datetime"  # Use zsh/datetime module for obtaining timestamp. "date" – use date command (fork)

Installation

The plugin is "standalone", which means that only sourcing it is needed. So to install, unpack zconvey somewhere and add

source {where-zconvey-is}/zconvey.plugin.zsh

to zshrc.

If using a plugin manager, then ZI is recommended, but you can use any other too, and also install with Oh My Zsh (by copying directory to ~/.oh-my-zsh/custom/plugins).

The plugin integrates with:

Add zi load z-shell/zconvey to your .zshrc file. ZI will clone the plugin the next time you start zsh. To update issue zi update z-shell/zconvey.

ZI can load in turbo mode, below is an example configuration, together with adding zc-bg-notify to $PATH:

zi ice wait"0"
zi light z-shell/zconvey
zi ice wait"0" as"command" pick"cmds/zc-bg-notify" silent
zi light z-shell/zconvey

Zinit

Add zinit load z-shell/zconvey to your .zshrc file. ZI will clone the plugin the next time you start zsh. To update issue zinit update z-shell/zconvey.

Antigen

Add antigen bundle z-shell/zconvey to your .zshrc file. Antigen will handle cloning the plugin for you automatically the next time you start zsh.

Oh-My-Zsh

  1. cd ~/.oh-my-zsh/custom/plugins
  2. git clone [email protected]:z-shell/zconvey.git
  3. Add zconvey to your plugin list

Zgen

Add zgen load z-shell/zconvey to your .zshrc file in the same place you're doing your other zgen load calls in.

Information

There are following commands:

  • zc – sends to other session; use "-a" option to be asked for target and a command to send
  • zc-all – the same as zc, but targets are all other active sessions (with -f also busy sessions)
  • zc-rename – assigns name to current or selected session; won't rename if there's a session with the same name
  • zc-take – takes a name for current or selected sessions, schematically renames any conflicting sessions
  • zc-ls – lists all active and named sessions
  • zc-id – shows ID and NAME of current session
  • zc-logo – the same as zc-id, but in a form of an on-screen logo; bound to Ctrl-O Ctrl-I
  • zc-bg-notify – in subdirectory cmds, link it to /usr/local/bin, etc. or load with e.g. ZI

The main command is zc (yet it is rather rarely used, I'm always sending to all sessions with zc-all). It is used to execute commands on other sessions. zc-ls is the main tool to obtain overall information on sessions. zc-take is a nice rename tool to quickly name a few sessions. Keyboard shortcut Ctrl-O Ctrl-I will show current session's ID and NAME in form of an on-screen logo.

zconvey's People

Contributors

diagonactic avatar psprint avatar ss-o avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

zconvey's Issues

Add ability to set a message when sending a command

When commands are executed on other shells, it looks like:
zc-all source /foo/bar
and on other shells:
source /foo/bar ##

I think it would be nice to have:
zc-all -m "reload stuff" source /foo/bar
and on other shells:
source /foo/bar ## reload stuff

(which is even better when using syntax highlighting)

[BUG] Does not clear already filled commands before executing

If in a shell session I opened but forgot about about it (deep in a tmux session for example), I already started to write a command like git checkout -b (and forgot about it).

Then when I try to run a command on all shell sessions like zc-all source /foo/bar, the already entered command is not cleared before executing the new command, resulting in the execution of unwanted command:
git checkout -b source /foo/bar

Instead it should do the same as zle push-input to keep pre-entered input, and pop it back after the next command execution,
and then run:
source /foo/bar
(and the previous input git checkout -b will be restored automatically)

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.