ow do I display vi / vim text editor line numbers while writing a shell script or c program? How can I turn on or off this feature on Linux, Apple OS X, or Unix-like operating systems?
use vi / vim as IDE (Integrated development environment) a software development system using Ubuntu Linux. How do I auto complete file name under vim / vi text editor while editing text file or java / c / python program? I can auto complete file nameunder bash shell by hitting [TAB] key.
ow do I print line numbers on the printer for my c / java / c++ code written using vi or vim text editor under Linux / UNIX like operating system?
Can tell me a Linux commands to edit a text file?
Q. I find vi hard to use. How do I change my default text editor from vim / vi to Pico under Debian Linux?
A. To use and change an editor to edit your text message, set the variable EDITOR to the pathname of the vi / vim binary file. You need to use export or set command for the same purpose.
Many Linux / UNIX command read shell EDITOR environment variable to determine which editor to use for editing a text file.
Set default text editor to pico
Type the command as follows:
$ which pico
Now setup a new text editor:
Add above line to ~/.bashrc file:
$ vi ~/.bashrc
Append text as follows:
Close and save the file. There is no no need to reboot system.
Also you can add alias if you want:
Q. Quick question â€“ How do I install VIM text editor for my FreeBSD server? Currently it has old version of vi. I like vim as it is a highly configurable text editor and efficient one.
A. VIM (Vi IMproved ) is not installed by default under FreeBSD. Vim is a text editor that is upwards compatible to Vi. It can be used to edit all kinds of plain text. It is especially useful for editing programs. You can install vim binary package or use FreeBSD’s ports system.
Task: Install vim binary package
Type the following command to install vim lite version:
# pkg_add -r -v vim-lite
You can also use FreeBSD ports system to install vim:
# cd /usr/ports/editors/vim-lite/
# make install clean
To start vim type command:
You can also create a alias using alias command:
$ alias vi='vim'
Add above alias to your shell start up file such as ~/.bashrc / ~/.cshrc
Task: Setup global vimrc file
You need to copy default vimrc file from /usr/local/share/vim/vim71/vimrc_example.vim to /usr/local/share/vim:
# cp /usr/local/share/vim/vim71/vimrc_example.vim /usr/local/share/vimrc
Task: Personal ~/.vimrc file
You can customize ~/.vimrc as per your requirements. Here is my own file:
$ cat ~/.vimrc
set nocompatible " must be the first line
filetype indent on
filetype plugin on
set statusline=%<%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P
Q. I am using vim under Ubuntu Linux and whenever I type following command:
Iâ€™m getting an error which read as follows:
E319: Sorry, the command is not available in this version: syntax on
How do I fix this problem?
Continue reading “Ubuntu Linux Vim Sorry, the command is not available in this version: syntax on”