On 28/07/10 02:54, winterTTr wrote:


On Tue, Jul 27, 2010 at 11:04 PM, Ben Fritz <[email protected]
<http://gmail.com>> wrote:



    On Jul 27, 2:55 am, winterTTr <[email protected]
    <mailto:[email protected]>> wrote:
     > I know that we can use the "set nomodifiable" to make a buffer
    read-only,
     > which makes all the text in it not modifiable.
     >
     > But is it possible to make some text in a buffer read-only but
    not for the
     > whole buffer?
     > I mean maybe we can "bind" a property to the string ( or text, or
    character
     > ) , which can
     > make the text read-only in a modifiable buffer.
     > Or even finally, We can  make the text not only a plain text,
      but text
     > binding some properties
     > set to different value to control the different aspects, such as
     > highlighting, read-only, or even font.
     > Maybe, "conceal" can also be one property of a text. :-)
     >

    I'm curious what your end goal is. Making only part of the buffer text
    read-only is probably not a trivial task. Knowing why you want this
    may help come up with some alternative solutions to the problem you
    are trying to solve.

OK, maybe just a user experience problem.

Let me give an example
When you want to edit the text between the xml tag, such as
<text>editing here</text>
If i can force the <text> and </text> to be read-only, which prevents
deleting the tag,
it maybe more convenient for me SOMETIMES.
OK, until now, i can use selection-mode/visual-mode to select the text
between tag
and edit them, but it does not limit the edit area.

Vim has a notion of |text-objects| (q.v.). In Normal mode, "cit" (Change Inside Tag, without the quotes) will change the text between the tags, not touching them (and since the c command puts you in Insert, not Replace, mode, you won't delete them.) Conversely, "dat" (still without the quotes, and with a rather than i) deletes the tags and the content between them.

Oh, and don't forget the power of undo!


Actually, this not a good example, but just for showing an idea.


    --
    You received this message from the "vim_dev" 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 from the "vim_dev" 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

Best regards,
Tony.
--
Show respect for age.  Drink good Scotch for a change.

--
You received this message from the "vim_dev" 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

Raspunde prin e-mail lui