Tuesday, September 10, 2013

Re: Advanced vimrc? question

...
>> I use different indention depth with different types of sources. It
>> is rather time consuming to set it manually. Is there a possibility
>> to defined these values to file extensions?
>
> Have you tried autocmds? eg
> autocmd FileType python setlocal shiftwidth=4
> autocmd FileType ruby setlocal shiftwidth=2

It's probably cleaner to add a vim file in your "indent" directory
(python.vim, ruby.vim, etc.) and let filetype detection load it automatically.

That would imply you are re-writing the indent scripts.

This is typically where you would use the _after_ directories.

For windows:
vimfiles\after

Linux:
.vim/after

In my case, I didn't like the indent settings for PHP and XML, so I created:

after/indent/php.vim
after/indent/xml.vim

These both had 1 line in them:
    setlocal shiftwidth=2

That way, each time you set the filetype, after everything runs as usual, the after directory fires and allows me to automatically change the shiftwidth (for xml above) to 2, from whatever it was.

HTH,
David




--
--
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 because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: