Wednesday, October 1, 2014

Re: How to edit remove Linux files on gVim on Windows without 'end of line' character problem?

I did the following test:
1. In Windows CMD manually downloaded file with command:
scp username@server:/path/to/the/file/file
Note: scp is Putty pscp.exe renamed file.
2. Opened the file with gVim and tested the :%xxd and there is original file downloaded, so only "new line" character without "carriage return" character which is original file from Linux box. This is OK, so "scp" program by default does NOT changes the "end of line" (EOL) character. And also gVim by default does not changes the EOL character.

1. But executing command: :e scp://username@server//path/to/file
2. Checking hex values with :%!xxd and :e scp://username@server//path/to/file
and "carriage return" and "new line" appears in file.
If I am not mistaken it looks like scp command in gVim does the trick to convert EOL characters on edit (:e command), but it does not convert EOL characters back to original when write (:w command) is executed.

I can't find any syntax in gVim to force to not change EOF characters when opened with scp command. Any idea?

P.S. Why this EOL is a problem? I am trying to remotely edit "bash" files on Linux and if changed with gVim using scp from Windows the EOL is in file and trying to execute this file it produces all sort of different errors stating there is ^M character in file. ^M is character representation of "carriage return". If I manually execute Linux command: "dos2unix file" EOL character get rid of "carriage return" characters and when this bash file is executed in Linux with command: ./file file executes without a problem.

And why I use gVim on Windows and not vim on Linux? Because I have customized gVim to extend that it is a pain to work with native out of the box vim on Linux. Also I don't want to change any vim settings on several Linux servers...

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment