netrw open close in tab

This commit is contained in:
ManjaroOne666 2019-05-27 00:10:32 +01:00
parent f0decf3d35
commit a9b7a0c8e3
3 changed files with 36 additions and 5 deletions

View File

@ -1,3 +1,4 @@
nmap <buffer> o <CR>
nmap <buffer> q :Rex<CR>
nmap <buffer><silent> o <CR>:call CloseNetrw(1)<CR>
nmap <buffer><silent> q :call CloseNetrw(0)<CR>
setl bufhidden=wipe
setl rnu nu

View File

@ -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 <space>nn :call OpenNetrw()<CR>
" nnoremap <space>ee :e .<CR>
" nnoremap <space>eq :Rex<CR>
"}}}
" #Obsession{{{

26
vimrc
View File

@ -242,7 +242,7 @@ if has('nvim')
nnoremap <space>ra :call RangerExplorer()<CR>
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(<q-args>)
" :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 <silent><space>cs :let @/=""<cr>
nnoremap : :setlocal norelativenumber<CR>:
nnoremap <silent> <space>rc :so $MYVIMRC<CR>
nnoremap <silent> <space>nn :setlocal invrelativenumber<CR>
nnoremap <silent><expr> <space>nh (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n"
nnoremap <silent> <space>sl :set invlist<CR>
nnoremap <space>aa A<left>
@ -610,6 +628,10 @@ nnoremap <silent><space>ss :syntax sync fromstart<CR>
if has('terminal')
tnoremap <Esc> <C-\><C-n>
endif
"}}}
" windows{{{
nnoremap <space><space> :resize<CR>:vertical resize<CR>
" }}}
" git mappings {{{
" also see vim-fugitive plugin section