vim text replacement operation

tags: vim  replace  text  Regular  command

The command mode is: {operation range} s / find content / replaced content /

example

:%s/\t/,/gi

Explanation

  • Replace Tab spaces with commas
  • g replaces the entire line (without g, only the first line of the line is replaced)
  • The percent sign% is replaced from the first line to the last line
:5,10s/\(\d+\),\(\d\+\)/\2,\1/

Explanation

  • Swap numbers
  • For example, "58899,76600" will be replaced with "76600,58899"
  • Replace lines 5 ~ 10
  • The regular \ d is used to match digits, you need to escape + and parentheses(), Referenced as\1 And\2

recording

  • 2019/11/04 22:34:00

Intelligent Recommendation

Linux vim text replacement %s/original text/replacement text/g

grammar ESC:%s/origanl/new/g %s represents replacement text. origan means original text new means new content /g means full text replacement, if you only replace the first one, /g is not needed It sho...

VIM text operation basis

This article focuses on the text manipulation of the VIM editor. Article directory VIM operation Text insertion VIM operation Text insertion Display line number: set nu set nonu : Cancel line number E...

Vim Practical Guide (5): Text Replacement

Original address:Vim Practical Guide (5): Text Replacement Introduction When editing code, sometimes you want to rename a variable or function. Vi provides a powerful replacement feature that is bette...

Several ways to write vim full text replacement

s Replace % Full text $ the last line 1 first row g global? is to replace all matching strings in the line specified above. If this is not added, only the first one in each line will be matched. Here ...

Vim replaces the text content, batch replacement

Article directory Simplest usage example usage extension command syntax example [range] = % [flags] = g Simplest usage example Use the vim command to open the file, enter in command modes/world/oofpg ...

More Recommendation

Replacement operation in vim last line mode

Switch to the last line mode first, add the command after: : 1. Replace the elements of the current line g : replace so c : Add a message when replacing 2. Replace an element in lines 22-28: 3. Replac...

Vim command Insert, delete, query, replacement operation.

Transfer from:   Come here, do notes check. Edit the file using Vim: The interface after entering is calledCommand mode interface. When you modify the file editing, it is calledInsert mode。 ...

Text editor VIM-VIM common operation

setnu setting line number // ---- Direct input is not available, enter S will enter the insert mode! There is a colon in front, and you can set the quotes in Setnu. : 4 jump to the 4th line of the lin...

excel operation word, the replacement text

1. In Excel vba editor - Tools - references add a reference to the word.14. 2. Use the word vba word search and replace function to replace text in text.   3.vba help target site.vba helpwebsite...

Linux text operation (vi/vim)

What is vim? Vim is a text editor developed from vi. The functions of easy programming, such as code completion, compilation, and error jump, are particularly rich and widely used by programmers. In s...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top