Thursday, March 1, 2012

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

On Thursday, 01 March, 2012 at 16:15:12 GMT, skrite wrote:
>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?

Put each setting that you want into its respective file in ~/.vim/ftplugin/. Eg., ~/.vim/ftplugin/html.vim.

Convert the tabs to spaces with :retab. You can put that into an autocmd to have it happen every time you read a buffer, if you want, something like this:

autocmd BufRead *.js,*.php retab

Best place for autocmds is in ~/.vimrc.

--

.

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