9

When I open a special log file (http://www.quickfixj.org/) in GVIM2, I get:

GVIM2

What does ^A especially means and how can I search it (typing /patternXY)?

Thanks for your help!

Kind regards

P.S.: I am using VIM version 7.4 on OS Windows 7.

Thomas Baruchel
  • 7,236
  • 2
  • 27
  • 46
mrbela
  • 4,477
  • 9
  • 44
  • 79
  • 4
    it's a literal "ctrl-a" character, ascii 0x01 – Marc B Jan 22 '16 at 16:02
  • 2
    with vim you can press ga in normal mode to show info about the char under the cursor. in this case vim show `<^A> 1, HEX 01, Octal 001`. – Lynch Jan 22 '16 at 16:06

2 Answers2

19

Try :help digraph-table in Vim, you can see

char  digraph   hex     dec     official name
^@      NU      0x00      0     NULL (NUL)
^A      SH      0x01      1     START OF HEADING (SOH)
...

So ^A is the ASCII 0x01 character. If you want to see ^A things with hex code, try set display+=uhex. It'll be displayed as <01> with color of gray.

Also you can search this character with /Ctrl-VCtrl-AEnter. See :help i_CTRL-V:

CTRL-V          Insert next non-digit literally.  For special keys, the
                terminal code is inserted.  It's also possible to enter the
                decimal, octal or hexadecimal value of a character
                i_CTRL-V_digit.
                The characters typed right after CTRL-V are not considered for
                mapping.  {Vi: no decimal byte entry}
                Note: When CTRL-V is mapped (e.g., to paste text) you can
                often use CTRL-Q instead i_CTRL-Q.

You can enter a character with its hex value, <C-V>Xnn or <C-V>xnn, or its decimal value, <C-V>nnn, or its octal value, <C-V>Onnn or <C-V>onnn. In this case, it'll be <C-V>x01, <C-V>001, or <C-V>o001.

If you're using Vim on Windows, Ctrl-V might be used to paste. Then try Ctrl-Q instead of Ctrl-V. See :help CTRL-V-alternative:

Since CTRL-V is used to paste, you can't use it to start a blockwise Visual
selection.  You can use CTRL-Q instead.  You can also use CTRL-Q in Insert
mode and Command-line mode to get the old meaning of CTRL-V.  But CTRL-Q
doesn't work for terminals when it's used for control flow.
Yous
  • 728
  • 6
  • 22
3

You can type it with Ctrl-V and then Ctrl-A. More generally, typing Ctrl-V allows you to literally type the next key (without being interpreted); try Ctrl-V and then Return.

Thus, you can search it with: /, then Ctrl-V, then Ctrl-A.

Thomas Baruchel
  • 7,236
  • 2
  • 27
  • 46