在Vim中缩放窗口比ZoomWin更好吗?

tom*_*nek 41 vim zoom vim-plugin

我曾经使用ZoomWin:https://github.com/vim-scripts/ZoomWin在Vim中的一个和多个窗口之间切换.但这个插件有一个大问题.当我试图恢复多个窗口(垂直分割)时,延迟大约2-4秒.

你知道如何避免这种滞后吗?或者也许是更好的解决方案.

版本25解决了问题:https://github.com/regedarek/ZoomWin

ljs*_*dev 61

我尝试使用没有任何插件的vim,因为当我在另一个系统上工作时我不想依赖它们.现在就出现同样的问题,我可以根据OP的要求提出一些"更好的方法"(替代方式):

  • c-w-|窗口接管(如果使用vsplits).c-w-=恢复.c-w-_用于水平分割
  • 关闭其他窗口,从而使当前全屏显示.拆分并从缓冲区重新打开以恢复
  • 使用tmux(如果可用)和运行VIM的多个实例,c-b-z为当前窗格全屏之间切换

我按照我认为的实用性顺序列出了这些.使用专用插件时,体验当然会更好,但这并不总是一种选择.

  • 很好,但是Cw- =不会恢复,而是在_middle_中拆分(而原始拆分可能有所不同)。 (2认同)

Ben*_*enC 33

一个简单的替代方案(根据您的需要可能足够):

" Zoom / Restore window.
function! s:ZoomToggle() abort
    if exists('t:zoomed') && t:zoomed
        execute t:zoom_winrestcmd
        let t:zoomed = 0
    else
        let t:zoom_winrestcmd = winrestcmd()
        resize
        vertical resize
        let t:zoomed = 1
    endif
endfunction
command! ZoomToggle call s:ZoomToggle()
nnoremap <silent> <C-A> :ZoomToggle<CR>
Run Code Online (Sandbox Code Playgroud)

  • 使用相同技术的相应插件:https://github.com/szw/vim-maximizer (2认同)
  • 很好的解决方案。奇迹般有效。 (2认同)

Ing*_*kat 13

ZoomWin版本24引入了窗口局部变量的保存.当我试用它时,我发现性能是不可接受的,可能是因为我安装了各种其他插件并安装了各种事件处理程序.

我已经向插件作者报告了我的问题,他回答说

ZoomWin的v25a有g:zoomwin_localoptlist和noautocmd东西.

所以,要么尝试恢复到版本23(我做了),要么尝试从http://drchip.org/astronaut/vim/index.html#ZOOMWIN关闭上述设置的最新版本

  • 谢谢!版本25非常出色.我刚刚将最新版本推送到我的Github帐户.https://github.com/regedarek/ZoomWin (5认同)

JES*_*Sii 10

我有另一种使用多年的方法;允许我将当前缓冲区“缩放”到一个新选项卡,然后再次快速关闭它,这样我就可以回到我原来的多窗口布局:

" "Zoom" a split window into a tab and/or close it
nmap <Leader>,zo :tabnew %<CR>
nmap <Leader>,zc :tabclose<CR>
Run Code Online (Sandbox Code Playgroud)


小智 5

另一个简单的方法是:tab split。好处是它不会更改当前选项卡的布局。缺点是它需要Vim 7.0或更高版本才能支持标签。

nnoremap <leader>t :call TabToggle()<cr>
function! TabToggle()
  if tabpagewinnr(tabpagenr(), '$') > 1
    " Zoom in when this tab has more than one window
    tab split
  elseif tabpagenr('$') > 1
    " Zoom out when this tab is not the last tab
    if tabpagenr() < tabpagenr('$')
      tabclose
      tabprevious
    else
      tabclose
    endif
  endif
endfunction
Run Code Online (Sandbox Code Playgroud)


mxg*_*grn 2

我用优秀的Zen Mode替换了 ZoomWin 。