Vim: Delete buffer without losing the split window

前端 未结 8 862
后悔当初
后悔当初 2020-12-07 07:55

When a buffer gets deleted (the \"bd[elete]\" command), it not only deletes the buffer but also removes the split window that buffer was in.

Is there a way to delete

相关标签:
8条回答
  • 2020-12-07 08:41

    I used to use :

    :bp<bar>sp<bar>bn<bar>bd<CR>
    

    But I found certain occasions where it closed my window. On top of that the next or previous buffer might not be what you want to be displayed in the split.

    Now I do this :

    • switch to the buffer I want to work on
    • Delete the alternate buffer

    nnoremap <leader>d :bd#<CR>

    0 讨论(0)
  • 2020-12-07 08:49

    I really like bufkill.vim there is a github repo as well

    0 讨论(0)
提交回复
热议问题