chmouel / zsh-select-with-lf

Zsh plugin to select a file or directory with LF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Select files or directories with lf

A simple plugin to let you select some files or a directory using lf

recording-20231007-23h11.mp4

🛠️ Installation

Using Antigen

Bundle zsh-vi-mode in your .zshrc

antigen bundle chmouel/zsh-select-with-lf

Using zplug

Load zsh-vi-mode as a plugin in your .zshrc

zplug "chmouel/zsh-select-with-lf"

Using zgen

Include the load command in your .zshrc

zgen load chmouel/zsh-select-with-lf

Using zinit

Include the load command in your .zshrc

zinit ice depth=1
zinit light chmouel/zsh-select-with-lf

Note: the use of depth=1 ice is optional, other types of ice are neither recommended nor officially supported by this plugin.

As an Oh My Zsh! custom plugin

Clone zsh-vi-mode into your custom plugins repo

git clone https://github.com/chmouel/zsh-select-with-lf \
  $ZSH_CUSTOM/plugins/zsh-select-with-lf

Then load as a plugin in your .zshrc

plugins+=(zsh-select-with-lf)

Keep in mind that plugins need to be added before oh-my-zsh.sh is sourced.

Using Antibody

Add zsh-vi-mode to your plugins file (e.g. ~/.zsh_plugins.txt)

chmouel/zsh-select-with-lf

Using Zap

Load zsh-vi-mode as a plugin in your .zshrc

plug "chmouel/zsh-select-with-lf"

Manual

Or any ZSH plugin manager (I use my own simple one vtplug)

You can as well simply git clone this repository and source the zsh-select-with-lf.plugin.zsh file if you want to do this just manually.

Requirements

Only lf is needed.

Usage

Just do C-x C-l to select a directory and C-x l (C-x mean control and x) it will start lf and put the result file or directory on your command line.

For files you need to select the files and press enter, for the directories you need to navigate to the directory and press q to quit lf.

This plugin will try to do the right thing if you have a file or a directory on the current word to have lf initially started on the right directory.

Configuration

You can customize some variables

  • ZSH_SELECT_WITH_LF_FILE_BIND: The keybinding to use to select files default to "^x^f"
  • ZSH_SELECT_WITH_LF_DIR_BIND: The keybinding to use to select directories default to "^x^f"

Copyright

Apache-2.0

Authors

Chmouel Boudjnah

Alternative

The wiki list another method on how to do this: https://github.com/gokcehan/lf/wiki/Integrations#zsh-file-picker--directory-changer

About

Zsh plugin to select a file or directory with LF

License:Apache License 2.0


Languages

Language:Shell 100.0%