{"id":13537577,"url":"https://github.com/wvanlint/twf","last_synced_at":"2025-04-10T03:53:46.601Z","repository":{"id":48596149,"uuid":"244303110","full_name":"wvanlint/twf","owner":"wvanlint","description":"Standalone tree view file explorer, inspired by fzf.","archived":false,"fork":false,"pushed_at":"2021-12-03T23:11:16.000Z","size":636,"stargazers_count":273,"open_issues_count":7,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T03:53:38.373Z","etag":null,"topics":["bash","cli","fzf","go","neovim","nvim","unix","vim","zsh"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wvanlint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-02T07:04:41.000Z","updated_at":"2025-04-03T01:00:40.000Z","dependencies_parsed_at":"2022-08-27T20:08:09.354Z","dependency_job_id":null,"html_url":"https://github.com/wvanlint/twf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanlint%2Ftwf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanlint%2Ftwf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanlint%2Ftwf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvanlint%2Ftwf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wvanlint","download_url":"https://codeload.github.com/wvanlint/twf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154999,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","cli","fzf","go","neovim","nvim","unix","vim","zsh"],"created_at":"2024-08-01T09:01:00.640Z","updated_at":"2025-04-10T03:53:46.574Z","avatar_url":"https://github.com/wvanlint.png","language":"Go","readme":"twf - Tree View Find\n===\n\ntwf is a standalone tree view explorer inspired by [fzf](https://github.com/junegunn/fzf).\n\n\u003cimg src=\"screenshot.png\" width=640\u003e\n\nFeatures\n--------\n\n- Standalone, usable from vim, the shell or any other program.\n- Locate files through external programs such as fzf.\n- Customizable previews.\n- Optional inline display in the shell.\n\nInstallation\n------------\n\n### Using [Homebrew](https://brew.sh/)\n\n```sh\nbrew install --HEAD wvanlint/twf/twf\n```\n\n### Using Go\n\nInstall Go, and ensure that `$GOPATH/bin` is added to the `$PATH`.\n\n```sh\nexport GOPATH=\"$HOME/go\"\nexport PATH=\"$PATH:$HOME/bin:$GOPATH/bin\"\n```\n\nInstall the Go binary.\n\n```sh\ngo get -u github.com/wvanlint/twf/cmd/twf\n```\n\nIntegrations\n------------\n\n### In .zshrc\n\n```sh\ntwf-widget() {\n  local selected=$(twf --height=0.5)\n  BUFFER=\"$BUFFER$selected\"\n  zle reset-prompt\n  zle end-of-line\n  return $ret\n}\nzle -N twf-widget\nbindkey '^T' twf-widget\n```\n\n### In .vimrc\n\n```vim\nfunction! Twf()\n  let temp = tempname()\n  execute 'silent ! twf ' . @% . ' \u003e ' . temp\n  redraw!\n  try\n    let out = filereadable(temp) ? readfile(temp) : []\n  finally\n    silent! call delete(temp)\n  endtry\n  if !empty(out)\n    execute 'edit! ' . out[0]\n  endif\nendfunction\n\nnnoremap \u003csilent\u003e \u003cSpace\u003et :call Twf()\u003cCR\u003e\n```\n\n### In .config/nvim/init.vim\n\n```vim\nfunction! TwfExit(path)\n  function! TwfExitClosure(job_id, data, event) closure\n    bd!\n    try\n      let out = filereadable(a:path) ? readfile(a:path) : []\n    finally\n      silent! call delete(a:path)\n    endtry\n    if !empty(out)\n      execute 'edit! ' . out[0]\n    endif\n  endfunction\n  return funcref('TwfExitClosure')\nendfunction\n\nfunction! Twf()\n  let temp = tempname()\n  call termopen('twf ' . @% . ' \u003e ' . temp, { 'on_exit': TwfExit(temp) })\n  startinsert\nendfunction\n\nnnoremap \u003csilent\u003e \u003cSpace\u003et :call Twf()\u003cCR\u003e\n```\n\nUsage\n-----\n\n```sh\ntwf [flags...] [path]\n```\n\nThe binary `twf` will output the path that you select in the tree view, so it is usable in scripts and from other programs.\nFor example, you can try the following commands:\n\n```sh\ncat $(twf)\ncat $(twf --height=0.5)\nvim $(twf)\n```\n\nIt is also possible to locate and highlight a file given as an argument.\n\n```sh\ntwf path/to/subdir/file\n```\n\n### Default keybindings\n\n- `j`: Move down.\n- `k`: Move up.\n- `ctrl-j`: Move preview down.\n- `ctrl-k`: Move preview up.\n- `p`: Move to parent.\n- `P`: Move to parent and collapse.\n- `o`: Expand/collapse directory.\n- `O`: Recursively expand/collapse directory.\n- `Enter`: Select file and exit.\n- `/`: Use an external program ([fzf](https://github.com/junegunn/fzf) by default) to find a file and highlight it in the tree.\n\n### Flags\n\n- `-autoexpandDepth \u003cdepth\u003e`: Depth to which directories should be automatically expanded at startup. If `-1`, depth is unlimited. The default is `1`, meaning only the root should be expanded.\n- `-autoexpandIgnore \u003cregexp\u003e`: Regular expression matching paths to ignore when auto-expanding directories at startup. Each path that's tested against the regex is relative to the twf root and does not begin with `/` or `./`, e.g. `foo/bar/qux`.\n\n  For example, `^(\\.git|internal/filetree/testdata)$` would ignore the `.git` directory at the root level as well as the `internal/filetree/testdata` directory.\n\n- `-bind \u003ckeybindings\u003e`: Keybindings for command sequences.\n\n  This takes the following format:\n  ```\n  \u003ckeybindings\u003e = \u003ckey\u003e::\u003ccommands\u003e[,\u003ckeybindings\u003e]\n  \u003ckey\u003e         = \"ctrl-a\" | \"a\" | \"esc\" | ...\n  \u003ccommands\u003e    = \u003ccommand\u003e[;\u003ccommand\u003e]...\n  \u003ccommand\u003e     = \"tree:open\" | \"quit\" | ...\n  ```\n  For example: `k::tree:prev,j::tree:next,enter::tree:selectPath;quit`.\n  See below for the possible keys and commands.\n\n- `-dir \u003cdir\u003e`: Root directory to browse.\n- `-graphics \u003cgraphicMappings\u003e`: Graphics per type of text span.\n\n  This takes the following format:\n  ```\n  \u003cgraphicMappings\u003e = \u003cgraphicMapping\u003e[,\u003cgraphicMappings\u003e]\n  \u003cgraphicsMapping\u003e = \u003cspan\u003e::\u003cgraphics\u003e\n  \u003cspan\u003e            = tree:cursor | tree:dir\n  \u003cgraphics\u003e        = \u003cgraphic\u003e[,\u003cgraphics\u003e]\n  \u003cgraphic\u003e         = reverse | bold\n  \u003cgraphic\u003e         = fg#\u003ccolor\u003e | bg#\u003ccolor\u003e\n  \u003ccolor\u003e           = black | red | green | yellow | blue | magenta | cyan | white | brightred | ...\n  \u003ccolor\u003e           = 0-255\n  \u003ccolor\u003e           = \u003cR\u003e\u003cG\u003e\u003cB\u003e  # In hexadecimal\n  ```\n- `-height \u003cfloat\u003e`: 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.\n- `-locateCmd \u003cstr\u003e`: The command whose output will be interpreted as a path to locate in the file tree, when called via the '/' key binding.\n- `-loglevel \u003clevel\u003e`: Logging priority. Empty disables logging. Follows the notation [here](https://godoc.org/go.uber.org/zap/zapcore#Level.UnmarshalText).\n- `-preview \u003cbool\u003e`: Enable/disable previews.\n- `-previewCmd \u003cstr\u003e`: Command to create preview of a file. The sequence `{}` serves as a placeholder for the path to preview.\n","funding_links":[],"categories":["Go","Other","\u003ca name=\"file-explorer\"\u003e\u003c/a\u003eFile explorer and tree visualization"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvanlint%2Ftwf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwvanlint%2Ftwf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvanlint%2Ftwf/lists"}