Skip to content

Commit 71e230a

Browse files
committed
Test fern
1 parent 6c2b68a commit 71e230a

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

vim/init.vim

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ else
4141
Plug 'nvim-lua/completion-nvim'
4242
Plug 'steelsojka/completion-buffers'
4343
endif
44+
Plug 'lambdalisue/fern.vim'
4445
call plug#end()
4546

4647
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -429,7 +430,7 @@ let g:fzf_tags_prompt = "Gd "
429430

430431
" Indentline
431432
let g:indentLine_char = ''
432-
let g:indentLine_fileTypeExclude = ['defx']
433+
let g:indentLine_fileTypeExclude = ['defx', 'fern']
433434

434435
" Vim test
435436
let test#strategy = "asyncrun"
@@ -563,3 +564,49 @@ augroup RubySpecialKeywordCharacters
563564
augroup END
564565

565566
lua require("lsp_config")
567+
568+
" Fern
569+
let g:fern#disable_default_mappings = 1
570+
let g:fern#renderer#default#root_symbol = '[root] '
571+
let g:fern#renderer#default#leading = ' '
572+
let g:fern#renderer#default#leaf_symbol = ' '
573+
let g:fern#renderer#default#collapsed_symbol = ''
574+
let g:fern#renderer#default#expanded_symbol = ''
575+
576+
nnoremap <C-b> :Fern . -drawer<CR>
577+
function! s:init_fern() abort
578+
nmap <nowait><buffer> d <Plug>(fern-action-remove)
579+
nmap <nowait><buffer> c <Plug>(fern-action-clipboard-copy)
580+
nmap <buffer> x <Plug>(fern-action-clipboard-move)
581+
nmap <buffer> p <Plug>(fern-action-clipboard-paste)
582+
nmap <buffer> o <Plug>(fern-action-open-or-expand)
583+
nmap <buffer> i <Plug>(fern-action-collapse)
584+
nmap <buffer> l <Plug>(fern-action-open-or-enter)
585+
nmap <buffer> h <Plug>(fern-action-leave)
586+
nmap <buffer> m <Plug>(fern-action-new-path)
587+
nmap <buffer> v <Plug>(fern-action-mark:toggle)
588+
nmap <buffer> V <Plug>(fern-action-mark:clear)
589+
nmap <buffer> r <Plug>(fern-action-rename)
590+
nmap <buffer> H <Plug>(fern-action-hidden:toggle)
591+
nmap <buffer> fi <Plug>(fern-action-include)
592+
nmap <buffer> <CR> <Plug>(fern-action-open-or-expand)
593+
nmap <buffer> <C-C> <Plug>(fern-action-cancel)
594+
nmap <buffer> q :<C-u>quit<CR>
595+
endfunction
596+
597+
augroup fern-custom
598+
autocmd! *
599+
autocmd FileType fern call s:init_fern()
600+
augroup END
601+
602+
nnoremap <silent> <Leader>ee :Fern . -drawer -reveal=%<CR>
603+
604+
function! s:on_highlight() abort
605+
highlight link FernRootSymbol Comment
606+
highlight link FernRootText Statement
607+
endfunction
608+
609+
augroup MyFernHighlight
610+
autocmd!
611+
autocmd User FernHighlight call s:on_highlight()
612+
augroup END

0 commit comments

Comments
 (0)