Git Product home page Git Product logo

zsh-cmd-architect's Introduction

zca logo

Gitter

Zsh Command Architect

Also check out ZNT Zsh Navigation Tools and ZEW Zsh Editing Workbench

Zsh Command Architect in action: zca

Installation

sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma-continuum/zsh-cmd-architect/master/doc/install.sh)"

To update run the command again.

ZCA will be installed at ~/.config/zca/zsh-cmd-architect, config files will be copied to ~/.config/zca. .zshrc will be updated with only 4 lines of code that will be added to the bottom.

After installing and reloading shell give ZCA a quick try with Ctrl-T.

Installation With Zinit

Add zinit load zdharma-continuum/zsh-cmd-architect to .zshrc. The config files will be available in ~/.config/zca.

Installation With Zgen

Add zgen load zdharma-continuum/zsh-cmd-architect to .zshrc and issue a zgen reset (this assumes that there is a proper zgen save construct in .zshrc). The config files will be available in ~/.config/zca.

Installation With Antigen

Add antigen bundle zdharma-continuum/zsh-cmd-architect to .zshrc. There also should be antigen apply. The config files will be in ~/.config/znt.

Manual Installation

After extracting ZCA to {some-directory} add following two lines to ~/.zshrc:

fpath+=( {some-directory} )
source "{some-directory}/zsh-cmd-architect.plugin.zsh"

As you can see, no plugin manager is needed to use the *.plugin.zsh file. The above two lines of code are all that almost all plugin managers do. In fact, what's actually needed is only:

source "{some-directory}/zsh-cmd-architect.plugin.zsh"

because ZCA detects if it is used by any plugin manager and can handle $fpath update by itself.

Single File Manual Installation

Running script doc/generate_single_file will create single-file version of ZCA. It can be sourced from .zshrc. Don't forget about configuration files (copy them to ~/.config/zca).

Introduction

ZCA allows to copy segments of commands in history, rearrange segments of current command, delete segments of current command. This way user glues command from parts without using a mouse. Advanced history search (multi word, without duplicate lines) allows to quickly find the parts.

Keys are:

  • Ctrl-T - start Zsh Command Architect (Zshell binding)
  • Enter - delete selected segment (when in command window) or add selected segment (when in history window)
  • [ or ] - move active segment (when in command window)
  • Shift-left or Shift-right - move active segment (when in command window)
  • Tab - switch between the two available windows
  • g, G - beginning and end of the list
  • / - start incremental search
  • Esc - exit incremental search, clearing filter
  • <,>, {,} - horizontal scroll
  • Ctrl-L - redraw of whole display
  • Ctrl-O, o - enter uniq mode (no duplicate lines)
  • Ctrl-W (in incremental search) - delete whole word
  • Ctrl-K (in incremental search) - delete whole line
  • Ctrl-D, Ctrl-U - half page up or down
  • Ctrl-P, Ctrl-N - previous and next (also done with vim's j,k)

Performance

ZCA is fastest with Zsh before 5.0.6 and starting from 5.2

Fixing tmux, screen and linux vt

If TERM=screen-256color (often a case for tmux and screen sessions) then ncv terminfo capability will have 2nd bit set. This in general means that underline won't work. To fix this by creating your own ncv=0-equipped terminfo file, run:

{ infocmp -x screen-256color; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t

A file will be created in directory ~/.terminfo and will be automatically used, tmux and screen will work. Similar is for Linux virtual terminal:

{ infocmp -x linux; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t

It will not display underline properly, but will instead highlight by a color, which is quite nice. The same will not work for FreeBSD's vt, ZCA will detect if that vt is used and will revert to highlighting elements via reverse mode.

zsh-cmd-architect's People

Contributors

psprint avatar pschmitt avatar vladdoster avatar alichtman avatar freed-wu avatar

Stargazers

Ondřej Macháček avatar  avatar Nico Kokonas avatar  avatar Mark Kogan avatar Rohit Sanbhadti avatar tuzi3040 avatar Frank Meeusen avatar

Watchers

 avatar  avatar  avatar

Forkers

vladdoster

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.