How can I reload the .ycm_extra_conf.py file in YouCompleteMe? - vim

In the YCM documentation, it says that "YCM looks for a .ycm_extra_conf.py file [...]; when the file is found, it is loaded (only once!)".
Is it possible to reload this file after Vim has already started? If so, how can I do it?

Since this merge, :YcmRestartServer will reload your config.

Related

Vim is not creating .swp files

I was working in vim and my OS(Mac OS X El Capitan) crashed.
I tried to recover from .swp files created by vim (usually). But, I noticed that vim is not creating them. I already setup swap/backup directories but not luck.
Btw: Im using this well-know vim config (https://github.com/amix/vimrc)
I found the issue, IDK why but by default backups and swap mode are disabled if you use this well-know vim config ((https://github.com/amix/vimrc))
To fix it, just add these lines to your vim config file
set swapfile
set backup
I had a similar problem where Vim wasn't challenging me when I was editing a file twice. It turned out that somewhere along the line I had an old version of that file's .swp file and it was creating a .swo file instead. I exited Vim, removed the old .swp file and when I re-edited the file in question it created the swap file with the .swp extension. If I tried to edit the file in another window it complained that a swap file already existed, as it should.
These alternative swap file names are discussed here.

Per project flake8 configuration

I'm using flake8 through syntastic in vim and I want a configuration file per project.
On the syntastic documentation it states that:
Depending on the checker, the filename of the corresponding
configuration file can be specified by setting either
g:syntastic_<filetype>_checker_file or
g:syntastic_<checker>_config_file. See the checker's documentation in
the wiki for the exact name.
The flake8 documentation says that .flake8 is a valid configuration file name. So I tried to place a valid flake8-configuration file called .flake8 in the root folder of my project. No luck.
I've also tried setting g:syntastic_flake8_config_file and g:syntastic_python_checker_file to .flake8 in my ~/.vimrc, still nothing.
What am I missing?
Just adding a .flake8 file to my working directory didn't work for me either.
But you can pass commandline options to syntastic checkers by setting the following option in your .vimrc:
let g:syntastic_LANGUAGE_CHECKER_args = 'ARGUMENT'
Flake8 accepts a --config=PATH flag to specify a config file, so in your case this would be:
let g:syntastic_python_flake8_args = '--config=PATH_TO_FLAKE8_CONFIG_FILE'

vim creates temporary files in the current working directory

I normally setup my backup directory in my vimrc as follows.
set backupdir=~/vimtmp,/tmp,.
set directory=~/vimtmp,/tmp,.
This works as all the *.*~ goes to the vimtmp folder.
However, certain plugins such as NERDTree, Tagbar create their temporary files in my current working directory. For instance, following files are created when these plugins are started.
[[buffergator-buffers]]
__Tagbar__
NERD_tree_3
This is really annoying issue because when I work with a version control system, these files are being created in some folders and I sometimes push them to the central repo accidentally.
Could you please suggest me some tips to handle this problem? For instance, how can I set current working directory specifically for the plugins so that they will use that directory for their temporary files.
Thank you very much.
After reviewing my own vimrc file, I found that following auto command is causing the problem. I was using this command to automatically save a file when I have created it. However, the side effect of this command was that it saves all buffers (even NERDTree, TagBar etc.) as well. Therefore, it was cluttering my working directory. So, by disabling the following command, I solved the problem.
" evil command
" autocmd BufNewFile * :write

How to make vim javacomplete to work?

I confess that I am a beginner in using vim and this question might be as dumb as it sounds. These are what I've done so far :
I downloaded the latest zip file format of the script from here.
I unzipped it to the .vim directory that placed the files javacomplete.vim, java_parser.vim and Reflection.java inside the ~/.vim/autoload directory by default.
The following option is set (much better, I've added it to my .vimrc file):
:setlocal omnifunc=javacomplete#Complete
java and javac are set properly in the system path variable (they work from the command line).
Assuming that that's all I need to do, pressing <C-x><C-o> (in the insert mode) doesn't do any auto-completion inside a .java file.
What am I doing wrong here?
If you're using Vim 7.2, there's a few issues related to how the plugin locates the java-based Reflection helper.
If you have .class listed in your wildignore or suffixes, then it can't actually locate the class file to execute.
I have a clone that I modified to get around that on github : https://github.com/cilquirm/javacomplete
Give that a go and see if it works for you

VIM: Unable to uninstall Latex-Box plugin with Vimball

According to documentation, vimball uninstall should be a very simple process of typing in :RmVimball LatexBox
However, I get the error message
vimball (RmVimball) unable to find in .VimballRecord
I'm pretty sure I'm typing in the right prompt because LatexBox.vmb is the file I ran :so % on to install the plugin.
The Vimball documentation (http://www.cs.csubak.edu/docs/vim/pi_vimball.html) states:
:RmVimball removes all files generated by the specified vimball
(but not any directories it may have made). One may choose a path
for de-installation, too (see |'runtimepath'|); otherwise, the
default is the first existing directory on the |'runtimepath'|.
And indeed my .VimballRecord exists in the first existing directory of the output when I type in :echo &runtimepath . I opened up the .VimballRecord and it says
LatexBox.vmb: call delete('C:\Program Files (x86)\Vim\vimfiles/ftplugin/tex_LatexBox.vim')| ...
which seems to confirm that LatexBox is the correct plugin name. I'm very confused where the error is coming from. Otherwise -- How can I remove this plugin manually? (I'm concerned that going through and deleting files in the ftplugin folder is not thorough)
To uninstall a vim plugin is really easy, because there're no hidden stuff.
Go into C:\Program Files\vim\vimfiles(depending on your system)
Find out all files about LatexBox
Delete them.
Make a backup of vimfiles folder before deleting files.
If something goes wrong, you have a change to recover.
Update:
Answer you question about :helptags command:
When you install a plugin, it may contains help files(for example latexbox.txt).
It was often install in C:\Program Files\vim\vimfiles\doc directory (I will call it doc from now).
This direcotry may contains other help files for other plugins.
Notice there's a tags file in this doc directory. The tags file is used for jumping to location when you press Ctrl-] on a word.
Don't worry if doc\tags not exist.
You can use :helptags C:\Program Files\vim\vimfiles\doc to generate it.
When you install a plugin via vimball (which is just a vimscript to help you creating files/directories),
The vimball will create latexbox.txt in doc directory,
and run :helptags command to update the tags file automatically.
So, when you manually delete doc\latexbox.txt,
the tags file still contains infomatation about latexbox.txt.
Just run :helptags path\you\want\to\sync command again to get doc\tags synchronised.
Been there. The problem is that Vimball version (v31) that comes packaged with Vim is obsolete and does not support .vmb files. Check 1 for the latest Vimball version and you will be alright.

Resources