Thursday, October 6, 2022

Re: Strange behavior of vim

On 2022-10-06, Barry Gold wrote:
> 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.

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

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20221006191511.GF24999%40phoenix.

No comments:

Post a Comment