Giter Club home page Giter Club logo

vim-tree's Introduction

vim-tree

vim-tree integrates good old tree(1) into Vim and Nvim for all common operating systems.

The plugin provides a single command, :Tree, and has no options. It is perfect for quickly navigating and exploring complex directory hierarchies.

vim-tree in action

Installation

Use your favorite plugin manager. E.g. vim-plug:

Plug 'mhinz/vim-tree'

Then restart Vim and :PlugInstall.

Dependencies

tree needs to be installed.

Ubuntu/Debian

$ sudo apt-get install tree

macOS

$ brew install tree

Windows

  1. Download the win32 tree binary zip archive and unzip it.
  2. Move tree.exe from the bin directory to the directory containing your vim.exe or nvim.exe. E.g. C:\Program Files (x86)\Vim\vim81\.

Usage

There are no options and only one command: :Tree.

That command defaults to tree -n -F --dirsfirst --noreport. It takes optional arguments that will simply be added to the default, so :Tree -a will run tree -n -F --dirsfirst --noreport -a.

Use ? in the tree buffer to get a list of all mappings.

A few tips:

  • For huge directories you might want to set a limit, e.g. :Tree -L 3.
  • If many files have spaces in their names, :Tree -Q might provide more readable output.

To keep a navigator-like window open:

:leftabove 40vnew | Tree

Then use p to open the current entry in the previous window.


To fold on directories:

autocmd FileType tree setlocal foldmethod=expr

Customization

  • The tree buffer sets the tree filetype.
  • tree#GetPath() returns the path of the current entry.

Stupid example:

autocmd FileType tree
      \ autocmd CursorMoved <buffer> execute 'pedit' tree#GetPath()

Now, every time you move the cursor to a file, it will be shown in the preview window.

Author and Feedback

If you like this plugin, star it! It's a great way of getting feedback. The same goes for reporting issues or feature requests.

vim-tree's People

Contributors

mhinz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

jrpat hupfdule

vim-tree's Issues

Weird character sequence appears if run from ~/.vim folder

This does not happen so far in any other folder... If I run :Tree from ~/.vim folder, then instead of clean box drawing lines, I see the following weird character sequence. This happens even if vim-tree is the only plugin I load, and happens with both vim and neovim.

��� UltiSnips/
�   ��� mail.snippets
�   ��� tex.snippets
��� after/
�   ��� ftplugin/
�       ��� mail.vim
�       ��� qf.vim
�       ��� rust.vim
�       ��� tex.vim
�       ��� vimwiki.vim
��� autoload/
�   ��� AnsiEsc.vim
�   ��� plug.vim
�   ��� plug.vim.old
��� bundle/
�   ��� autoload/
�   �   ��� vimwiki/
�   �       ��� base.vim

And here's the screenshot:

Screen Shot 2021-06-24 at 1 46 07 PM

Relevant information:

Vim 8.2 patches 1-2890 ARM64
NeoVim v0.5.0-dev+nightly-356-gb28d458f8 ARM64
macOS BigSur 11.4 ARM64
$TERM xterm-256color

mapping to `lcd` to the parent directory

vim-tree already provides a mapping for lcding to the selected directoy and calling :Tree with the same options again.

It would be nice to have a mapping for the opposite operation. lcding to the parent directory of the current one and calling :Tree with the same options again.

edit: Actually, I can think of two possible options to implement this.

  1. Always lcd to the parent directory of the current one
  2. Jump to the previous directory.
    Those options are different if the directory that was lcded to, is not a direct subdirectory of the previously shown one, but multiple levels deep (for example the CompilerIdC directory in the screencast. When lcdin to that directory and then "jumping back" we would be back at /data/github/neovim/neovim).

Spurious n gets appended as prefix to name of file before opening it

A spurious n gets appended as prefix to the file name before opening it, hence not really opens the intended file.

This does not happen from all directories. It happens in a git directory I have on my system: ~/Desktop/textfiles/grid-typesetting/. All important files worked upon in the video below are in that directory:

spurious_n.mp4

Nvim (same problem also occurs on latest vim):

NVIM v0.5.0-dev+nightly-298-g0a653f7ab
Build type: Release
LuaJIT 2.1.0-beta3

System:

macOS BigSur 11.4 ARM64 (Apple M1 chip)

Terminal (didn't try on other terminals):

iTerm2 (3.4.8. i.e. latest)

Folding directories

Hi,

Thanks for your plugin, it's really nice.
I think the ability to fold the directories would be very useful.

mapping to reload current tree with current options

It would be nice if there was a mapping to reload the current tree with the same options it was called orginally.

At the moment this must be done by calling :Tree again and manually adding those same options. A predefined mapping to just reuse the options from the last call would be handy.

Also it would be nice if the current scroll position would be retained when reloading the tree. What the correct scroll position is is open to discussion.

It may be the line the cursor is on (which probably would be the easiest solution, but may not be the perfect solution if the tree has changed much since the last call (many new or deleted files/directories).

Or it may be tied to the actual file or directory the cursor on currently on (which is more work, especially if the currently selected file/directory was renamed or removed)

As vim-tree supports folding, it would be nice, if it would possible to retain the current folds when reloading that way.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.