Tony Mechelynck <[EMAIL PROTECTED]>2008-10-05 01:21 +0300> On 04/10/08 20:01, 
badmagic wrote:
>> Tony Mechelynck wrote:
>>> On 04/10/08 05:40, badmagic wrote:
>>>>> Netrw doesn't permit editing directly on the server; it permits editing
>>>>> the file on one's local machine.
>>>>>
>>>>> vim scp://host/path/file
>>>>>
>>>>> downloads a copy of the file to your local machine, whereupon one may
>>>>> inspect and edit it. Then
>>>>>
>>>>> :w
>>>>>
>>>>> causes netrw to upload the edited copy. The transfers in this case are
>>>>> via scp; one may also use ftp. You could then just write the file
>>>>> locally instead: :w localfilename .
>>>>>
>>>>> Regards,
>>>>> Chip Campbell
>>>>>
>>>>>
>>>>>
>>>> Actually, netrw is just a fancy way of saying Vim allows you to use scp
>>>> ( part of the ssh tools, port 22 TCP) to open "remote" files on a server
>>>> "in their place". It might add some fancy commands for browsing etc. but
>>>> it's still just an ssh/scp connection that Vim adds another layer on top
>>>> of so you can use the netrw commands from within vim.
>>>>
>>>> It doesn't open it locally. Any editing you do on the file is being done
>>>> on the remote file. This can be proven with tcpdump.
>>>>
>>>> If you run tcpdump as you're editing the file, you can see the packets
>>>> traversing the network on port 22 TCP. Every keystroke causes network
>>>> traffic. Every command (including :w) is being issued to the remote
>>>> file. The remote file is being edited in place in real time.
>>>
>>> Vim never edits a file in place. It reads the file into memory and
>>> edits it there. It only writes the file if you tell it to.
>>>
>>> If every keystroke causes network traffic, that network traffic does
>>> not (with the exception of file saves, maybe) go to the file being
>>> edited. It may go to the Vim swapfile, if you happen to open it on the
>>> remote site (which I don't recommend). ":w" without a filename writes
>>> the file from memory back to where it was read from (i.e., on the
>>> remote site). With a filename (which may include a path), it writes it
>>> to that location, and if that location is local, nothing of that write
>>> goes over the line.
>>>
>>>> netrw will also allow local browsing and editing but that's not what's
>>>> happening here.
>>>>
>>>> I just want a variable I can use to specify the directory the file
>>>> that's being edited below my home directory is in.
>>>>
>>>> Within Vim, if I issue the following command:
>>>>
>>>> :echo fnamemodify('.',':p:p')
>>>>
>>>> it returns
>>>>
>>>> /export/home/badmagic
>>>>
>>>> but I can't find an explanation of the '.',':p:p' part.
>>>
>>> one :p is enough, and it's explained under ":help filename-modifiers",
>>> which is linked from ":help fnamemodify()", the very help for the
>>> function you used. If youda RTFM youda faunt it.
>>>
>>>> Where can I find a description of all the :p and other variables that
>>>> represent file names, directories etc?
>>>
>>> In general, in the Vim help. It beats the help for any other program
>>> I've ever seen the way a royal flush beats a 7-5-4-3-2 polychrome hand
>>> in poker. If you ask nicely I'll tell you (after I've slept) what
>>> helptag completion and the :helpgrep command are all about; but by
>>> that time you ought to have found it without my help.
>>>
>>>>
>>>> TIA,
>>>> Steve
>>>
>>> Best regards,
>>> Tony.
>>
>> Hi Antoine,
>>
>> Thanks for the email.
>>
>> Don't know if you saw my last email or not but I figured out how to do
>> it all on my own. As it turned out % was the answer. A simple % and
>> no-one could tell me straight off. (Michael worked it out about an hour
>> after I had already figured it out).
>>
>> Instead, all I got from you was fnamemodify() which I didn't need,
>> filename-modifiers which were useless, the promise of info on helptag
>> (after you'd slept) which I didn't need, a very condescending attitude
>> which I didn't appreciate ("If you ask nicely I'll tell you (after I've
>> slept)") and told to read the F'ing manual ("If youda RTFM youda faunt
>> it.") which I did and it didn't help because you sent me on a wild goose
>> chase reading irrelevant stuff I didn't need.
>>
>> % expands out to subdir/to/file.html
>>
>> pure and simple
>>
>> Sometimes it's alright to just say, "I don't know!"
>>
>>
>> I do appreciate you taking the time to help me but sometimes, it doesn't
>> pay to be too full of yourself, especially when you're wrong and don't
>> know the right answer.
>>
>> Regards,
>> Steve
>>
>>
>
> Well, sorry if I misunderstood you, but please note the following:
>
> 1) % means the current file, the way it appears on the status line; 
> however in your Subject you asked for the current directory, which is 
> quite a different thing, and usually not even the directory of the 
> current file.
>
> 2) How could I know that telling you where to find what :p meant would 
> be "sending you on a wild goose chase" when you yourself _asked_ for it? 
> As for my "condescending" tone, it might have been less so if your own 
> post hadn't made it obvious that you had not even looked up the help for 
> the function where that :p was used.
>
> 3) About mentioning ways to search the help: you yourself seemed to 
> indicate that using the Vim help was foreign to your thinking. Sorry if 
> I misunderstood. "After I slept" was pure truth: it was 6 AM at my place 
> when I wrote that mail, and I hadn't yet gone to bed.
>
> I think I would have run less chance of sending you on a wild goose 
> chase if _you_ hadn't sent _us_ on a wild goose chase to begin with.
>
> Regards,
> Tony.
> -- 
> Flugg's Law:
>       When you need to knock on wood is when you realize that the
> world is composed of vinyl, naugahyde and aluminum.
>
> 

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

Reply via email to