Friday, July 23, 2010

Re: How to yank into a usb?

On 07/23/10 07:05, Izaak Khaliq wrote:
> I'm trying to yank a file into a usb drive. How do I do it?
> using openSUSE 11.3.

Presuming you have your USB drive mounted at something like
/media/usb1, there are a couple interpretations to what you're
asking:

- do you want to just copy (save) the current file (with any
modifications you've performed but not saved) to the USB drive? Use

:w /media/usb1/some_file_name.ext


- do you want to copy (save) the original of the current file
without the unsaved changes in the current buffer? Use

:!cp <c-r>% /media/usb1/

where "<c-r>" is achieved by pressing control+R


- do you want to save a visually-selected portion of your text to
a file? If it's a line-wise selection, you can just use

:'<,'>w /media/usb1/some_file_name.ext

Though if it's not line-wise (i.e. character-wise or block-wise
visual mode), you'll have to copy that text to a temporary file
and write that:

y " yank your selection
:new " create a new buffer
P " puts the data we yanked in the new buffer
:$d " deletes the trailing blank line
:w /media/usb1/some_file_name.ext
:q! " quit the temp buffer we created


- are you using the built-in file-explorer plugin and you want to
select/tag files to copy to the USB drive? If so, I'd have to
defer to others on the list who are better versed in that (but
knowing that's what you want would give them the hint they need).


Hope this helps,

-tim


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