Vim omnicompletion: optional preview window - vim

I've searched for different types of workarounds to deal with the preview window splitting the current window to display documentation when doing a selection in Omnicompletion, like closing the preview window if it exists when you leave insert mode.
However, those solutions are impractical. Sometimes you may want to go into the preview window to read some documentation about the current completing module, but with the autocommand in place this would not be possible.
Even if it would, I am looking to have the documentation never show up because I really don't want it.
Reading the source code in pythoncomplete.vim I see that the value for the documentation is hard coded and it will force the preview window to show up if this has any contents (it skips this if it can't come up with docs for the module).
Is there a global option that I am not aware to tell Vim to never display docs? Or be able to toggle it?
If I do want to read the docs in a split window allow me to do so (maybe with some shortcut) otherwise don't show me anything.
I really want to avoid having to copy/paste pythoncomplete.vim to tweak this particular setting to my liking.

The preview is controlled by the global 'completeopt' setting. To turn that off, use
:set completeopt-=preview

Related

How to expand an UltiSnips snippet using <c-y> in the YouCompleteMe pop-up menu?

This problem really hit a nerve with me. I have both YouCompleteMe and UltiSnips installed on my vim 8.0 editor. It seems that both of these plugins use the tab key for doing the auto-completion and that has created an incompatibility that has been also addressed by this question. My question is more specific, though. When I write a piece of code like <html, there is a pop-up menu that shows me all related snippets for that code.
I use the tab key to navigate through that menu but when I hit ctrl+y to accept and therefore expand one of these snippets, nothing happens! I think this structure suggests that it's possible to somehow choose one of those snippets from the menu without trying to define a shortcut for UltiSnip. What am I doing wrong? How should I navigate and choose those snippets?
I also would not want to stuff my vim with any new plugins (like supertab, etc.).
The solution was actually a lot simpler than I expected. In the beginning, I felt stupid for not knowing it but when I find a similar question like this one, I thought that probably many were fallen into the same trap.
I don't know whether to name it a bug or not but it's how Ultisnips and YouCompleteMe work together. In order to expand a snippet, you have to write the initializer exactly as it's defined. Of course, this seems obvious, but when you see a pop-up menu of different snippets, you might think they can be chosen but it only works if you already wrote the snippet initializer exactly as it's defined.
So when a snippet is called "html5"---as it's shown in my question---writing an extra opening bracket (<) will cause it to stop working. It cannot be expanded.
Also, don't forget to check out Siegfried Gevatter configuration. It's not possible to use tab key both for navigating into the pop-up menu and expanding the snippets.
P.S. It was nice if navigating through the pop-up menu could change the whole word (including the angle bracket), not just what succeeds it. This feature works this way in most of the other editors I see and that's probably why I wasn't able to spot the problem in the beginning.

vim: where is the autocompletion preview window for ctags generated tags?

The documentation for the "completeopt" options says:
...
A comma separated list of options for Insert mode completion
|ins-completion|. The supported values are:
...
preview Show extra information about the currently selected
completion in the preview window. Only works in
combination with "menu" or "menuone".
For me this sounds that if "menu" and "preview" is set, you always get a preview window for the current autocompleted item, so for a ctags tag I expected to see a preview of the file, where the item is defined (the same as I would press CTRL-W-} on a tag under the cursor).
But it seems this preview window is only available for omni-completion, if the set omnifunc supports it. How could I also get a preview window for autocompleted tags?
The built-in completions don't have much additional stuff to show, so this feature is only available for custom completions (as you'd correctly assumed), namely via the info attribute in the returned completion items, see :help complete-items.
If you really would like additional information about tags (but there isn't much, see :help tags-file-format), you'd have to write a custom completion (sourced from taglist()) and populate the mentioned info attribute.
This is far from perfect but you can set showfulltag to get more information for each suggestion.
Without set showfulltag:
With set showfulltag:
As you can see, the completion menu becomes a little crowded and you must skip entries but well…
Using the preview window would be so much nicer.
See :help 'showfulltag'.

Vim popup menu, like the omni autocomplete popup

I'm making a Vim Script. I want to make a popup that offers alternatives. It should work the same as the Omni-popup, but not replace the string or go through the omni functions. Like this:
I've haxxed in the functionality I need by using the completefunc and the auto command event CompleteDone, just to get the popup. But it's really ugly and messy, since I'm not using it for auto completion.
Is there a way to use this popup but with full control, not going through the omni-complete functionality? Like populating it with values and receive the value selected?
I know you can just place the alternatives in an other buffer and just grab the input from there. But it disturbs the work flow, I want a popup.
The insert mode popup menu is only meant for completions, as you've correctly found out. There is not other precedence for popup menus as a general selector in Vim, so such functionality is not there and is difficult to emulate. (In GVIM, one can populate a right mouse button popup menu, but this would need to be triggered by a mouse key press.)
The "Vim way" would be to :echo the list of menu items and query (via getchar() or input()), or just use confirm() or inputlist(). Examples built into Vim are the query in :tselect.
Plugins often use a split scratch buffer to build a more elaborate menu; this can even be combined with 'completefunc', as any text entry into the scratch buffer is discarded, anyway.
The FuzzyFinder - buffer/file/command/tag/etc explorer plugin uses this, and even provides an API for custom uses, cp. :help fuf-callbackitem-mode. That's certainly worth a look, though the menu would still be located at the top, not inside the current buffer.
Do either of these do what you want?
:help inputdialog()
:help inputlist()

Vim Autocomplete Hints for Go

I use https://github.com/nsf/gocode in conjunction with https://github.com/Shougo/neocomplete.vim for my Go autocompletion.
It works really well, except for one little thing. When I type something like
fmt.pri
I get autocomplete option like so:
fmt.Println(a ...interface{}) (n int, err error)
Since I'm new to Go, this is super helpful, because now I know what arguments the method takes, what are the types, and also what does it return.
Unfortunately, as soon as I write past bracket, the information is gone.
fmt.Println(
So on more complex methods that I'm using for first time, I'm stuck, and have to jump to source definition, or run godoc.
It would be much easier to have that information available somewhere, preferably on the bottom of Vim where the command/status line is.
Does anyone know how such a thing could be achieved?
Preview window breaks my Vim so it's not an option.
I use autocomplpop (well, my fork of it) and it has a feature where it does a small split window with the completion text in it that sticks around. It does this when you set...
let g:acp_completeoptPreview = 1
I'm sure neocomplcache has a similar feature. Glancing through its documentation it discusses a preview window in several places. Search for preview in its docs and see what you can find.
This is ultimately controlled by 'completeopt' containing 'preview' (:h completeopt). The auto-completing packages often set these values as part of their functionality, which is why with autocomplpop you need to use its option to control it instead of just doing 'completeopt+=preview'.

Text editor in Windows with real time update?

What's a good text editor in Windows that automatically updates the view whenever the opened file has been modified by another process? I need this to watch the output of my program.
If you like using a mouse, Notepad++ is great
If you're happier with the keyboard, for me, it has to be Emacs. Here's the download for Windows.
To use the feature in Emacs, add the following to your .emacs:
(global-auto-revert-mode t)
There are lots of people at work who like Textpad but I don't understand why, it doesn't even have column editing.
Notepad++ has this feature.
If you want to reload automatically, go to Settings / Preferences, then the MISC tab and uncheck Update silently under File Status Auto-detection.
What I use is snaketail. It can update in real time several files, even without the focus.
I would recommend Notepad2. It refresh the content automatically without focus switching. You just need to go to menu 'Settings' and set 'File Change Notification...' option, and then save your settings. But keep in mind, refresh has a delay about 2-3 seconds.
Editplus is great.
This doesn't really answer your question, but it sounds like what you really want is some kind of console view, not a file. Would it be possible to pipe your program's output into an output stream that's visible in a console instead? Those are designed to show new lines as they arrive, automatically scroll, etc.
See the Viewer (F3 option) in FAR file manager, when End button is pressed, it updates and scrolls text automatically
Use Tail For Windows.
Tail doesn't need to have focus on.
I've got it from superuser.com answer.

Resources