Last active
May 25, 2018 03:01
-
-
Save singleghost/e198ba5362c2827e0d0a0511c1d90d09 to your computer and use it in GitHub Desktop.
vim 配置脚本
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 " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" The following are examples of different formats supported. | |
" Keep Plugin commands between vundle#begin/end. | |
" plugin on GitHub repo | |
" Plugin 'kana/vim-fakeclip' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'jiangmiao/auto-pairs' | |
Plugin 'pangloss/vim-javascript' | |
Plugin 'farmergreg/vim-lastplace' | |
" Plugin 'Valloric/YouCompleteMe' | |
" plugin from http://vim-scripts.org/vim/scripts.html | |
" Plugin 'L9' | |
" Git plugin not hosted on GitHub | |
" Plugin 'git://git.wincent.com/command-t.git' | |
" git repos on your local machine (i.e. when working on your own plugin) | |
" Plugin 'file:///home/gmarik/path/to/plugin' | |
" The sparkup vim script is in a subdirectory of this repo called vim. | |
" Pass the path to set the runtimepath properly. | |
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} | |
" Install L9 and avoid a Naming conflict if you've already installed a | |
" different version somewhere else. | |
" Plugin 'ascenator/L9', {'name': 'newL9'} | |
" Plugin 'tpope/vim-commentary' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required | |
" To ignore plugin indent changes, instead use: | |
"filetype plugin on | |
" | |
" Brief help | |
" :PluginList - lists configured plugins | |
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate | |
" :PluginSearch foo - searches for foo; append `!` to refresh local cache | |
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal | |
" | |
" see :h vundle for more details or wiki for FAQ | |
" Put your non-Plugin stuff after this line | |
"configure expanding of tabs for various file types | |
au BufRead,BufNewFile *.py set expandtab | |
au BufRead,BufNewFile *.c set noexpandtab | |
au BufRead,BufNewFile *.h set noexpandtab | |
au BufRead,BufNewFile Makefile* set noexpandtab | |
" encodings related stuff | |
set fileencodings=utf-8,gb2312,gbk,cp936,latin-1 | |
set fileencoding=utf-8 | |
" set termencoding=utf-8 | |
set fileformat=unix "和 line ending 有关 | |
set encoding=utf-8 | |
" -------------------------------------------------------------------------------- | |
" configure editor with tabs and nice stuff... | |
" -------------------------------------------------------------------------------- | |
set expandtab " enter spaces when tab is pressed | |
set textwidth=0 " break lines when line length increases | |
set tabstop=4 " use 4 spaces to represent tab | |
set softtabstop=4 | |
set shiftwidth=4 " number of spaces to use for auto indent | |
set autoindent " copy indent from current line when starting a new line | |
set hlsearch " set highlight search | |
set incsearch " incremental searching, search when you type chars | |
set ignorecase " searches are case insensitive | |
set smartcase " ...unless they contain at least one capital letter | |
" make backspaces more powerfull | |
set backspace=indent,eol,start | |
set cursorline " 突出显示当前行 | |
set ruler " show line and column number on the status line | |
syntax on " syntax highlighting | |
set showcmd " show (partial) command in status line | |
set nu " show line number | |
" 设置光标样式 | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode | |
set noeb " 去掉输入错误提示声音 | |
set autoread " 文件被改动时自动载入" | |
set clipboard=unnamedplus " alias unnamed register to the + register, 也就是说y, d, p这些命令会直接使用系统剪贴板 | |
set wildmenu | |
" make file with .strace extension highlighted | |
autocmd BufRead,BufNewFile *.strace set filetype=strace | |
" :w!! | |
" write the file when you accidentally opened it without the right (root) privileges | |
cmap w!! w !sudo tee % > /dev/null | |
" autocmd Filetype python setlocal commentstring=#\ %s | |
" nnoremap <leader>s <C-]> | |
" nnoremap <leader>a <C-t> | |
map <C-n> :nohl<cr> | |
autocmd BufWritePost poc.js !./adb_push.sh <afile> | |
colorscheme darkblue | |
"set paste这条命令开启paste模式,解决了C-v粘贴时自动缩进的问题。 | |
set pastetoggle=<F9> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment