4

The ; movement is supposed to repeat t, T, f, and F movements. For f and F this works fine as the cursor is placed on the character. However, pressing ; after t or T does not work as VIM finds the same character again and again (i.e., the cursor will not continue to move).

Is there a workaround for this? Might it be considered a VIM bug even though technically it is correct?

dotancohen
  • 11,278
  • 19
  • 67
  • 96
  • The workaround is to do `2;` I'm not sure this behavior can be considered a bug, though, but it should be more carefully documented. – romainl Jul 11 '12 at 19:51
  • you should definitely have a look at easymotion plugin - it changed my ouse of f,F,t,T completely https://github.com/Lokaltog/vim-easymotion – epsilonhalbe Jul 12 '12 at 09:08

2 Answers2

5

That behavior is controlled by the ; flag of 'cpoptions'. Execute

:verbose set cpo?

to see how yours are set.

This is a vi-compatibility issue. If your Vim is configured to be vi-compatible, the ; will be included in 'cpoptions' and you will get the behavior you observe. See

:help 'cpoptions'
:help cpo-;
:help 'compatible'

The solution to your problem depends on how you got Vim into this vi-compatible state. One usually has to go to extra effort to do that, such as starting Vim as "vim -u NONE", with -C or with no .vimrc file in your home directory.

Edit:

This was a problem that was fixed in Vim 7.3.235 with the addition of the ; flag to 'cpoptions'. In earlier versions, Vim always behaves as described in dotancohen's question.

garyjohn
  • 34,610
  • 8
  • 97
  • 89
  • I don't see a mention of `;` in `:h 'cpoptions'` or `:h 'compatible'` and `:set cpo?` returns `aABceFs`. None of these letters seem to be related to `tTfF` or `;,`. – romainl Jul 11 '12 at 22:14
  • It's at the bottom of the list of flags under ":help 'cpoptions'". See ":help cpo-;". I'll add that to my answer. The value of 'cpo' that you are seeing is the default when `Vim` is started in 'nocompatible' mode, which is the usual case. See the very first line of ":help 'cpoptions'". If you start `Vim` in vi mode (i.e., 'compatible'), for example by staring it as "vim -u NONE", then 'cpo' will contain all the option flags including `;` and you will get the vi-compatible behavior of `;`. – garyjohn Jul 11 '12 at 23:09
  • Well, my Vim version is 7.3.35 and I don't see `;` at all in the help. Furthermore, Vim spits an `E539` when I do `:set cpo+=;` whether I'm in compatible mode or not. This is probably a version problem. – romainl Jul 12 '12 at 05:58
2

As I recall this was a bug that has now been fixed.

It seems fixed in vim version 7.3.584

What version of vim are you using?

Bill

broomdodger
  • 3,060
  • 1
  • 16
  • 5
  • Thank you, I'm still on 7.3.154. It is great to know that this is fixed! How did you find that? I cannot find the VIM bugtracker. – dotancohen Jul 12 '12 at 05:43
  • 2
    There isn't a bug tracker, but you can find descriptions of patches in ftp://ftp.vim.org/pub/vim/patches/7.3/README. It looks like it was fixed at 7.3.235: '";" gets stuck on a "t" command, it's not useful'. – garyjohn Jul 12 '12 at 06:36
  • Thanks. I did find that page but I cannot get past the first 200 bytes or so, the page hangs. – dotancohen Jul 12 '12 at 12:45
  • That link was ftp, try this http link: http://ftp.vim.org/pub/vim/patches/7.3/README – broomdodger Jul 12 '12 at 15:30