除了我目前正在编辑的缓冲外,我如何能够在维姆关闭所有的缓冲?
Is it possible to update vim plugins automatically?
除了我目前正在编辑的缓冲外,我如何能够在维姆关闭所有的缓冲?
您可使用这一文字。
http://www.vim.org/scripts/script.php?script_id=1071
仅将其贴在<代码>.vim/plugin的目录上,然后使用<代码>:Buf Only,指令关闭所有缓冲器,但封存。 您也可在您的<代码>.vimrc中将其描绘成其他地方。
资料来源:Github(通过文字镜子):。
我非常容易地这样做:
:%bd|e#
如果你不关心目前的问题,那么做像(不需要说明)这样的事情就更加简单:
1,100bd
我
:w | %bd | e#
如果我只想打开我目前的缓冲地带,结束所有其他事情,我会投赞成票。
如何开展工作:首先写当前的缓冲变化,然后关闭所有开放的缓冲地带,然后,我现在重新开放。 在Vim,>/code>链条共同执行指挥。 如果您的缓冲时间已经更新,上述时间可缩短到<条码>:%bd >>>>>>>>><#>/code>。
依靠Janruiz的回答。
改变你想要保持的缓冲,然后
:1,1000bd
指挥<条码>bd(删除)将不会删除任何未经改动的缓冲区。 这样,你就可以把目前(变换)档案保留在缓冲清单中。
Edit: Please notice that this will also delete your NERDTreeBuffer. You can get it back with :NERDTree
我在我的档案中这样做。
nnoremap <leader>ca :w <bar> %bd <bar> e# <bar> bd# <CR>
之后,<条码>铅+卡条码>(全部)除现时外,关闭所有缓冲器。
What it does is
:w - 拯救目前的缓冲
%bd - 关闭所有缓冲地带
e# - 公开最后编辑文件
bd# - 关闭未标明的缓冲
在这方面,我做了些什么。 因此,在排除所有缓冲器和上述多数解决办法之后,我要保持我的好奇立场,只是无视这一事实。 我还认为,重新确定指挥比打上指挥更佳,因此,我在这里使用<条码>和代号;b条码>来排除所有的缓冲,并跳回我的原 cur。
noremap <leader>bd :%bd|e#|bd#<cr>| "
<代码>%bd = 删除所有缓冲器。
<代码>e# = 开放最后的缓冲,以供编辑(Which 是缓冲Im在工作)。
bd#
to delete the [No Name] buffer that gets created when you use %bd
.
两岸的管道相互接连。 页: 1
<代码>“ = 保持我方位。
<说明>::如评论意见所述,此封/windows和不是缓冲区。
使用
:on[ly][!]
以及
:h only
关闭所有开放的缓冲地带:
silent! execute "1,".bufnr("$")."bd"
关闭所有开放的缓冲带,但目前的除外:
function! CloseAllBuffersButCurrent()
let curr = bufnr("%")
let last = bufnr("$")
if curr > 1 | silent! execute "1,".(curr-1)."bd" | endif
if curr < last | silent! execute (curr+1).",".last."bd" | endif
endfunction
将这一功能添加到<条码>。
召集地图:
nmap <Leader>c :call CloseAllBuffersButCurrent()<CR>
有一个<>插座,这确实如此,只是一个更远!
http://github.com/Asheq/close-buffers.vim” rel=“noretinger”>close-buffers.vim
因此,这是一个老的问题,但它帮助我为我的项目提出一些想法。 关闭所有缓冲地带,但现在使用的是,
map <leader>o :execute “%b >#”<CR>
:%bd then Ctrl-o
:%bd
Ctrl-o 跳回最后的缓冲地带,即你提到的“这一天”。
function! CloseOtherBuffer()
let l:bufnr = bufnr()
execute "only"
for buffer in getbufinfo()
if !buffer.listed
continue
endif
if buffer.bufnr == l:bufnr
continue
else
if buffer.changed
echo buffer.name . " has changed, save first"
continue
endif
let l:cmd = "bdelete " . buffer.bufnr
execute l:cmd
endif
endfor
endfunction
let mapleader = ,
nnoremap <leader>o :call CloseOtherBuffer()<CR>
此前的法典将在你到达目标缓冲和新闻时生效。 它将关闭除目前外的其他所有缓冲地带。
它将所有缓冲器全部放开,并关闭所有与目前缓冲号码不相同的缓冲号码。
我喜欢1,100bd
(.suggested by juanruiz, 似乎为我工作。
我在地图上添加了一个<条码>空白!
nnoremap <leader>bd :1,100bd<CR>
nnoremap <leader>bdq :1,100bd<CR>:q!<CR>
这造成所有的缓冲,关闭了Vim,这是我所期待的。
页: 1 s comment:
command! Bonly silent execute "%bd|norm <C-O>"
norm <C-O>
jumps to the last position in the jump list, which means where the cursor was before the %bd
.silent
instead of silent!
. That way, if any open buffers are modified, Vim prints an error message so I know what happened. The modified buffers stay open in my tests.nnoremap <leader>x :execute %bdelete|edit #|normal `" |bdelete#<CR>
Is it possible to update vim plugins automatically?
How can I configure vim to autowrite buffers after switching with alt-tab to another application?
I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....
I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...
How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...
I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...
Whenever I start a shell in vim using :sh, it doesn t source my ~/.bashrc file. How can I get it to do this automatically?
I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...