如何最大化分割窗口?

发布于 2024-12-11 02:24:33 字数 102 浏览 0 评论 0原文

在Vim中调用:help,我得到了带有分割窗口的帮助手册页。我想最大化帮助手册窗口并关闭另一个窗口。

我该怎么做?执行此操作的 Vim 命令是什么?

Invoking :help in Vim, I got the help manual page with split window. I want to maximize the help manual window and close the other window.

How can I do this? What is the Vim command to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

白衬杉格子梦 2024-12-18 02:24:33

您可以使用Ctrl+WT这是一个大写的T)将任何打开的窗口移动到其自己的选项卡。

正如其他人所提到的 Ctrl+W_ / Ctrl+W| 在当前选项卡/窗口布局中最大化(同时尊重各种其他窗口的最小高度/宽度设置)。

(Ctrl+W= 将所有窗口大小调整为相同大小,尊重最小高度/宽度设置)

编辑 到注释

  1. 启动 vim (例如 < code>gvim /tmp/test.cpp)
  2. 调用帮助 :help different-motions - 打开一个拆分窗口,
  3. 将帮助移动到最大化的单独选项卡中: CwT
  4. 享受阅读精美手册 :)
  5. 将帮助移回原始选项卡:

    <前><代码>mAZZS`A

    • mA:设置全局标记A
    • ZZ:关闭帮助缓冲区/选项卡
    • CwS:分割原始窗口
    • `A:跳转到已保存的标记A

您可以避免使用普通(非帮助)缓冲区的标记。如果您有兴趣,请告诉我。

You can employ Ctrl+WT (that's a capital T) to move any open window to its own tab.

As mentioned by others Ctrl+W_ / Ctrl+W| to maximize within the current tab/window layout (while respecting min height/width settings for various other windows).

(Ctrl+W= resizes all windows to equal size, respecting the minimum height/width settings)

Edit To the comment

  1. start vim (e.g. gvim /tmp/test.cpp)
  2. invoke help :help various-motions - opens a split window
  3. move help into separate tab maximized: C-wT
  4. enjoy reading the fine manual :)
  5. move the help back into the original tab:

    mAZZ<C-w>S`A
    
    • mA: set global mark A
    • ZZ: close help buffer/tab
    • C-wS: split original window
    • `A: jump to saved mark A

You can avoid using a mark for normal (non-help) buffers. Let me know if you're interested.

夕嗳→ 2024-12-18 02:24:33

使用:help [主题],您可以打开一个您感兴趣的主题。
Ctrl-Wo 将最小化其他窗口(仅保留帮助窗口打开/最大化)。
(Ctrl-Wo 表示按住 Ctrl 按 W,然后按 o)

With :help [topic] you open up a topic that interests you.
Ctrl-Wo will minimize the other windows (leaving only the help window open/maximized).
(Ctrl-Wo means holding Ctrl press W, and then o)

流星番茄 2024-12-18 02:24:33

您可以使用 Ctrl+W_(下划线)将窗口扩展到最大尺寸。展开窗口的最终大小将受到 winminheight 选项的值的限制。当您关闭帮助窗口时,之前的窗口将恢复到以前的大小。

You can expand a window to its maximum size using Ctrl+W_ (underscore). The final size of the expanded window will be constrained by the value of the winminheight option. When you close the help window, your previous window(s) will be restored to their former sizes.

吐个泡泡 2024-12-18 02:24:33

我更喜欢使用选项卡。用于

:tabedit %

打开在新选项卡中最大化的文件,完成后所有窗口都返回到旧设置,

:tabclose

我发现这是理想的解决方案,因为它与 :cw 和 Tagbar 插件一起使用。取自: vim.wikia

I prefer to use tabs for that. Use

:tabedit %

to open a file maximized in a new tab, once you are done return to the old setup with all windows using

:tabclose

I find this the ideal solution as this works together with :cw and the Tagbar plugin. Taken from: vim.wikia

美男兮 2024-12-18 02:24:33

我喜欢用“M”来最大化,用“m”来最小化。

它看起来不太好,因为它会缩小同一缓冲区中的所有其他打开的窗口,但我发现它在处理选项卡时更有用。例如,不必为该文件打开一个新选项卡,然后在使用完该文件或想要最小化它后必须将其关闭。

nnoremap <C-W>M <C-W>\|<C-W>_
nnoremap <C-W>m <C-W>=

nnoremap 的原因是我不关心递归映射,但只是映射也应该起作用。

I like to use 'M' to maximize and 'm' to minimize.

It won't look great as it'll shrink all the other open windows that are in the same buffer, but I found it to be more useful when dealing with tabs. So for instance, instead of opening a new tab for that file then having to close it after you're done with it or want to minimize it.

nnoremap <C-W>M <C-W>\|<C-W>_
nnoremap <C-W>m <C-W>=

The reason for nnoremap is that I don't care about recursive mapping, but just map should also work.

作妖 2024-12-18 02:24:33

安装插件vim-maximizer,然后就可以最大化当前窗口并用F3恢复

Install the plugin vim-maximizer, then you can maximize the current window and restore with F3

总以为 2024-12-18 02:24:33

您可以使用全尺寸获得帮助窗口,而无需关闭/调整任何其他窗口的大小

tab help {topic}

,这将在新选项卡中打开帮助窗口,其他窗口将保持原样(确实调整大小以便可以显示选项卡行,但这只是一个上面的附加行)。您可以照常关闭帮助:至少 :bwc 也可以帮助我关闭新选项卡。

You can get help window in full size without closing/resizing any other windows by using

tab help {topic}

This will open help window in a new tab, other windows will be left as-is (really resized so that tabline can be shown, but this is only one additional line above). You can close help as usual: at least :bw<CR> and <C-w>c work for me closing new tab as well.

筱武穆 2024-12-18 02:24:33

插件 ZoomWin

Charles Campbell

此插件重新映射

Ctrl-w o

执行以下两项操作:最大化并恢复以前的布局。

该插件可以从两个位置下载

Plugin ZoomWin

by Charles Campbell

This plugin remaps

Ctrl-w o

to do both: maximize and restore previous layout.

This plugin can be downloaded from two locations

哆啦不做梦 2024-12-18 02:24:33

不知何故,ZoomWin 插件对我来说根本不起作用,我现在看到还有其他插件,但我已经写了这个,并给了我我想要的确切效果(下面详细介绍了一个小怪癖)

function! ToggleZoom(zoom)
  if exists("t:restore_zoom") && (a:zoom == v:true || t:restore_zoom.win != winnr())
      exec t:restore_zoom.cmd
      unlet t:restore_zoom
  elseif a:zoom
      let t:restore_zoom = { 'win': winnr(), 'cmd': winrestcmd() }
      exec "normal \<C-W>\|\<C-W>_"
  endif
endfunction

augroup restorezoom
    au WinEnter * silent! :call ToggleZoom(v:false)
augroup END
nnoremap <silent> <Leader>+ :call ToggleZoom(v:true)<CR>

使用映射键(在我的例子中为 Leader 和 +)在最大化/先前布局之间切换。如果您更改为同一选项卡中的另一个拆分,最大化将关闭。

如果您更改选项卡,分割将保持最大化,尽管不知何故它不会再覆盖完整的整个宽度,宽度最小化的窗口会重新获得一些4列或其他内容。无论如何,即使有那个小怪癖,它对我来说也是可以接受的。

编辑:不知怎的,它现​​在工作得很好,以前肯定以某种方式搞砸了。

Somehow the ZoomWin plugin did not work at all for me, I now see there are other plugins but I already wrote this and gives me the exact effect I wanted (with a minor quirk detailed below):

function! ToggleZoom(zoom)
  if exists("t:restore_zoom") && (a:zoom == v:true || t:restore_zoom.win != winnr())
      exec t:restore_zoom.cmd
      unlet t:restore_zoom
  elseif a:zoom
      let t:restore_zoom = { 'win': winnr(), 'cmd': winrestcmd() }
      exec "normal \<C-W>\|\<C-W>_"
  endif
endfunction

augroup restorezoom
    au WinEnter * silent! :call ToggleZoom(v:false)
augroup END
nnoremap <silent> <Leader>+ :call ToggleZoom(v:true)<CR>

Use the mapped key (Leader and + in my case) to toggle between maximized / previous layout. If you change to another split in the same tab, maximization turns off.

If you change tabs, the split stays maximized, although somehow it won't cover the complete full width anymore, with the width minimized windows gaining back some 4 columns or something. Anyway it works acceptably for me even with that minor quirk.

edit: somehow it works fine now, must've messed up in some way before.

流年已逝 2024-12-18 02:24:33

要仅获取帮助,然后关闭另一个窗口,请执行以下操作: :helpCTRL-WCTRL-W:close。然后你就会得到帮助。

To get just the help up, then close the other window, do this: :helpCTRL-WCTRL-W:close. Then you'll have just the help up.

扭转时空 2024-12-18 02:24:33

在你的 .vimrc 中,只需放置

nmap - :res<CR>:vertical res<CR>$

当你想要最大化当前窗口时,只需在命令模式下按 - 即可。当您想恢复多个窗口的最后状态时,请按=

in your .vimrc, just place

nmap - :res<CR>:vertical res<CR>$

When you want maximize current window, just press - in command mode. Press = when you want to restore the last status of multiple window

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文