From 2383c4b5878055e2cd13fd5ed2ac2e0820b3286f Mon Sep 17 00:00:00 2001 From: Oxbian Date: Tue, 25 Jul 2023 15:58:14 +0200 Subject: Updating fern actions & fern treeview + how to use vm in vim instructions --- .vim/plugins.vim | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to '.vim/plugins.vim') diff --git a/.vim/plugins.vim b/.vim/plugins.vim index add6b38..6db8cc9 100644 --- a/.vim/plugins.vim +++ b/.vim/plugins.vim @@ -72,41 +72,49 @@ let g:loaded_netrwPlugin = 1 let g:loaded_netrwSettings = 1 let g:loaded_netrwFileHandlers = 1 + let g:fern#default_hidden = 1 " Show hidden files let g:fern#renderer = 'devicons' let g:fern_renderer_devicons_disable_warning = 1 " Multi window select in which you open the file function! s:init_fern() abort - " Use 'select' instead of 'edit' for default 'open' action - nnoremap (fern-action-open) (fern-action-open:select) - - nnoremap a (fern-action-new-path) - nnoremap d (fern-action-remove) - nnoremap < m (fern-action-move) - nnoremap r (fern-action-rename) - nnoremap v (fern-action-open:vsplit) - nnoremap ga (fern-action-git-stage) - nnoremap gd (fern-action-git-unstage) + nmap + \ (fern-my-open-expand-collapse) + \ fern#smart#leaf( + \ "\(fern-action-open:select)", + \ "\(fern-action-expand)", + \ "\(fern-action-collapse)", + \ ) + nmap action (fern-action-choice) + nmap (fern-my-open-expand-collapse) + nmap a (fern-action-new-path) + nmap d (fern-action-remove) + nmap m (fern-action-move) + nmap r (fern-action-rename) + nmap s (fern-action-open:split) + nmap v (fern-action-open:vsplit) + nmap ga (fern-action-git-stage) + nmap gd (fern-action-git-unstage) endfunction augroup my-fern-hijack - autocmd! - autocmd BufEnter * ++nested call s:hijack_directory() + autocmd! + autocmd BufEnter * ++nested call s:hijack_directory() augroup END function! s:hijack_directory() abort - let path = expand('%:p') - if !isdirectory(path) - return - endif - bwipeout % - execute printf('Fern %s', fnameescape(path)) + let path = expand('%:p') + if !isdirectory(path) + return + endif + bwipeout % + execute printf('Fern %s', fnameescape(path)) endfunction augroup fern-custom - autocmd! * - autocmd FileType fern call s:init_fern() + autocmd! * + autocmd FileType fern call s:init_fern() augroup END " Which Key -- cgit v1.2.3