Thursday, February 25, 2010

Re: Calling :set ff=unix or ff=dos based on save location

Thanks a lot pansz, after I little research I ended up with the following in
my _vimrc:

" set ff=unix if I'm writing to Y:\ or U:\, ff=dos for Z:\ and C:\. Note
'/' for path seperator.
if !exists("autocmds_loaded")
let autocommands_loaded = 1
autocmd Bufwritepre,filewritepre Y:/* set ff=unix
autocmd Bufwritepre,filewritepre U:/* set ff=unix
autocmd Bufwritepre,filewritepre Z:/* set ff=dos
autocmd Bufwritepre,filewritepre C:/* set ff=dos
endif

pansz wrote:
>
> corykendall 写道:
>> Howdy ladies and gentlemen,
>>
>> I use VIM for all editing... half of which is saved on a Windows machine,
>> and the other half of which is saved through Samba on a Unix machine.
>> Gvim
>> itself is running on windows.
>>
>> I'm looking for something I can add to my vimrc that automatically calls
>> ":set ff=unix" when I save to either the U:\ or V:\ drives (both mapped
>> via
>> Samba to unix), and automatically calls ":set ff=dos" otherwise.
>>
>> Thanks for any help!
>
> You can use the autocmd FileWritePre to catch the event and do what you
> want..
>
>
> --
> You received this message from the "vim_use" maillist.
> For more information, visit http://www.vim.org/maillist.php
>
>

--
View this message in context: http://old.nabble.com/Calling-%3Aset-ff%3Dunix-or-ff%3Ddos-based-on-save-location-tp27704784p27714429.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

No comments: