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

52127New feature: cursor at the beginning of tab character in normal mode

Expand Messages
  • Vladimir A. Pavlov
    Oct 2, 2008
    • 0 Attachment

      A few days ago I wrote the following to vim@...:

      > I'd like to switch to vim but there is an annoying issue with
      > it that I couldn't solve.
      > When the cursor is at a tab character most editors display
      > the cursor at the beginning of the interval the tab character
      > occupies as follows (_ is the cursor):
      > _ if (a > c) ...
      > Vim does the same in insert or replace mode. But in normal
      > mode the cursor is displayed at the end of the tab character:
      > _if (a > c) ...
      > Is there a way to make vim show the cursor at the beginning
      > of a tab character in normal mode as it does in insert mode?
      > I tried searching in Google but found nothing unfortunatelly :(

      Then I got a reply that said it's impossible without vim code
      modification so I decided to find out how to fix that.

      I seem to find the solution (the patch is at the end of this
      email) but it is so simple that I can't understand why it hasn't
      been done yet (since I know several people that are irritated by
      this "feature" of vim).

      I guess this mailing list is the best place to ask whether I
      miss anything. Here are my questions:

      1. Are there any obvious problems/bugs with the patch itself?
      In other words, does it breaks anything very "basic" so
      that it definitely breaks some basic functionality or
      some plugins?

      2. If there are no problems with it, do you have any wishes to
      apply it to the trunk? (And what the reasons for not doing

      If so, I would add an option called, say, cursorattabstart
      that will trigger the new behaviour and resend the patch
      here for anyone of you to commit.


      The patch follows (should be applied to just unpacked

      diff -Naur vim72.orig/src/charset.c vim72/src/charset.c
      --- vim72.orig/src/charset.c 2008-07-24 18:59:44.000000000 +0400
      +++ vim72/src/charset.c 2008-10-02 21:44:18.000000000 +0400
      @@ -1333,7 +1333,7 @@
      if (start != NULL)
      *start = vcol + head;
      if (end != NULL)
      - *end = vcol + incr - 1;
      + *end = vcol;
      if (cursor != NULL)
      if (*ptr == TAB
      @@ -1345,7 +1345,7 @@
      && (*p_sel == 'e' || ltoreq(*pos, VIsual)))
      - *cursor = vcol + incr - 1; /* cursor at end */
      + *cursor = vcol; /* cursor at end */
      *cursor = vcol + head; /* cursor at start */

      You received this message from the "vim_dev" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 10 messages in this topic