您所在的位置:首页 - 生活 - 正文生活

gvim自定义命令

嘉壮
嘉壮 04-22 【生活】 389人已围观

摘要**Title:MasteringProgrammingCommandsingVim****Introduction:**gVim,orthegraphicalversionofVim,isapowe

Title: Mastering Programming Commands in gVim

Introduction:

gVim, or the graphical version of Vim, is a powerful text editor beloved by programmers for its efficiency and versatility. Mastering its commands can significantly enhance your productivity and workflow. Below, we delve into essential gVim programming commands categorized by functionality.

Navigation Commands:

1.

Moving the Cursor:

h, j, k, l:

Move left, down, up, and right respectively.

w, e, b:

Move to the beginning of the next word, to the end of the current word, and to the beginning of the previous word respectively.

Ctrl f, Ctrl b:

Scroll forward and backward one screenful respectively.

gg, G:

Move to the first and last lines of the file respectively.

:line_number:

Move to a specific line number.

2.

Scrolling:

Ctrl u, Ctrl d:

Scroll half a page up and down respectively.

Ctrl y, Ctrl e:

Scroll one line up and down respectively.

zt, zz, zb:

Move current line to top, middle, or bottom of the screen respectively.

Editing Commands:

1.

Inserting and Appending:

i, I:

Enter insert mode before the cursor, or at the beginning of the line respectively.

a, A:

Enter insert mode after the cursor, or at the end of the line respectively.

o, O:

Open a new line below or above the current line and enter insert mode respectively.

2.

Deleting:

x:

Delete the character under the cursor.

dd:

Delete the entire line.

dw:

Delete from the cursor to the end of the current word.

d$ or D:

Delete from the cursor to the end of the line.

3.

Cut, Copy, and Paste:

yy:

Copy the current line.

yw:

Copy from the cursor to the end of the current word.

p, P:

Paste after or before the cursor respectively.

ddp:

Swap the current line with the one below it.

Search and Replace:

1.

Searching:

/:

Search forward.

?:

Search backward.

n:

Find the next occurrence.

N:

Find the previous occurrence.

2.

Replacing:

:s/old/new:

Replace the first occurrence of "old" with "new" on the current line.

:s/old/new/g:

Replace all occurrences of "old" with "new" on the current line.

:%s/old/new/g:

Replace all occurrences of "old" with "new" in the entire file.

:%s/old/new/gc:

Replace all occurrences with confirmation.

Saving and Exiting:

1.

Saving:

:w:

Save changes.

:w filename:

Save as a different filename.

2.

Exiting:

:q:

Quit if no changes have been made.

:q!:

Quit without saving changes.

:wq or :x:

Save changes and quit.

ZZ:

Save changes and quit.

Customization:

1.

Configuration:

.vimrc:

Customize gVim by editing the .vimrc file in your home directory.

2.

Plugins:

Explore and install plugins to extend gVim's functionality according to your needs.

Conclusion:

These gVim commands provide a solid foundation for efficient programming. Practice incorporating them into your workflow, and explore further customization options to tailor gVim to your specific requirements. With time and experience, you'll become a proficient gVim user, boosting your productivity and coding prowess.

Tags: 三国无双7帝国 烧脑游戏3 绝世唐门人物

最近发表

icp沪ICP备2023033053号-25
取消
微信二维码
支付宝二维码

目录[+]