Tinou /.vimrc

parts from the books, parts from tips, wiki...
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
  finish
endif

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

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

set autoindent		" always set autoindenting on
if has("vms")
  set nobackup		" do not keep a backup file, use versions instead
else
  set backup		" keep a backup file
endif
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

" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries
" let &guioptions = substitute(&guioptions, "t", "", "g")

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

" This is an alternative that also works in block mode, but the deleted
" text is lost and it only works for putting the current register.
"vnoremap p "_dp

" 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 nohlsearch
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 indent on

  " 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

endif " has("autocmd")
set showmode
version 6.0
set nocompatible
let s:cpo_save=&cpo
set cpo&vim
map!  
map!  
map!  
map!  
map!  
map!  
map!  
map!  
map!  
map!  
map Q gq
map  
map  
map  
map  
map  
map  
map  
map  
map  
map  
map ; :set invhls
let &cpo=s:cpo_save
unlet s:cpo_save
set smartindent
set cin
set background=dark
set mouse=a
set foldmethod=marker

set showtabline=2

set foldcolumn=1
set fillchars=fold:=
cnoremap  
cnoremap  
cnoremap  
cnoremap  
cnoremap b 
cnoremap w 
cnoremap $ 
cnoremap ^ 
cnoremap k 
cnoremap j 

set modifiable
set laststatus=2
colorscheme desert
set ignorecase
set linebreak
set display=lastline
set shiftwidth=2
set statusline=[%02n]\ %(%M%R%H%)\ %F\ %=%{getcwd()}\ <%l,%c%V>\ %P
map  :wa:mks! current.vim
map  :so current.vim

set autoread

" set your working directory to the file you're editing
function! CD()"{{{
let _dir = expand("%:p:h") 
exec "cd " . _dir 
unlet _dir 
endfunction"}}}
call CD()

"**************** 
" In Makefile, automatically convert eight spaces at the beginning 
" of line to tab, as you type (or paste) 
"***************** 
au FileType make :inoremap  :call MapSpaceInMakefile() 
" function! MapSpaceInMakefile() "{{{
function! MapSpaceInMakefile() 
    " if this space is 8th space from the beginning of line, replace 8 spaces with 
    " one tab (only at the beginning of file) 
    let line = getline('.') 
    let col = col('.') 

    if strpart(line, 0, 8) == '        ' 
        let new = "\t" . strpart(line,8) 
        call setline('.', new ) 
    endif 

    return "" 
endfunction
"}}}
vnoremap  `.``gvP``P

map  j
map  k
imap  j
imap  k
imap  h
imap  l
map  h
map  l

map  :tabnext
map  :tabprevious
imap  :tabnext
imap  :tabprevious
nn  :if tabpagenr() == tabpagenr("$")\|tabm 0\|el\|exe "tabm ".tabpagenr()\|en
nn  :if tabpagenr() == 1\|exe "tabm ".tabpagenr("$")\|el\|exe "tabm ".(tabpagenr()-2)\|en


set wmh=0

imap  ->
map  :cn
map  :cp
map ; :set invhls
set wildmode=full
set wildmenu
set wildcharm=

map  h
map  j
map  k
map  l
map  c
imap  h
imap  j
imap  k
imap  l
imap  c

map \i magg=G'azz

map  gj
map  gk
imap  gki
imap  gji

noremap  
noremap  
inoremap  ->
inoremap  ->

vnoremap > >gv
vnoremap <  >gv
vnoremap   * :let @/='\<'.expand("").'\>'  set hlsearch

set scrolloff=5
set listchars=tab:..,eol:<,trail:.

let g:alternateRelativeFiles = 1

"nnoremap : q:i
"nnoremap / q/i
"nnoremap ? q?i

inoremap  u
inoremap  u