Loading ...
Sorry, an error occurred while loading the content.

Re: behave mswin: word and WORD movement in selection

Expand Messages
  • Bram Moolenaar
    ... The trouble is that we don t have enough modifiers. Normally is used to advance a WORD left while moves a word left. In Select mode you
    Message 1 of 2 , Jun 1, 2002
      Vlad Sandrini wrote:

      > Don't know if this is a bug but anyway...
      > With :behave mswin (standard win install, unix evim, etc) you have
      > selection instead of visual, so you select text with shift-movement,
      > and this is well known.
      > Now, when in insert mode, you use <C-LEFT> and <C-RIGHT> and you
      > obtain word (lowercase) movement, that is alphanumeric words,
      > separated by spaces and non-word symbols, like typing lower 'w' and
      > 'b' in normal and visual.
      > When in select mode, visual mode's brother, I'd expect to type
      > <C-S-Left> and <C-S-Right> and expand my selection with the same kind
      > of movement, but the movement I get is WORD (uppercase), like typing
      > upper 'W' and 'B' in normal and visual: that is, words separated by
      > spaces only (non-word symbols like points and other separators are
      > skipped, considered part of the word) - while a lowercase word
      > movement would be much more useful.

      The trouble is that we don't have enough modifiers. Normally <C-Left>
      is used to advance a WORD left while <S-Left> moves a word left. In
      Select mode you already need the shift modifier to keep the selection,
      thus we can't distinguish between word and WORD.

      > I read in visual.txt that <C-O> in select should switch to visual for
      > one command, so I expected to workaround this issue adding these lines
      > at the bottom of mswin.vim:
      > :vmap <C-S-Left> <C-O>b
      > :vmap <C-S-Right> <C-O>w
      > ...but it doesn't work.
      > Indeed, hand typing <c-o>b and <c-o>w DOES work when in select.
      > However, when I map these movements, all it does when I press
      > <C-S-Left> and <C-S-Right> in select, is beep and stand still.
      > Did I do something wrong? Is there something wrong with <c-o> in
      > select at all? Must I take a few minute rest?
      > (vim 6.1.81)

      It's much simpler: ":vmap" already takes care of switching from Select
      to Visual mode. Thus you only need:

      :vmap <C-S-Left> b
      :vmap <C-S-Right> w

      hundred-and-one symptoms of being an internet addict:
      91. It's Saturday afternoon in the middle of may and you are on computer.

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
    Your message has been successfully submitted and would be delivered to recipients shortly.