.vimrc causes error (E10: \ should be followed by /, ? or &) - vim

I've copy pasted this .vimrc into my /etc/vimrc in Fedora 15. Every time I use vim for anything, I get a number of errors with line numbers which don't seem to be the correct line numbers of my vimrc file because there aren't any '\'s on those lines.
I've googled this and there is a similar stack overflow question, but I believe it is irrelevant to my question.
I also removed everything that said MySys() == linux/max/windows or etc because I'm using linux so I just used the linux lines.
Any ideas?
Edit---
Here's my (barely) modified vimrc file:
https://docs.google.com/document/d/1PznK0FizGlBr6W6m9wikM334q8b6KFFCgmsF-f8MX3s/edit?hl=en_US

Error you mentioned here normally happens in one of the following cases:
You are trying to use line continuation inside :execute.
You are trying to use line continuation when vim is in compatible mode.
To remove the second case run vim using vim -N. If no errors appear, add set nocompatible at the top of the vimrc. If errors still appear, search for exe (as :execute can be truncated to :exe) and check out whether somewhere line matching \n\s*\\ is passed to :execute.

Related

Vim weird behaviour with backspace with empty .vimrc

I'm having a weird issue with vim on Ubuntu. I've been using it for the last few weeks, trying to learn, on Windows and it behaves differently now that I'm using it on Linux.
I noticed that while in insert mode pressing backspace will delete text just like any other editor on Windows, but on Linux the text is "deleted" yet it stays there until I press ESC or write over it.
I was trying to fix this but I'm confused as to whether this is intended behaviour or not. It happens in gvim too.
The reason of this question is this, however:
I deleted my .vimrc file to see if any of my config was at fault and it fixed it. Backspace was now back to its regular self.
But then I tried creating an empty .vimrc file and that made it go back to the delayed delete. It's empty. Why the hell?
So I have no idea what's causing this. Hope my question makes sense my English ain't the best. Thanks.
Alright so looking at :h compatible I found this:
"When a |vimrc| or |gvimrc| file is found while Vim is starting up,
this option is switched off, and all options that have not been
modified will be set to the Vim defaults. Effectively, this means
that when a |vimrc| or |gvimrc| file exists, Vim will use the Vim
defaults, otherwise it will use the Vi defaults. (Note: This doesn't
happen for the system-wide vimrc or gvimrc file, nor for a file given
with the |-u| argument). Also see |compatible-default| and
|posix-compliance|."
So if I'm getting this right, running Vim with a .vimrc file should automatically set nocompatible and running it without one should set compatible... ? Whatever the case, I tried checking with :verbose set compatible? and it always says nocompatible is on so the -N flag shouldn't do anything... Yet it fixes the issue.
Without a vimrc Vim will load /usr/share/vim/vim80/defaults.vim (depending on your vim version). In this file the bs/backspace parameter is set to 2, or actually it is indent,eol,start which is the same as 2 (see :h bs)
Now if you create an empty .vimrc, defaults.vim will not be loaded, so your bs will possibly be 0.
This behaviour is described in :h defaults.vim
So to solve your problem, just put set bs=2 in your .vimrc
Alright I fixed it.
Running vim with the -N command makes it work properly. I'm not sure why but that's what's happening.

Vim plugin uninstall failed aftermath :(

I was installing some packages via pathogen and did not like one of the color themes and deleted those packages via terminal.
Ever since then when I execute vim thankYou.js ( :) ), I get this.
Failed. HELP
How do I remove those '--- options --' and confirmations? I just want to go straight to vim.
Thanks in advance ;)
You should try following the explanation at on Vim-FAQ 2.5:
2.5. I have a "xyz" (some) problem with Vim. How do I determine it is a
problem with my setup or with Vim? / Have I found a bug in Vim?
(...)
vim -u ~/.vimrc --noplugin -N -i NONE
This will simply use your .vimrc as configuration file, but not load
any plugins. If the error occurs this time, the error is possibly
caused by some configuration option inside your .vimrc file. Depending
on the length of your vimrc file, it can be quite hard to trace the
origin within that file.
The best way is to add :finish command in the middle of your .vimrc.
Then restart again using the same command line. If the error still
occurs, the bug must be caused because of a setting in the first half
of your .vimrc. If it doesn't happen, the problematic setting must be
in the second half of your .vimrc. So move the :finish command to the
middle of that half, of which you know that triggers the error and
move your way along, until you find the problematic option. If your
.vimrc is 350 lines long, you need at a maximum 9 tries to find the
offending line (in practise, this can often be further reduced, since
often lines depend on each other).
If the problem does not occur, when only loading your .vimrc file, the
error must be caused by a plugin or another runtime file (indent
autoload or syntax script). Check the output of the :scriptnames
command to see what files have been loaded and for each one try to
disable each one by one and see which one triggers the bug. Often
files that are loaded by vim, have a simple configuration variable to
disable them, but you need to check inside each file separately.

Automatic insertion of comment leader not working vim

I can't seem to get the formatoptions to work in the general case for vim.
I have filetype plugin on and in many of the default plugins there's a line saying setlocal fo-=t fo+=croql and after reading the vim docs I saw that was where the automatic insertion of the comment leader was coming from. I liked this, but it wasn't happening in python, (because the formatoption line wasn't in the default plugin) so I put the line (except with set fo+=crotl) in my .vimrc.
It doesn't seem to have done anything, the comment leader is still not inserted in python (or bash which also doesn't have the line in the default plugin).
I've also tried putting the line in my .vim/after/ftplugin/python.vim file (both as setlocal and set, and it hasn't done anything there either.
My question is - are there any options that will override this action that I should look out for? else, what could be the reason it's not working?
Thanks in advance
EDIT:
I should note also: in the python buffers :set formatoptions? shows that the options have been set, they just don't work.
I just found out - The options were working, it was just that the comments were set with
set comments=...,b:#,...
and after looking that up, I found the 'b' means vim only counts the line as a comment if there is whitespace after the #, as I wasn't putting the space there, vim didn't count it as a comment and hence didn't apply the formatoptions set for comments.

Using folds with synmaxcol in vim

Sometimes when I'm working on a project I want to play around with some data. Often times the data is on one line and is huge (>25k characters). I understand I could set nowrap and have this line just run off the screen, but I tend to like set wrap for other reasons. So, as a workaround I want to hide these long lines in a marker fold (e.g. {{{ long line }}}). This works fine but I run into a problem with synmaxcol for some reason. If the folded line exceeds synmaxcol then when I open the file, the syntax highlighting runs over. For example:
However, as soon as I open the fold the syntax corrects itself:
Having to open the fold every time is annoying though. As you can see in this example the line is not actually all that long -- it just exceeds synmaxcol. Since synmaxcol is exceeded at a "string" element, the rest of the file is highlighted as a string (so nothing but a singular double quote will stop it).
Why is this happening and how can I fix it? I've tried this with different syntax files and filetypes and it still occurs. I've also tried it with no plugins, a minimal vimrc (containing only syn on) and a modeline to set fdm=marker:synmaxcol=60 and it still happens.
You can manually enter :syntax sync fromstart to force Vim to rescan the syntax from the beginning of the opened file.
I would suggest defining a hotkey for convenience:
noremap <F5> <Esc>:syntax sync fromstart<CR>
inoremap <F5> <C-o>:syntax sync fromstart<CR>
Now you can press F5 to clean up most syntax highlighting problems.
Also, have a look at Vim's fixing syntax highlighting - wiki page
Moreover reading :help :syn-sync-first might shed some more light on the issue.
UPDATE:
I was able to reproduce this behavior on my machine (I'm running Vim 7.3.429).
However, when I wrapped the fold markers {{{ and }}} in block comments, vim correctly rendered the syntax. You can create appropriately wrapped fold-markers using the zf command. See Vim tips: Folding fun.
Normally Vim picks the correct blockcomment string based on the currently active syntax. However, my Vim is pretty vanilla and didn't recognize Ruby syntax. I could specify autocmd FileType ruby set commentstring==begin%s=end in my .vimrc file to set the proper block comment. See :fold-create-marker for more details.
Another solution is to set synmaxcol=0, which will effectively set it to infinity. This causes Vim to check the syntax of the entire line, no matter how long it is. However, I'm not sure what kind of performance penalty you'll have to pay for that.

the weirdest VI problem EVER

Ok, so I am trying to type the following in .cshrc file: alias ls 'ls --color=auto'. I type one character at a tiem.
However, when I reach --color= i type a and cursor goes to the next line.
I checked the .vimrc file and didn't fine anything out of whack. I am using vim7.2
EDIT
I noticed it is only happens in the .cshrc file, and cursor starts blinking with ' character.
I had "set mouse=a" set in .vimrc file
What is the problem?
Do you have textwidth set? If so it'll break your lines once they reach a certain length. Inspect the value via
:set textwidth?
Set it to 0 to turn off hard line-wrapping. Otherwise, do you have a mapped to something weird in insert mode? Check
:imap a
to see if you do.
I cannot test it now, but probably something wrong with the appropriate indent file for that filetype. Does it happen if you edit some other configuration file ?

Resources