diff options
author | Oxbian <got.dacs@slmail.me> | 2023-07-24 20:34:33 +0200 |
---|---|---|
committer | Oxbian <got.dacs@slmail.me> | 2023-07-24 20:34:33 +0200 |
commit | 15aa4257ee97af243573c43644b35cf6ddbc0b25 (patch) | |
tree | 5191781aae63e535abf63ced5a1b14cd4022657d | |
parent | 92b99a881e4e5bcea3010c9838d3efadff235583 (diff) | |
download | vimrc-15aa4257ee97af243573c43644b35cf6ddbc0b25.tar.gz vimrc-15aa4257ee97af243573c43644b35cf6ddbc0b25.zip |
Updating fern actions
-rw-r--r-- | .vim/plugins.vim | 32 | ||||
-rw-r--r-- | README.md | 16 |
2 files changed, 38 insertions, 10 deletions
diff --git a/.vim/plugins.vim b/.vim/plugins.vim index 61395d7..5d17b17 100644 --- a/.vim/plugins.vim +++ b/.vim/plugins.vim @@ -18,11 +18,9 @@ call plug#begin('~/.vim/plugged') Plug 'joshdick/onedark.vim' " Onedark themes for vim Plug 'vim-airline/vim-airline' " Vim statusline Plug 'lambdalisue/fern.vim' " Filetree in vim -Plug 'lambdalisue/fern-hijack.vim' " Open directory with fern Plug 'lambdalisue/fern-renderer-devicons.vim' " Icon in fern Plug 'ryanoasis/vim-devicons' " Devicons Plug 'lambdalisue/fern-mapping-git.vim' " Fern git mapping -Plug 'andykog/fern-copynode.vim' " Fern copy node Plug 'lambdalisue/fern-git-status.vim' " Fern git status Plug 'liuchengxu/vim-which-key' " Show leader mapping cheatsheet @@ -68,7 +66,13 @@ let g:lsp_diagnostics_echo_cursor = 1 let g:lsp_diagnostics_virtual_text_enabled = 0 " Fern -let g:fern#default_hidden = 1 +" Disable netrw. +let g:loaded_netrw = 1 +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 @@ -76,6 +80,28 @@ let g:fern_renderer_devicons_disable_warning = 1 function! s:init_fern() abort " Use 'select' instead of 'edit' for default 'open' action nmap <buffer> <Plug>(fern-action-open) <Plug>(fern-action-open:select) + + nmap <buffer> a <Plug>(fern-action-new-path) + nmap <buffer> d <Plug>(fern-action-remove) + nmap <buffer> m <Plug>(fern-action-move) + nmap <buffer> r <Plug>(fern-action-rename) + nmap <buffer> v <Plug>(fern-action-open:vsplit) + nmap <buffer> ga <Plug>(fern-action-git-stage) + nmap <buffer> gd <Plug>(fern-action-git-unstage) +endfunction + +augroup my-fern-hijack + 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)) endfunction augroup fern-custom @@ -27,14 +27,11 @@ This config has just the necessary plugins installed: ### Graphics utilities - [Fern](https://github.com/lambdalisue/fern.vim) to have a file tree in vim. -- [Fern hijack](https://github.com/lambdaalisue/fern-hijack.vim) to open folder preview with fern. - [Fern renderer devicons](https://github.com/lambdalisue/fern-renderer-devicons.vim) to have devicons in fern. - [Fern git mapping](https://github.com/lambdalisue/fern-mapping-git.vim) to add git stage & unstage in fern. -- [Fern copy node](https://github.com/andykog/fern-copynode.vim) to copy filename or foldername or filepath or folderpath. - [Fern git status](https://github.com/lambdalisue/fern-git-status.vim.git) show file git status in fern. - [Vim which key](https://github.com/liuchengxu/vim-which-key) show leader keybinds in a GUI. - [Vim devicons](https://github.com/ryanoasis/vim-devicons) language icons for vim. -- [Vim nerdtree syntax highlighting](https://github.com/tiagofumo/vim-nerdtree-syntax-highlight) nerdtree syntax highlighting - [Vim gitgutter](https://github.com/airblade/vim-gitgutter) to see diff between files with git. ### LSP @@ -94,10 +91,15 @@ More help at `:help spell` For help, use `:help fern`. Keybinds: -- `Ctrl+f` open the treeview in the current window -- `ga` stage a file or unstage if already stagged (TODO) -- `cp` copy node name (file, folder..) -- `cP` copy node path +- `Ctrl+f` open the treeview in the current window, +- `ga` stage a file from git, +- `gd` unstage a file from git, +- `cp` copy node name (file, folder..), +- `cP` copy node path, +- `a` create a file or folder, +- `d` delete a file or folder, +- `r` rename a file or folder, +- `m` move a file or folder. ### Vim Gutter |