I'm trying the Vim plugin Jedi-vim and it would open a preview-window while doing autocomplete and close when it's done. This may cause the cursor and the code to jump in term of the location in the physical LCD screen and it makes my eye uncomfortable. I have the option of leaving this window open, however I prefer to have a bigger screen estate. Is there a way to move the preview-window else where like maybe on the bottom, or use vertical split instead?
Asked
Active
Viewed 3,102 times
3 Answers
7
The only thing that distinguishes the preview window from other windows is the 'previewwindow'
option. You can turn any window into the preview window via :setlocal previewwindow
, or influence the position of it via e.g. :botright vertical pedit
.
When Vim opens the preview window, it is positioned above the current window. So, you either need to manually open it before attempting the completion, or completely turn off this behavior via :set completeopt-=preview
.

Ingo Karkat
- 167,457
- 16
- 250
- 324
-
Hmm I'm not that far in understanding Vim yet. I tried `:botright vertical pedit` after the window is open it just say "E32: No file name" – huggie Mar 24 '14 at 03:39
-
`:pedit` requires a filename; I just left this obvious fact out of the answer. – Ingo Karkat Mar 24 '14 at 07:19
-
1OK, `:botright vertical pedit previewwindow` puts the preview window on the right. Thanks. – huggie Mar 26 '14 at 04:27
-
Is there a way to resize the previewwindow by its name? I would like to put this into vimrc. – huggie Mar 26 '14 at 04:59
-
I did a `vertical resize 120` and it controls the focused window so it does its job. But putting that botright command into vimrc, when vi is opening it'll say `"previewwindow" [New File]` and not opening the file immediately. Not so happy about the pause. Anyway to turn that off? – huggie Mar 26 '14 at 05:07
-
Hmm, when trying to do that for a particular filetype, `autocmd BufNewFile,BufRead *.py botright vertical pedit previewwindow` has a side effect of turning that pause off. Oh well, I am not well versed in Vim, but I am happy. :D – huggie Mar 26 '14 at 05:10
1
Try something like this:
augroup PreviewOnBottom
autocmd InsertEnter * set splitbelow
autocmd InsertLeave * set splitbelow!
augroup END

vim4life
- 11
- 1
-
You can achieve the same results with `set splitbelow`. Which is a little cleaner than the above. – David Ross Apr 28 '19 at 19:09
0
If you are using gVim you can,
- Select the Preview Window in Normal mode
- Click on Window menu in the toolbar >> Move To >> Right Side
I know using a mouse is a "non-VIM" way of doing it, but it works, and is easy.

Sri
- 1
- 1