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 ...


11

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 <...


9

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

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 ...


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 ...


7

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


4

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


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.


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.


3

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.


3

I was mapping two commands to one F-key to execute 2 plugin commands and none of the above worked for me. The only option that worked for me was with to <CR>: nnoremap <F10> :Doctest <CR> :lwindow<CR>


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

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 ...


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

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.


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. ...


2

Remove :botright as it does: :bo[tright] {cmd} Execute {cmd}. If it contains a command that splits a window, it will appear at the bottom and occupy the full width of the Vim window. When the split is vertical the window appears at the far right and occupies the full height of the Vim window. Doesn't work for |:...


2

My problem here is caused by my single quote in viewdir So I removed it and it's ok.


1

A window cannot exist without any buffer attached. Just make sure you have an empty unnamed buffer in every window and save the session.


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

Recent vim includes win_execute() which works across tabpages. call win_execute(og, 'close') Beware of changes fired by autocmds from the vimhelp: The window will temporarily be made the current window, without triggering autocommands. When executing {command} autocommands will be triggered, this may have unexpected side effects. Use |:noautocmd| if ...


1

A solution to this problem is mentioned in Vim's documentation (:h --remote). The following command should open filename to line_number: gvim --servername DEBUG --remote-send "<C-\><C-N>:tab drop filename<CR>line_numberG" Note that this seems to neither raise nor focus Vim. And I believe that opening the file using :tab drop ...


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 ...


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