All Projects → wvanlint → Twf

wvanlint / Twf

Standalone tree view file explorer, inspired by fzf.

Programming Languages

go
31211 projects - #10 most used programming language
bash
514 projects

Projects that are alternatives of or similar to Twf

Fzf
🌸 A command-line fuzzy finder
Stars: ✭ 40,965 (+20800.51%)
Mutual labels:  fzf, cli, zsh, unix, neovim
Data Science At The Command Line
Data Science at the Command Line
Stars: ✭ 3,174 (+1519.39%)
Mutual labels:  cli, unix, zsh
dotfiles
dotfiles of my linux setup
Stars: ✭ 25 (-87.24%)
Mutual labels:  zsh, neovim, nvim
Init.nvim
An Opinionated Neovim Config for the Minimalists
Stars: ✭ 194 (-1.02%)
Mutual labels:  fzf, neovim, nvim
Geo
🌎 A Bash utility for easy wan, lan, router, dns, mac address, and geolocation output, with clean stdout for piping
Stars: ✭ 225 (+14.8%)
Mutual labels:  cli, zsh, unix
dotfiles
🚀 tmux, ohmyzsh, powerlevel10k, neovim 🔧
Stars: ✭ 24 (-87.76%)
Mutual labels:  zsh, neovim, nvim
Dotfiles
My dotfiles 🚀. Includes configs for neovim, tmux, zsh, alacritty and more.
Stars: ✭ 47 (-76.02%)
Mutual labels:  fzf, zsh, neovim
Zoxide
A smarter cd command. Supports all major shells.
Stars: ✭ 4,422 (+2156.12%)
Mutual labels:  fzf, cli, zsh
Dotfiles
🏠
Stars: ✭ 60 (-69.39%)
Mutual labels:  zsh, neovim, nvim
Dotfiles
Workstation configuration, provisioning and tools
Stars: ✭ 67 (-65.82%)
Mutual labels:  fzf, zsh, neovim
Dotfiles
💻 Use command line interface manager for macOS configuration.
Stars: ✭ 97 (-50.51%)
Mutual labels:  cli, zsh, neovim
Jarvis
Dotfiles for a powerful, web development-focused environment powered by Neovim, iTerm2, tmux, and zsh
Stars: ✭ 617 (+214.8%)
Mutual labels:  fzf, zsh, neovim
Luneta
command-line fuzzy finder
Stars: ✭ 49 (-75%)
Mutual labels:  cli, zsh, unix
Forgit
💤 A utility tool powered by fzf for using git interactively.
Stars: ✭ 1,823 (+830.1%)
Mutual labels:  fzf, cli, zsh
Enhancd
🚀 A next-generation cd command with your interactive filter
Stars: ✭ 2,049 (+945.41%)
Mutual labels:  fzf, cli, zsh
Dotfiles
vim, zsh, git, homebrew, nvm, neovim - my whole world
Stars: ✭ 2,217 (+1031.12%)
Mutual labels:  zsh, neovim
Vim Subversive
Vim plugin providing operator motions to quickly replace text
Stars: ✭ 168 (-14.29%)
Mutual labels:  neovim, nvim
Kommentary
Neovim commenting plugin, written in lua.
Stars: ✭ 172 (-12.24%)
Mutual labels:  neovim, nvim
Dotfiles
~/.dotfiles
Stars: ✭ 177 (-9.69%)
Mutual labels:  zsh, unix
Z.lua
⚡ A new cd command that helps you navigate faster by learning your habits.
Stars: ✭ 2,164 (+1004.08%)
Mutual labels:  fzf, zsh

twf - Tree View Find

twf is a standalone tree view explorer inspired by fzf.

Features

  • Standalone, usable from vim, the shell or any other program.
  • Locate files through external programs such as fzf.
  • Customizable previews.
  • Optional inline display in the shell.

Installation

Using Homebrew

brew install --HEAD wvanlint/twf/twf

Using Go

Install Go, and ensure that $GOPATH/bin is added to the $PATH.

export GOPATH="$HOME/go"
export PATH="$PATH:$HOME/bin:$GOPATH/bin"

Install the Go binary.

go get -u github.com/wvanlint/twf/cmd/twf

Integrations

In .zshrc

twf-widget() {
  local selected=$(twf --height=0.5)
  BUFFER="$BUFFER$selected"
  zle reset-prompt
  zle end-of-line
  return $ret
}
zle -N twf-widget
bindkey '^T' twf-widget

In .vimrc

function! Twf()
  let temp = tempname()
  execute 'silent ! twf ' . @% . ' > ' . temp
  redraw!
  try
    let out = filereadable(temp) ? readfile(temp) : []
  finally
    silent! call delete(temp)
  endtry
  if !empty(out)
    execute 'edit! ' . out[0]
  endif
endfunction

nnoremap <silent> <Space>t :call Twf()<CR>

In .config/nvim/init.vim

function! TwfExit(path)
  function! TwfExitClosure(job_id, data, event) closure
    bd!
    try
      let out = filereadable(a:path) ? readfile(a:path) : []
    finally
      silent! call delete(a:path)
    endtry
    if !empty(out)
      execute 'edit! ' . out[0]
    endif
  endfunction
  return funcref('TwfExitClosure')
endfunction

function! Twf()
  let temp = tempname()
  call termopen('twf ' . @% . ' > ' . temp, { 'on_exit': TwfExit(temp) })
  startinsert
endfunction

nnoremap <silent> <Space>t :call Twf()<CR>

Usage

twf [flags...] [path]

The binary twf will output the path that you select in the tree view, so it is usable in scripts and from other programs. For example, you can try the following commands:

cat $(twf)
cat $(twf --height=0.5)
vim $(twf)

It is also possible to locate and highlight a file given as an argument.

twf path/to/subdir/file

Default keybindings

  • j: Move down.
  • k: Move up.
  • ctrl-j: Move preview down.
  • ctrl-k: Move preview up.
  • p: Move to parent.
  • P: Move to parent and collapse.
  • o: Expand/collapse directory.
  • O: Recursively expand/collapse directory.
  • Enter: Select file and exit.
  • /: Use an external program (fzf by default) to find a file and highlight it in the tree.

Flags

  • -bind <keybindings>: Keybindings for command sequences.

    This takes the following format:

    <keybindings> = <key>::<commands>[,<keybindings>]
    <key>         = "ctrl-a" | "a" | "esc" | ...
    <commands>    = <command>[;<command>]...
    <command>     = "tree:open" | "quit" | ...
    

    For example: k::tree:prev,j::tree:next,enter::tree:selectPath;quit. See below for the possible keys and commands.

  • -dir <dir>: Root directory to browse.

  • -graphics <graphicMappings>: Graphics per type of text span.

    This takes the following format:

    <graphicMappings> = <graphicMapping>[,<graphicMappings>]
    <graphicsMapping> = <span>::<graphics>
    <span>            = tree:cursor | tree:dir
    <graphics>        = <graphic>[,<graphics>]
    <graphic>         = reverse | bold
    <graphic>         = fg#<color> | bg#<color>
    <color>           = black | red | green | yellow | blue | magenta | cyan | white | brightred | ...
    <color>           = 0-255
    <color>           = <R><G><B>  # In hexadecimal
    
  • -height <float>: Proportion (between 0.0 and 1.0) of the vertical space of the terminal to take up. If equal to 1.0, an alternative buffer will be used.

  • -locateCmd <str>: The command whose output will be interpreted as a path to locate in the file tree, when called via the '/' key binding.

  • -loglevel <level>: Logging priority. Empty disables logging. Follows the notation here.

  • -preview <bool>: Enable/disable previews.

  • -previewCmd <str>: Command to create preview of a file. The sequence {} serves as a placeholder for the path to preview.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].