Last active
June 30, 2017 11:41
-
-
Save keepzero/8f14cb7090f5640b41be68bf45a14be0 to your computer and use it in GitHub Desktop.
vimrc minimal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
" set encodings | |
set encoding=utf-8 | |
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
" few options just make things better | |
set scrolloff=3 | |
set showmode | |
set showcmd | |
set hidden | |
set wildmenu | |
set wildmode=list:longest | |
set noerrorbells | |
set cursorline | |
set ttyfast | |
set ruler | |
set laststatus=2 | |
" split window shortcut | |
nnoremap <C-w>- <C-w>s<C-w>j | |
nnoremap <C-w>\| <C-w>v<C-w>l | |
noremap <C-J> <C-W>j | |
noremap <C-K> <C-W>k | |
noremap <C-H> <C-W>h | |
noremap <C-L> <C-W>l | |
" Emacs bind | |
inoremap <C-a> <Home> | |
inoremap <C-e> <End> | |
inoremap <C-b> <Left> | |
inoremap <C-f> <Right> | |
"inoremap <C-w> <Esc>dbcl | |
inoremap <C-d> <C-o>s | |
"inoremap <C-u> <Esc>d0cl | |
inoremap <C-k> <C-o>C | |
" tabs | |
set autoindent | |
set backspace=indent,eol,start | |
set complete-=i | |
set smarttab | |
" filetype detect | |
if has('autocmd') | |
filetype plugin indent on | |
autocmd FileType python set ts=4 sw=4 et sts=4 | |
autocmd BufRead,BufNewFile *.json set ft=javascript | |
autocmd BufRead,BufNewFile */etc/nginx/* set ft=nginx | |
autocmd BufRead,BufNewFile */etc/init.d/* set ft=sh | |
autocmd BufRead,BufNewFile *.sls set ft=yaml | |
endif | |
" syntax on | |
if has('syntax') && !exists('g:syntax_on') | |
syntax enable | |
endif | |
" searching and moving | |
set magic | |
nnoremap / /\v | |
vnoremap / /\v | |
set ignorecase | |
set smartcase | |
set incsearch | |
set showmatch | |
set hlsearch | |
" handle long lines | |
set wrap | |
set formatoptions=qrn1 | |
" autoread when file changed out vim | |
set autoread | |
" Load matchit.vim, but only if the user hasn't installed a newer version. | |
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' | |
runtime! macros/matchit.vim | |
endif | |
" force to use hjkl | |
nnoremap <up> <nop> | |
nnoremap <down> <nop> | |
nnoremap <left> <nop> | |
nnoremap <right> <nop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dotVimrc
参考 vim-sensible 插件和 Coming Home to Vim
更人性化的分隔窗口快捷键
Ctrl-w + -
分成上下Ctrl-w + |
分成左右更好用的搜索
插入模式下 Emacs 键绑定
支持在插入模式 (insert mode) 下使用部分 Emacs/bash 键绑定
载入内置的 matchit 插件
在编程语言的括号或者 html 标签上按
%
即可跳转到成对的括号或标签