Skip to content

hellolzc/vim-fern-symlink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fern-symlink.vim

fern plugin MIT License Doc

fern-symlink is a fern.vim plugin that decorates symbolic-link entries in the tree drawer by appending -> <resolved-target> after the file name, and highlights the arrow and target with dedicated syntax groups.

 src/
   config.vim
   main.vim
 bin -> ../build/bin/
 latest.log -> /var/log/app/2026-04-21.log

Requirements

Installation

Install with your favorite plugin manager. For vim-plug:

Plug 'lambdalisue/vim-fern'
Plug 'hellolzc/vim-fern-symlink'

Usage

Just install the plugin. Any symbolic link encountered in the fern drawer will be decorated automatically.

Configuration

All variables are optional; defaults are shown below. Set them in your vimrc before the plugin loads (or at any time before the first fern redraw).

" Disable automatic initialization on VimEnter.
" If set, you must call fern_symlink#init() manually.
let g:fern_symlink_disable_startup = 0

" Append " -> <target>" to symlink labels.
let g:fern_symlink#show_target = 1

" Arrow glyph inserted between the name and the target.
let g:fern_symlink#arrow = ' -> '

" fnamemodify() modifier applied to the resolved target path.
" ':~' abbreviates $HOME to ~. Use ':.' for a cwd-relative path, or
" '' for the raw absolute path.
let g:fern_symlink#target_modifier = ':~'

Unicode arrow

If your font supports it and you prefer a fancier arrow:

let g:fern_symlink#arrow = ''

Highlight groups

Group Default Purpose
FernSymlinkArrow Comment The arrow glyph.
FernSymlinkTarget Comment The target path.

Override in your vimrc:

highlight FernSymlinkTarget ctermfg=51 guifg=#00d7ff cterm=italic gui=italic

How it works

On each viewer:redraw hook emitted by fern, the plugin walks helper.fern.visible_nodes, calls getftype() + resolve() on each node's _path, and rewrites node.label once per node. A buffer-local processing flag prevents recursive redraws, and a per-node _fern_symlink_done flag prevents duplicate decoration.

Because the plugin touches label rather than badge, it coexists with fern-git-status.vim without stepping on its output.

License

MIT. See LICENSE.

About

Symbolic link decoration for vim-fern

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors