VIM returns "Error detected while processing" and "Sorry, the command is not available in this version"
Single-User Solution

Run select-editor and select the proper version of vim. This is what psql does on initial run. This will drop a file ~/.selected_editor which will be used by psql when it calls sensible-editor.

Multi-User Ubuntu/Debian

If you're on Debian it's best to set it system-wide, especially if you're the only user on the system.


Have psql delegate to the system. To configure psql to use your default editor, run

echo SELECTED_EDITOR="editor" &gt; ~/.selected_editor

Configuring Debian and Ubuntu system-wide for the right editor, simply run

update-alternatives --config editor


Or set it your self,

update-alternatives --set editor /usr/bin/vim.gtk3



Checking

You can always check what version of vim you're using by issuing :version, this should say something like this

Huge version with GTK3 GUI.


If it doesn't, and it instead says 

Huge version without GUI.


Or, 

Small version without GUI.


You're likely without the needed features. Visual block replace specifically requires -vreplace