-S option

15 views
Skip to first unread message

Jorge Almeida

unread,
Jan 11, 2020, 8:03:15 AM1/11/20
to vim...@googlegroups.com
I'm fighting the following strange behaviour:
From an xterm, in Linux:
$ vim -S bar.vim foo.txt

bar.vim is a very basic syntax file. What happens is that foo.txt gets
edited but the syntax highlighting is missing.
I can activate it via
:so bar.vim
but it should not be necessary. What's wrong?

Note that
$ gvim -S bar.vim foo.txt
edits the file with syn. hi. active.


TIA

Jorge Almeida
bar.vim

Gary Johnson

unread,
Jan 11, 2020, 1:52:28 PM1/11/20
to vim...@googlegroups.com
It works for me.

I created the following files,

----------------------------- bar.vim ------------------------------
syn keyword Statement cow
----------------------------- foo.txt ------------------------------
The cow stood in the pasture.
--------------------------------------------------------------------

and ran vim as follows:

$ vim -N -u NONE --cmd 'syntax on' -S bar.vim foo.txt

The word "cow" was highlighted in yellow, as expected.

The vim I used is a normal version, reasonably up to date.

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 17 2019 13:33:01)
Included patches: 1-18
Compiled by gary@aurora
Normal version with GTK2 GUI. Features included (+) or not (-):
...

Regards,
Gary

Jorge Almeida

unread,
Jan 11, 2020, 2:29:21 PM1/11/20
to vim...@googlegroups.com
On Sat, Jan 11, 2020 at 6:52 PM Gary Johnson <gary...@spocom.com> wrote:
>
> On 2020-01-11, Jorge Almeida wrote:
> > I'm fighting the following strange behaviour:
> > >From an xterm, in Linux:
> > $ vim -S bar.vim foo.txt


> $ vim -N -u NONE --cmd 'syntax on' -S bar.vim foo.txt
>
Thanks a lot. The problem goes away with the '-u NONE' part. So I
checked my .vimrc and the culprit was a custom color scheme I use. The
corresponding file, in .vim/colors/, contained a line 'hi clear",
before my custom colors. I don't know whether it was supposed to be
there or I just put it there , cargo-cult like. Anyway, commenting out
that line yields the desired behaviour.

regards

Jorge
Reply all
Reply to author
Forward
0 new messages