Convert Figma logo to code with AI

lambdalisue logovim-fern

🌿 General purpose asynchronous tree viewer written in Pure Vim script

1,305
49
1,305
22

Top Related Projects

19,922

A tree explorer plugin for vim.

File manager for Neovim. Better than NERDTree.

Neovim plugin to manage the file system and other tree like structures.

A file explorer tree for neovim written in lua

Quick Overview

The vim-fern project is a file explorer plugin for the Vim text editor. It provides a modern and customizable file management experience within the Vim environment, allowing users to navigate, open, and manage files and directories.

Pros

  • Customizable: The plugin offers a high degree of customization, allowing users to tailor the file explorer to their specific needs and preferences.
  • Efficient Navigation: The file explorer provides a fast and responsive navigation experience, with features like fuzzy search and directory bookmarking.
  • Integrated with Vim: The plugin is tightly integrated with the Vim ecosystem, leveraging Vim's powerful editing capabilities and key bindings.
  • Extensible: The plugin is designed to be extensible, with support for various plugins and integrations to enhance its functionality.

Cons

  • Learning Curve: The plugin may have a steeper learning curve compared to some other file explorer plugins, as it offers a more feature-rich and customizable experience.
  • Performance: While generally responsive, the plugin may experience some performance issues on large file systems or with a large number of files.
  • Compatibility: The plugin may not be compatible with all Vim configurations or plugins, requiring some setup and troubleshooting.
  • Documentation: The project's documentation, while comprehensive, could be improved in terms of organization and clarity for new users.

Code Examples

N/A (This is not a code library)

Getting Started

N/A (This is not a code library)

Competitor Comparisons

19,922

A tree explorer plugin for vim.

Pros of NERDTree

  • Well-established and widely adopted in the Vim community
  • Extensive documentation and user support
  • Rich set of features, including bookmarks and filters

Cons of NERDTree

  • Slower performance, especially with large directory structures
  • Less integration with native Vim features
  • More complex codebase, making it harder to customize or extend

Code Comparison

NERDTree:

let g:NERDTreeShowHidden = 1
let g:NERDTreeMinimalUI = 1
let g:NERDTreeIgnore = []
let g:NERDTreeStatusline = ''

Fern:

let g:fern#default_hidden = 1
let g:fern#default_exclude = ''
let g:fern#disable_default_mappings = 1

Key Differences

  • Fern is designed to be more lightweight and faster than NERDTree
  • Fern integrates better with native Vim features like netrw
  • NERDTree has a larger user base and more extensive documentation
  • Fern's codebase is more modular and easier to extend
  • NERDTree offers more built-in features out of the box

Performance

Fern generally outperforms NERDTree, especially when dealing with large directory structures or on slower systems. This is due to its more efficient design and better integration with Vim's native features.

Customization

While both plugins are customizable, Fern's modular architecture makes it easier to extend and modify. NERDTree's extensive feature set can sometimes make customization more complex.

Community Support

NERDTree has a larger and more established community, which can be beneficial for finding solutions to problems or getting help. However, Fern is gaining popularity and has an active development community.

File manager for Neovim. Better than NERDTree.

Pros of chadtree

  • Faster performance due to being written in Python
  • More extensive feature set, including git integration and advanced filtering
  • Highly customizable with a wide range of configuration options

Cons of chadtree

  • Requires Python support in Vim/Neovim
  • Steeper learning curve due to more complex functionality
  • May be considered "heavier" compared to the lightweight nature of vim-fern

Code comparison

vim-fern configuration:

let g:fern#drawer_width = 30
let g:fern#default_hidden = 1
let g:fern#disable_default_mappings = 1

chadtree configuration:

let g:chadtree_settings = {
    \ 'view.width': 30,
    \ 'view.show_hidden': v:true,
    \ 'keymap.toggle_hidden': ['gh'],
    \ }

Both vim-fern and chadtree are file explorer plugins for Vim/Neovim, but they differ in their approach and feature set. vim-fern is a lightweight, pure Vimscript solution that focuses on simplicity and compatibility. It provides basic file exploration functionality with a clean interface.

chadtree, on the other hand, is a more feature-rich alternative written in Python. It offers advanced capabilities like git integration, fuzzy finding, and extensive customization options. While this makes chadtree more powerful, it also increases complexity and requires Python support.

The choice between the two depends on the user's needs and preferences. vim-fern is ideal for those seeking a simple, lightweight file explorer, while chadtree caters to users who want more advanced features and are willing to invest time in learning and configuring the plugin.

Neovim plugin to manage the file system and other tree like structures.

Pros of neo-tree.nvim

  • Built specifically for Neovim, leveraging its features and APIs
  • Highly customizable with extensive configuration options
  • Supports multiple sources (filesystem, buffers, git status) in a unified interface

Cons of neo-tree.nvim

  • Requires Neovim 0.5+ and Lua knowledge for configuration
  • May have a steeper learning curve due to its advanced features
  • Potentially heavier resource usage compared to vim-fern

Code Comparison

vim-fern:

let g:fern#drawer_width = 30
let g:fern#default_hidden = 1
nnoremap <leader>f :Fern . -drawer -toggle<CR>

neo-tree.nvim:

require("neo-tree").setup({
  window = {
    width = 30,
    mappings = {
      ["<leader>f"] = "toggle",
    },
  },
  filesystem = {
    filtered_items = {
      visible = false,
      hide_dotfiles = false,
    },
  },
})

Summary

vim-fern is a more traditional Vim plugin, written in VimScript and compatible with both Vim and Neovim. It offers a simpler setup and may be more suitable for users who prefer a lightweight, straightforward file explorer.

neo-tree.nvim is a modern, feature-rich file explorer designed exclusively for Neovim. It provides advanced functionality and extensive customization options, making it ideal for users who want a powerful, integrated solution and are comfortable with Lua-based configuration.

The choice between the two depends on your specific needs, Neovim usage, and preference for simplicity versus advanced features.

A file explorer tree for neovim written in lua

Pros of nvim-tree.lua

  • Written in Lua, which is faster and more efficient for Neovim
  • More extensive customization options and features
  • Active development with frequent updates and new features

Cons of nvim-tree.lua

  • Requires Neovim 0.5+, not compatible with Vim
  • Steeper learning curve due to more complex configuration
  • May have more dependencies and potential conflicts with other plugins

Code Comparison

nvim-tree.lua configuration:

require'nvim-tree'.setup {
  auto_close = true,
  view = {
    width = 30,
  }
}

vim-fern configuration:

let g:fern#drawer_width = 30
let g:fern#default_hidden = 1

Summary

nvim-tree.lua is a powerful, feature-rich file explorer specifically designed for Neovim, offering extensive customization options and frequent updates. However, it requires Neovim 0.5+ and may have a steeper learning curve.

vim-fern is a more lightweight and versatile option that works with both Vim and Neovim, providing a simpler configuration process and broader compatibility. It may have fewer advanced features compared to nvim-tree.lua but offers a solid, stable experience for users of both editors.

Choose based on your preferred editor, desired features, and comfort level with configuration complexity.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

🌿 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

Split windows (netrw style)
nerdfont.vim / glyph-palette.vim / fern-renderer-nerdfont.vim / fern-git-status.vim

Project drawer (NERDTree style)
nerdfont.vim / glyph-palette.vim / fern-renderer-nerdfont.vim / fern-git-status.vim

See Screenshots for more screenshots.

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


🔍 Click here to find fern plugins 🔍


Concept

  • Supports both Vim and Neovim without any external dependencies
  • Support split windows and project drawer explained in this article
  • Provide features as actions so that user don't have to remember mappings
  • Make operation asynchronous as much as possible to keep latency
  • User experience is more important than simplicity (maintainability)
  • Customizability is less important than simplicity (maintainability)
  • Easy to create 3rd party plugins to support any kind of trees

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

  • Netrw hijack (Use fern as a default file explorer)
  • Nerd Fonts integration
  • Git integration (show status, touch index, ...)
  • Bookmark feature

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.