A simple plugin to let you select some files or a directory using lf
recording-20231007-23h11.mp4
Using Antigen
Bundle zsh-vi-mode in your .zshrc
antigen bundle chmouel/zsh-select-with-lfUsing 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-lfUsing zinit
Include the load command in your .zshrc
zinit ice depth=1
zinit light chmouel/zsh-select-with-lfNote: 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-lfThen 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-lfUsing Zap
Load zsh-vi-mode as a plugin in your .zshrc
plug "chmouel/zsh-select-with-lf"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.
Only lf is needed.
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.
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"
Chmouel Boudjnah
- Fediverse - <@chmouel@fosstodon.org>
- Twitter - <@chmouel>
- Blog - <https://blog.chmouel.com>
The wiki list another method on how to do this: https://github.com/gokcehan/lf/wiki/Integrations#zsh-file-picker--directory-changer