How to display hidden characters in vi / vim
Answer:
In vi / vim, type
set: list
To turn off, type
set: nolist
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to display hidden characters in vi / vim
Answer:
In vi / vim, type
set: list
To turn off, type
set: nolist
How to expand tab into spaces in vi / vim
Answer:
It is always good to use spaces instead of tab when editing program's source code.
In you ~/.vimrc, add the following lines
: set expandtab
: set shiftwidth=4
: set softtabstop=4
: set tabstop=4
Only expandtab is needed in fact, but most opensource projects tend to maintain a consistency of 4-spaces-indent, follow it anyway.
How to show line number in vi / vim?
Answer:
In vi, type the following to display the line number
:set number
To hide the line number
:set nonumber
To set the line number option permanently, append into ~/.vimrc
echo ":set nonumber" >> ~/.vimrc
How to comment out a large block of lines in vi?
Answer:
Press enter and that's all.
How to replace a character for a new line in vi?
Answer:
You might have tried
:%s/,/\n/g
But it didn't work.
Try replacing with \r instead
:%s/,/\r/g