sorenson-axial / fzf-widgets

ZLE widgets of fzf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fzf-widgets - ZLE widgets of fzf

Overview | Installation | Requirements | Usage | Configuration | License

license-badge release-badge

Overview

This repository manage ZLE widgets of fzf. Available widgets can check here.

screenshot

Pros

  • Can map widgets to whatever key you like
  • Can easily install with plugin manager
  • Can use with zsh-autosuggestions
  • Show error messages with $POSTDISPLAY
  • All widgets are autoloaded function

Installation

You can install with plugin manager. If use zplug, add the following to your .zshrc:

zplug 'ytet5uy4/fzf-widgets'

Requirements

zsh: version 5.0.2 or higher

Usage

  1. Map widgets to key with bindkey command
  2. Execute widget with mapped key

Configuration

You can map widgets to key and specify options of fzf to widgets. For example, add the following to your .zshrc:

if zplug check 'ytet5uy4/fzf-widgets'; then
  # Map widgets to key
  bindkey '^@'  fzf-select-widget
  bindkey '^@.' fzf-edit-dotfiles
  bindkey '^@c' fzf-change-directory
  bindkey '^@n' fzf-change-named-directory
  bindkey '^@f' fzf-edit-files
  bindkey '^@k' fzf-kill-processes
  bindkey '^@s' fzf-exec-ssh
  bindkey '^\'  fzf-change-recent-directory
  bindkey '^r'  fzf-insert-history
  bindkey '^xf' fzf-insert-files
  bindkey '^xd' fzf-insert-directory
  bindkey '^xn' fzf-insert-named-directory

  ## Git
  bindkey '^@g'  fzf-select-git-widget
  bindkey '^@ga' fzf-git-add-files
  bindkey '^@gc' fzf-git-change-repository

  # GitHub
  bindkey '^@h'  fzf-select-github-widget
  bindkey '^@hs' fzf-github-show-issue
  bindkey '^@hc' fzf-github-close-issue

  ## Docker
  bindkey '^@d'  fzf-select-docker-widget
  bindkey '^@dc' fzf-docker-remove-containers
  bindkey '^@di' fzf-docker-remove-images
  bindkey '^@dv' fzf-docker-remove-volumes

  # Enable Exact-match by fzf-insert-history
  FZF_WIDGET_OPTS[insert-history]='--exact'

  # Start fzf in a tmux pane
  FZF_WIDGET_TMUX=1

  # use fd for finding directories and files
  FZF_CHANGE_DIR_FIND_COMMAND="fd -t d"
  FZF_INSERT_DIR_FIND_COMMAND="fd -t d"
  FZF_INSERT_FILE_COMMAND="fd -t f"
  FZF_EDIT_FILES_COMMAND="fd -t f"

  # modify history command to remove duplicates
  FZF_HISTORY_COMMAND="fc -l 1 | sed  's/^ *[0-9]*\*?  //g' | awk '!seen[\$0]++'"
fi

License

Copyright (c) 2017 ytet5uy4

Released under the MIT License, see LICENSE.md.

About

ZLE widgets of fzf

License:MIT License


Languages

Language:Shell 100.0%