function! s:fern_reveal(dict) abort execute 'FernReveal' a:dict.relative_path endfunction let g:fern#disable_default_mappings = 1 let g:fern#drawer_width = 30 let g:fern#renderer = 'nerdfont' let g:fern#renderer#nerdfont#padding = ' ' let g:fern#hide_cursor = 0 let g:fern#mapping#fzf#disable_default_mappings = 1 let g:Fern_mapping_fzf_file_sink = function('s:fern_reveal') let g:Fern_mapping_fzf_dir_sink = function('s:fern_reveal') let g:fern_disable_startup_warnings = 1 function! s:fern_preview_width() abort let width = float2nr(&columns * 0.8) let width = min([width, 200]) return width endfunction let g:fern_preview_window_calculator = { \ 'width': function('s:fern_preview_width') \ } nnoremap :Fern %:h -drawer -reveal=% autocmd FileType fern call s:fern_my_settings() function! s:fern_my_settings() abort echo 'ok' nmap h (fern-action-collapse) nmap l (fern-action-open-or-expand) nmap dd (fern-action-clipboard-move) nmap yy (fern-action-clipboard-copy) nmap p (fern-action-clipboard-paste) nmap ? (fern-action-help) nmap p (fern-action-preview:toggle) nmap (fern-action-preview:auto:toggle) nmap (fern-action-preview:scroll:down:half) nmap (fern-action-preview:scroll:up:half) nmap (fern-quit-or-close-preview) fern_preview#smart_preview("\(fern-action-preview:close)", ":q\") nmap q (fern-quit-or-close-preview) endfunction function s:init_fern_mapping_reload_all() nmap R (fern-action-reload:all) nnoremap p endfunction augroup my-fern-mapping-reload-all autocmd! * autocmd FileType fern call s:init_fern_mapping_reload_all() autocmd FileType fern set nonu augroup END autocmd FileType fern call glyph_palette#apply()