~/.vimrc config file


# set tab = 2 space
set tabstop=2
set shiftwidth=2
set expandtab

set paste

Modify file in-place

vim 默认每次写入(:w)文件时都会创建一个新的文件(inode),然后再移除旧文件,并重命名新文件为目标文件名。

如果想让 vim 原地修改文件:

:set backupcopy=yes


Ctrl + K 输入特殊字符

在 Insert 模式下,按 Ctrl + K,然后键入两个字符的组合键以输入一个特殊字符。


  • a< : ǎ
  • a> : â
  • "a:" : ä
  • a' : á
  • =e : €
  • Ye : ¥
  • Ct : ¢

:digraphs 查看所有可用的特殊字符组合键。

Ctrl + V 输入任意字符

It is also possible to enter any character (which can be displayed in your current 'encoding'), even a character for which no digraph is defined, if you know the character value, as follows (where ^V means "hit Ctrl-V, except if you use Ctrl-V to paste, in which case you should hit Ctrl-Q instead):

  • By decimal value: ^Vnnn (with 000 <= nnn <= 255)
  • By octal value: ^VOnnn or ^Vonnn (with 000 <= nnn <= 377)
  • By hex value: ^VXnn or ^Vxnn (with 00 <= nn <= FF)
  • By hex value for BMP Unicode codepoints: ^Vunnnn (with 0000 <= nnnn <= FFFF)
  • By hex value for any Unicode codepoint: ^VUnnnnnnnn (with 00000000 <= nnnnnnnn <= 7FFFFFFF)


  • In all cases, initial zeros may be omitted if the next character typed is not a digit in the given base (except, of course, that the value zero must be entered as at least one zero).
  • Hex digits A-F, when used, can be typed in upper or lower case, or even in any mixture of them.

Last update: 2023-02-16 01:24:47 UTC