Problems getting Vim's omnicppcomplete to work right - vim

I'm trying to get OmniCppcomplete to work and I'm running into trouble. I've followed the steps on this page (including the things to add to the .vimrc file). I downloaded and extracted the zip file to ~/.vim, I ran the commands it says, I did everything there and it still doesn't work. I also tried downloading the modified stl for the __STD_NAMESPACE_BEGIN fix. I ran ctags on the directory and placed the tags file in ~/.vim/tags/cpp.
Whenever I type a class name or namespace name followed by a . or :: or whatever, I only get an error saying Omni completion (^O^N^P) Pattern not found. I've run tselect TestClass to see that the tags were actually being generated and they are, so I'm at a loss as to what's happening.

I think I figured it out. I had been placing my tags in a directory called ~/.vim/tags/cpp/, rather than making a file called cpp and placing it in the tags directory. It seems to work now.

Related

In XMonad, Mod-p (dmenu_run) displays an empty menu

When I hit MOD-p in XMonad, I used to get a list of commands. Now I just get an empty menu. If I type the name of an executable on my path and hit the carriage return, the command executes as expected. But why aren't any programs listed in the menu? Solution is posted below.
By default, XMonad maps MOD-p to dmenu_run. (You can see the default key bindings in the source code on github.) So I tried launching dmenu_run from the command line and saw the same behaviour; a blank menu that allows me to type the name of an executable in my path.
The problem was that the file ~/.cache/dmenu_run was empty. When I deleted this file and ran dmenu_run again, it worked perfectly (and created a new, non-empty ~/.cache/dmenu_run). I think the problem happened when I added a definition of $XDG_CACHE_HOME to my .zshrc file and the cache somehow got blanked out.

vimrc tags option specification for .git/tags files

I'm using the following method to populate a tags file in my repositories' .git directories:
https://tbaggery.com/2011/08/08/effortless-ctags-with-git.html
So, for any given git repo, I will have a .git/tags file in it. How do I configure my tags option to recursively look up from my current directories in a repo to find these tags files?
I currently have this:
set tags^=./.git/tags,*/.git/tags;~
As I understand it, that should look for ./.git/tags and if it exists use that. Else, it will go up one directory and look for .git/tags there. Failing that, it will go up two directories, and so on, stopping once it hits my home directory (~).
That seemed to work until I had another git repository in the mix. What I find is that if I have two repos at $HOME like so:
~/my_repo_2910
~/my_repo
If I am in ~/my_repo, things work fine. That is, tag resolutions happen via ~/my_repo/.git/tags. However, if I'm in a subdirectory of ~/my_repo, say ~/my_repo/dir, then running my tag commands will resolve to files in ~/my_repo_2910. I'm not sure how that is possible, but it is very dangerous for me to unexpectedly jump repos via my :tag lookups.
Clearly I'm not setting the tags option correctly. Can someone point out what I'm doing wrong.
Update
Knoble's answer works for me if I update my CentOS 7 vim to version 8 following the instructions here:
https://vi.stackexchange.com/a/21697/25433
Then his tags specification works for me fine.
With the recent fugitive updates, I had to fix my tags setup (fugitive no longer sets tags).
I have this line now:
set tags^=.git/tags;~
Note the lack of * wildcard
As sussed out in comments, there appears to be a difference between my version (8+ on macOS) and the OP version (7.4 RHEL)

Setting vimwiki defaults

The situation: I was using vimwiki, I stopped for a brief flirtation with emacs/org-mode, and then ran screaming back to vim. I figured it was a good time to clean up my kludgy setup, and so I started with a fresh ~/.vim directory, installed pathogen, and I've been adding packages that way.
What's very strange is, when I go to start a new vimwiki index file, I get the message:
Vimwiki: Make new directory: /home/thomas/Dropbox/wiki/wiki
despite my .vimrc containing instead
let g:vimwiki_list = [{'path':'~/cerebra/wiki', 'path_html':'~/cerebra/export/html/'}]
That is to say, it's trying to save the wiki in a place almost, but not quite, like my previous vimwiki installation, and ignoring the new setting I've given it.
I bet if I understood how to use find with grep I could find where this setting is so that I could delete it. I examined each file in ~/.vim/bundle/vimwiki, and found no instance of the word "Dropbox" there, and it's nowhere in my vimrc.
from the comments, it turns out, your $HOME/cerebra is a softlink to /home/thomas/Dropbox/wiki.
So vimwiki works just fine.
small suggestion:
You could consider to create a link in dropbox, not the other way round. dropbox supports it.

knitr & vim: Creating *.Rnw files

I'm trying to get knitr using, whilst creating a *.Rnw file using Vim (with the Vim-LaTeX plugin).
If I open a *.Rnw file in Vim, and type a < (e.g. for <<foo, echo=TRUE>>=) so I can input a code chunk, I find myself unable to type it, and Vim returns an error 'E117: Unknown function: RwriteChunk'
I have no problems typing a >or writing inline code (\Sexpr{}). Anyone found any solutions to this problem?
Many thanks,
Tom
PROBLEM RESOLVED
It turns out that the necessary runtime file wasn't in the right place. I have copied it from "~/.vim/ftplugin" to "/usr/share/vim/vim73/ftplugin" and now everything is working fine.

A few vim questions

So I was hoping that some old school Vim'ers could help me out. These are all separate questions and normally I would put them up each on their own but I'm not sure if that qualifies as question whoring here.
Plus I think if you know enough to be asking any of these questions they will all be coming up in the near future:
I have a library I'm writing and a series of applications that use that library. There doesn't seem to be an easy way(from what I can tell) to build a ctags file for the library and build one for each of my applications and make sure one references the other when I'm in vim.
Using gf to open files from command mode is awesome, but a lot of my include files
don't contain the full path. They refer to an include directory I set in the IDE. How can I set this directory as another point for Vim to start looking for files?
Is there a way to compile a file inside Vim and send the output to a buffer? I'm currently using MSVS 2k3 but I'll be porting over to Linux in a few weeks so if this is possible on either system I'd appreciate it.
Re 3)
If you put a makefile in your root dir, you can simply write
:make
This will run make and (iirc) put any errors into a seperate buffer, and make vim goto the first compile error. From there you can navigate all erroring lines using :next-error
Also, see this page
http://wiki.beyondunreal.com/Legacy:Vim
and
http://linux.byexamples.com/archives/287/perform-grep-and-make-in-vim/
for details on how to show the result in a seperate console.
1- tags files are independent, and can be used together. See :h 'tags'
I can't tell what is the easy way to build tags files. I have one that consists in using two plugins of mine:
one (draft) plugin that knows how to update C++ tags files (it should be easy to adapt it to other filetypes),
and another (local_vimrc) that helps me define directories-local .vimrc. Thus for any files within a given directory hierarchy, I can adapt the &tags options to use the relevant tag files, and the current tag file that will be rebuilt automatically (or when a keybinding is triggered). (Plugins like project should do the trick as well)
2- :h 'path'
3- :h :make
HTH.
2)
:cd {path}
For help:
:he cd
A few others like :lcd might be better suited. Just scroll down that help page.
This is rather off topic, but might still be useful: if you're using Visual Studio a lot and like Vim, you might want to look at ViEmu. It's the best Vim-emulation for any IDE I've yet seen, and the cost is really low. :) And no, I'm not getting a commission. :P
It's not obvious, but if you open a directory instead of a file, it's nicely browseable.
e.g.
:e . (colon-e-dot)
:e .. (colon-e-dot-dot)
will let you browse from your current directory or its parent.
(understanding that you were probably hoping for a capability to have vim accept e.g.
:e abc.txt
and have it look in several directories, which I don't know how to do.)

Resources