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
endif

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


  • Articoli Recenti:

  • Tag

  • Categorie

  • Meta

  • Licenza Creative Commons

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

    Smilla Magazine Il Bloggatore iwinuxfeed.altervista.org Feedelissimo - tecnologia WebShake - tecnologia