Tim Chase wrote:
file file_id=myidc:\test.txt/file
When the cursor is on the 'm' of 'myid' and I press 'vw',
a word is selected in visual mode. However, the at the
end of 'myid' is also selected. How do I change the list
of 'word separators'?
Well, the answer to your question is that there's a setting
called 'iskeyword' to which you can add and from which you
can remove characters. However, by default, it doesn't
include the double-quote character. What you're seeing is
an expression of that range from the drop-point m *up to,
but not including* where the cursor is (on the quote). If
you follow your vw example with y to yank it, and then
paste it elsewhere, you'll see that the selection was
accurately just myid, not myid
Thanks, this is indeed the setting I'm looking for. However it seems
that the w motion *is* inclusive, at least on my installation. Here's
what :set iskeyword says:
iskeyword=@,48-57,_,192-255
(which is the default, I did a 'set nocp' to make sure it was reset to
the default, as per the docs).
Now when I repeat putting the cursor on 'm' and pressing 'w', the is
selected, as confirmed by yanking and pasting and seeing 'myid' being
pasted. This is not what the documentation says should happen, so I
looking around for any mappings of w to something but as far as I can
tell, no such mapping is available.
For the record, I'm using gvim 7 of may 7th, according to :version.
I've tried starting gvim without loading a vimrc, but I get the same
behaviour. Anyone else seeing this? Am I picking up side effects from
other settings somehow?
On a related note, when I have 'myid' selected and I want
to replace it with the contents of the yank buffer, I
press 'p'. But the original contents of the yank buffer
are then replaced my 'myid', i.e. the text that was
replaced in the paste operation. How do I change this
behaviour?
The best solution I know is to use
_p
For more info, you can read at
:help _
:help 0
:help v_p
Hope this helps you find a solution to what you're trying to
do.
Thanks, I'll investigate this, I think I can work something out from here.
cheers,
roel