diff --git a/after/ftplugin/netrw.vim b/after/ftplugin/netrw.vim index 0bddd94..2be4e8e 100644 --- a/after/ftplugin/netrw.vim +++ b/after/ftplugin/netrw.vim @@ -1,3 +1,4 @@ -nmap o -nmap q :Rex +nmap o :call CloseNetrw(1) +nmap q :call CloseNetrw(0) setl bufhidden=wipe +setl rnu nu diff --git a/config/plugins.shared.vim b/config/plugins.shared.vim index 4359e79..27063af 100644 --- a/config/plugins.shared.vim +++ b/config/plugins.shared.vim @@ -2,7 +2,15 @@ let g:netrw_liststyle=3 let g:netrw_list_hide='^\..*' - let g:netrw_preview = 0 + let g:netrw_preview = 1 + let g:netrw_winsize = 40 + " let g:netrw_browse_split = 4 + let g:netrw_altfile = 1 + let g:netrw_mousemaps = 0 + + nnoremap nn :call OpenNetrw() + " nnoremap ee :e . + " nnoremap eq :Rex "}}} " #Obsession{{{ diff --git a/vimrc b/vimrc index 2ae6316..4918fe4 100644 --- a/vimrc +++ b/vimrc @@ -242,7 +242,7 @@ if has('nvim') nnoremap ra :call RangerExplorer() endif else - if !exists('*RangerExplorer') "{{{ + if !exists('*RangerExplorer') function RangerExplorer() abort exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h') if filereadable('/tmp/vim_ranger_current_file') @@ -464,6 +464,25 @@ command! -nargs=1 -complete=command Redir silent call Redir() " :Redir hi ............. show the full output of command ':hi' in a scratch window " :Redir !ls -al ........ show the full output of command ':!ls -al' in a scratch window "}}} +function! OpenNetrw() abort "{{{ + let g:netrw_opened_in_tab = 1 + Texplore +endfunction +"}}} + +function! CloseNetrw(keep_buffer) abort "{{{ + if a:keep_buffer == 1 + let l:current_buffer = bufnr("%") + tabclose + tabprevious + execute "buffer" l:current_buffer + else + tabclose + tabprevious + endif +endfunction +"}}} + "}}} end #functions "----------------------------------------------------------------------------}}} "#commands{{{ @@ -577,7 +596,6 @@ nnoremap 0 ^ nnoremap cs :let @/="" nnoremap : :setlocal norelativenumber: nnoremap rc :so $MYVIMRC -nnoremap nn :setlocal invrelativenumber nnoremap nh (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n" nnoremap sl :set invlist nnoremap aa A @@ -611,6 +629,10 @@ if has('terminal') tnoremap endif "}}} +" windows{{{ + nnoremap :resize:vertical resize + +" }}} " git mappings {{{ " also see vim-fugitive plugin section nnoremap gD :!clear; echo 'git diff'; git diff