How to automatically execute a VIM command only for some file types

Posted: maggio 21st, 2012 | Author: | Filed under: English, Guide, Howto | Tags: , , , , , , | No Comments »

I want to set the maximum line length to a certain value, only for tex files.

VIM has a command to force line length. It’s:

set tw=120

To automatically execute this command only for tex files, you have to edit your vimrc file (~/.vimrc or /etc/vim/vimrc) adding the following lines:

if has("autocmd")
autocmd BufRead,BufNewFile *.tex set tw=120

Now VIM will execute this command every time that you will open a tex file.

  • Articoli Recenti:

  • Tag

  • Categorie

  • Meta

  • Licenza Creative Commons

    Copyright © 2020, | – Blog is proudly powered by WordPress All rights Reserved | Theme by Ryan McNair modified By Francesco Apollonio

    Smilla Magazine Il Bloggatore Feedelissimo - tecnologia WebShake - tecnologia