由网络副手--寻路人于2019.04.22 16:22:00发布在Linux Shell 个人VIM 编辑器打造,vimrc 阅读3354 评论0 喜欢0 一、个人编辑器打造 1.1 先安装Ctags yum install -y ctags 1.2 安装 Vundle 插件管理工具 git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 1.3 vimrc 文件内容 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 'tpope/vim-fugitive' " 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) " Pass the path to set the runtimepath properly. " ----------------------------------------------[ Myself Plugin Begin ]------------------------------------------------ Plugin 'scrooloose/nerdtree' " 目录管理工具 " Plugin 'shawncplus/phpcomplete.vim' "PHP自动补全 " Plugin 'Lokaltog/vim-powerline' " 美化状态栏 Plugin 'nathanaelkane/vim-indent-guides' " 可视化相同代码缩进关联 Plugin 'vim-scripts/taglist.vim' " taglist 信息 Plugin 'https://github.com/vim-airline/vim-airline.git' " airline Plugin 'https://github.com/vim-airline/vim-airline-themes.git' " airline 皮肤 " Plugin 'lvht/phpcd.vim' " PHP Doument Plugin 'vim-scripts/PHPSyntaxCheck' " PHP 语法检查 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 " ----------------------------------------------[ BaseSet Begin ]------------------------------------------------ set number set showcmd set incsearch set expandtab set showcmd set history=400 set autoread set ffs=unix,mac,dos set hlsearch set shiftwidth=2 set wrap set ai set si set cindent set termencoding=unix set tabstop=2 set nocompatible set showmatch set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936 set termencoding=utf-8 set encoding=utf-8 set fileformats=unix set ttyfast syntax on set imcmdline set showfulltag set cursorline set ruler " set mouse=a " 设置背景主题 color ron "set guifont=Courier_New:h10:cANSI " 设置字体 " 用浅色高亮当前行 " autocmd InsertLeave * se nocul " 用浅色高亮当前行 autocmd InsertEnter * se cul " 显示标尺 set ruler " 输入的命令显示出来,看的清楚些 set showcmd " 光标移动到buffer的顶部和底部时保持3行距离 set scrolloff=3 "状态行显示的内容 set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} " 启动显示状态行(1),总是显示状态行(2) set laststatus=2 " 设置tab键的空格数 set tabstop=4 " 设置tab空格数 set softtabstop=4 " 让配置变更立即生效 autocmd BufWritePost $MYVIMRC source $MYVIMRC " ----------------------------------------------[ Plugin Config Begin ]------------------------------------------------ " NERDTree的配置-------------------------------------- " 1.按F2键,打开或者关闭 nmap :NERDTreeToggle " 启动vim,自动打开NERDtree autocmd vimenter * NERDTree " 如果没有打开具体文件,自动加载 autocmd StdinReadPre * let s:std_in=1 autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif " 2.自动加载NERDTREE " autocmd BufRead * 25vsp ./ " 显示隐藏文件 let NERDTreeShowHidden=1 " NERDTress File highlighting function! NERDTreeHighlightFile(extension, fg, bg, guifg, guibg) exec 'autocmd filetype nerdtree highlight ' . a:extension .' ctermbg='. a:bg .' ctermfg='. a:fg .' guibg='. a:guibg .' guifg='. a:guifg exec 'autocmd filetype nerdtree syn match ' . a:extension .' #^\s\+.*'. a:extension .'$#' endfunction call NERDTreeHighlightFile('jade', 'green', 'none', 'green', '#151515') call NERDTreeHighlightFile('ini', 'yellow', 'none', 'yellow', '#151515') call NERDTreeHighlightFile('md', 'blue', 'none', '#3366FF', '#151515') call NERDTreeHighlightFile('yml', 'yellow', 'none', 'yellow', '#151515') call NERDTreeHighlightFile('config', 'yellow', 'none', 'yellow','#151515') call NERDTreeHighlightFile('conf', 'yellow', 'none', 'yellow', '#151515') call NERDTreeHighlightFile('json', 'yellow', 'none', 'yellow', '#151515') call NERDTreeHighlightFile('html', 'yellow', 'none', 'yellow', '#151515') call NERDTreeHighlightFile('styl', 'cyan', 'none', 'cyan', '#151515') call NERDTreeHighlightFile('css', 'cyan', 'none', 'cyan', '#151515') call NERDTreeHighlightFile('coffee', 'Red', 'none', 'red', '#151515') call NERDTreeHighlightFile('js', 'Red', 'none', '#ffa500', '#151515') call NERDTreeHighlightFile('php', 'Magenta', 'none', '#ff00ff', '#151515') " 映射tt为ctrl+ww 少按一次 map oo w " NERDTree的配置结束-------------------------------- " 设置状态栏主题风格 let g:Powerline_colorscheme='solarized256' " 随 vim 自启动 let g:indent_guides_enable_on_vim_startup=1 " 从第二层开始可视化显示缩进 let g:indent_guides_start_level=2 " 色块宽度 let g:indent_guides_guide_size=1 " 快捷键 i 开/关缩进可视化: nmap i IndentGuidesToggle " 设置折叠 set foldmethod=manual " ----------------------------[ airline Begin ]----------------------------------- let g:airline_theme="luna" "这个是安装字体后 必须设置此项" let g:airline_powerline_fonts = 1 "打开tabline功能,方便查看Buffer和切换,这个功能比较不错" "我还省去了minibufexpl插件,因为我习惯在1个Tab下用多个buffer" let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#buffer_nr_show = 1 "设置切换Buffer快捷键" nnoremap :bn nnoremap :bp " 关闭状态显示空白符号计数,这个对我用处不大" let g:airline#extensions#whitespace#enabled = 0 let g:airline#extensions#whitespace#symbol = '!' " 在Gvim中我设置了英文用Hermit, 中文使用 YaHei Mono " if has('win32') set guifont=Hermit:h13 set guifontwide=Microsoft_YaHei_Mono:h12 endif " ----------------------------[ airline End ]----------------------------------- " ----------------------------[ airline End ]----------------------------------- " let g:deoplete#ignore_sources = get(g:, 'deoplete#ignore_sources', {}) " let g:deoplete#ignore_sources.php = ['phpcd', 'omni'] " let g:phpcd_php_cli_executable = 'php7.0' "-----------------------------[ PHPSYNTAX CHECK ]------------------ " let g:PHP_SYNTAX_CHECK_BIN = ‘/apps/php/bin/php' 赞 0 分享 赏 您可以选择一种方式赞助本站 支付宝扫码赞助 BraveDu 署名: 网络副手~寻路人