Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the skills of using vim in linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the linux vim use skills have what, has certain reference value, interested friends can refer to, hope that after reading this article, great harvest, let Xiaobian take you to understand.

A favorite editor for programmers: vim

Let's start with the three types of vim:

1. Command mode: Enter "vim filename" in Linux terminal to enter command mode, but you cannot enter text.

2. Edit mode: Press i in command mode to enter edit mode, then you can write programs, press Esc to return to command mode.

3. End line mode: press: to enter the end line mode in command mode, there will be a colon in the lower left corner, at this time you can type in the command and execute it.

Below is a brief analysis of the three patterns:

Here are some common vim techniques:

o: Insert one line below the current line and enter edit mode

O: Insert one line above the current line and enter edit mode

r: Replace character at cursor

R: Replace current and subsequent characters until [ESC] is pressed

w Save gg=G Automatic alignment syntax

set nu: Set line number

set nonu: cancel line number

v: enter visual

yy: copy current row

yyy: current line and the following three lines

p: paste

vim use

o: Insert one line below the current line and enter edit mode

O: Insert one line above the current line and enter edit mode

r: Replace character at cursor

w Save gg=G Auto Alignment Syntax

R: Replacement mode

yy: copy current row

yyy: current line and the following three lines

p: paste

nyw: copy n words

u: withdrawn

d: Cut

dd: Cut a line

ndd: Cut n rows

x: Delete cursor character, equivalent to [Delete] function key

X: Delete cursor front character, equivalent to [Backspace]

dd: Delete the row where the cursor is located

db: delete cursor all the way to the beginning of the word

DW: Delete cursor all the way to end of word

s: Replace the specified number of characters with the entered text, starting at the current cursor position

S: Delete the specified number of lines and replace them with the entered text

d0: Delete to the beginning of the line

D: Delete cursor to end of line

d+}: Delete cursor to next blank line

dG: Delete cursor to end of file

L: Bottom line of current screen

H: Current screen top line

M: middle line of current screen

$: End of current line

0 / ^: First of the current line

W: The first word of the next word

b: last word

: Line number to specified line

}: Next blank line

{: previous blank line

%: automatic matching lookup

a: added to the end

vsp + file name vertical split screen

Ctrl+ww: Switch between screens

/ + Find content: Start finding

N: Next target

N: Previous target

59,60s/source/target/g Replace all from 59 to 60

%s/Source/Target/g Full-text replacement

r filename: bring the file to the cursor

Thank you for reading this article carefully. I hope that Xiaobian's sharing of "What are the skills of using vim in linux" will help everyone. At the same time, I hope that everyone will support you a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report