How to reduce the time of clang_complete search through boost - vim

I like using clang with vim.
The one problem that I always have is that whenever I include boost, clang goes through boost library every time I put "." after a an object name. It takes 5-10 seconds.
Since I don't make changes to boost headers, is there a way to cache the search through boost?
If not, is there a way to remove boost from the auto-completion search?
update (1) in response to answer by adaszko
after
:let g:clang_use_library = 1
I type a name of a variable.
I press ^N. Vim starts to search through boost tree. it auto-completes the variable.
i press "." and get the following errors:
Error detected while processing function ClangComplete:
line 35:
Traceback (most recent call last):
Press ENTER or type command to continue
Error detected while processing function ClangComplete:
line 35:
File "<string>", line 1, in <module>
Press ENTER or type command to continue
Error detected while processing function ClangComplete:
line 35:
NameError: name 'vim' is not defined
Press ENTER or type command to continue
Error detected while processing function ClangComplete:
line 40:
E121: Undefined variable: l:res
Press ENTER or type command to continue
Error detected while processing function ClangComplete:
line 40:
E15: Invalid expression: l:res
Press ENTER or type command to continue
Error detected while processing function ClangComplete:
line 58:
E121: Undefined variable: l:res
Press ENTER or type command to continue
Error detected while processing function ClangComplete:
line 58:
E15: Invalid expression: l:res
Press ENTER or type command to continue
... and there is no auto-compeltion
update (2)
not sure if clang_complete should take care of the issue with boost. vim without plugins does search through boost.
superuser has an answer to comment out search through boost dirs with set include=^\\s*#\\s*include\ \\(<boost/\\)\\#!

So, you have at least two options. Option #1 is to set g:clang_use_library
to 1. Here's what :help g:clang_use_library says about it:
Instead of calling the clang/clang++ tool use libclang directly. This
gives access to many more clang features. Furthermore it automatically
caches all includes in memory. Updates after changes in the same file will
therefore be a lot faster.
This requires working setup of Python Vim integration though.
Option #2 is to set g:clang_complete_auto to 0 by which you disable
automatic completion after ->, ., :: and may use <C-x> <C-o> instead
to manually invoke clang_complete whenever you wish.
I use both.

from here, you can add the following to your .vimrc:
:set include=^\\s*#\\s*include\ \\(<boost/\\)\\#!
(the question of caching the search through boost is still open though)

I've done a lot of performance enhancements to clang_complete, you can check about this at issue #187. Big part of the problem was just weak script performance due to non optimized code.

Related

Incompatibility with EnhancedJumps and vimfiler?

Here's the plugin I'm talking about: https://github.com/vim-scripts/EnhancedJumps
The plugin sometimes croaks when navigating backwards:
Error detected while processing function EnhancedJumps#Jump:
line 52:
E121: Undefined variable: mappings
next: vimfiler:default
Could it be caused by my vimfiler plugin?
Your hunch is right. Because the :redir command cannot be nested, there can be conflicts in EnhancedJumps (which I'm the author of) if another plugin has redirection active, too. To work around that, I've added a configuration in version 3.02 to turn that off. Put the following into your ~/.vimrc:
let g:EnhancedJumps_CaptureJumpMessages = 0
You'll lose a tiny bit of functionality (messages reported during jumping may be out of order), but can continue to use both plugins without script errors.

gvim Windows - Message popup box with OK button?

I am running gvim version 7.4 on Windows. Everytime i start gvim, before it loads the window with multiple tabs that i have, i get a popup. First thing i would see is this popup titled "Message" and it contains the following lines, with an "OK" button at bottom. If i click the ok button, gvim starts running without any further problems. I have not been able to find anything in google searches. What is the cause of this popup, and how to eliminate it ?
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py"
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py" [unix] 332L,
10531C
"Week-3-SCHEMA-DESIGN\using_update.30ad2dc2bda6.py"
"Week-3-SCHEMA-DESIGN\using_update.30ad2dc2bda6.py" [unix]
110L, 2680C
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py"
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py" [unix]
144L, 4261C
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py.b4vim.orig"
Additions after couple of replies:::
Thanks for the replies, Ingo Karkat and romain. I took a look into the vimlog file. It is 26000 lines long. So i searched for the first filename blog.py which occurs only in the following section of vimlog output file. The corresponding region of vimsession file is also given below.
line 140: badd +113 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
line 141: badd +0 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py.b4vim.orig
line 142: silent! argdel *
Error detected while processing C:\nirmal\vimsession:
line 142:
E480: No match: *
line 143: set lines=43 columns=171
line 144: edit Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py"
"Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py" [unix] 332L, 10531C
Since the above output contained an error at line 142, i took a look at my vimsession file. BTW, i have the very last statement of my _vimrc file as source vimsession. Even if i delete my vimsession file (while i have my gvim session open), and recreate it from the open gvim session, i still get the same kind of message box. I took a look at the help pages for argdel which occurs in line 142, causing the error, but unable to figure why this line gets into the vimsession. Following is the relevant section of my vimsession file, which pertains to the very first line that comes up in the popup Message window.
badd +1 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
badd +98 Week-3-SCHEMA-DESIGN\hw3-2and3-3\blogPostDAO.py.b4vim.orig
badd +3466 \Documents\ and\ Settings\bharathil\vimlog
badd +89 \nsam\vimsession
silent! argdel *
set lines=43 columns=171
edit Week-3-SCHEMA-DESIGN\hw3-2and3-3\blog.py
In my readings, I have not yet finished the User Manual, even half way. My _vimrc file is the one that was suggested as starting setup (by the User Manual). I have only added minimal stuff to it. I don't understand how the argdel gets into the vimsession, since i don't remember messing with that command at all. I suspect once i figure out how to fix the error near blog.py (first file in error list), i will be able to repeat the process, for all the 10 tabs (2 windows in each) and stop this message box from popping up.
This is output from stuff in your ~/.vimrc or plugins that runs before GVIM is fully initialized. The execution of those commands should be delayed via
:autocmd VimEnter * {commands-here}
How to find these commands? You can capture a full log of a Vim session with vim -V20vimlog. After quitting Vim, examine the vimlog log file for suspect commands.

Vim E474: Invalid argument: backupcopy=

Im getting this error when I re-open a given file. It gives a line number in that file, but it is different text that is on that line. So I can't establish a certain line or text that trigger this error.
My vimrc: http://pastebin.com/6YPVwePV
This was a bug on some versions of vim, which was fixed in 7.4.462. See: https://groups.google.com/forum/#!msg/vim_dev/3u0PKRJrSjU/48W88Q6mLJ4J
and the thread that lead to that patch: https://groups.google.com/forum/#!msg/vim_dev/x3t4oemwkXc/9HyfuEy7LV4J

Sublime Text 3 line completion package

There was a wonderful package called Compline for Sublime Text 2, which allowed completing whole lines, similar to variable/word autocompletion.
I doesn't work in ST3*, so I'm looking for alternatives.
From Compline's README:
Full line completion known from VIM as ctrl+x, ctrl+l shortcut
Simply begin to write a line, press the shortcut (default it ctrl+,) and Sublime will let
you chose similar lines to complete.
Edit: *by "doesn't work" I mean it can be installed, but the actual line completion never happens. The possible list of completions is visible, but selecting one "does nothing".
The error message in the console is:
Traceback (most recent call last):
File "/home/karel/.config/sublime-text-3/Packages/Compline/Compline.py", line 35, in foo
self.view.replace(edit, sublime.Region(begin, self.view.sel()[i].end()), matches[index])
File "/opt/sublime_text/sublime.py", line 657, in replace
raise ValueError("Edit objects may not be used after the TextCommand's run method has returned")
ValueError: Edit objects may not be used after the TextCommand's run method has returned
Edit2: uploaded screenshots
EDIT:
OK, I was wrong, it really does bug out for me too. So I did fix it:
https://github.com/astropanic/Compline/pull/4
You can pull the working version from my fork while the author of the package is reviewing the request: https://github.com/vlakarados/Compline

Vim: Error detected while processing function <SNR>37_MRU_LoadList:

I do not know what happend, in the cluster, anytime I tried to open any file no matter it is new or not, I will always get error message:
Error detected while processing function <SNR>37_MRU_LoadList:
line 5:
E684: list index out of range: 0
E15: Invalid expression: s:MRU_files[0] =~# '^\s*" Most recently edited files in Vim'
Press ENTER or type command to continue
Does anyone know how to solve it?
Seems like you're using the mru.vim - Plugin to manage Most Recently Used (MRU) files, and somehow the storage file has become corrupted.
Try removing it:
:call delete(g:MRU_File)
Like #balrok said in his comments, this situation seems to be happening when the home partition ran out of space. In my case, my cluster space is limited to be only 70G around. After moving all the data files into another space, this problem is solved.

Resources