vim/vi

Install

Ubuntu

sudo apt install vim

Delete blank Lines

:g/^$/d

colorscheme

(vim only)

To change the colorscheme in your vi session (e.g. so that comments appear in a better colour than the default dark blue)...

colorscheme desert

Alternatively, to make vi appear with no colours (as it does in AIX)

syntax off

To make a colorscheme change permanent add something like this to your .vimrc file in your home directory

syntax on

colorscheme desert

To step through the list of available colorschemes use...

colorscheme [space] [tab]

To get a list of available colorschemes use...

colorscheme [space] [ctrl-d]

You can also see the install colorschemes from the shell prompt using...

ls /usr/share/vim/vim*/colors

You can add colorschemes by downloading them to /usr/share/vim/vim*/colors (to make them available to everyone) or to ~/.vim/colors (to make them available to only you).

Folding

(vim only)

This functionality is useful if you are coding (Java, Python, KSH etc) and want to collapse a section of your code for easier visibility of nesting levels etc.

For example, to enable folding of sections of a Java program delineated by { and }...

:setlocal foldmethod=manual

Move to the start of the code block and type: zfa}

Use za to toggle the fold off when you are done with it.

There are many other folding options which are nicely documented here...

https://vim.fandom.com/wiki/Folding