15

By default, Vim will refuse to replace the current buffer with another one if it contains unsaved changes. You'll need to add the option below to your vimrc if you don't want that behavior (and you don't want that): set hidden Buffers are Vim's equivalent of documents in other programs. When you switch to another document, you switch to another buffer. ...


11

From :h tab-page-intro: A tab page holds one or more windows. You can easily switch between tab pages, so that you have several collections of windows to work on different things. Usually you will see a list of labels at the top of the Vim window, one for each tab page. Tabs containing windows is the way Vim was designed to work. I think you ...


8

In alternative to the maximized window, why do not gain more space for a full vim multiwindows editing experience with an autostart FULL SCREEN mode? ;-) FULL SCREEN screenshot of the final result (= ALL THE VIDEO pixels capacity): In my opinion that's better than a windows maximize: a complete FULL SCREEN (as I used to do with puTTY with ALT-Enter when ...


7

No you can't, here's why: Vim use multiple concepts to handle text files: Buffer: An in-memory version of a file. Editing a file will in fact edit the buffer before writing (i.e. saving) anything to the file on your filesystem. Window: A view into a buffer, a representation of the buffer content. A window can switch buffer and split to display multiple ...


6

Full restore If you want to restore layout with multiple termina buffers, you must restore other windows and buffers too, so it's in fact a full buffer layout restore, it's usage is not limited to terminal buffers. Three things must be done to achive that: Split windows according to saved layout. We can use result of winlayout() to do this. Load buffer in ...


4

Close window: Ctrl-w c Close all other windows: Ctrl-w o, (o for "only") For more information open vim and enter the command :help window. Look particularly at sections 3 and 4.


4

With the windows arranged as in you last illustration, move the cursor to window 3 and type <C-W>J.


3

Having multiple views of the same buffer allows you to quickly compare or copy-and-paste without moving back and forth, as @RudyB's answer explains. Another use case is the opening of another file; of course, with plain Vim commands, you can achieve this by using :split instead of :edit. However, many people have plugins (that provide most recently used ...


3

Put the following in your vimrc: set splitright Read :h splitright for more information.


2

From :help 'lines': Number of lines of the Vim window. [...] When Vim is running in the GUI or in a resizable window, setting this option will cause the window size to be changed. [..] You can use this command to get the tallest window possible: :set lines=999 The columns option does the same, except for the width (in characters). So you ...


2

I would recommend you to use for example <C-P>, since <C-[> is the same as <Esc> and <C-]> is used to jump to a definition of the keyword under the cursor. You can just do this: nnoremap <C-P> <Esc>:set columns+=1 lines+=1<CR> The another way is to use the command separator |, but you have to escape it or use <...


2

You can do this with | (on windows, in the _vimrc file, so you have to replace it with <bar>). e.g. " unix nnoremap <C-[> :set columns+=1 | lines+=1<CR> " windows nnoremap <C-[> :set columns+=1 <bar> lines+=1<CR> See the documentation : :help :bar ref: https://stackoverflow.com/a/3249303/2558252


2

It appears as though your needs may be met by using tabs. See :help tabpage in Vim for general help, but here are a few relevant commands: Start Vim with vim -p filename ... to open each file in a separate tab (Though this will be limited by the tabpagemax setting). Move to the next tab with gt and the previous with gT. :tabe or :tabedit will open a new tab ...


2

I don’t use NERDTree myself, but reading the documentation it looks like you want the s map, which opens the selected file in a new vertical split. You may also need to add set splitright to your .vimrc to ensure that the split is created at the right of the NERDTree window. Keep in mind though that as your layouts get more complex your workflow may suffer. ...


1

Nerdtree is the beast on its own (don't like it personally but anyway) You can try following snippet of code: func! MyOpen() abort let selected = g:NERDTreeFileNode.GetSelected() if selected != {} "remove everyother window wincmd o "open selected file in vertical split exe "vsplit " . selected.path.str() "...


1

Manual approach You can use 2<c-w>0 to resize current window to fit buffer, with 2 extra lines. It's fully commented, read comment as explanation. " Resize window to fit buffer + <count>. It works the same as <c-w>_ if there " are too many lines to fit. command -count WinFitBuf call s:win_fit_buf(<count>) nnoremap <expr> <...


1

The function setwinvar can change options using the & syntax: call setwinvar(1, "&list", 0) You can execute any code in the context of another window using win_execute (vim only): call win_execute(winid, 'set syntax=python') In neovim there is also nvim_win_set_option call nvim_win_set_option(win, 'list', 0)


1

I don't believe this is possible, other than by the methods you have already suggested. I don't think Vim knows whether or not the terminal it is in has focus, and it definitely has no method of changing the window manager's state (except shell/system commands such as those you mention).


1

You need Vim 8.1, then you can use the following command: :below terminal ++rows=10 Normally a terminal is opened above the current window, but with below it is opened at the bottom. And in this case, the terminal should have a height of 10 rows. See :help :terminal for additional ++-options.


1

You can retrieve the window number (as opposed to the window ID) and then use wincmd to close: let winnr = win_id2win(og) if winnr > 0 execute winnr.'wincmd c' endif Keep in mind this won't work if the window isn't in the current tab page.


1

Unfortunately there is no easy way to fix this at the moment, the OP has opened a vim-go issue and we agree that this is something vim-go can do better. Now we just need someone to spend time fixing it :-) In the meanwhile, you can do some things to use ALE and vim-go simultaneously. Setting g:go_list_type = 'locationlist' will make vim-go always use the ...


1

104 columns / 51 lines = 2.04 Your calculation is skewed because the aspect ratio of each cell is vertical. For example on Terminal.app, with 23pt font and default character spacing, each terminal cell have a width of 7px and a height of 15px for a total of 728x765px: You cannot retrieve the font size from within Vim without invoking external commands or ...


1

Registers are not shared between different Vim sessions. If you want that, then you have to store and load the data from a file. I think, the Yankring plugin does something like this. Also it should be possible to write your viminfo using :wv file after you put something into your desired register and load it from the other vim session using :rv. See also ...


1

Starting vim using vim -u NONE won't work because you need a vimrc file with set nocp filetype plugin on The two settings are needed because "netrw" is actually a plugin distributed with vim by default, but still a plugin. I would reccomend you to create an alternative vimrc to confirm that the issue is due to some settings in your vimrc. You can do ...


1

In addition to the gVim-specific commands in the other answers, there are a couple standard Windows features to launch any application maximized. If you are staring gVim from a shortcut, such as from the Start Menu or Desktop, you can change the shortcut properties to start Vim maximized. Right-click the shortcut, choose Properties, and select Maximized ...


Only top voted, non community-wiki answers of a minimum length are eligible