Difference between revisions of "Enhancing the vi (or vim)"

From Tech-Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
[[Category:Linux]]
 
First of all, install vim to replace the vi (if not installed already)
 
First of all, install vim to replace the vi (if not installed already)
  
 
To enable syntax highlighting on vim, type:
 
To enable syntax highlighting on vim, type:
  
  syntax on
+
  :syntax on
  
 
To enable line numbering, type:
 
To enable line numbering, type:
  
  set number
+
  :set number
  
 
To enable auto indenting, type:
 
To enable auto indenting, type:
  
  set autoindent
+
  :set autoindent
 +
 
 +
To convert from dos to unix, type:
 +
 
 +
:set fileformat=unix
  
 
Or you can edit your ~/.vimrc and type:
 
Or you can edit your ~/.vimrc and type:

Latest revision as of 02:35, 8 August 2016

First of all, install vim to replace the vi (if not installed already)

To enable syntax highlighting on vim, type:

:syntax on

To enable line numbering, type:

:set number

To enable auto indenting, type:

:set autoindent

To convert from dos to unix, type:

:set fileformat=unix 

Or you can edit your ~/.vimrc and type:

syntax on
set number
set autoindent
set showmatch           " briefly jump to matching bracket when inserting one
set expandtab           " expand tabs to spaces (use :retab to redo entire file)
set wrapscan            " allows search to wrap to top of document when the bottom has been hit
set tabstop=3           " width (in spaces) that a <tab> is displayed as
set shiftwidth=3        " width (in spaces) used in each step of autoindent