Thursday, March 1, 2012

Re: how to change tab and shiftwidth behaviour depending on file type.

thanks very much on this. will give it a shot

sk

On Thu, Mar 1, 2012 at 12:14 PM, Gary Johnson <garyjohn@spocom.com> wrote:
On 2012-03-01, Taylor Hedberg wrote:
> skrite, Thu 2012-03-01 @ 08:15:12-0800:
> > i do a lot of work in python and a lot in ruby, html, and javascript.
> > What i would like is for all my python files to behave with 1 tab = 4
> > spaces, with the correct indent, etc.. But on the ruby,html,and
> > javascript, i need only 2 spaces.
> >
> > In both cases, i need the tabs converted to spaces.
> >
> > how would i set something like this up?
>
> Write a script that sets the options as you want them for a particular
> filetype, then save it as ~/.vim/ftplugin/python.vim,
> ~/.vim/ftplugin/ruby.vim, etc.

If you do that, any settings you make may be overwritten by settings
made in the standard ftplugins in $VIMRUNTIME/ftplugin.  A better
place for your scripts is in ~/.vim/after/ftplugin.  As the name
implies, those scripts will be sourced after all the others, so any
settings made in those scripts will be made last.

> See also: `:help ftplugin`.

and

   :help after-directory

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 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

No comments:

Post a Comment