:vsplit autocomplete not working with /django/ directory in VIM - vim

Normally if I type :vsplit /path/to/some/directoryTab, the available directories will autocomplete.
After doing a reinstall of VIM, there is one directory that now will not allow autocomplete, and I can't figure out why. The directory is ~/Sites/django/. Once I type ~/Sites/, Tab will show me drupal and apps directories, but will not show django. If my working directory is inside this django directory, :vsplit won't let me autocomplete either.
I did a ls -haltr on the directory and it looks the same as the others inside the ~/Sites/ directory.
Also, when I use the CtrlP plugin inside this directory, I get the error "==NO ENTRIES==". In other places, CtrlP works fine.
Why might this be happening and how can I fix it?

The directory is getting ignored because it has /django/ in it's path...which was set by my Python linter. The linter causes Vim to ignore /*django*/. To see this, use set wildignore to see what directories are getting ignored.
I just changed the directory to /dj/ and it works fine.
I could have also changed the wildignore directories by using set wig-=my_directory command.

Related

vim: change pwd while working with cscope

I'm currently working on project using vim+cscope.
Sometimes, to make some code-exploring tasks easier I use :cd command to navigate to a specific folder withing the project. But then, if i want to issue some cscope command such as Ctrl-] or :cscope find it won't work before i change back to my project's root directory. I understand that's because cscope just tries to open the path as it is written in the cscope_db file without any sophistication.
So how do i make cscope "remember" my project's root directory so wherever i am it will always know to open the right path?
Apparently :set csre did that for me:
basename of cscope.out location (usually the project root directory) will be used as the prefix to construct an absolute path.
Due to some misconfiguration I missed it.

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

How to keep previous directory in CtrlP?

Using the CtrlP plugin, I'm typing .. several times to get to the root directory of a project, then perform the search from there.
However after I reopen CtrlP it still searches in the directory of the current file.
How can I get it to stick to the directory that I originaly set ?
By reading its documentation, of course.
If you want CtrlP to always open in your project's root directory, if applicable, just add this line to your ~/.vimrc:
let g:ctrlp_working_path_mode=2
But you could also use both :CtrlP to browse in the current directory and :CtrlpRoot to browse in the root of your project.
Or simply use :CtrlPLastMode to launch CtrlP in… the last mode.
If your project doesn't fit CtrlP's definition of a project, a simple mapping could be enough:
nnoremap <key> :CtrlP /path/to/project<cr>
or you could use this option:
let g:ctrlp_root_markers = ['']
edit
My answer was based on the version of CtrlP currently installed on my machine.
The latest version adds an optional argument to :CtrlPLastMode: --dir which does exactly what you are looking for:
:CtrlPLastMode --dir
The g:ctrlp_working_path_mode values are different, too. I believe r is the equivalent of 2.

Plugins in gVim not working

I need help in installing some of the popular plugins in Vim. I just started learning this editor and is very excited to use the popular plugins. I'm using gVim in Windows XP and have extracted the .vim files and copied them to the Program Files folder of Vim.
Inside my "F:\Program Files\Vim" folder, there are exactly two folders the "vim73" and the "vimfiles" folder. I put the .vim files (EasyMotion.vim) into the "plugin" folder inside the "vimfiles" folder.
When I run gVim, the plugins doesn't work, and in my case, the EasyMotion plugin is not working. I typed the "/w" to make the EasyMotion plugin work (as stated on its usage on its github account) and nothing seems to work.
Am I missing out something here? Are there extra commands to put in the vimrc file to recognize those plugins?
Cheers!
Never touch Program Files. There is a vim setting called 'runtimepath' (see the :help 'rtp') that says where Vim is going to locate the plugins. For each directory in the runtimepath, Vim will source every .vim file found in the plugin subfolder, and lookup for functions containing # in their names in the .vim files of the autoload folder. It will also lookup filetype plugins in the ftplugin folder when 'ft' is set.
Normally you should have %HOMEPATH%\Vim\vimfiles in your runtimepath (:echo &rtp to know). Unzip Easymotion there, NOT in Program Files.
Due to that structure, vim plugins mix up in the same 2-3 folders. However it is possible to install every plugin in its own subfolder if you play with runtimepath. The pathogen plugin is dedicated to that. It makes it possible to have every plugin in its own subfolder, and adds every plugin root folder to the runtimepath. The Readme is self-explanatory.
As #benoit said, you should never in general put files into your vim73 folder
(notable exceptions exist, but you'll know when you encounter them).
On windows, Vim searches for configuration files (those include _vimrc and your
plugins) in several directories, in a certain order. First it will look in
$HOME ... which is your c:\documents and settings\username\ folder
$VIM ... which is the folder where you installed or extracted Vim
$VIMRUNTIME ... which is your \vim73 folder ...
and so on ...
What this means? It means it will first look in $HOME before looking in let's
say, your Vim install folder. So it is a nice way of separating plugins which
you just want to test out before being sure you're gonna be keeping them.
For example, you could organize your Vim related files in this manner:
- install vim to c:\vim or c:\program files\vim\
(vim's program files will go in \...\vim\vim73\)
- put your _vimrc in \vim\
- put your vimfiles in \vim\vimfiles\
- and put your temporary vimfiles in c:\documents and settings\username\vimfiles\
That way when you're done with them, you can just delete that last
\username\vimfiles\ folder.

Resources