Skip to main content
  1. Personal Development Environment/

Collections of Amazing Vim Tips

·342 words·2 mins· loading · loading · ·
Neovim
Personal Development Environment - This article is part of a series.
Part 1: This Article

Why
#

This blog will evolve to including more valuable content. Using nvim tag to filter more content about nvim and others.

001 Using command mode in visual block.
#

After you select a visual block in vim, you can execute operation on the block by typing :normal ops. ops means the operations you intend to do. For instance, let’s assume that you have a text as shown below, and you have already select them in virtual mode.

After typing :normal Atest that mean appends “test” to every line at the end. You will see:

002 Mapping <C-d> and <C-u> to <C-d>zz and <C-u>zz.
#

<C-d> is key combinations of Control and d. In normal mode, <C-d> means half page down and <C-u> means half page up. zz is key combinations of double z, which help center cursor to middle position of current buffer. The new mapping is combinations of these two operations. Even though page is moved to up or down, the focus will always be center.

003 Repeat and Reverse Operation 1
#

004 daw or daW delete one word and cW or cw delete one word then
#

005 <C-h> and <C-w> to delete words in insert mode.
#

For example, assuming current buffer contains this is a test. <C-h> will delete one character and <C-w> will delete one word.

006 <C-o> enter Insert normal mode
#

Insert normal Mode means that the buffer will leave at insert mode after using Norm mode.

For example, we assume current buffer is this is a test,

007 gv select recent visual block
#

008 Vr + character replace one line with same character
#

009 use * to search for each occurrence
#

You can use * to search the word at which the current cursor locate.

010 Powerful Command Line Mode
#

011 read !{cmd} to load output of cmd to current buffer
#

012 write !{cmd} to send current buffer to input of cmd
#

013 use <C-o> as backward jump and <C-i> as forward jump
#

Personal Development Environment - This article is part of a series.
Part 1: This Article

Related

Tiling Windows Management in macOS
497 words·3 mins· loading · loading
MacOS Windows Management
Make A Powerful Terminal Workspace
964 words·5 mins· loading · loading
MacOS Terminal
macOS Setup for Development and Research
·3280 words·16 mins· loading · loading
MacOS Development