vim - Vim:在缓冲区循环时忽略在其他窗格中打开的缓冲区
问题描述
假设我有两个窗格垂直拆分并打开了多个缓冲区。我file-a.txt/buffer 1
在左窗格中打开,我的光标集中在右窗格上。在右窗格中,我想在剩余的打开缓冲区中循环而不通过file-a.txt/buffer 1
.
也就是说,我想在另一个窗格中循环浏览缓冲区时忽略在其他窗格中打开的缓冲区。这可能吗?
谢谢。
解决方案
简单的解决方案是检查缓冲区是否在其他窗口中打开。如果是,则bnext
再次执行。
function! Bnext() abort
bnext " Go to next buffer.
if len(win_findbuf(bufnr('%'))) > 1 " If buffer opened in more than one window,
call Bnext() " then call func again to go to next one.
endif
endfunction
nnoremap <leader>b :call Bnext()<CR>
推荐阅读
- go - 向新客户端发送 Websocket 消息
- reactjs - 如何使用 useState(在 React 中)来防止多次单击 div?
- php - 使用 $ 作为数据定义 PHP 字符串文字
- wolfram-mathematica - 如何将以下 Mathematica 代码转换为 sympy?
- java - 如何将多个按钮组合在一起,以便只有一个按钮可以保持专注?
- node.js - 带有 EP32 客户端的 Nodejs Websocket 服务器
- python - django 反向 url 错误
- xml - 布局深度...?如何调整布局层次和层?(安卓工作室)
- python-2.7 - 我的问题是关于 python 代码我有这个代码我想知道为什么值是 (2)?
- vue.js - 如何使用 VUE 更新树视图