Skip to content

Commit

Permalink
vim
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspercliff committed Sep 28, 2024
1 parent 5990e49 commit 8975ed8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/os/linux/vim/常用命令.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 常用命令

- 选择文件中的所有一个词并且替换
进入命令模式,可以通过按 ESC 键从插入模式(Insert mode)回到命令模式(Normal mode)。
输入 :%s/old_word/new_word/g 并按回车。这里 % 表示对整个文件进行操作,s 是 substitute 命令,
old_word 是你要替换的单词,new_word 是新单词,g 表示 global(全局),即替换每一行中所有的匹配项。
如果你想在替换前看到每次的替换,并决定是否替换:
输入 :%s/old_word/new_word/cg,其中 c 表示 confirm,即每次询问用户是否替换。

0 comments on commit 8975ed8

Please sign in to comment.