Buffer syntax hilighting lost after some action

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Buffer syntax hilighting lost after some action

Bugzilla from tomasz2k@poczta.onet.pl
Hey

I have a little problem with Vim and I cannot find it in archives. I have a file.txt and I know it has specified syntax, so I set it:

:set syntax=cs

Then, when I switch to another buffer and go back (twice :bn), syntax setting is lost. It has plain .txt formatting and I have to :set syntax=cs again. The same goes when I change a colortheme. I can do :colors=elflord, and syntax is cleared as well. :/

Based on this situation I have 3 questions.

1. Is there a variable to setup something like keep-syntax-for-buffer?

2. Is there a config file (for one user) to set up a syntax based on location, e.g. (~/home/user/csharp/) sets a cs syntax for .txt files by default?

3. Is there 'toggle' function in Vim? I want to set up F12 for switching color themes - elflord, morning, evening, etc in queue?

Thanks for answers,
Regards,
Tomasz Kalkosinski
Reply | Threaded
Open this post in threaded view
|

Re: Buffer syntax hilighting lost after some action

Gareth Oakes-2
Hi there,

> Based on this situation I have 3 questions.
>
> 1. Is there a variable to setup something like keep-syntax-for-buffer?
>
> 2. Is there a config file (for one user) to set up a syntax based on location, e.g. (~/home/user/csharp/) sets a cs syntax for .txt files by default?

:help new-filetype

One of the listed methods should work fine and will fix issue (1) at the
same time.

Cheers,
Gareth