mirror of
https://github.com/wklken/vim-for-server.git
synced 2026-11-20 21:23:00 +03:00
177 lines
3.9 KiB
VimL
177 lines
3.9 KiB
VimL
"==========================================
|
|
" 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 <C-j> <C-W>j
|
|
map <C-k> <C-W>k
|
|
map <C-h> <C-W>h
|
|
map <C-l> <C-W>l
|
|
|
|
cnoremap <C-j> <t_kd>
|
|
cnoremap <C-k> <t_ku>
|
|
cnoremap <C-a> <Home>
|
|
cnoremap <C-e> <End>
|
|
|
|
|
|
" 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 <silent><leader>/ :nohls<CR>
|
|
|
|
" tab
|
|
set expandtab
|
|
set smarttab
|
|
set shiftround
|
|
|
|
" indent
|
|
set autoindent smartindent shiftround
|
|
set shiftwidth=4
|
|
set tabstop=4
|
|
set softtabstop=4
|
|
|
|
vnoremap < <gv
|
|
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 <F3> :set list! list?<CR>
|
|
nnoremap <F4> :set wrap! wrap?<CR>
|
|
nnoremap <F6> :exec exists('syntax_on') ? 'syn off' : 'syn on'<CR>
|
|
|
|
set pastetoggle=<F5>
|
|
au InsertLeave * set nopaste
|
|
|
|
fun! <SID>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 <buffer> :call <SID>StripTrailingWhitespaces()
|
|
|