Skip to content

hernancerm/zsh-trampoline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

127 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh-trampoline

zsh + fzf for filesystem navigation.

What is this?

This is a zsh plugin to facilitate two use cases:

  1. cd to commonly visited directories.
  2. Open in $EDITOR commonly visited files.

After sourcing the plugin this keybind is set:

  • Ctrl-t List configured directories and files in fzf.

Installation

Without a plugin manager

  1. Install fzf.

  2. Clone the zsh-git repository by executing the below command:

    git clone 'https://github.com/hernancerm/zsh-trampoline.git' \
      "${HOME}/.zsh-trampoline/zsh-trampoline"
  3. Source the plugin (also add command to your ~/.zshrc to 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 a plugin manager

With Sheldon:

[plugins.zsh-trampoline]
github = "hernancerm/zsh-trampoline"

# File: ~/.config/sheldon/plugins.toml
# Source plugins.
eval "$(sheldon source)"

# File: ~/.zshrc

Configuration file

zsh-trampoline supports two config files:

  1. ~/.zt
  2. ~/.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 :0 to 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.

Similar projects

About

zsh + fzf for filesystem navigation

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages