Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VIM symbol ^A in log file

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.

like image 476
mrbela Avatar asked Jan 22 '16 15:01

mrbela


People also ask

What is the m character in vim?

The file in question was created in Windows and then copied over to Linux. ^M is the keyboard equivalent to \r or CTRL-v + CTRL-m in vim.

What is m carriage return?

In ASCII and Unicode, the carriage return is defined as 13 (or hexadecimal 0D); it may also be seen as control+M or ^M. In the C programming language, and many other languages (including regular expression) influenced by it, \r denotes this character.


1 Answers

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.
like image 131
Yous Avatar answered Oct 12 '22 00:10

Yous