Friday, August 26, 2011

Re: Consuming 'filetype' stuff from .vimrc

El 26/08/11 18:07, Russell Bateman escribió:
> I would like to know how how to adjust the width (set columns) in gvim
> based on filetype that, I assume, Vim knows by reason of the file I've
> launched it on. For example, if it's a Java file (.java), I'd like to
> make it 120 columns wide, but leave it maybe 80 for all others. I
> realize that I might mix the types of files that show up on the
> command line, so I don't expect Vim to read my mind.
>
> if has( "gui_running" )
> if _____filetype is Java_____
> set columns=120
> endif
> endif
>
> Is this covered behavior or even possible?
>
> Please help me fill in the blank. Yes, I've read the filetype.txt help
> document, but I'm a little obtuse and need a bit of a push to get
> going.
>
> Profuse thanks.
>
> Russ Bateman
>
You can use

if has("gui_running")
if &filetype == "java"
set columns=120
endif
endif

However I'd reccomend just having the following

set columns=120

in ~/.vim/ftplugin/java.vim or~/.vim/ftplugin/java/something.vim.

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