Hi Eric,
From the Cocoa perspective this feature is simple to implement: when
copying you can put multiple representations of the text on the
pasteboard. What you're asking for could be achieved by putting the
selection in "rich text" format on the pasteboard. However, (as far
as I know) Vim has no way of giving you the selected text complete
with attributes (such as font, bold, etc.) which makes this feature
hard to implement. In fact, hard enough for me not to want to attempt
it. :-/
Björn
On Sun, Jul 27, 2008 at 8:54 PM, björn <bjorn.w...@gmail.com> wrote:
> From the Cocoa perspective this feature is simple to implement: when
> copying you can put multiple representations of the text on the
> pasteboard. What you're asking for could be achieved by putting the
> selection in "rich text" format on the pasteboard. However, (as far
> as I know) Vim has no way of giving you the selected text complete
> with attributes (such as font, bold, etc.) which makes this feature
> hard to implement. In fact, hard enough for me not to want to attempt
> it. :-/
Well, since we use NSTextStorage (which inherits from NSAttributedString)
to store the text for (at least MMTextView), it might be possible to bypass
the vim process, simply give the text stored in that TextStorage. However,
I do agree there might be some limitations.
- Jiang
Like only being able to copy what's currently in view perhaps?
Particularly for the OP: Have you investigated the :TOhtml command? Its
purpose is to convert a file into HTML using syntax highlighting.
Perhaps also hijacking its functionality could be a way of implementing
this kind of clipboard support. I don't suppose HTML is a flavour you
can put on the pasteboard that other apps will readily recognise is it?
I'd suggest if anything just implementing a Vim command to place
something on the pasteboard with a user-defined flavour and then leave
the rest to Vimscript. Something like
:[range]macyank[!] flavour
to yank text in range (default current line--bang to omit final newline)
into the clipboard with given flavour. Could be quite handy, e.g. you
could possibly even yank bits of binary files as images if desired, etc..
Ben.
This is unavoidable in Vim within its design, as I think you suspected.
Vim always must have the cursor on the screen, and the cursor must
always be either at the beginning or the end of the visual area. So if
the visual area is larger than a page, you must be looking at one end of
it, and since scrolling must move the cursor to keep it on the screen,
this alters the visual area.
If you didn't know already, you may find it handy to learn that you can
use the o key to move the cursor to the other end of the visual area.
I guess one thing that could be considered would be automatically doing
o if scrolling would move the cursor off the screen without doing so,
but not with doing so, i.e. if by simulating o the cursor would stay on
the screen while scrolling. I don't know if this is a very good idea,
though, or whether it would really help that much anyway.
Ben.
> That reminds me, I have a lot of problems mouse-selecting a large body
> of text. First, I seem to have inconsistent problems with the scroll
> speed as I try to drag-select off the top or bottom edge to get more
> text. Sometimes it's really slow.
in addition to what Ben said, you can click on where you want the
selection to start, hit `ma`, scroll, click at the end, and hit `v'a`
to select the text between the two clicks.
Nico