Showing posts with label VIM. Show all posts
Showing posts with label VIM. Show all posts

Tuesday, 28 January 2025

vim global search replace

 https://www.baeldung.com/linux/vim-search-replace

To search and replace all occurrences on every line of the file, we need to slightly modify the previous command:

:%s/article/tutorial/g

The symbol lets us access all the content in the file, and we can replace all occurrences in each line.

The sample.txt file should match this after replacing all occurrences:

Wednesday, 8 September 2021

2021 Ubuntu & Vim - change default color, fix security issue, vim not reading ~.vimrc

https://phoenixnap.com/kb/vim-color-schemes 

In your home folder in ubuntu ( cd ~)

// Create .vimrc file

$ vim .vimrc

// in .vimrc file add the following 

# Set directory is to fix vim security issue, where opened file by vim saved in default temp location can be opened 

set directory=~/.vimbak

# As of Sept 8 2021 colo is deprecated

colo desert

OR

colorscheme desert

syntax on

// :wq! to save the file


// Then in home directory. create directory .vimbak for vim to temporarily save progress on opened file

$ mkdir .vimbak


Vim not reading .vimrc?

https://stackoverflow.com/questions/3495124/not-reading-vimrc

This should not happen, go inside of the link above to find solutions.

(Not recommended) In ubuntu u can change vim global settings for all users at :

/etc/vim/vimrc


Friday, 9 July 2021

Visual studio code redo/udo vs vim

Visual Studio :


UndoCtrl+Zundo
RedoCtrl+Yredo



Vim: 

Undo  => U

Redo => CTRL R