gath
gath

Reputation: 25452

How do i enable syntax highlighting and syntax indentation in msysgit vim?

Am using mysgit for windows, but mysgit vi editor is unable to do syntax highlighting and indentation for my source code (html/python/css .... files)

I managed to copy the syntax folder from my original GVIM7.2 installation to Git Vim72 installation folder, now i see like syntax highlighting is active.

What am unable to do is indentation. I have tried to copy the ftplugin folder from my GVim7.2 installation to Git Vim72 folder but still no indentation.

I have tried to place filetype plugin indent on setting on the vimrc file, but still nothing is working?

Any help on how to enable syntax indentation?

Gath

Upvotes: 4

Views: 4388

Answers (3)

Jazz
Jazz

Reputation: 1

Nithin's answer worked for me, though my vimrc file is in path C:\Program Files (x84)\Git\bin\vim instead of ..\share\vim.

I wanted Java syntax highlighting so I copied java.vim from /usr/share/vim/vim70/syntax/java.vim from my linux server. It turned out that java.vim uses html.vim (not a problem, I copied html.vim, too).

For it to work on windows one needs to change the following line in java.vim:

syntax include @javaHtml <sfile>:p:h/html.vim

to

syntax include @javaHtml <sfile>:p:h\html.vim

I also found out that \share\vim\vimrc pretty much has all important settings for programmers already, including:

set syntax = on
set background = dark
set ai

I hope this helps anyone with the same problem.

Upvotes: 0

Nithin
Nithin

Reputation: 314

If you want to customize the msysgit vi editor, you will have to edit the configuration files in the msysgit installation folder. I installed msysgit on C:\Program Files\Git, so my vimrc file is in the path C:\Program Files\Git\share\vim.

The plugin and syntax files were in \share\vim\vim72. I could only find syntax files for C and C++. You might have to get the syntax files for other languages elsewhere. (This site has syntax files for a lot of languages.)

For indentation, check that \share\vim\vimrc file has the following line somewhere:

set ai

Upvotes: 7

Kimball Robinson
Kimball Robinson

Reputation: 3387

You may need to check that it is correctly determining the file type. To see what filetype vim thinks you're dealing with, type :set filetype without any other parameters. Vim might not know how to indent your filetype, or you may have to download the filetype plugin and put it in the right folder (I don't know where to get that plugin).

Did you mean msysgit instead of mysgit?

Upvotes: 0

Related Questions