由网络副手--寻路人于2016.09.11 02:06:00发布在工具类 VIM 编辑器打造 阅读2962 评论0 喜欢0 一. 安装配置VIM编辑器 背景: 1.轻便,高效,丰富的资源以及灵活的配置 2.阅读文本便捷 3.经典巧妙的编辑方式及强大的功能 安装.yum -y install vim* 非常简单 配置VIM编辑器 1. 在用户目录下创建.vim 文件夹 2. 在.vim 用户目录下创建插件管理目录 bundel 3. 在用户根目录创建.vimrc 文件并编写配置 mkdir ~/.vim mkdir ~/.vim/bundle #管理插件 cd ~/.vim/bundle git clone https://github.com/gmarik/vundle.git vim ~/.vimrc filetype off set nocompatible " Set Bundel Config set rtp+=~/.vim/bundle/vundle/ call vundle#rc() " let Vundle manage Vundle Bundle 'gmarik/vundle' " my bundles here : Bundle 'vim-scripts/ctags.vim' " Let you tips status more beautiful Bundle 'vim-airline/vim-airline' " Begin brief help of Bundle " :BundleList - list configured bundles " :BundleInstalli (!) - install(update) bundles " :BundleSearch (!) foo - search(or refresh cache first) for foo " :BundleClean (!) - confirm(or auto-approve) removal of unused bundles " End brief help " Config for My Vim set history=1000 set ruler set number set showcmd " set showmod set laststatus=2 set cmdheight=2 set scrolloff=3 " Fill space between Windows set fillchars=stl:\ ,stlnc:\ ,vert:\ " Turn off annoying error sound set noerrorbells set novisualbell set t_vb= "Turn off splash screen set shortmess=atI "syntax and theme syntax on colorscheme desert "colorscheme molokai highlight NonText guibg=#060606 highlight Folded guibg=#0A0A0A guifg=#9090D0 set cursorline " Configure backspace to be able to across two lines set backspace=2 set whichwrap+=<,>,h,l " Tab and indent set expandtab set smarttab set shiftwidth=2 set tabstop=2 set autoindent set cindent " Files ,blackups and encoding set nobackup set noswapfile set autoread set autowrite set autochdir set fileencodings=utf-8,bg18030,gbk,big5 set fileformats=unix,dos,mac filetype plugin on filetype indent on " Text search and replace set showmatch set matchtime=2 set hlsearch set incsearch set ignorecase set smartcase set magic set lazyredraw set nowrapscan set iskeyword+=_,$,@,%,#,-,. " Switch syntax highlighting on, when the terminal has colors if has("gui_running") colorscheme solarized endif set guifont=DejaVu\ Sans\ Mono\ 15 set guioptions=aegic " Set vim-airline set laststatus=2 let g:airline_powerline_fonts = 1 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#buffer_nr_show = 1 nnoremap :bn nnoremap :bp 二. 用Bundel管理插件 具体的使用方法已经在.vimrc 中记录的, 例如: 上文.vimrc 中我即将安装,vim-scripts/ctags.vim 插件 **安装方法:** 此时在此处写入插件名称后,执行 :BundleInstall,即可安装,安装后在 ~/.vim/bundle/目录中可见刚安装插件 **卸载方法:** 把.vimrc 中的皮肤那一行删除后执行 :BundleClean 即可. 以下为使用命令详解. :BundleList -列举列表(也就是.vimrc)中配置的所有插件 :BundleInstall -安装列表中的全部插件 :BundleInstall! -更新列表中的全部插件 :BundleSearch foo -查找foo插件 :BundleSearch! foo -刷新foo插件缓存 :BundleClean -清除列表中没有的插件 :BundleClean! -清除列表中没有的插件 三. 插件安装使用总结 1.1 ctags Ctags工具是用来遍历源代码文件生成tags文件,这些tags文件能被编辑器或其它工具用来快速查找定位源代码中的符号(tag/symbol),如变量名,函数名等。 安装方法:如.vimrc 中的Bundel vim-scripts/ctags.vim 安装后可以通过 ctags --help 来确认是否安装 切换进入项目目录,手动执行 ctags -R . 1.2 安装PHP错误语法检查插件 官网地址: http://www.vim.org/scripts/script.php?script_id=4984 下载: [点击下载][1] 安装方法: 将phpcheck.vim放入vim的plugin目录。 (注:plugin目录一般在~/.vim或vim的安装目录下) 1.3 项目管理插件 访问链接: http://www.vim.org/scripts/script.php?script_id=69 wget http://www.vim.org/scripts/download_script.php?src_id=6273 下载后重命名为 project1.4.1.tar.gz 解压, 1.3.1 把 project.vim 放到 ~/.vim/plugin 下 1.3.2 把project.txt 拷贝到 ~/.vim/doc 下 供给:help project 安装好后,首次启动 启动 vim 后输入 :Project ,就会看到左边出现项目列表,如果还没有项目,列表为空。 在常规模式下输入 \C (斜杠+大写C)创建项目: Enter the Name of the Entry: ManagerStu (项目名称) Enter the Absolute Directory to Load: /www/managerstu (项目路径) Enter the CD parameter: /www/managerstu 在输入. (CD 指打开该项目(包括项目下的文件)后, vim 将进入的路径,“.” 指的是当前项目路径) Enter the File Filter: (可以不填写) 1.4 语法自动补全工具 四. 常用的VIM Bundel插件 以下为记录所有插件,敬请笑纳: " Define bundles via Github repos Bundle 'christoomey/vim-run-interactive' Bundle 'croaky/vim-colors-github' Bundle 'danro/rename.vim' Bundle 'kchmck/vim-coffee-script' Bundle 'kien/ctrlp.vim' Bundle 'pbrisbin/vim-mkdir' Bundle 'scrooloose/syntastic' Bundle 'slim-template/vim-slim' Bundle 'thoughtbot/vim-rspec' Bundle 'tpope/vim-bundler' Bundle 'tpope/vim-endwise' Bundle 'tpope/vim-fugitive' Bundle 'tpope/vim-rails' Bundle 'tpope/vim-surround' Bundle 'vim-ruby/vim-ruby' Bundle 'vim-scripts/ctags.vim' Bundle 'vim-scripts/matchit.zip' Bundle 'vim-scripts/tComment' Bundle "mattn/emmet-vim" Bundle "scrooloose/nerdtree" Bundle "Lokaltog/vim-powerline" Bundle "godlygeek/tabular" Bundle "msanders/snipmate.vim" Bundle "jelera/vim-javascript-syntax" Bundle "altercation/vim-colors-solarized" Bundle "othree/html5.vim" Bundle "xsbeats/vim-blade" Bundle "Raimondi/delimitMate" Bundle "groenewege/vim-less" Bundle "evanmiller/nginx-vim-syntax" Bundle "Lokaltog/vim-easymotion" Bundle "tomasr/molokai" [1]: http://www.vim.org/scripts/download_script.php?src_id=22312 赞 0 分享 赏 您可以选择一种方式赞助本站 支付宝扫码赞助 BraveDu 署名: 网络副手~寻路人