1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
| set encoding=utf-8 set autoindent " 继承前一行的缩进方式, 特别适用于多行注释 set smarttab " 为c程序员提供自动缩进 set tabstop=4 " 设置制表符(tab键)的宽度 set softtabstop=4 " 设置软制表符的宽度 set shiftwidth=4 " (自动) 缩进使用的4个空格 set noexpandtab " 不要用空格代替制表符 set nowrap " 不要换行 set cindent " 使用 C/C++ 语言的自动缩进方式 set linebreak " 整词换行 set mouse=a " 使用鼠标 set history=256 " 历史记录256条 set cursorline " 高亮指针所在行 set backspace=2 " 退格键可用 set cmdheight=2 " 设置命令行高亮 set nowrap " 不要换行 set linebreak " 整词换行 set clipboard=unnamed " 支持访问系统剪贴板
map <F8> :set nu!<CR> " toggle 行号 set pastetoggle=<F9> " 粘贴模式 map <F10> :nohlsearch<CR> map <F10> :nohlsearch<CR>
if has("syntax") syntax on " 语法高亮 endif " colo murphy " 配色方案 desert darkblue delek evening murphy set background=dark
" 状态行设置 set nu " 显示行号 set laststatus=2 " 总显示最后一个窗口的状态行; 设为1则窗口数多于一个的时候显示最后一个窗口的状态行; 0不显示最后一个窗口的状态行 set ruler " 标尺, 用于显示光标位置的行号和列号, 逗号分隔.每个窗口都有自己的标尺.如果窗口有状态行, 标尺在那里显示.否则, 它显示在屏幕的最后一行上. set showcmd " 命令行显示输入的命令 set showmode " 命令行显示vim当前模式 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l, %v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} "状态行显示的内容 autocmd InsertLeave * se cul " 用浅色高亮当前行
" 搜索和匹配 set showmatch " 插入括号时, 短暂地跳转到匹配的对应括号 set smartcase " 只包含小写字母时才忽略大小写 set incsearch " 输入字符串就显示匹配点 set hlsearch " 搜索结果高亮显示 set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 set wildmenu " 增强模式中的命令行自动完成操作
" 分割窗口 nnoremap <C-J> <C-W><C-J> nnoremap <C-K> <C-W><C-K> nnoremap <C-L> <C-W><C-L> nnoremap <C-H> <C-W><C-H>
" 设置 leader 键, 例子为空号键, 也可以设置为其他的 let mapleader=" " " 设置快捷键, 关闭一个窗口 map <leader>wq :wq<CR> map <leader>w :w<CR> map <leader>q :q<CR> map <leader>c :tabc<CR> map <leader>o :tabo<CR> map <leader>s :tabs<CR> map <leader>p :tabp<CR> map <leader>n :tabn<CR>
highlight WhitespaceEOL ctermbg=red guibg=red match WhitespaceEOL /\s\+$/
autocmd FileType sh source ~/.vim/sh.vim autocmd FileType md source ~/.vim/md.vim autocmd FileType java source ~/.vim/java.vim
set nocompatible " be iMproved, required 不使用vi的键盘模式, 而是vim自己的 filetype off " required 不侦测文件类型
" set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim' " python风格代码自动缩进 Plugin 'vim-scripts/indentpython.vim' " 自动补全 " Plugin 'Valloric/YouCompleteMe' " 语法高亮 Plugin 'scrooloose/syntastic' " 树形目录 Plugin 'scrooloose/nerdtree' " 超级搜索 Plugin 'kien/ctrlp.vim' " git集成 Plugin 'tpope/vim-fugitive' " 多行编辑 Plugin 'terryma/vim-multiple-cursors' " markdown 支持 Plugin 'kannokanno/previm' " 代码折叠 " Plugin 'tmhedberg/SimpylFold' Plugin 'auto-pairs'
call vundle#end() " required filetype plugin on " required 载入文件类型插件, 为特定文件类型载入香港缩进文件 filetype indent on " required 载入文件类型插件, 为特定文件类型载入香港缩进文件
" :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 " " Install Plugins: " " Launch vim and run :PluginInstall " To install from command line: vim +PluginInstall +qall
" <CR>回车 <C>Ctrl <M>Alt <S>Shift <ESC> <TAB> <LEADER>转义符号\\ <BAR>管道符号|
" NerdTree let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree let NERDTreeWinPos='right' let NERDTreeWinSize=30 let NERDTreeChDirMode=1 map <F2> :NERDTreeToggle<CR> " 当只有nerdtree时, 自动关闭vim autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|