63

The top window is called the preview window. So any of <c-w>z, <c-w><c-z> or :pc[lose][!] should work. The below is the help for :help :pclose CTRL-W z CTRL-W_z CTRL-W CTRL-Z CTRL-W_CTRL-Z :pc :pclose :pc[lose][!] Close any "Preview" window currently open. When the 'hidden' option is set, or when the buffer ...


28

For my specific case, the preview window was opened by plugins. So, I used plugin configuration to automatically close these windows. Supertab As suggested by Alex Kroll: let g:SuperTabClosePreviewOnPopupClose = 1 YouCompleteMe let g:ycm_autoclose_preview_window_after_insertion = 1 let g:ycm_autoclose_preview_window_after_completion = 1 If the second ...


6

:saveas does write to files, after all the help says: "Save the current buffer under the name {file}". Note also how it says that ! is needed to overwrite an existing file. You wouldn't need to talk about overwriting if writing wasn't involved. Also, note the message from a successful saveas command: "bar" [New] 364L, 1060C written


5

Your function returns nothing, but you call it expecting the buffer number. This should work: function! ScratchBuffer() vnew setlocal nobuflisted buftype=nofile bufhidden=wipe noswapfile return bufnr('%') endfunction


4

another nice option, which is relevant also in other cases, is using :only to close all other windows, including the preview: :on[ly][!] :{count}on[ly][!] CTRL-W o *CTRL-W_o* *E445* CTRL-W CTRL-O *CTRL-W_CTRL-O* *:on* *:only* Make the current window the only one on the screen. All other windows are closed. ...


4

It's called "preview window" and you can read all about it in :help preview-window. The 'previewheight' option should be what you are looking for.


3

Another option that automatically closes the preview window and that should work with multiple completion plugins was suggested by deoplete's author in an issue: autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif The downside is that you won't be able to focus the scratch window, so no scrolling. But for quick lookups it's the most ...


2

You can create a buffer like this with the 'buftype' option: :set buftype=nofile As :help 'buftype' explains: The value of this option specifies the type of a buffer: <empty> normal buffer nofile buffer which is not related to a file and will not be written See :help special-buffers for more background on this and ...


1

After seven hours of fiddling with the documentation and searching, I was able to write a function that takes a filetype, an array of strings and show a dummy buffer based on that. function! showInPreview(name, fileType, lines) let l:command = "silent! pedit! +setlocal\\ " . \ "buftype=nofile\\ nobuflisted\\ " . \ "...


1

In this case i would :new :setlocal buftype=nofile :setlocal bufhidden=hide :setlocal noswapfile buftype=nofile does not associate the buffer with a file. noswapfile does not create a swapfile. bufhidden=hide hides the buffer, when its windows is closed. Vim discards the content in the buffer on exit without warning. If you like to clear it before, you ...


1

:saveas is not going to work in a scratch buffer. A scratch buffer is a temporary buffer, that is not associated with a file and therefore cannot be saved. Instead they are discarded without warning, when vim is exited. If you would like to know more: :h special-buffers :h buftype


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