All Projects → yuki-yano → zeno.zsh

yuki-yano / zeno.zsh

Licence: MIT license
zsh fuzzy completion and utility plugin with Deno.

Programming Languages

typescript
32286 projects
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to zeno.zsh

superdeno
Super-agent driven library for testing Deno HTTP servers.
Stars: ✭ 119 (+0%)
Mutual labels:  deno
denoliver
A simple, dependency free static file server for Deno with possibly the worst name ever.
Stars: ✭ 94 (-21.01%)
Mutual labels:  deno
Thread
type safe multi-threading made easier
Stars: ✭ 34 (-71.43%)
Mutual labels:  deno
core
Server side rendering with The Elm Architecture in Deno
Stars: ✭ 16 (-86.55%)
Mutual labels:  deno
discord-emoji
[Library/Deno] A near exact emoji tables of Discord for string-based insertion of emotes without having to escape Unicode.
Stars: ✭ 37 (-68.91%)
Mutual labels:  deno
awesome-oak
A list of community projects for oak
Stars: ✭ 63 (-47.06%)
Mutual labels:  deno
Tmux Fzf Url
🚀 Quickly open urls on your terminal screen!
Stars: ✭ 227 (+90.76%)
Mutual labels:  fzf
azure-functions-deno-worker
Run Deno 🦕 on Azure Functions ⚡️
Stars: ✭ 99 (-16.81%)
Mutual labels:  deno
fzf.aws
🌀 Using fuzzy finder to perform AWS operations on the command line
Stars: ✭ 63 (-47.06%)
Mutual labels:  fzf
land
Run Deno X module without installation.
Stars: ✭ 39 (-67.23%)
Mutual labels:  deno
astrodon
Make Desktop apps with Deno 🦕
Stars: ✭ 826 (+594.12%)
Mutual labels:  deno
i18next-fs-backend
i18next-fs-backend is a backend layer for i18next using in Node.js and for Deno to load translations from the filesystem.
Stars: ✭ 67 (-43.7%)
Mutual labels:  deno
nvim-contabs
contextual tabs for vim/neovim
Stars: ✭ 20 (-83.19%)
Mutual labels:  fzf
dmm
Lightweight Deno Module Manager
Stars: ✭ 59 (-50.42%)
Mutual labels:  deno
oembed-parser
Extract oEmbed data from given webpage
Stars: ✭ 65 (-45.38%)
Mutual labels:  deno
ptera
Ptera is DateTime library for Deno
Stars: ✭ 62 (-47.9%)
Mutual labels:  deno
dotfiles
My doots. Changes are frequent, stability not guaranteed. Supports Arch, CentOS and Darwin.
Stars: ✭ 27 (-77.31%)
Mutual labels:  fzf
dotland
deno.land website
Stars: ✭ 947 (+695.8%)
Mutual labels:  deno
Fae
A functional module for Deno inspired from Ramda.
Stars: ✭ 44 (-63.03%)
Mutual labels:  deno
deno sticker
🦕 The data I used for submitting for printing deno_sticker.
Stars: ✭ 50 (-57.98%)
Mutual labels:  deno

logo

zsh fuzzy completion and utility plugin with Deno.

Features

  • Insert snippet and abbrev snippet
  • Completion with fzf
    • Builtin git completion
    • User defined completion
  • ZLE utilities

Demo

Abbrev snippet

zeno

Completion with fzf

zeno

Requirements

Installation

zinit

zinit ice lucid depth"1" blockf
zinit light yuki-yano/zeno.zsh

git clone

$ git clone https://github.com/yuki-yano/zeno.zsh.git
$ echo "source /path/to/dir/zeno.zsh" >> ~/.zshrc

Usage

Abbrev snippet

Require user configuration file

$ gs<Space>

Insert
$ git status --short --branch
$ gs<Enter>

Execute
$ git status --short --branch

Completion

$ git add <Tab>
Git Add Files> ...

Insert snippet

Use zeno-insert-snippet zle

Search history

Use zeno-history-completion zle

Change ghq managed repository

Use zeno-ghq-cd zle

Configuration example

Completion and abbrev snippet

# if defined load the configuration file from there
# export ZENO_HOME=~/.config/zeno

# if disable deno cache command when plugin loaded
# export ZENO_DISABLE_EXECUTE_CACHE_COMMAND=1

# if enable fzf-tmux
# export ZENO_ENABLE_FZF_TMUX=1

# if setting fzf-tmux options
# export ZENO_FZF_TMUX_OPTIONS="-p"

# Experimental: Use UNIX Domain Socket
export ZENO_ENABLE_SOCK=1

# if disable builtin completion
# export ZENO_DISABLE_BUILTIN_COMPLETION=1

# default
export ZENO_GIT_CAT="cat"
# git file preview with color
# export ZENO_GIT_CAT="bat --color=always"

# default
export ZENO_GIT_TREE="tree"
# git folder preview with color
# export ZENO_GIT_TREE="exa --tree"

if [[ -n $ZENO_LOADED ]]; then
  bindkey ' '  zeno-auto-snippet

  # fallback if snippet not matched (default: self-insert)
  # export ZENO_AUTO_SNIPPET_FALLBACK=self-insert

  # if you use zsh's incremental search
  # bindkey -M isearch ' ' self-insert

  bindkey '^m' zeno-auto-snippet-and-accept-line

  bindkey '^i' zeno-completion

  bindkey '^x '  zeno-insert-space
  bindkey '^x^m' accept-line
  bindkey '^x^z' zeno-toggle-auto-snippet

  # fallback if completion not matched
  # (default: fzf-completion if exists; otherwise expand-or-complete)
  # export ZENO_COMPLETION_FALLBACK=expand-or-complete
fi

ZLE widget

if [[ -n $ZENO_LOADED ]]; then
  bindkey '^r'   zeno-history-selection
  bindkey '^x^s' zeno-insert-snippet
  bindkey '^x^f' zeno-ghq-cd
fi

Builtin completion

  • git
    • add
    • diff
    • diff file
    • checkout
    • checkout file
    • switch
    • reset
    • reset file
    • restore
    • fixup and squash commit
    • rebase
    • merge

See: https://github.com/yuki-yano/zeno.zsh/blob/main/src/completion/source/git.ts

User configuration file

The configuration file is searched from the following.

  • $ZENO_HOME/config.yml
  • $XDG_CONFIG_HOME/zeno/config.yml or ~/.config/zeno/config.yml
  • Find .../zeno/config.yml from each in $XDG_CONFIG_DIRS

Example

$ touch ~/.config/zeno/config.yml

and

snippets:
  # snippet and keyword abbrev
  - name: git status
    keyword: gs
    snippet: git status --short --branch

  # snippet with placeholder
  - name: git commit message
    keyword: gcim
    snippet: git commit -m '{{commit_message}}'

  - name: "null"
    keyword: "null"
    snippet: ">/dev/null 2>&1"
    # auto expand condition
    # If not defined, it is only valid at the beginning of a line.
    context:
      # buffer: ''
      lbuffer: '.+\s'
      # rbuffer: ''

  - name: branch
    keyword: B
    snippet: git symbolic-ref --short HEAD
    context:
      lbuffer: '^git\s+checkout\s+'
    evaluate: true # eval snippet


completions:
  # simple sourceCommand, no callback
  - name: kill signal
    patterns:
      - "^kill -s $"
    sourceCommand: "kill -l | tr ' ' '\\n'"
    options:
      --prompt: "'Kill Signal> '"

  # use excludePatterns and callback
  - name: kill pid
    patterns:
      - "^kill( .*)? $"
    excludePatterns:
      # -l, -n or -s is followed by SIGNAL instead of PID
      - " -[lns] $"
    sourceCommand: "LANG=C ps -ef | sed 1d"
    options:
      --multi: true
      --prompt: "'Kill Process> '"
    callback: "awk '{print $2}'"

  # Use null (\0) termination Input / Output
  - name: chdir
    patterns:
      - "^cd $"
    sourceCommand: "find . -path '*/.git' -prune -o -maxdepth 5 -type d -print0"
    options:
      # Added --read0 if null termination is used in `sourceCommand` output.
      --read0: true
      --prompt: "'Chdir> '"
      --preview: "cd {} && ls -a | sed '/^[.]*$/d'"
    callback: "cut -z -c 3-"
    callbackZero: true  # null termination is used in `callback` I/O

FAQ

Q: zsh-syntax-highlighting does not work well.

A: Use fast-syntax-highlighting instead.

Related project

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].