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

Any way of getting statusline=%B in insert mode?

Expand Messages
  • DervishD
    Hi all, and happy new year! I have %B in my status line, but it doesn t work in insert mode, only on normal and visual mode. At first I thought that the status
    Message 1 of 11 , Jan 2, 2007
    • 0 Attachment
      Hi all, and happy new year!

      I have %B in my status line, but it doesn't work in insert mode,
      only on normal and visual mode. At first I thought that the status line
      wasn't being evaluated while in insert mode, but the line and column
      numbers change correctly, so it *is* being evaluated, it's just that %B
      doesn't seems to work.

      Any way of working around this problem? Is this a feature?

      Thanks a lot in advance :)

      Raúl Núñez de Arenas Coronado

      --
      Linux Registered User 88736 | http://www.dervishd.net
      It's my PC and I'll cry if I want to... RAmen!
    • A.J.Mechelynck
      ... I confirm that in Insert/Replace mode %B gives a single digit zero. In Select mode it works OK, even in Select (insert) i.e. when triggered by hitting
      Message 2 of 11 , Jan 2, 2007
      • 0 Attachment
        DervishD wrote:
        > Hi all, and happy new year!
        >
        > I have %B in my status line, but it doesn't work in insert mode,
        > only on normal and visual mode. At first I thought that the status line
        > wasn't being evaluated while in insert mode, but the line and column
        > numbers change correctly, so it *is* being evaluated, it's just that %B
        > doesn't seems to work.
        >
        > Any way of working around this problem? Is this a feature?
        >
        > Thanks a lot in advance :)
        >
        > Raúl Núñez de Arenas Coronado
        >

        I confirm that in Insert/Replace mode %B gives a single digit zero. In Select
        mode it works OK, even in Select (insert) i.e. when triggered by hitting
        shift-arrow in Insert mode.

        Even in Insert mode, the display is OK in non-current windows (e.g. clicking a
        status line or using Ctrl-O Ctrl-W w to change windows, gives a correct
        display on the status line of the window which we just left).

        IMHO this is a bug.


        Best regards,
        Tony.
      • DervishD
        Hi Tony :) ... OK, thanks for the confirmation. ... So really it is a bug and not a feature. Again, thanks :) Raúl Núñez de Arenas Coronado -- Linux
        Message 3 of 11 , Jan 2, 2007
        • 0 Attachment
          Hi Tony :)

          * A.J.Mechelynck <antoine.mechelynck@...> dixit:
          > DervishD wrote:
          > > I have %B in my status line, but it doesn't work in insert mode,
          > >only on normal and visual mode. At first I thought that the status line
          > >wasn't being evaluated while in insert mode, but the line and column
          > >numbers change correctly, so it *is* being evaluated, it's just that %B
          > >doesn't seems to work.
          > >
          > I confirm that in Insert/Replace mode %B gives a single digit zero. In
          > Select mode it works OK, even in Select (insert) i.e. when triggered
          > by hitting shift-arrow in Insert mode.

          OK, thanks for the confirmation.

          > Even in Insert mode, the display is OK in non-current windows (e.g.
          > clicking a status line or using Ctrl-O Ctrl-W w to change windows,
          > gives a correct display on the status line of the window which we just
          > left).

          So really it is a bug and not a feature. Again, thanks :)

          Raúl Núñez de Arenas Coronado

          --
          Linux Registered User 88736 | http://www.dervishd.net
          It's my PC and I'll cry if I want to... RAmen!
        • A.J.Mechelynck
          ... IMHO, I said. Bram has the final say, not me. ... Best regards, Tony.
          Message 4 of 11 , Jan 2, 2007
          • 0 Attachment
            DervishD wrote:
            > Hi Tony :)

            :-) Olá Raúl

            >
            > * A.J.Mechelynck <antoine.mechelynck@...> dixit:
            >> DervishD wrote:
            >>> I have %B in my status line, but it doesn't work in insert mode,
            >>> only on normal and visual mode. At first I thought that the status line
            >>> wasn't being evaluated while in insert mode, but the line and column
            >>> numbers change correctly, so it *is* being evaluated, it's just that %B
            >>> doesn't seems to work.
            >>>
            >> I confirm that in Insert/Replace mode %B gives a single digit zero. In
            >> Select mode it works OK, even in Select (insert) i.e. when triggered
            >> by hitting shift-arrow in Insert mode.
            >
            > OK, thanks for the confirmation.
            >
            >> Even in Insert mode, the display is OK in non-current windows (e.g.
            >> clicking a status line or using Ctrl-O Ctrl-W w to change windows,
            >> gives a correct display on the status line of the window which we just
            >> left).
            >
            > So really it is a bug and not a feature. Again, thanks :)

            IMHO, I said. Bram has the final say, not me.

            >
            > Raúl Núñez de Arenas Coronado
            >

            Best regards,
            Tony.
          • Bill McCarthy
            ... Perhaps. It behaves that way (also in 6.4) for both %b and %B. In Gvim, the cursor is between 2 characters - so returning zero for %b and %B seems
            Message 5 of 11 , Jan 2, 2007
            • 0 Attachment
              On Tue 2-Jan-07 12:57pm -0600, A.J.Mechelynck wrote:

              > DervishD wrote:
              >> Hi all, and happy new year!
              >>
              >> I have %B in my status line, but it doesn't work in insert mode,
              >> only on normal and visual mode. At first I thought that the status line
              >> wasn't being evaluated while in insert mode, but the line and column
              >> numbers change correctly, so it *is* being evaluated, it's just that %B
              >> doesn't seems to work.
              >>
              >> Any way of working around this problem? Is this a feature?
              >>
              >> Thanks a lot in advance :)
              >>
              >> Raúl Núñez de Arenas Coronado
              >>
              >
              > I confirm that in Insert/Replace mode %B gives a single digit zero. In Select
              > mode it works OK, even in Select (insert) i.e. when triggered by hitting
              > shift-arrow in Insert mode.
              >
              > Even in Insert mode, the display is OK in non-current windows (e.g. clicking a
              > status line or using Ctrl-O Ctrl-W w to change windows, gives a correct
              > display on the status line of the window which we just left).
              >
              > IMHO this is a bug.

              Perhaps. It behaves that way (also in 6.4) for both %b and
              %B. In Gvim, the cursor is between 2 characters - so
              returning zero for %b and %B seems reasonable. OTOH,
              supporting the bug conclusion, the character position of %c,
              %v and %V report the position following the between
              character cursor.

              --
              Best regards,
              Bill
            • A.J.Mechelynck
              Bill McCarthy wrote: [...] ... In (g)vim, the cursor is never between characters. In gvim, with the default setting for guicursor , the cursor looks as if it
              Message 6 of 11 , Jan 2, 2007
              • 0 Attachment
                Bill McCarthy wrote:
                [...]
                > Perhaps. It behaves that way (also in 6.4) for both %b and
                > %B. In Gvim, the cursor is between 2 characters - so
                > returning zero for %b and %B seems reasonable. OTOH,
                > supporting the bug conclusion, the character position of %c,
                > %v and %V report the position following the between
                > character cursor.
                >

                In (g)vim, the cursor is never between characters. In gvim, with the default
                setting for 'guicursor', the cursor looks as if it were between characters,
                because it is drawn as a vertical bar occupying the leftmost 25% of its
                character cell; but ":set guicursor=a:block-Cursor" will show that it is
                indeed within a character cell (whose position is reported by %c %v %V).


                Best regards,
                Tony.
              • DervishD
                Hi Tony :) ... It s Hola , but thanks for the nice gesture :))))) ... Of course, but given that even in the GUI version the problem happens (I thought that
                Message 7 of 11 , Jan 3, 2007
                • 0 Attachment
                  Hi Tony :)

                  * A.J.Mechelynck <antoine.mechelynck@...> dixit:
                  > DervishD wrote:
                  > > Hi Tony :)
                  > :-) Olá Raúl

                  It's "Hola", but thanks for the nice gesture :)))))

                  > > So really it is a bug and not a feature. Again, thanks :)
                  >
                  > IMHO, I said. Bram has the final say, not me.

                  Of course, but given that even in the GUI version the problem
                  happens (I thought that the bar was in between characters, and not at
                  the 25% leftmost position), I'm inclined to think it is a bug and not a
                  feature. Specially because it is a bit annoying, when moving around in
                  insert mode, not being able to know the byte value of a character when I
                  need to. Of course, I can switch to normal mode or map something to "g8"
                  in insert mode, but...

                  Thanks for all and à bientôt :))

                  Raúl Núñez de Arenas Coronado

                  --
                  Linux Registered User 88736 | http://www.dervishd.net
                  It's my PC and I'll cry if I want to... RAmen!
                • A.J.Mechelynck
                  DervishD wrote: [...] ... ga (or in Insert mode Ctrl-O ga) is what you want: g8 is used in UTF-8 to show the actual bytes which represent the character: e.g.
                  Message 8 of 11 , Jan 3, 2007
                  • 0 Attachment
                    DervishD wrote:
                    [...]
                    > Of course, but given that even in the GUI version the problem
                    > happens (I thought that the bar was in between characters, and not at
                    > the 25% leftmost position), I'm inclined to think it is a bug and not a
                    > feature. Specially because it is a bit annoying, when moving around in
                    > insert mode, not being able to know the byte value of a character when I
                    > need to. Of course, I can switch to normal mode or map something to "g8"
                    > in insert mode, but...

                    ga (or in Insert mode Ctrl-O ga) is what you want: g8 is used in UTF-8 to show
                    the actual bytes which represent the character: e.g. on the letter é (small e
                    with acute accent), ga shows "<é> 233, Hex 00e9, Octal 351" while g8 shows "c3
                    a9".

                    >
                    > Thanks for all and à bientôt :))

                    De nada, y hasta luego, amigo.

                    >
                    > Raúl Núñez de Arenas Coronado
                    >

                    Best regards,
                    Tony.
                  • DervishD
                    Hi Tony :) ... I just didn t remember about ga, and I was using g8 most of the time O:)))) Thanks a lot for the tip :)) ... Do you speak spanish? I studied
                    Message 9 of 11 , Jan 3, 2007
                    • 0 Attachment
                      Hi Tony :)

                      * A.J.Mechelynck <antoine.mechelynck@...> dixit:
                      > DervishD wrote:
                      > > Of course, but given that even in the GUI version the problem
                      > >happens (I thought that the bar was in between characters, and not at
                      > >the 25% leftmost position), I'm inclined to think it is a bug and not a
                      > >feature. Specially because it is a bit annoying, when moving around in
                      > >insert mode, not being able to know the byte value of a character when I
                      > >need to. Of course, I can switch to normal mode or map something to "g8"
                      > >in insert mode, but...
                      >
                      > ga (or in Insert mode Ctrl-O ga) is what you want: g8 is used in UTF-8 to
                      > show the actual bytes which represent the character: e.g. on the letter é
                      > (small e with acute accent), ga shows "<é> 233, Hex 00e9, Octal 351" while
                      > g8 shows "c3 a9".

                      I just didn't remember about ga, and I was using g8 most of the time
                      O:)))) Thanks a lot for the tip :))

                      > > Thanks for all and à bientôt :))
                      >
                      > De nada, y hasta luego, amigo.

                      Do you speak spanish? I studied french a long time ago, and I'm
                      afraid I'm no longer able to maintain a conversation in french, although
                      I still understand it a bit. Your spanish is for sure much better than
                      my french O:)))

                      Again, thanks for the nice gesture, you're very kind :)

                      Raúl Núñez de Arenas Coronado

                      --
                      Linux Registered User 88736 | http://www.dervishd.net
                      It's my PC and I'll cry if I want to... RAmen!
                    • Redoute
                      ... %{char2nr(getline( . )[col( . )-1])} works for me.
                      Message 10 of 11 , Jan 3, 2007
                      • 0 Attachment
                        DervishD wrote:

                        > Any way of working around this problem?

                        %{char2nr(getline('.')[col('.')-1])}

                        works for me.
                      • DervishD
                        Hi Redoute :) ... Thanks! I ve modified it a bit, because I wanted the number as hexa and always with the same width, using printf : set statusline=%y%m%r
                        Message 11 of 11 , Jan 4, 2007
                        • 0 Attachment
                          Hi Redoute :)

                          * Redoute <redoute@...> dixit:
                          > DervishD wrote:
                          > > Any way of working around this problem?
                          >
                          > %{char2nr(getline('.')[col('.')-1])}
                          >
                          > works for me.

                          Thanks! I've modified it a bit, because I wanted the number as hexa
                          and always with the same width, using "printf":

                          set statusline=%y%m%r\ %t%=[%L]\ %05l,%03c\ %{printf('x%02x',char2nr(getline('.')[col('.')-1]))}


                          Raúl Núñez de Arenas Coronado

                          --
                          Linux Registered User 88736 | http://www.dervishd.net
                          It's my PC and I'll cry if I want to... RAmen!
                        Your message has been successfully submitted and would be delivered to recipients shortly.