Strange behavior of vim

14 views
Skip to first unread message

Barry Gold

unread,
Oct 6, 2022, 1:48:26 PM10/6/22
to vim_use
 I have been using vim for many years, but it has lately been behaving very strangely. I have autoindent and autowrap set, but vim appears to ignore them while editing some files.

Note: *some* files. The exact same vim process will work properly on some files and misbehave on others.

My .vimrc:
---------------------------------------------------------
set autoindent
set nohls
syntax off
set tw=72
set ws
set ic
set ts=8
set sw=4
map <F2> :n
map ^N :n
:np <F3> :w
:e #<F4> :w
map <F5> :e #
map v k$hjl
map = 3k$h3jl
map @ k$hjl
map q F r
map v f r
set background=light
set ff=unix
let loaded_matchparen=1
set fo+=tcroqj
filetype off
---------------------------------------------------------

Note: I copied "set fo+=tcroqj" from somewhere; I no longer remember what it does.

Relevant facts:
1. version: VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 13 2022 22:15:51)
Included patches: 1-4372

2. In the recent past I upgraded my copy of cygwin (unix emulator on Windows) to  the latest version.  

Gary Johnson

unread,
Oct 6, 2022, 3:13:57 PM10/6/22
to vim_use
A common cause of such problems is a filetype plugin, but you have
set "filetype off", so I don't think it can be that. When Vim acts
up, you might execute

:filetype

to see what the current settings are and whether they have changed.

The 'filetype' could also be set by a modeline. You can look for
a modeline in the problematic file or execute

:verbose set ft?

to see if 'filetype' has been set by a modeline or by something
else.

Another common cause is setting 'paste', which resets a number of
options to improve pasting behavior until 'nopaste' is set. The
next time Vim acts up, execute

:verbose set paste?

to see if that might be the case. That will show not only the value
of the 'paste' option but where it was last set.

Another command to try is

:verbose set ai? tw?

which will show where those options were last set. There is no
'autowrap' option, but Vim will autowrap when 'textwidth' ('tw') is
not zero. The wrapping behavior is also affected by the
'formatoptions' ('fo') option. See

:help 'paste'
:help 'textwidth'
:help 'formatoptions'

Finally, it would help greatly to know exactly the circumstances
under which the odd behavior occurs and what that behavior is. That
is, which files cause the odd behavior and which do not.
When you observe the odd behavior, can you reproduce it in a few
steps from the time Vim is started? That would give us a lot more
information to help you with.

I also have Vim version 8.1.4372 as well as 9.0.250 on a Windows
machine running the latest Cygwin, so if the problem is peculiar to
that installation, I can help you check that out, too.

Regards,
Gary

Barry Gold

unread,
Oct 7, 2022, 2:26:31 AM10/7/22
to vim_use
Following your suggestions, I think that this behavior is caused by the extension .cl
I'm using that for PHP classes, but it looks like my current version of vim thinks that .cl is for "LISP" files.

Maybe I can override that somehow?

Christian Brabandt

unread,
Oct 7, 2022, 2:30:46 AM10/7/22
to vim_use

On Do, 06 Okt 2022, Barry Gold wrote:

> Following your suggestions, I think that this behavior is caused by the extension .cl
> I'm using that for PHP classes, but it looks like my current version of vim thinks that .cl is for "LISP" files.
>
> Maybe I can override that somehow?

You may want to check :h new-filetype where the help manual discusses
several ways to overrule the default filetype detection method.



Best,
Christian
--
Jede Erscheinung ist zugänglich wie ein planum inclinatum, das
bequem zu ersteigen ist, wenn der hintere Teil des Keiles schroff und
unerreichbar dasteht.
-- Goethe, Maximen und Reflektionen, Nr. 615

Barry Gold

unread,
Oct 7, 2022, 9:57:53 AM10/7/22
to vim_use
Over the years I have grown to hate things that need a lot of configuration (by me) to work. I think my simplest solution is just to change the extension I use for PHP classes. One quick shell script to do a mass-rename, a change to my autoload, and ta-da!
Reply all
Reply to author
Forward
0 new messages