vim-javacomplete2 - Don't write first suggestion to line - vim

I recently installed the plugin vim-javacomplete2 via vim-plug into Vim 7.4. Overall, I am happy with it but there is one thing that bugs me. When i initiate it with <C-x><C-o> it writes the first suggestion to the line like so.
Is there anyway to have it list the suggestions without writing the first one to the line like this?
I see it done on the plugin's GitHub page but i am unable to figure out how.

Since it says it uses the vim omnicompletion, i bet it works with the normal completopt settings: :set completeopt+=noinsert see :help completeopt for more information

Related

Can you view the default Vim settings?

I’m starting to learn about creating my own .vimrc file and I keep noticing features that are missing with my custom version that were present in the default setup.
I was wondering if it is possible to view the default settings, so I can compare them to my own and look up all the standard inclusions I don't know to learn more about them.
I searched and couldn’t find an answer online, and if the reason why there isn’t one is that the answer to this question is glaringly obvious, I’m really sorry; I’m still a bit of a noob :p
No worries, it’s a perfectly valid question. Unfortunately, the answer is a bit complicated. First of all, Vim has certain defaults that are documented in the built-in help system.
Some of them are only used when Vi compatibility mode is disabled, and that’s the first customisation most people make:
:set nocompatible
On top of that, many distributions provide their own custom config, for example Debian/Ubuntu comes with /etc/vim/vimrc. To makes things even more confusing, Vim 8 comes with a sane configuration (called default.vim) that only gets applied when ~/.vimrc is not found. Not to mention that NeoVim comes with its own set of defaults.
In practice, I suggest to explicitly set any options you care about to make sure your config is portable between systems and versions of Vim. To see the current value of a given option, use a question mark:
:set showcmd?
To learn more about a given option (including the default value), use Vim’s comprehensive help system:
:help showcmd
Finally, you might want to check my annotated .vimrc for some inspiration, and there is also the vim-sensible plugin that provides some sane defaults most people would agree to.
The easiest way to see “vanilla” Vim options is to start it using:
$ vim -u NONE -N
It will start Vim without any of your customizations or plugins, but still in ‘nocompatible’ mode (i.e., basically, running full-fledged Vim, instead of its stripped down version emulating Vi).
Then, you can execute the following commands:
:set all
:map
:command
:let
:function
:autocmd
to see all options, mappings, commands, variables, functions, and auto-commands, respectively, that are currently in effect. (I cannot promise I haven’t forgotten a customization category.)
Vim also comes with a bunch of basic configurations that is skipped by the -u NONE option, that you can also include while still excluding your .vimrc, by using -u NORC, instead.
Based on #Amadan's answer, I came up with this file (ShowAllDefaults.vim) and command to run it and capture the output.
. In the mean time, learning that, if you have files under ~/.vim, they get executed if you use this:
vim -u ShowAllDefaults.vim -N +q
So the correct way to do it is:
vim -u NONE -N +"source ShowAllDefaults.vim" +q
Contents of ShowAllDefaults.vim:
set verbosefile=/tmp/ShowAllDefaults.log
set all
map
command
let
function
autocmd
I am trying after long time to get familiar with vim also, and I came across this because I had same question.
How I found answer from within vim was to pull up help on defaults and it explained to get defaults along with .vimrc for newer users and also gave the path to default script so you could open it right up in your editor and read & compare it.
I am not going to give my exact path because that might change in different versions, so best to get it from help documents inside vim.

Does anyone have extra «» generated from lh-brackets

Can't seem to find any reason for this, but I have been using Ycm, syntastic, and all the lh- plugins with vim for a while now. In the case of lh-brackets, I used to have a problem with it generating "«»" every time it 'automatically' generated the other bracket, paren, quote, etc. But it was only happening in .vim files, so i turned it off for vim files in my vimrc. Now nothing has changed, no new scripts installed, and all of the sudden, this happens with ALL files (cpp, h, pl, py, etc). Like i said, not using heavy customization, and everything is default except the disabling of lh-brackets when editing vim files, but that has now become a hotkey since i cant use it anywhere.
My Question is this: does anyone have this or similar problem with lh-brackets, and if so, any idea how to fix it, or is there some setting I am missing?
My first thoughts are to go though and check any updated vim scripts (this just happened a day ago) that could have been updated when doing an apt-get upgrade (like debian.vim) but after that I've got nothing...
The placeholders characters can be jumped to (:h <Plug>MarkersJumpF -> <C-J> with vim, <m-ins> with gvim). That's their purpose.
If you have installed lh-cpp, see :h lh-cpp-first-steps, you'll find a quick guide to my C++ suite (and lh-brackets incidentally).
EDIT: The plugin was badly designed. I've patched the plugin to rely on g:usemarks in order to fix the ergonomic of plugin .
In the (now-) past, if you wanted to set b:usemarks to 0, you'd have needed to add an autocommand that'd set b:usemarks to 0 in all new buffers.
Now, (lh-brackets v2.2.0), if you want to always disable the placeholders/marker characters, you need to set g:usemarks to 0, not b:usemarks. Buffer-local variables are meant to be set from ftplugins, or tree/project-local plugins which are supported thanks to plugins like local_vimrc.
And as romainl has pointed out, don't hesitate to use the bug trackers, or even to contact me.
hmm found it:
:let b:usemarks=0
now needs to be set, apparently that was a marker for integration to another plugin, though i dont use it.

How can I enable SCSS snippets for Vim's SnipMate?

I have installed garbas’s snipMate fork and honza’s snippet repository for Vim 7.3. I’m running OS X Lion 10.7.5.
I’m able to get everything working properly, as expected — my problem occurs when trying to add scss.snippets (I have tried to do so both as a plugin and manually into the snippets folder, with the same results). I know my new snippet file is recognized, because I tested it by adding CSS snippets to the newly-created scss.snippets file. I knew this would cause a collision, and it did in fact bring up the collision prompt (as outlined in the snipmate docs).
The specific problem: Typing a trigger and then Tab deletes the trigger and doesn’t return the expanded snippet.
I have tried setting the filetype and also the scope.alias solution proposed in Vim and snipMate (plugin) - adding new snippet won't work and in the docs, but I get the same results. Lastly, I tried eliminating all potential n00b mistakes by trying the above solutions against a clean .vimrc file. Again, I get the same results.
10 million virtual high-fives for anyone who can help me — until then, I’ll be bouncing my head off my desk awaiting my salvation... or perhaps reinstalling TextMate. Thanks in advance.
It's probably the snippets you used are not indented correctly or there's some mistakes in the syntax of those snippets which Snipmate then fails to autocomplete
Try looking at that particular snippets file and see if it's highlighted in some way.
it's just probably a wrong indentation of the source code.
Because i reproduced the problem on my scss.snippets file by reindenting or using improper syntax on the snippet files.
NOTE: the snippets use tabs instead of spaces so be sure to disable expandtab
:set noet or :set noexpandtab
I myself, don't know the reason behind this.

vim plugin for directory list/file open

I'm looking for a vim plugin similar to http://www.vim.org/scripts/script.php?script_id=1325 with a directory list in which you can select a file to open. Does this exist somewhere? Wasn't able to find it myself.
NERDTree is the second best ranked plugin on vim.org and it perfectly fits your description.
There are many other variations of the same principle:
FuzzyFinder
LustyExplorer (the one I used before)
Command-T (famous among TextMate switchers, I never liked it, though)
CtrlP (the one I use now)
…
And I second :Explore.
Have you tried the :Explore command that comes with the standard vim distribution since (roughly) version 6?
See http://vim.wikia.com/wiki/File_explorer for basic help on that command.
See http://vimdoc.sourceforge.net/htmldoc/pi_netrw.html#netrw-quickhelp for detailed help on what the Explorer can do.
If you want to open an explorer without replacing the current buffer, you can use the :Sexplore command. A puerile mnemonic for that is to execute :Sex.

How do I setup REPL on vim?

I have installed vimclojure to make it easier to start learning clojure. But, I haven't been able to setup REPL inside vim. This is essentially because I was not able to write a maplocalleader in vim(?)
Based on the documentation in vimclojure/doc/clojure.txt I put the following in my .vimrc to start the REPL -
:map <LocalLeader>sr *sr* *StartRepl*
But typing "sr" doesn't start the REPL.
Thanks in advance.
Most likely there is an error occurring in the plugin before the VimClojure mappings are fully defined.
One likely scenario that I have run into several times occurs when the Clojure source file has syntax errors when it's loaded into the Vim buffer.
There's something going on in the plugin during the load of the source file (syntax highlighting or something) that errors out and prevents the mappings from getting defined.
This is probably just an unfortunate issue with VimClojure and should be reported, but I haven't had time to dig enough and log an intelligent bug report/patch.
To troubleshoot, with a Clojure source file open in current buffer, try doing this:
:call vimclojure#Repl.New()
This invokes the function inside the plugin that is mapped to \sr. It's not a recommended way of launching the Repl, but since we're just troubleshooting your configuration, hopefully it will reveal something meaningful to you.
Also, do this to see if there happen to be any helpful messages getting logged.
:messages
<LocalLeader> uses value from maplocalleader variable or it is backslash by default. If you do not set maplocalleader variable try \sr
I've found vim-fireplace plugin a much easier way to start learning Clojure in Vim. Good introduction can be found in "Unboxing vim-fireplace".
I don't have a mapping for sr in my .vimrc, but it works for me.
Have you checked that your Nailgun server is running, and that you have turned on Gorilla?
E.g.,
let clj_want_gorilla = 1
let vimclojure#NailgunClient = "/Users/foo/vimclojure-2.1.0/ng"
One can use Conque, a vim plugin that supports running a shell in a vim buffer. I have successfully used it to run a clojure REPL inside vim. It supports split screens, so one can send code from a clojure source code buffer to the clojure REPL.
I've found that if the NailgunClient cannot be found, VimClojure will fail silently and none of the <LocalLeader> commands will work. I'm basically just repeating Joe Holloway above, but try this to verify that the Nailgun client is actually found:
:call vimclojure#Repl.New()
In my case I forgot to build the client, so I just returned to the unzipped VimClojure folder and ran make. This creates ng, the nailgun client executable. Make sure this is in your PATH somewhere, or set
let vimclojure#NailgunClient = "/Users/foo/vimclojure-2.1.0/ng"
as mentioned above.
Don't you need to press ,sr? LocalLeader is a comma by default I think.
Have you tried mapping it to something else? It seems like you aren't sure what LocalLeader is mapped to, so I would recommend changing your mapping.
I solved the E10 problem with :set nocompatible. Then the \sr etc. commands worked OK.
Getting VimClojure setup with a Nailgun server is how I've done it. I use leiningen to help manage the classpath. It's a fairly complicated process, but nice once you've got it set up.
In addition to using the correct local leader key (ie. "\" -> \sr by default), note that in order for VimClojure to start a repl, a clojure file needs to be loaded in the buffer. If you just start vim and hit \sr nothing will happen because VimClojure is not active yet.
You can activate VimClojure by editing a file with the clj extension. From inside vim:
:e test.clj
Now when you hit \sr the repl should open. If not, see the other answer regarding checking hidden error messages.
This tutorial is up-to-date as of time of writing and helped me get VimClojure set up with Leiningen in OSX: https://github.com/daveray/vimclojure-easy
The more advanced setup linked to in the What's Next section was also helpful.

Resources