Vim: Close All Buffers But This One

前端 未结 13 2367
别那么骄傲
别那么骄傲 2020-12-22 15:04

How can I close all buffers in Vim except the one I am currently editing?

13条回答
  •  盖世英雄少女心
    2020-12-22 15:54

    I put this in my .vimrc file

    nnoremap ca :w  %bd  e#  bd# 
    

    then your leader + ca (close all) close all the buffers except the current one.

    What it does is

    :w - save current buffer

    %bd - close all the buffers

    e# - open last edited file

    bd# - close the unnamed buffer

提交回复
热议问题