Code:
syn on
# general
set history=1000 # lines of Ex-mode commands, search history
set browsedir=buffer # use directory of the related buffer for file browser
set clipboard+=" unnamed" # use clipboard register '*' for all y, d, c, p ops
set viminfo+=! # make sure it can save viminfo
set isk+=$,%,#,- # none of these should be word dividers
set confirm # raise a dialog confirm whether save changed buffer
set fenc=utf-8 # default fileencoding
set fencs=utf-8,ucs-bom,euc-jp,gb18030,gbk,gb2312,cp936
map Q gq
# do not use Ex-mode, use Q for formatting
set columns=151
set lines=38
" path/backup
set nobackup
" Set tabsize to 4 and replace tabs with spaces
set shiftwidth=2
set tabstop=2
set expandtab
set smarttab
set sm
"set guioptions-=T
" Text Formatting/Layout
set ai " autoindent
set si " smartindent
set cindent " do C-style indenting
set fo=tcrqn " see help (complex)
set complete=.,b,d,k,u,w,
" 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.
set wrap
" visual cues
set showmatch " show matching paren
set hlsearch " do not highlight searched for phrases
set scrolloff=5 " minimal number of screen lines to keep above/below the cursor
set novisualbell " use visual bell instead of beeping
set noerrorbells " do not make noise
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " how :set list show
" Pressing < or > will let you indent/unident selected lines
vnoremap < <gv
vnoremap > >gv
" Set the font to 'Courier New' 'Regular' 'Size=10'
set guifont=monospace\ 12
" Vim UI
set selectmode=mouse,key "select both with the mouse and shifted arrow key
set syntax=on " set syntax highlighting on
set linespace=0 " space it out a little more (easier to read)
set wildmenu " type :h and press <Tab> to look what happens
set ruler " always show current position along the bottom
set cmdheight=2 " use 2 screen lines for command-line
set lazyredraw " do not redraw while executing macros (much faster)
set hid " allow to change buffer without saving
set backspace=2 " make backspace work normal
" set whichwrap+=<,>,h,l " allow backspace and cursor keys to wrap
set mouse=a " use mouse in all modes
set shortmess=atI " shorten messages to avoid 'press a key' prompt
set report=0 " tell us when anything is changed via :...
set fillchars=vert:\ ,stl:\ ,stlnc:\
" make the splitters between windows be blank
"
"set cursorcolumn " highlight the current column
set cursorline " highlight current line
set incsearch " BUT do highlight as you type you search phrase
set laststatus=2 " always show the status line
" set list " we don't want to show tabs/space, to ensure we get them out of my files
set matchtime=5 " how many tenths of a second to blink matching brackets for
" set nohlsearch " do not highlight searched for phrases
set nostartofline " leave my cursor where it was
set nu
set numberwidth=5 " We are good up to 99999 lines
set showcmd " show the command being typed
" colors
"Try to load happy hacking teal colour scheme
"I copy this to ~/.vim/colors/hhteal.vim
"silent! colorscheme torte
"silent! colorscheme blue
"//"if exists("colors_name") == 0
"//" "Otherwise modify the defaults appropriately
"//"
"//" "background set to dark in .vimrc
"//" "So pick appropriate defaults.
"//" hi Normal guifg=gray guibg=black
"//" hi Visual gui=none guifg=black guibg=yellow
"//"
"//" "The following removes bold from all highlighting
"//" "as this is usually rendered badly for me. Note this
"//" "is not done in .vimrc because bold usually makes
"//" "the colour brighter on terminals and most terminals
"//" "allow one to keep the new colour while turning off
"//" "the actual bolding.
"//"
"//" " Steve Hall wrote this function for me on vim@vim.org
"//" " See :help attr-list for possible attrs to pass
"//" function! Highlight_remove_attr(attr)
"//" " save selection registers
"//" new
"//" silent! put
"//"
"//" " get current highlight configuration
"//" redir @x
"//" silent! highlight
"//" redir END
"//" " open temp buffer
"//" new
"//" " paste in
"//" silent! put x
"//"
"//" " convert to vim syntax (from Mkcolorscheme.vim,
"//" " Mkcolorscheme.vim - Help write colorscheme files from existing settings : vim online)
"// delete empty,"links" and cleared" lines
"//" silent! g/^$\| links \| cleared/d
"//" " join any lines wrapped by the highlight command output
"//" silent! %s/\n \+/ /
"//" " remove the xxx's
"//" silent! %s/ xxx / /
"//" " add highlight commands
"//" silent! %s/^/highlight /
"//" " protect spaces in some font names
"//" silent! %s/font=\(.*\)/font='\1'/
"//"
"//" substitute bold with NONE"
"//" execute 'silent! %s/' . a:attr . '\([\w,]*\)/NONE\1/geI'
"//" " yank entire buffer
"//" normal ggVG
"//" " copy
"//" silent! normal "xy
"//" " run
"//" execute @x
"//"
"//" " remove temp buffer
"//" bwipeout!
"//"
"//" " restore selection registers
"//" silent! normal ggVGy
"//" bwipeout!
"//" endfunction
"//" autocmd BufNewFile,BufRead * call Highlight_remove_attr("bold")
"//" " Note adding ,Syntax above messes up the syntax loading
"//" " See :help syntax-loading for more info
"//"endif
highlight Pmenu guibg=yellow guifg=black
highlight PmenuSel guibg=white guifg=black
" Spell check
function! ToggleSpell()
if !exists("b:spell")
setlocal spell spelllang=en_gb
let b:spell = 1
else
setlocal nospell
unlet b:spell
endif
endfunction
" Warn whenever text exceeds 78 columns.
" let w:m1=matchadd('Search', '\%<79v.\%>78v', -1)
" let w:m2=matchadd('ErrorMsg', '\%>78v.\+', -1)
set visualbell
" Map keys for user frendly shortcuts
map <C-Tab> <Esc>:tabn<CR>
imap <C-Tab> <Esc>:tabn<CR>
map <C-S-Tab> <Esc>:tabp<CR>
imap <C-S-Tab> <Esc>:tabp<CR>