Home

Awesome

🌿 vim-fern

Support Vim 8.2.5136 or above Support Neovim 0.4.4 or above Powered by vital.vim Powered by vital-Whisky MIT License Doc Doc (dev) reviewdog vim neovim

<p align="center"> <strong>Split windows (netrw style)</strong><br> <sup> <a href="https://github.com/lambdalisue/nerdfont.vim" target="_blank">nerdfont.vim</a> / <a href="https://github.com/lambdalisue/glyph-palette.vim" target="_blank">glyph-palette.vim</a> / <a href="https://github.com/lambdalisue/fern-renderer-nerdfont.vim" target="_blank">fern-renderer-nerdfont.vim</a> / <a href="https://github.com/lambdalisue/fern-git-status.vim" target="_blank">fern-git-status.vim</a> </sup> <img src="https://user-images.githubusercontent.com/546312/90719223-cdbc8780-e2ee-11ea-8a6e-ea837a194ffa.png"> </p> <p align="center"> <strong>Project drawer (NERDTree style)</strong><br> <sup> <a href="https://github.com/lambdalisue/nerdfont.vim" target="_blank">nerdfont.vim</a> / <a href="https://github.com/lambdalisue/glyph-palette.vim" target="_blank">glyph-palette.vim</a> / <a href="https://github.com/lambdalisue/fern-renderer-nerdfont.vim" target="_blank">fern-renderer-nerdfont.vim</a> / <a href="https://github.com/lambdalisue/fern-git-status.vim" target="_blank">fern-git-status.vim</a> </sup> <img src="https://user-images.githubusercontent.com/546312/90719227-ceedb480-e2ee-11ea-98c5-0b7cbcb1bb6a.png"> </p> <p align="right"> <sup> See <a href="https://github.com/lambdalisue/vim-fern/wiki/Screenshots" target="_blank">Screenshots</a> for more screenshots. </sup> </p>

Fern (furn) is a general purpose asynchronous tree viewer written in pure Vim script.


<p align="center"> <strong>🔍 <a href="https://github.com/topics/fern-vim-plugin">Click here to find fern plugins</a> 🔍</strong> </p>

Concept

Installation

vim-fern has no extra dependencies so use your favorite Vim plugin manager or see How to install page for detail.

Usage

Command (Split windows)

Screencast of Split windows

Open fern on a current working directory by:

:Fern .

Or open fern on a parent directory of a current buffer by:

:Fern %:h

Or open fern on a current working directory with a current buffer focused by:

:Fern . -reveal=%

The following options are available for fern viewer.

OptionDefaultDescription
-openereditAn opener to open the buffer. See :help fern-opener for detail.
-revealRecursively expand branches and focus the node. See :help fern-reveal for detail.
-stayStay focus on the window where the command has called.
-waitWait synchronously until the fern viewer become ready.
:Fern {url} [-opener={opener}] [-reveal={reveal}] [-stay] [-wait]

Command (Project drawer)

Screencast of Project drawer

All usage above open fern as split windows style. To open fern as project drawer style, use -drawer option like:

:Fern . -drawer

A fern window with project drawer style always appeared to the most left side of Vim and behaviors of some mappings/actions are slightly modified (e.g. a buffer in the next window will be used as an anchor buffer in a project drawer style to open a new buffer.)

Note that additional to the all options available for split windows style, project drawer style enables the following options:

OptionDefaultDescription
-width30The width of the project drawer window
-keepDisable to quit Vim when there is only one project drawer buffer
-toggleClose existing project drawer rather than focus
:Fern {url} -drawer [-opener={opener}] [-reveal={reveal}] [-stay] [-wait] [-width=30] [-keep] [-toggle]

Actions

To execute actions, hit a on a fern buffer and input an action to perform. To see all actions available, hit ? or execute help action then all available actions will be listed.

Actions

Window selector

The open:select action open a prompt to visually select window to open a node. This feature is strongly inspired by t9md/vim-choosewin.

Window selector

Renamer action (A.k.a exrename)

The rename action open a new buffer with path of selected nodes. Users can edit that buffer and :w applies the changes. This feature is strongly inspired by shougo/vimfiler.vim.

Renamer

Plugins

Users

Most of functionalities are provided as plugins in fern. So visit Github topics of fern-vim-plugin or Plugins page to find fern plugins to satisfy your wants.

For example, following features are provided as official plugins

And lot more!

Developers

Please add fern-vim-plugin topic to your fern plugin. The topic is used to list up 3rd party fern plugins.

Then please add a following badge to indicate that your plugin is for fern.

[![fern plugin](https://img.shields.io/badge/🌿%20fern-plugin-yellowgreen)](https://github.com/lambdalisue/vim-fern)

Customize

Use FileType fern autocmd to execute initialization scripts for fern buffer like:

function! s:init_fern() abort
  " Use 'select' instead of 'edit' for default 'open' action
  nmap <buffer> <Plug>(fern-action-open) <Plug>(fern-action-open:select)
endfunction

augroup fern-custom
  autocmd! *
  autocmd FileType fern call s:init_fern()
augroup END

The FileType autocmd will be invoked AFTER a fern buffer has initialized but BEFORE contents of a buffer become ready. So avoid accessing actual contents in the above function.

See Tips pages to find tips, or write pages to share your tips ;-)

Contribution

Any contribution including documentations are welcome.

Contributors who change codes should install thinca/vim-themis to run tests before complete a PR. PRs which does not pass tests won't be accepted.

License

The code in vim-fern follows MIT license texted in LICENSE. Contributors need to agree that any modifications sent in this repository follow the license.