From bf78e3be37580791be60762cadec973e32276b2f Mon Sep 17 00:00:00 2001 From: Randy8080 Date: Thu, 18 Feb 2021 09:44:19 +0800 Subject: [PATCH] Global command --- vim.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vim.md b/vim.md index 3be67b0..8aa2d1c 100644 --- a/vim.md +++ b/vim.md @@ -500,6 +500,7 @@ Search and Replace {.cols-3} | `:g/foo/t$` | Copy lines containing `foo` to EOF | | `:g/foo/m$` | Move lines containing `foo` to EOF | | `:g/^/m0` | Reverse a file | +| `:g/^/t.` | Duplicate every line | @@ -554,7 +555,7 @@ Search and Replace {.cols-3} :%s/^\(.*\)\n\1/\1/ # Remove duplicate lines :%s/<\/\=\(\w\+\)\>/\U&/g # Convert HTML-Tags to uppercase :g/^pattern/s/$/mytext # Find and append text to the end -:g/pattern/normal @q # Run a macro on matching lines +:g/pattern/norm! @i # Run a macro on matching lines /^\(.*\)\(\r\?\n\1\)\+$ # View the duplicates lines :v/./,/./-j # Compress blank lines into a blank line :g//,//d # Delete inclusively from to