0

I've just set up slackware 14 on a virtualbox. As one does, I immediatly created/altered my .bashrc and, more importantly, my .vimrc files.

To avoid writing huge lines of code, I usually add something like

au BufWinEnter * w:m1=matchadd('ErrorMsg','\%>100v.\+', -1)
if version >= 702
    au BufWinLeave * call clearmatches()
endif

I've used these settings for quite a while now, only this time, whenever I open a file in vim, a weird file is being created, with :m1=matchadd('ErrorMsg','\%>100v.\+', -1) as its name.
I've reduced my .vimrc file to just the basics, which I believe can't have anything to do with this oddity (vim-7.3.645-x86_64-1):

set nocompatible
set ai
set nu
set ruler
set hlsearch
set hidden
set showcmd
set cursorline
set confirm
syntax on
color evening
au BufWinEnter * w:m1=matchadd('ErrorMsg','\%>100v.\+', -1)
if version >= 702
    au BufWinLeave * call clearmatches()
endif

Any ideas what is causing this behaviour, and how to fix it?

1

That is expected; the autocmd executes the Ex command w:m1=matchadd('ErrorMsg','\%>100v.\+', -1). w is the short form of write, what follows is interpreted as the file name.

I guess a :let went missing, because then the command makes sense: let w:m1=... defines a window-local variable m1 and assigns the result of the matchadd() call to it.


The autocmd appears to highlight all characters beyond column 100. Note that in recent Vim 7.3 versions, you can use the 'colorcolumn' feature for that:

:set colorcolumn=101
  • Thanks, I did indeed miss the let... probably d+w somewhere by accident. Anyway, I will be using colorcolumn from now on. – Elias Van Ootegem Jun 5 '13 at 13:43
0

If you add,

set vbs=1 " Verbose error reporting Zero = Norm to Nine = Max

into your .vimrc and start with a 3 or 4 it will show you all the files loaded/called (and a lot more as you push to 9) as you are opening vim/files.

Not an exact answer, but could help you track it down.

  • Sorry, forgot to mention that I already tried that. That just informs me that :m1=matchadd.... [NEW] was written to $PWD. Thanks for the input, though. Ingo Karkat's answer was correct. I can't believe I missed the let... And I will be changing the regex autocommand to colorcolumn from now on :) – Elias Van Ootegem Jun 5 '13 at 13:42
  • Yep, I see the other reply now, teach me to take 10~15 to finish my reply, I expected it was given as I was typing and reading another screen. Glad you have an answer. – Lenny_Nero Jun 7 '13 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.