netrw open close in tab
This commit is contained in:
		
							parent
							
								
									f0decf3d35
								
							
						
					
					
						commit
						a9b7a0c8e3
					
				| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
nmap <buffer> o <CR>
 | 
					nmap <buffer><silent> o <CR>:call CloseNetrw(1)<CR>
 | 
				
			||||||
nmap <buffer> q :Rex<CR>
 | 
					nmap <buffer><silent> q :call CloseNetrw(0)<CR>
 | 
				
			||||||
setl bufhidden=wipe
 | 
					setl bufhidden=wipe
 | 
				
			||||||
 | 
					setl rnu nu
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,7 +2,15 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  let g:netrw_liststyle=3
 | 
					  let g:netrw_liststyle=3
 | 
				
			||||||
  let g:netrw_list_hide='^\..*'
 | 
					  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{{{
 | 
					"   #Obsession{{{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										26
									
								
								vimrc
								
								
								
								
							
							
						
						
									
										26
									
								
								vimrc
								
								
								
								
							| 
						 | 
					@ -242,7 +242,7 @@ if has('nvim')
 | 
				
			||||||
    nnoremap <space>ra :call RangerExplorer()<CR>
 | 
					    nnoremap <space>ra :call RangerExplorer()<CR>
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  if !exists('*RangerExplorer') "{{{
 | 
					  if !exists('*RangerExplorer')
 | 
				
			||||||
    function RangerExplorer() abort
 | 
					    function RangerExplorer() abort
 | 
				
			||||||
      exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
 | 
					      exec 'silent !ranger --choosefile=/tmp/vim_ranger_current_file ' . expand('%:p:h')
 | 
				
			||||||
      if filereadable('/tmp/vim_ranger_current_file')
 | 
					      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 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
 | 
					" 	: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
 | 
					"}}} end #functions
 | 
				
			||||||
"----------------------------------------------------------------------------}}}
 | 
					"----------------------------------------------------------------------------}}}
 | 
				
			||||||
"#commands{{{
 | 
					"#commands{{{
 | 
				
			||||||
| 
						 | 
					@ -577,7 +596,6 @@ nnoremap 0 ^
 | 
				
			||||||
nnoremap <silent><space>cs :let @/=""<cr>
 | 
					nnoremap <silent><space>cs :let @/=""<cr>
 | 
				
			||||||
nnoremap  : :setlocal norelativenumber<CR>:
 | 
					nnoremap  : :setlocal norelativenumber<CR>:
 | 
				
			||||||
nnoremap <silent> <space>rc :so $MYVIMRC<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><expr> <space>nh (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n"
 | 
				
			||||||
nnoremap <silent> <space>sl :set invlist<CR>
 | 
					nnoremap <silent> <space>sl :set invlist<CR>
 | 
				
			||||||
nnoremap <space>aa A<left>
 | 
					nnoremap <space>aa A<left>
 | 
				
			||||||
| 
						 | 
					@ -610,6 +628,10 @@ nnoremap <silent><space>ss :syntax sync fromstart<CR>
 | 
				
			||||||
if has('terminal')
 | 
					if has('terminal')
 | 
				
			||||||
  tnoremap <Esc> <C-\><C-n>
 | 
					  tnoremap <Esc> <C-\><C-n>
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					"}}}
 | 
				
			||||||
 | 
					"   windows{{{
 | 
				
			||||||
 | 
					    nnoremap <space><space> :resize<CR>:vertical resize<CR>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"   }}}
 | 
					"   }}}
 | 
				
			||||||
"   git mappings {{{
 | 
					"   git mappings {{{
 | 
				
			||||||
" also see vim-fugitive plugin section
 | 
					" also see vim-fugitive plugin section
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue