开发者

Opening help in a full window

开发者 https://www.devze.com 2023-02-04 12:02 出处:网络
When I 开发者_如何转开发have no opened buffers, calling :h will open help in a split window. But I want it to open in a full-sized window. There doesn\'t see to be a :nosplit or :full command though.

When I 开发者_如何转开发have no opened buffers, calling :h will open help in a split window. But I want it to open in a full-sized window. There doesn't see to be a :nosplit or :full command though. Any ideas?


:h | only

:only is the command that will make the current window the only window visible.


you can open a new tab just with the help with

:tab h


This admittedly hackish method should work for most terminal windows. Tested in unix-flavored vim.

:set helpheight=99999

then

:h


Two options:

You can switch to the other window and issue a "close window" command:

ctrl-W w  switches windows (to non-help window)
ctrl-W c  closes current window

... or you can open the help file directly. On vim 7.3 for Windows (Cygwin), for example:

vim /usr/share/vim/vim73/doc/help.txt


Just add to your .vimrc or init.vim the following line:

augroup HelpBuffer | au! filetype help only | augroup END

It will create autogroup HelpBuffer and whenever a help buffer is opening only command is triggered and the buffer is widening.


open vim from command line:  
lnx#> vim  
:help  
ctrl+w+shift+_ - will maximize window vertically.  
ctrl+w+| - will maximize window horizontally.
ctrl+w+= - will resize window to half size horizontally or vertically.
ctrl+w+(up or down) arrow will help to navigate into vertical windows.
ctrl+w+(left or right) arrow will help to navigate into horizontal windows.

NOTE: Vim help documentation is wonderful!

Maybe you'll enjoy also this: Actually using ed - Arabesque


An awesome plugin for toggling windows fullscreen is vim-maximizer.

After it's installed you can simply use <F3> (default shortcut) to toggle fullscreen on the window.

You can also customize the shortcut keys, for example if you wanted to use <C-w> z (similar to tmux shortcut):

nnoremap <silent><C-w>z :MaximizerToggle<CR>
vnoremap <silent><C-w>z :MaximizerToggle<CR>gv
inoremap <silent><C-w>z <C-o>:MaximizerToggle<CR>


command -nargs=? Help help <args> | only

You can add that to your .vimrc. Then write :Help topic to see help on a topic, and :Help to see help main page, both in full-sized windows.


This is what I came up with - it works with Telescope's find help as well. It spawns the help file in a new tab, goes back to the previous one where it closes the opened split and goes back to the new tab with the help. The second line lists the help file in the buffer list so it can appear in the vim-airline's tabline (bufferline):

augroup help_as_buffer
  autocmd!
  autocmd FileType help :tabnew % | tabprevious | quit | tabnext 
  autocmd FileType help set buflisted
augroup END
0

精彩评论

暂无评论...
验证码 换一张
取 消