Vim Autocomplete Hints for Go - vim

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

Related

How to remove the fold level numbers in vim?

I'm using NeoVIM, and I set up it to show folds automatically. The trouble is that when there is more than one level of folds, it's going to show numbers at the left.
Is there any way to remove them, just look like any other modern editors?
I searched on google, StackOverflow, and checked the vimhelp page. I haven't seen a way for this.
I'm sure that's the default behavior, I can reproduce it on the default vim of codesandbox and without any plugin. Please check this link https://codesandbox.io/s/wizardly-tereshkova-vwh5im?file=/README.md. Here is the screenshot.
As explained in :help fold-foldcolumn, when the value of :help 'foldcolumn is large enough, the fold level is indicated by vertical bars but, when there is not enough room, numbers are used instead. That behavior is not governed by any option so there is nothing you can do about it except rolling up your sleeves and modifying the source code.
That said, the ˇs in your screenshot are clearly not standard `:help 'fillchars', as hinted in the comments, so you should probably take a look at what is redefining those before taking any action.

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.

snippet in vim - any option to go back to the previous parameter?

I am using neocomplcache along with neosnippet and honza's vim-snippets. They are great, except that when I press Ctrl-k, I can go to the next parameter, but I have no way to go back to the previous parameter.
So for example, if I inserted 'for' snippet and made a typo on the index variable, but I already pressed Ctrl-k, am I screwed? Must I go through modifications of all the parameters and then come back to do replace operation? Or is there mapping for select mode that I can help me in this situation? Currently Tab and S-Tab do not do anything.
Lastly, are all snippet plugins like this? Or is neocomplcache just missing this feature (out of the box, at least)?
I encourage you to try UltiSnips. It is much more powerful and mature than vim-snippets or neosnippet. For instance, since UltiSnips is based on Python, it is very extensible. Concerning your problem: yes, you can jump back and forth with UltiSnips. Finally, be sure to check out screencasts (listed in the link) to see all the fancy stuff you can do with it.
For example, I use the following configuration:
let g:UltiSnipsSnippetsDir = '~/.vim/snippets/'
let g:UltiSnipsSnippetDirectories = ['UltiSnips', 'snippets']
let g:UltiSnipsExpandTrigger = '<C-CR>'
let g:UltiSnipsJumpForwardTrigger = '<A-d>'
let g:UltiSnipsJumpBackwardTrigger = '<A-a>'
NOTE: ~/.vim/snippets/ is my directory for custom snippets.
As I've already mentioned UltiSnips uses Python extensively, and therefore requires Vim to be built with Python support. If you are on Windows (especially x64), that might be a trouble, the one I've run into quite some time ago. To save yourself precious time and avoid frustration you may consider downloading my Vim for Windows. Both x86 and x64 architectures are provided, and it supports both Python 2 and Python 3 simultaneously. I can assure you that it is stable. To install properly just follow the instructions. These builds are updated frequently.
The original SnipMate and its fork (the plugins for which vim-snippets is actually meant to be) both allow you to go back to the previous placeholder with <S-Tab>. I believe UltiSnips does too.
Neocomplcache doesn't support snippet expansion out of the box anymore. AFAIK, you need another plugin by the same author called neosnippet which is the one responsible for the <C-k> mapping. A quick look at the doc shows no "reverse jump" mapping, function or command. You can probably create a new issue on neosnippet's Github page.

Vim omnicompletion: optional preview window

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

Vim: How to set up an efficient autocomplete configuration?

I've been using Vim for a while now and love it, but one thing I've noticed when I use other editors is that I've never really got autocomplete working with much efficiency. I have supertab & snipmate working, I have tags for whatever language I'm using set up, but somehow it seems a little too cumbersome to use all that much, and apart from long method names I typically just avoid autocomplete.
Does anyone have fast, comprehensive autocomplete funcitonality set up in vim? Specifically:
At the moment, I hit "tab" to autocomplete class/method/variable names & generate snippets, but Ctrl+X+O for inbuilt langauge commands. I'd rather press tab for everything.
The ordering doesn't seem to be too intelligent. Very common stuff is often hidden in the middle of a bunch of rarely-used commands.
I've set up autocomplpop to show potential autocompletes as I'm typing, but I have to hit tab twice to accept the first entry. One much rather single-tab it.
So, any tips on setting up an efficient, comprehensive autocomplete configuration in vim? I know this question is a little vague - but if anyone has an overview of how they autocomplete well, and/or a link to a guide, it would be much appreciated.
Just thought I'd come back and mention that I finally found something I like: A customised version of NeoComplCache. Nice auto popup, everything integrated pleasantly into 'tab', and with a bit of customisation plays nice with snippets.
http://www.vim.org/scripts/script.php?script_id=2620
This is very dependant on your working domain. Vim is a text editor with the ability to interface with intelligent text-aware mechanisms.
If you are using java there is eclim, which is the eclipse backend together with a vim plugin for the frontend.
For C or C++ there is the plugin OmniCppComplete
It works by scanning the headers in the paths you have set up in vim (see :h path), and works very well imo.
If you have to press Ctrl-X_Ctrl-O for omnicompleteion, then your supertab config seems a bit broken. It should try omni or filename completion first, and then fall back to word completion.
YouCompleteMe plugin by Valloric is a very decent plugins for autocomplete and suggestion.
It contains support for all the major languages and you can extend the feature with setting up different engine .
it also comes with syntax checker so u don't have to use Syntastic separately
For setup details visit this link
https://github.com/Valloric/YouCompleteMe

Resources