我的Git提交消息包含一个空白字符,看起来像一个简单的空间当我输出git log
或运行gitk
。但是,当我用Vim打开Git提交消息时,空间显示为underbar,如屏幕截图所示。怎么能找出这是什么性格?如果你能告诉我如何复制它,我会把它粘贴在这里。什么是我的Git提交消息中的空白字符?
的屏幕截图显示GIT中提交消息Vim中在的iTerm在MacOS。
我的Git提交消息包含一个空白字符,看起来像一个简单的空间当我输出git log
或运行gitk
。但是,当我用Vim打开Git提交消息时,空间显示为underbar,如屏幕截图所示。怎么能找出这是什么性格?如果你能告诉我如何复制它,我会把它粘贴在这里。什么是我的Git提交消息中的空白字符?
的屏幕截图显示GIT中提交消息Vim中在的iTerm在MacOS。
使用vim,您可以使用ga
(在正常模式下),使用字符上的光标以十进制,十六进制和八进制形式显示ascii值。
从:help ga
:
:as[cii] or *ga* *:as* *:ascii*
ga Print the ascii value of the character under the
cursor in decimal, hexadecimal and octal. For
example, when the cursor is on a 'R':
<R> 82, Hex 52, Octal 122 ~
When the character is a non-standard ASCII character,
but printable according to the 'isprint' option, the
non-printable version is also given. When the
character is larger than 127, the <M-x> form is also
printed. For example:
<~A> <M-^A> 129, Hex 81, Octal 201 ~
<p> <|~> <M-~> 254, Hex fe, Octal 376 ~
(where <p> is a special character)
The <Nul> character in a file is stored internally as
<NL>, but it will be shown as:
<^@> 0, Hex 00, Octal 000 ~
If the character has composing characters these are
also shown. The value of 'maxcombine' doesn't matter.
Mnemonic: Get ASCII value.
例如,使用ga
与上a
显示的字符:
<a> 97, Hex 61, Octal 141
相关文章:[删除非破坏性空格字符( )](http://www.markhneedham.com/blog/2013/02/23/ruby-stripping-out-a-non-breaking-space-character -nbsp /)。 – JJD
如果您发现自己需要unicode名称,您可能需要查看[characterize.vim](https://github.com/tpope/vim-characterize) –
如果你发现自己经常希望看到的字符代码,你可以将其放入状态栏和/或直尺格式:
set laststatus=1
set statusline=%F\ %(%w%h%r%m%)%=%2v:%4l/%4L\ 0x%02B
set rulerformat=%25(%w%h%r%<%m%=%2v:%4l/%4L\ 0x%02B%)
朝向最后的%02B
总是将字符代码放在窗口的右边距(如果您的字符值大于255,它的宽度会增加)。我以0x
为前缀,所以我记得它是十六进制的。
将光标移动到该字符处并输入'ga'(在正常模式下)在屏幕底部显示该字符的一些信息。 – Marth
它输出:'< > 160,十六进制00a0,八进制240'。看起来这是一个[non-breaking space](https://en.wikipedia.org/wiki/Non-breaking_space)。 – JJD
随时将您的评论转换为“完整”答案,以便我可以授予您答案标志。 – JJD