diff options
author | Oxbian <got.dacs@slmail.me> | 2023-07-25 15:58:14 +0200 |
---|---|---|
committer | Oxbian <got.dacs@slmail.me> | 2023-07-25 15:58:14 +0200 |
commit | 2383c4b5878055e2cd13fd5ed2ac2e0820b3286f (patch) | |
tree | a1a25229e1973f204b99ac4564360975975d6796 | |
parent | 32de71752457551f96433f9aff5fba81950d8245 (diff) | |
download | vimrc-2383c4b5878055e2cd13fd5ed2ac2e0820b3286f.tar.gz vimrc-2383c4b5878055e2cd13fd5ed2ac2e0820b3286f.zip |
Updating fern actions & fern treeview + how to use vm in vim instructions
-rw-r--r-- | .vim/keymaps.vim | 2 | ||||
-rw-r--r-- | .vim/plugins.vim | 48 | ||||
-rw-r--r-- | README.md | 18 |
3 files changed, 43 insertions, 25 deletions
diff --git a/.vim/keymaps.vim b/.vim/keymaps.vim index 5827003..19cee2e 100644 --- a/.vim/keymaps.vim +++ b/.vim/keymaps.vim @@ -95,7 +95,7 @@ au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g """"""""""""""""""""""" " Toggle fern tree view -nnoremap <C-f> :Fern .<CR> +nnoremap <C-f> :Fern %:h -drawer -width=35 -toggle<CR> """""""""""""""""""" " GitGutter 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 <buffer> <Plug>(fern-action-open) <Plug>(fern-action-open:select) - - nnoremap <buffer> a <Plug>(fern-action-new-path) - nnoremap <buffer> d <Plug>(fern-action-remove) - nnoremap < <buffer> m <Plug>(fern-action-move) - nnoremap <buffer> r <Plug>(fern-action-rename) - nnoremap <buffer> v <Plug>(fern-action-open:vsplit) - nnoremap <buffer> ga <Plug>(fern-action-git-stage) - nnoremap <buffer> gd <Plug>(fern-action-git-unstage) + nmap <buffer><expr> + \ <Plug>(fern-my-open-expand-collapse) + \ fern#smart#leaf( + \ "\<Plug>(fern-action-open:select)", + \ "\<Plug>(fern-action-expand)", + \ "\<Plug>(fern-action-collapse)", + \ ) + nmap <buffer> action <Plug>(fern-action-choice) + nmap <buffer> <CR> <Plug>(fern-my-open-expand-collapse) + 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> s <Plug>(fern-action-open:split) + 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() + 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 @@ -91,15 +91,15 @@ More help at `:help spell` For help, use `:help fern`. Keybinds: -- `Ctrl+f` open the treeview in the current window, +- `Ctrl+f` open the treeview buffer at the left, - `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. +- `m` move a file or folder, +- `v` open a file in vertical split, +- `s` open a file in horizontal split ### Vim Gutter @@ -160,3 +160,13 @@ python -m venv .venv source .venv/bin/activate pip install python-lsp-server[all] ``` + +## VM + +To code on a virtual machine, I use sshfs, it just mount the system of the vm on my machine and tada! + +```bash +sudo mkdir /mnt/vm +sudo sshfs -o allow_other -p 22 user@localhost:/home/user/ /mnt/vm/ +``` + |