zsh + fzf for filesystem navigation.
This is a zsh plugin to facilitate two use cases:
cdto commonly visited directories.- Open in
$EDITORcommonly visited files.
After sourcing the plugin this keybind is set:
- Ctrl-t List configured directories and files in fzf.
-
Install fzf.
-
Clone the zsh-git repository by executing the below command:
git clone 'https://github.com/hernancerm/zsh-trampoline.git' \ "${HOME}/.zsh-trampoline/zsh-trampoline"
-
Source the plugin (also add command to your
~/.zshrcto enable on future sessions):source "${HOME}/.zsh-trampoline/zsh-trampoline"
OR: If you want to set a custom keybind then use:
ZT_SET_KEYBINDS=0 source "${HOME}/.zsh-trampoline/zsh-trampoline" bindkey "^t" zt-jump
OR: If you use jeffreytse/zsh-vi-mode:
ZT_SET_KEYBINDS=0 source "${HOME}/.zsh-trampoline/zsh-trampoline" function zvm_after_init { zvm_define_widget zt-jump zvm_bindkey viins "^t" zt-jump }
With Sheldon:
[plugins.zsh-trampoline]
github = "hernancerm/zsh-trampoline"
# File: ~/.config/sheldon/plugins.toml# Source plugins.
eval "$(sheldon source)"
# File: ~/.zshrczsh-trampoline supports two config files:
~/.zt~/.zt.local(for what you don't want to commit to source control.)
The configs are merged in order, no overrides. I recommend using the first config file for common dirs/files in your setup, while the second config file for sensitive or machine-specific dirs/files. Both files share the same syntax.
Example contents of the config file:
~/dev/work
~/dev/temp:0
~/dev/Some Dir With Spaces:0
~/dev/Another Dir With Spaces
${HISTFILE}
$HOME/foo/
Explanation of the config file's syntax:
- Each line has the absolute path of one directory or one file.
- By default, directories are expanded to their level-1 sub-dirs.
- Directories may be suffixed with
:0to list the dir itself instead of its level-1 sub-dirs. - Paths containing a colon (
:) character are not supported. - The tilde (
~) character is expanded to the user home directory. - Environment variables are supported.