:%s//hogehoge/ で置き換えできる
Vimで検索している文字列をファイル内置き換えしたい時は
:%s//hogehoge/ |
でファイル内の検索に引っかかった文字列を置き換えできます。
Vimずっと使ってきてたけど、最近初めて知りました。
*とかで単語検索した後とかに、置き換えできるので便利です。
{pattern}の部分を空にすると、最後に検索したパターンが入るそうです。
If the {pattern} for the substitute command is empty, the command uses the pattern from the last substitute or
:global
command. If there is none, but there is a previous search pattern, that one is used. With the [r] flag, the command uses the pattern from the last substitute,:global
, or search command.
0 件のコメント :
コメントを投稿