automatically syntax by file extensions

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

automatically syntax by file extensions

Vu The Cuong

----- Original Message -----
From: Vu The Cuong
To: [hidden email]
Sent: Friday, September 02, 2005 2:43 PM
Subject: automatically syntax by file extensions


Currently I always open files with *.php. *.html, *.c etc extensions.
Each time I after opening a file type, I must do:
- set filetype=php
or
- set filetype=c
or
- set filetype=html
So it takes time.
Is there a way to tell Vim to automatically detect files extensions and
use syntax corresponding to that file.
many thanks
Reply | Threaded
Open this post in threaded view
|

Re: automatically syntax by file extensions

A.J.Mechelynck
----- Original Message -----
From: "Vu The Cuong" <[hidden email]>
To: <[hidden email]>
Sent: Friday, September 02, 2005 7:45 AM
Subject: automatically syntax by file extensions


>
> ----- Original Message -----
> From: Vu The Cuong
> To: [hidden email]
> Sent: Friday, September 02, 2005 2:43 PM
> Subject: automatically syntax by file extensions
>
>
> Currently I always open files with *.php. *.html, *.c etc extensions.
> Each time I after opening a file type, I must do:
> - set filetype=php
> or
> - set filetype=c
> or
> - set filetype=html
> So it takes time.
> Is there a way to tell Vim to automatically detect files extensions and
> use syntax corresponding to that file.
> many thanks
>
>

Place in your vimrc:

    filetype on
or
    source $VIMRUNTIME/vimrc_example.vim

(the latter includes, among many other things, "filetype plugin indent on")

see
    :help :filetype
    :help :filetype-overview
    :view $VIMRUNTIME/vimrc_example.vim
    :help vimrc_example.vim


Best regards,
Tony.

Reply | Threaded
Open this post in threaded view
|

Re: automatically syntax by file extensions

Vu The Cuong
thanks.:) it simple but help me a lot.
----- Original Message -----
From: "Tony Mechelynck" <[hidden email]>
To: "Vu The Cuong" <[hidden email]>; <[hidden email]>
Sent: Friday, September 02, 2005 3:01 PM
Subject: Re: automatically syntax by file extensions


> ----- Original Message -----
> From: "Vu The Cuong" <[hidden email]>
> To: <[hidden email]>
> Sent: Friday, September 02, 2005 7:45 AM
> Subject: automatically syntax by file extensions
>
>
> >
> > ----- Original Message -----
> > From: Vu The Cuong
> > To: [hidden email]
> > Sent: Friday, September 02, 2005 2:43 PM
> > Subject: automatically syntax by file extensions
> >
> >
> > Currently I always open files with *.php. *.html, *.c etc extensions.
> > Each time I after opening a file type, I must do:
> > - set filetype=php
> > or
> > - set filetype=c
> > or
> > - set filetype=html
> > So it takes time.
> > Is there a way to tell Vim to automatically detect files extensions and
> > use syntax corresponding to that file.
> > many thanks
> >
> >
>
> Place in your vimrc:
>
>     filetype on
> or
>     source $VIMRUNTIME/vimrc_example.vim
>
> (the latter includes, among many other things, "filetype plugin indent
on")

>
> see
>     :help :filetype
>     :help :filetype-overview
>     :view $VIMRUNTIME/vimrc_example.vim
>     :help vimrc_example.vim
>
>
> Best regards,
> Tony.
>