Tag Archive for 'vi'

Am Lovin’ vi

I have fallen in love with vi. I have started usign vi only recently. The concept was a bit difficult at first, but now I think I have got used to it. I still sometimes forget to enter the insert mode before typing, but that’ll come with practise. Also I have now learnt how to yank text, paste it and yeah also used the search and replace feature.

Below is a screen shot of my terminal using the vi. Each tab has a different file open. And the tab which contains the main file, I have divided it into two frames. It allows me to look at different parts of the same file without having to keep scrolling all the time.

vi terminal

vi terminal

Reblog this post [with Zemanta]

My .vimrc File

Spurred on by my recent experiences with the vi editor, I havedecided to shift from gedit to vi. The insert, command and visual notion was a bit difficult to get hang of at the beginning, but with some practice I am getting the hang of it. There’s so many more features in it than I have used till now. It needs a bit of getting used to.

The first thing I did was to customize my .vimrc file to suit my programming style. I like my code to be syntaxically coloured, indented and prefer spaces over tabs. Also I keep the width of my tabs to 2. I must mention here that most of my programming habbits are because of Udit Sajjanhar – the one semester that he was our TA for the course of compilers.

So here is my vimrc file :

" do not keep a backup file
set nobackup

" wrap off
set nowrap

" tabs are only 2 characters
set tabstop=2

" auto indent uses 2 charaters
set shiftwidth=2

" spaces instead of tabs
set expandtab

" set auto-indentation on
set autoindent

" expand command line using tab
set wildchar=

" show line numbers
set number

" fold using markers
set foldmethod=marker

" powerful backspaces
set backspace=indent,eol,start

" highlight search terms
set hlsearch

" dont wrap words
set textwidth=0

" history
set history=50

" 1000 undo levels
set undolevels=1000

" show partial commands
set showcmd

" show matching braces
set showmatch

" auto-detect the file type
filetype plugin indent on

" on the syntax by default
if has("syntax")
syntax on
endif

" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 &amp;amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp;amp; line("'\"") <= line("$") |
\   exe "normal g`\"" |
\ endif

Here’s the file in case you want to download it : vimrc

Reblog this post [with Zemanta]



Theme Tweaker by Unreal