nerdtree - VIM and NERD Tree - closing a buffer properly -
Does anyone know how to close a buffer in VIM when using NERDTree without messing all of its windows Go? The NERD tree normally breaks your display into two vertical windows (the browser on your left, and then on the right side of your main window). If you close the buffer, you decrease in a huge file browsing window. If you select the second file, then the second window opens, but it separates it horizontally from any idea?
I do not use the NERD tree, but if I understand correctly, Want to close the window without a buffer? If my argument is correct, then try this script.
"Delete the buffer while keeping the window layout (do not close buffer windows)." Version 2008-11-18 from http: // vim Wikia.com/wiki/VimTip165 if v: version & lt; 700 || Exists ('loaded_bclose') || & Amp; If you have a closing endif, go to loaded_bclose = 1 if it exists ('bclose_multiple') bclose_multiple = 1 endif display the message function saying "message" echohl ERRORMSG echomsg a: msg echohl none endfunction.! " Command ': Bclose! If it exists, the window will show an optional buffer (Ctrl- ^) "or the last buffer (: BP), or empty buffer if there is no previous" command "to remove the buffer in the current window: 'Command' Becklace! That's the same, but 'executed': BD! ' (discard change). "An alternative argument can specify which buffer will be off (name or number). Function: Bclose (bang, buffer) if empty (one: buffer) go btarget = bufnr ('%') one elseif: buffer Else let btarget = bufnr (a: buffer) if andif if btarget <0 call: warnings ('no mail no buffer'; = '^ \ ^ \ d \ + $' go btarget = bufnr (str2nr (a: buffer) A: buffer) returns if the ADIF is empty (A: bang) & Getbufvar (btarget, '& amp; modified') Calls: Warning (do not write any since last change for 'buffer' .btarget . '(Use the: BeckLoss!) 'Return returns' "The number of windows that we see in the target buffer that we will remove GM: Beaclos_ a lot & amp; LAN (wnums)> 1 call S: warn. Wnums = filter (range (1, winnr ('$'), 'winbufnr (v: val) == btarget' ('buffer is in multiple windows (use: bclose_multiple = 1') ') For wcurrent = winnr () w in wn 'wcmd w' execute let prevbuf = bufnr ('#') if prevbuf & amp; amp; amp; amp; amp; amp; amp; and amp; amp; and buflisted (Prevbuf) & amp; ampb; bu buffer # other bride endif if btarget == bufnr ('%') "Number of listed buffers which are not intended to be removed go blisted = filter (range (1 , Bufnr ('$'), 'buflisted (v: value) & amp; amp; amp; amp; amp; amp; amp ;..of: val = btarget'). "Not listed, not targeted, and not shown bhidden go = filter (copy (marmalade), 'buffin (v: val) & lt; 0')" First take a buffer, if any (can be more intelligent) = (Arm + mouth + [-1]) [0] If Bjamp & gt; Perform the 'buffer'. Apply the bjump to the other 'ENEVE': Bang Andif Endiff And 'Explained' BD Lete '. A: Bang. ' '.btarget wcurrent.'wincmd w' execute the end command command! -bang -complete = buffer-nargs =? Call Bclose & lt; Sid & gt; Bclose ('& lt; Collision & gt;', '& lt; Arg & gt;') nnoremap & lt; Silent & gt; & Lt; Leader & gt; BD: Bclose & lt; CR & gt; Nnoremap & lt; Silent & gt; & Lt; Leader & gt; BD: Beaclus! & Lt; CR & gt;
Comments
Post a Comment