" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

if v:progname =~? "gvim"
	set autoindent
	set ruler
	set number
	set columns=130
	colorscheme slate
endif

set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [POS=%04l,%04v][%p%%]\ [LEN=%L] 
set laststatus=2 

imap <C-s> <Esc>:w<CR>a
nmap <C-s> :w<CR>
imap <F6> <Esc>:make<CR>
nmap <F6> :make<CR>
nmap <C-t> :tabnew<CR>
imap <C-t> <ESC>:tabnew<CR> 
nmap <C-w> :tabclose<CR>
imap <C-w> <ESC>:tabclose<CR>
imap <C-z> <Esc>:u<CR>i
nmap <C-z> u
imap <A-v> <Esc>:vsplit<CR>a
nmap <A-v> :vsplit<CR>
imap <A-x> <Esc>:close<CR>a
nmap <A-x> :close<CR>
vmap <Tab> >
vmap <S-Tab> <
vmap <C-c> y
nmap <C-v> p
imap <C-V> <Esc>pi
vmap <C-x> <Del>
imap <C-K> <Esc>dda
vmap <C-K> d
nmap <C-K> dd

" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible

" A clean-looking font for gvim
set guifont=Droid\ Sans\ Mono\ 9
set nowrap

" allow backspacing over everything in insert mode
set backspace=indent,eol,start

set nobackup            " don't make backup files
set history=50		" keep 50 lines of command line history
set ruler		" show the cursor position all the time
set showcmd		" display incomplete commands
set incsearch		" do incremental searching

" Don't use Ex mode, use Q for formatting
map Q gq

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
  syntax on
  set hlsearch
endif

" Only do this part when compiled with support for autocommands.
if has("autocmd")

  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
  filetype plugin on

  " Put these in an autocmd group, so that we can delete them easily.
  augroup vimrcEx
  au!

  set nowrap
  
  " For all text files set 'textwidth' to 78 characters.
  autocmd FileType text setlocal textwidth=78

  " 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 && line("'\"") <= line("$") |
    \   exe "normal g`\"" |
    \ endif

  augroup END

else


endif " has("autocmd")
