• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Gokul Deepak

Gokul Deepak

GoCool and Debug

  • Home
  • Terraform
  • WordPress
  • Android
  • How to
  • About Me

Vi and Vim Editor commands

August 23, 2020 by Gokul Deepak S Leave a Comment

Vi and Vim Editor commands

Here I’m mentioning all the commands related to Vi and Vim editor that I learn

Command to delete all lines in Vi Editor:

:1,$d 

Delete a single line where the cursor is

dd

Find and /replace

:%s/find_word/replace_word/g

To search a word that has the character forward slash / or any special characters then simply include backward slash \ before that \/

:%s/find\/words\~/replacewords/g

Add Text to beginning of every line – use ˆ
Add Text to end of every line- use $

:%s/ˆ/text/
:%s/$/text/

Remove Blank Lines

:g/^$/d

Remove Blank Lines that contains space

:g/^ *$/d

Filed Under: Linux

About Gokul Deepak S

Leave a ReplyCancel reply

0 Comments
Inline Feedbacks
View all comments

Primary Sidebar

Popular Pages

  • Home
  • How to find the date of the Facebook group it was created
  • Yureka Yu Plus vs Lenovo K3 Note
  • How to Install Windows without GRUB rescue
  • How to Remove LinkWithin logo under 'You Might Also Like' widget in blogger
  • Combine two separate files line by line in Notepad++

Archives

Categories

  • Android
  • Apache
  • AWS
  • Blogger
  • Computer Tips
  • DevOps
  • Docker
  • Earn
  • Facebook Tips
  • Git
  • Google Tips
  • Hosting
  • How to
  • Laptop Tips
  • Laptops
  • Linux
  • Mobile
  • MongoDB
  • Nginx
  • Node JS
  • Notepad++
  • PostgresQL
  • Terraform
  • Ubuntu
  • Wordpress
  • Xenforo

Tags

Android Android One AWS Bluehost Comparisions Custom ROM Elementor Facebook Genesis Genesis Sample Theme Google Drive How to Lineage OS Notes OnePlus One OwnCloud Rooting Smartphones Stock ROM Studiopress Tomcat Wordpress plugin

Copyright © 2025 · Maintained by GokulDeepak

wpDiscuz