VIM: Preview Height

I am new to vim, so I was trying to modify an existing vimrc script file. The script will take the contents of the current buffer and copy it to a new window, and then start Python. The script works, but the preview window always makes up 50% of the current window.

This is the script:

" Preview window for python
fu! DoRunPyBuffer2()
pclose! " force preview window closed
setlocal ft=python

" copy the buffer into a new window, then run that buffer through python
sil %y a | below new | sil put a | sil %!python -
" indicate the output window as the current previewwindow
setlocal previewwindow ro nomodifiable nomodified

" back into the original window
winc p
endfu

command! RunPyBuffer call DoRunPyBuffer2()
map <f5> :RunPyBuffer<CR>

I tried installing lines, installing preview, installing pvh, winc 10 -, ... but nothing works. So does anyone know how I can change the height of the preview window?

+3
source share
1 answer

You can try changing the height of the window before setting it to "previewwindow":

" copy the buffer into a new window, then run that buffer through python
sil %y a | below new | sil put a | sil %!python -
" indicate the output window as the current previewwindow
setlocal winheight 20
setlocal previewwindow ro nomodifiable nomodified

Update:

, , โ€‹โ€‹ . "windowheight" , , .

- , :new:

:below 10 new  "create a window of height 10
+4

Source: https://habr.com/ru/post/1753031/


All Articles