I'm experiencing a very slow startup of gvim with tex files and the latex-suite plugin. For example, opening this tex file takes 7 seconds. A minimal .vimrc file only contains the following line:
filetype plugin on
My .vim folder only contains the latex-suite plugin (snapshot 2013-01-16). I suspect the folding functionality in latex-suite but I'm not sure how to track this down properly and fix it. I'm running gvim 7.3 on Ubuntu 12.10.
Does anybody know how to fix this slow startup?
If the problem is related to the filetype (as you've already determined), the slowness should also happen when you :edit the file from within a running Vim, or even when you reload the Tex file via :e!. I'd use that to investigate the root cause. If you suspect folding, :setl foldmethod=manual or :setl nofoldenable would be a first attempt.
Since you've already isolated the problem down to the plugin, I would recommend to direct any feedback and problem reports to its author; even if you get a fix or workaround here, it still should flow back into the plugin.
latex-suite seems to do some kind of package scanning which I disabled by setting
let g:Tex_PackagesMenu = 0
in my .vimrc. This reduces the startup time to 3.5s (from 7s) and I think I can live with this ;).
Related
I closed a vim window completely (something I rarely do) and when I opened it back up my syntax highlighting for jsx files stopped.
I had some other windows open and inside these the syntax highlighting for jsx was still working.
I compared the filetypes in both and could see that the ones that were still working were set to javascript.jsx and the exact same files in my new window had a filetype of javascriptreact.
Then I shut down all windows to see if reloading all would have an effect, and now all my .jsx files come up with filetype of javascriptreact with no proper syntax highlighting (especially jsx parts).
I didn't intentionally change any config options that I'm aware of, and am using vim-jsx plugin.
Does anyone have any idea of what might be going on? I am getting the same behavior in terminal Vim and in MacVim.
It's worth noting that when I manually set the filetype back to javascript.jsx it doesn't have an effect.
Help!
Ok, this is embarrassing, but apparently this line got removed from my .vimrc.
execute pathogen#infect()
So none of the plugins in ~/.vim/bundle were loading. Still not quite sure how that happened, but I suspect carelessness on my part rather than foul play.
Anyway. I survived to code another day...
I uninstalled vim74 and compiled vim81 and installed it. However I found it strange, comparing to vim74. When there's no .vimrc file under HOME dir, I open a c++ file and syntax highlight is working and I can use Backspace to delete letters. However when I add a .vimrc under HOME dir and just put set number into it, when the c++ source file is opened, no highlight, and Backspace not working. Why is that ? I used to add some configurations in .vimrc under vim74 before, and this situation never happens.
After complaints that Vim in its default configuration is hard to use (especially for beginners), it was decided to enable a default configuration if the user hasn't created his own ~/.vimrc (yet). This was introduced with Vim 8.0, and explains what you're seeing (namely: syntax highlighting and sensible backspace behavior). Read more about the details at :help defaults.vim.
The help also has instructions how to keep the defaults when adding your own ~/.vimrc configuration:
If you create your own .vimrc, it is recommended to add these lines somewhere
near the top:
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
Then Vim works like before you had a .vimrc.
Tip: Don't go all crazy with adding various snippets (especially not those you don't fully understand) and plugins to your ~/.vimrc, even though the Internet is full of them. Rather, build it up gradually, depending on needs, and back up your understanding with careful studying of the excellent :help. Also, avoid pre-packaged Vim distributions; they're even worse.
I am using mac vim in terminal via /Applications/MacVim.app/Contents/vim
By now I didn't really care about what was in the MacVim directory in /Applications/MacVim.app/Contents/Resources/vim/runtime
and still somehow I had proper syntax highlighting etc.. I guess my vim loaded the files from macvim?
Somehow I messed arround with snipmate and all the syntax highlighting stopped to work. Filetypes are correct, but no highlighting. So I copied the syntax folder from the macvim app to my ~/.vim/syntax and it worked like a charm. Is there a way how I can use the ones from the app again?
Thanks for any help
Copying the syntax to your own ~/.vim/ directory effectively forks the factory-defaults. The downside is that you now have to update your copy whenever Macvim is updated.
The key to figuring out the problems is the 'runtimepath' setting. By modifying that (in your ~/.vimrc), you should be able to include the proper runtime files (and that is not just syntax, but also filetype plugins, should you have :filetype plugin on). BTW, it's unlikely this is caused by snipMate.
:set runtimepath?
Also, the :scriptnames command tells you exactly which scripts have been sourced so far.
I'm using GVim (ver 7.3.46) - saving a text file to a network folder, I keep getting this W11 error, and as far as I know no other process / application is changing the file, I suspect vim thinks it changed because of lag to saving it to the network drive, and it detects a different timestamp? In any case, I'd like to suppress this error (and only this error) - is this possible?
W11: Warning: File "foo.txt" has changed since editing started
See ":help W11" for more info.
When editing this file, set the autoread setting, so Vim will automatically reread it:
:setl autoread
This can possibly be set via a modeline.
Another alternative is to set the buftype option for this file. But I am not sure, what other consequences this have, so I suspect this might have some side effects.
See
:h 'buftype'
For the possible values and their implications of the buftype option.
Between Christian's suggestion of
:set autoread
being added to my .gvimrc, as well as storing the backup and swap file local
:set backupdir=~/backup
:set directory=~/backup
seems to have resolved my issue.
If I open a file containing 5,000 lines of code and continue to input, I found that my vim became very slow, it displays my input after about 1s.
It even won't become any better after I start up with --noplugin. But after switching my .vimrc file, everything gets fine again. The .vimrc file is written by myself and after checking for some time, I still can't locate the error. I have clear all the key maps, but the problem still exists.
So can you give my any advise or tell my how to debug in vim? I found there is a debug option but can't get how to work.
You can use the --startuptime option when start vim:
--startuptime {fname} *--startuptime*
During startup write timing messages to the file {fname}.
This can be used to find out where time is spent while loading
your .vimrc, plugins and opening the first file.
When {fname} already exists new messages are appended.
(Only available when compiled with the |+startuptime|
feature).
Take following steps to diagnose the problem:
type vim --startuptime log.txt main.java in bash to start vim
type :tabe log.txt in vim to view the log.
The reason for slowness is often the not set or wrong set ruby_path on compile time of vim (see also discussion on google vim/ruby google group). It is easier to set it in vimrc, because you can change it without recompiling vim. You can set the path through the g:ruby_path variable in your .vimrc file. Don't copy and paste both, use the right one.
If you setup RBENV you have to use this one:
" ruby path if you are using rbenv
let g:ruby_path = system('echo $HOME/.rbenv/shims')
If you setup RVM you have to use this one:
" ruby path if you are using RVM
let g:ruby_path = system('rvm current')
You can also use the vim-rbenv plugin, which sets the path too.
For me the part on loading ruby specific functions in vim got 10 times faster.
If you are using jruby, than the start up slowliness can be even bigger. See examples for fixing it here.
If running vim 7.4,
put this in your .vimrc
set regexpengine=1
vim 7.4 has a new regex engine that appear not to work well in some situations. Previous version vim 7.3 used the old engine ( set regexpengine=1 ).
The "slow response" from syntax highlighting problem affects the vim help files as well ( and .vimrc file too ).
Something like this is usually caused by syntax colouring. Try with :syntax off.
Add these lines to your ~/.vimrc or ~/.config/nvim/init.vim:
set lazyredraw " don't redraw everytime
set synmaxcol=128 " avoid slow rendering for long lines
syntax sync minlines=64 " faster syntax hl
Also if you're using tmux, consider adding this to your ~/.tmux.conf:
set -sg escape-time 10