Mike Hoy | 1 Dec 2008 01:52
Picon
Gravatar

set ff=dos problems


In my .vimrc file I have:

set ff=dos

and it doesn't format my files for dos. I have to type it out before
saving it. Any way to automate this? My instructor only uses notepad
to view code and I'm on GNU/Linux. I'd like to be able to just use vim
and it automatically saves it in dos format.

--

-- 
Mike Hoy

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

Alf | 1 Dec 2008 02:22
Picon

Re: apvlv 0.0.4 publish for test

package update.

downloadaddr:
http://apvlv.googlecode.com/

2008/11/30 Alf <naihe2010 <at> gmail.com>
Now, it's not stable, just publish for test.
 

apvlv 0.0.4
=============

News features

* remove the status bar from the bottom, and add it to every window.

* make the active window healight the status bar.

* add cache module to make the display faster.

* add 'r' command to rotate page.

* add ':TOtext' to translate pdf doc page to a text file.

* add ':pr[int]' to print the document.

* add ':open file' to open a PDF document.

* add ':doc file' to set the doc to current window.

* support open multiple PDF files once, and load them in cache. can be set by ':doc file'.

Bug Fix

* fix the absolutepath () bug.



download addr:
http://apvlv.googlecode.com/files/apvlv-0.0.4-for-test.tar.gz



--
  ,= ,-_-. =.
( (_/)o o(\_) )
   `-'(. .)`-'
       \_/



--
  ,= ,-_-. =.
( (_/)o o(\_) )
   `-'(. .)`-'
       \_/

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

Marc Weber | 1 Dec 2008 02:32
Picon
Picon

Re: set ff=dos problems


On Sun, Nov 30, 2008 at 05:52:18PM -0700, Mike Hoy wrote:
> In my .vimrc file I have:
> set ff=dos
> and it doesn't format my files for dos. I have to type it out before

Hi Mike.

The problem is that it's set explicitely when opening a file per buffer.
And per buffer settings override the default one.
However I strongly discourage this way to do it *for all* files.
Because you'll happen to edit you ~/.bashrc file as well and then: oh
dear, bash won't read it :-)

The way to go is using autocommands after creating, reading or before
writing them.
But I'd either use a localvimrc http://www.vim.org/scripts/script.php?script_id=441
to setup this autocommand or use a confirmation to remember you that you
should use dos format for files.

For example something like this should do it (untested):
  autocmd BufWritePre * if &ff != 'dos' && input('set ff to dos [y]') == 'y' | setlocal ff=dos | endif

Then you'll continue to edit other files with vim as well..

Enjoy
Marc Weber

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

Tony Mechelynck | 1 Dec 2008 03:02
Picon
Gravatar

Re: set ff=dos problems


On 01/12/08 01:52, Mike Hoy wrote:
> In my .vimrc file I have:
>
> set ff=dos
>
> and it doesn't format my files for dos. I have to type it out before
> saving it. Any way to automate this? My instructor only uses notepad
> to view code and I'm on GNU/Linux. I'd like to be able to just use vim
> and it automatically saves it in dos format.
>

When Vim open an existing file for editing, it checks the ends-of-files, 
and remembers how they were set in order not to change the setting when 
writing. This is good and proper, and governed by the 'fileformats' 
options. With recent Vim versions (7.2.040 or later) this can be 
overridden both when reading and writing. This is what I recommend:

- keep 'fileformats' at its default, or maybe make it universal by
	" in the vimrc
	set ffs=unix,dos,mac
- to create _new_ files with 'dos' fileformat by default (I'm not sure 
this blanketwise use of ff=dos is something that can be recommended on 
Linux; if I were you I would try to limit it to ONLY the files which 
your instructor will ever see -- see below).
	" in the vimrc
	setglobal ff=dos
- to _change_ the fileformat of an existing file: after reading and 
before saving
	" at the keyboard while editing
	:setlocal ff=dos
- It is NOT recommended to change every file to "dos" fileformat, even 
those which will never be sent to your instructor, because if you do, 
you will probably create (not always intentionally) a mixture of 
dos-like and Unix-like files on your computer, with the risk of getting 
error messages from gcc, patch, make, bash, or other typical "unix" 
utilities because they found ^M bytes at the end of almost every line in 
some file. Even Vim for Unix/Linux cannot understand vim scripts 
(including your vimrc) if they have dos-like ends of lines. (OTOH, with 
their default settings, Vim for Windows and Vim for Mac do understand 
unix-like scripts.) It is possible but *very dangerous* -- IF I WERE YOU 
I WOULDN'T DO IT. Here's how:
	" in the vimrc
	au BufWritePre * if &ma && !&ro | set ff=dos | endif
The test on (&ma && !&ro) is meant to avoid doing it for 'nomodifiable' 
and 'readonly' files but IT IS NOT FOOLPROOF. If you use this 
autocommand (which, again, I do *not* recommend) you will have to make 
DEAD SURE that you set 'readonly' (and ff=unix) on EVERY Unix file you 
edit, before saving it (even saving it implicitly if you use the 
'autowrite' and/or 'autowriteall' options). Even so, you will then have 
a hard time modifying Unix files for use on your own computer.

Note for your instructor (in the "been there, done that" line):
------------------------
Notepad is a broken editor, it cannot open correctly any files having 
the standard ends-of-lines used by default on all Unix/Linux systems. 
Use WordPad instead, it is just as easy to use and works much better.

Best regards,
Tony.
--

-- 
There was a young man from Bel-Aire
Who was screwing his girl on the stair,
	But the banister broke
	So he doubled his stroke
And finished her off in mid-air.

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

John Beckett | 1 Dec 2008 03:04
Picon

RE: set ff=dos problems


Mike Hoy wrote:
> In my .vimrc file I have:
> set ff=dos
> and it doesn't format my files for dos.

The following tip is a bit of a mess, but there is some useful info that might
assist:
http://vim.wikia.com/wiki/Change_end-of-line_format_for_dos-mac-unix

I think the problem is that Vim tries to retain the fileformat (line ending) that it
finds when reading the file. The command 'set ff=dos' is talking about the current
buffer, not files that you open in the future.

An autocmd that sets ff for all files in a certain directory might suit, or you
could have a script that you run to prepare files before sending.

John

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

bgold12 | 1 Dec 2008 04:49
Picon

Case sensitive :write


Hey, I've just discovered that vim doesn't retain the case of the
filename you provide as the argument to the :write command if there's
a filename by the same name but different case in the folder you're
saving to, or if you're writing a file that's already has the same
name but different case as the one you're saving.

This is usually not a problem, and I can circumvent it by just
renaming the file outside of vim, but i'm wondering why vim won't let
you write a new file with a different case (but the same name)? Is
there a setting for this?

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

Matt Wozniski | 1 Dec 2008 05:06
Picon
Favicon

Re: Case sensitive :write


On Sun, Nov 30, 2008 at 10:49 PM, bgold12 wrote:
>
> Hey, I've just discovered that vim doesn't retain the case of the
> filename you provide as the argument to the :write command if there's
> a filename by the same name but different case in the folder you're
> saving to, or if you're writing a file that's already has the same
> name but different case as the one you're saving.

Works fine for me on Linux.

rm [aA]; touch a; vim -c 'w A' -c q; ls -1i [aA]

My wild-assed guess is that you're running on DOS or Windows, where
filenames are case insensitive and 'a' and 'A' are the same file.

~Matt

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

Mr. Shawn H. Corey | 1 Dec 2008 05:09
Picon

Re: Case sensitive :write


On Sun, 2008-11-30 at 19:49 -0800, bgold12 wrote:
> Hey, I've just discovered that vim doesn't retain the case of the
> filename you provide as the argument to the :write command if there's
> a filename by the same name but different case in the folder you're
> saving to, or if you're writing a file that's already has the same
> name but different case as the one you're saving.
> 
> This is usually not a problem, and I can circumvent it by just
> renaming the file outside of vim, but i'm wondering why vim won't let
> you write a new file with a different case (but the same name)? Is
> there a setting for this?

Are you running under Windows or Linux?

--

-- 
Just my 0.00000002 million dollars worth,
  Shawn

The key to success is being too stupid to realize you can fail.

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

John Beckett | 1 Dec 2008 05:51
Picon

RE: Case sensitive :write


bgold12 wrote:
> Hey, I've just discovered that vim doesn't retain the case of 
> the filename you provide as the argument to the :write 
> command if there's a filename by the same name but different 
> case in the folder you're saving to, or if you're writing a 
> file that's already has the same name but different case as 
> the one you're saving.

This is a feature of Windows. You can try this at command prompt (no Vim running):

 echo 111111 > juNK.txt
 dir junk.txt
 echo 222222 > Junk.txt
 dir junk.txt

The second dir is the same as the first.

John

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

John Beckett | 1 Dec 2008 09:15
Picon

Vim Tips wiki - Main Page


The December edition of the Vim Tips Main Page is now available:
http://vim.wikia.com/wiki/Main_Page

Remember that if you log on you won't see the ads (except for the main page)!

John

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


Gmane