Skip to content

Vim search (next / previous, i.e. n / Shift-N) not working in fern.vim drawer #307

@victoriastuart

Description

@victoriastuart

Hello: I just (yesterday) started using fern.vim, as NERDtree was too slow opening large directories.

[netrw opened those large directories efficiently; however, while I appreciate the native simplicity of netrw, it lacks polish and features, e.g. decent bookmarking; other issues, e.g. navigation.]

In NERDtree, with a open directory I was able to [edit: using /-search in Vim] search a term, using the standard Vim mappings n | Shift-N to navigate through those matches.

How can I regain that search functionality in fern.vim?

My ~/.vimrc entries:

let g:fern#disable_default_mappings   =  1
let g:fern#disable_drawer_auto_quit   = 1
let g:fern#disable_viewer_hide_cursor = 1

noremap <silent> <C-n> :Fern . -drawer -width=75 -toggle<CR><C-w>=
noremap <silent> <Leader>f :Fern . -drawer -reveal=% -width=75<CR><C-w>=
noremap <silent> <Leader>. :Fern %:h -drawer -width=75<CR><C-w>=

function! FernInit() abort
  nmap <buffer><expr>
        \ <Plug>(fern-my-open-expand-collapse)
        \ fern#smart#leaf(
        \   "\<Plug>(fern-action-open:select)<ESC><BAR>:FernDo close<CR>",
        \   "\<Plug>(fern-action-expand)",
        \   "\<Plug>(fern-action-collapse)",
        \ )
  nmap <buffer> <CR> <Plug>(fern-my-open-expand-collapse)
  nmap <buffer> <2-LeftMouse> <Plug>(fern-my-open-expand-collapse)
  nmap <buffer> m <Plug>(fern-action-mark:toggle)j
  nmap <buffer> N <Plug>(fern-action-new-file)
  nmap <buffer> K <Plug>(fern-action-new-dir)
  nmap <buffer> B <Plug>(fern-action-save-as-bookmark)
  nmap <buffer> T <Plug>(fern-action-trash)
  nmap <buffer> V <Plug>(fern-action-move)
  nmap <buffer> R <Plug>(fern-action-rename)
  nmap <buffer> s <Plug>(fern-action-open:split)
  nmap <buffer> v <Plug>(fern-action-open:vsplit)
  nmap <buffer> r <Plug>(fern-action-reload)
  nmap <buffer> <nowait> d <Plug>(fern-action-hidden:toggle)
  nmap <buffer> <nowait> < <Plug>(fern-action-leave)
  nmap <buffer> <nowait> > <Plug>(fern-action-enter)
endfunction

augroup FernEvents
  autocmd!
  autocmd FileType fern call FernInit()
augroup END

" NerdTREE-like presentation:
let g:fern#mark_symbol                       = ''
let g:fern#renderer#default#collapsed_symbol = ''
let g:fern#renderer#default#expanded_symbol  = ''
let g:fern#renderer#default#leading          = ' '
let g:fern#renderer#default#leaf_symbol      = ' '
let g:fern#renderer#default#root_symbol      = '~ '

" Bookmarks:
let g:fern#mapping#bookmark#disable_default_mappings = 0
let g:fern#scheme#bookmark#store#file = "~/.vim/fern-bookmark.json"

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions