"========================================== " Author: wklken " Version: 0.1 " Email: wklken@yeah.net " BlogPost: http://www.wklken.me " ReadMe: README.md " Donation: http://www.wklken.me/pages/donation.html " Last_modify: 2014-10-46 " Sections: " Desc: simple vim config for server, without any plugins. "========================================== " leader let mapleader = ',' let g:mapleader = ',' " syntax syntax on " history set history=2000 " filetype filetype on filetype indent on filetype plugin on filetype plugin indent on " base set nocompatible " use vim defaults set autoread set shortmess=atI set magic set title " change the terminal's title set nobackup " do not keep a backup file set novisualbell " turn off visual bell set visualbell t_vb= " turn off error beep/flash set t_vb= set tm=500 " show location set cursorcolumn set cursorline " movement set scrolloff=7 " keep 3 lines when scrolling nnoremap k gk nnoremap gk k nnoremap j gj nnoremap gj j map j map k map h map l cnoremap cnoremap cnoremap cnoremap " show set ruler " show the current row and column set number " show line numbers set nowrap set showcmd " display incomplete commands set showmode " display current modes set showmatch " jump to matches when entering parentheses set matchtime=2 " tenths of a second to show the matching parenthesis " search set hlsearch " highlight searches set incsearch " do incremental searching set ignorecase " ignore case when searching set smartcase " no ignorecase if Uppercase char present noremap / :nohls " tab set expandtab set smarttab set shiftround " indent set autoindent smartindent shiftround set shiftwidth=4 set tabstop=4 set softtabstop=4 vnoremap < >gv " fold set foldenable set foldmethod=indent set foldlevel=99 " encoding set encoding=utf-8 set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 set termencoding=utf-8 set ffs=unix,dos,mac set formatoptions+=m set formatoptions+=B " select & complete set selection=inclusive set selectmode=mouse,key set completeopt=longest,menu set wildmenu set wildignore=*.o,*~,*.pyc,*.class " theme set background=dark colorscheme desert hi! link SignColumn LineNr hi! link ShowMarksHLl DiffAdd hi! link ShowMarksHLu DiffChange " status line set statusline=%<%f\ %h%m%r%=%k[%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}]\ %-14.(%l,%c%V%)\ %P set laststatus=2 " Always show the status line - use 2 lines for the status bar " specific language autocmd FileType python set tabstop=4 shiftwidth=4 expandtab ai autocmd FileType ruby set tabstop=2 shiftwidth=2 softtabstop=2 expandtab ai autocmd BufNewFile *.sh,*.py exec ":call AutoSetFileHead()" function! AutoSetFileHead() " .sh if &filetype == 'sh' call setline(1, "\#!/bin/bash") endif " python if &filetype == 'python' call setline(1, "\#!/usr/bin/env python") call append(1, "\# encoding: utf-8") endif normal G normal o normal o endfunc " others set backspace=indent,eol,start " make that backspace key work the way it should set whichwrap+=<,>,h,l cmap w!! w !sudo tee >/dev/null % nnoremap :set list! list? nnoremap :set wrap! wrap? nnoremap :exec exists('syntax_on') ? 'syn off' : 'syn on' set pastetoggle= au InsertLeave * set nopaste fun! StripTrailingWhitespaces() let l = line(".") let c = col(".") %s/\s\+$//e call cursor(l, c) endfun autocmd FileType c,cpp,java,php,ruby,python autocmd BufWritePre :call StripTrailingWhitespaces()