Linux-vim的配置

1. 效果

vim是个非常强大的编辑器(主要是云端不能用其他的编辑器/(ㄒoㄒ)/~~),以下是我的vim配置文件,没啥新意,方便实用就行了,最终效果如下图:
这里写图片描述

2. 使用方法

#首先下载个Vundle
$git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/vundle
#打开.vimrc文件
$gedit ~/.vimrc
#复制我的`.vimrc`的内容,然后替换你.vimrc内容
#运行
$vim
#输入以下命令
:PluginInstall
#等待下载完成即可,下载可能需要点时间,主要在ycm下载需要时间,如果不需要可以去掉这个插件

3. 我的.vimrc文件

autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Switch syntax highlighting on, when the terminal has colors
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
  syntax on
endif

" Javascript syntax hightlight
syntax enable

" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile Appraisals set filetype=ruby
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd Syntax javascript set syntax=jquery

" Color scheme
set t_Co=256
let g:rehash256 = 1
highlight NonText guibg=#060606
highlight Folded  guibg=#0A0A0A guifg=#9090D0

set nocompatible              " be iMproved 
filetype off                  " required!  

set rtp+=~/.vim/bundle/vundle/  
call vundle#rc()  

" let Vundle manage Vundle  
" required!   
Bundle 'gmarik/vundle'  

" 可以通过以下四种方式指定插件的来源  
" a) 指定Github中vim-scripts仓库中的插件,直接指定插件名称即可,插件明中的空格使用“-”代替。  
Bundle 'L9'  

" b) 指定Github中其他用户仓库的插件,使用“用户名/插件名称”的方式指定  
Bundle 'tpope/vim-fugitive'  
Bundle 'Lokaltog/vim-easymotion'  
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}  
Bundle 'tpope/vim-rails.git'
Bundle 'scrooloose/nerdtree.git'
Bundle 'majutsushi/tagbar'
Bundle 'ctrlp.vim'
Bundle 'tomasr/molokai'
Bundle 'Valloric/YouCompleteMe'
let g:ycm_global_ycm_extra_conf = 'your path to .ycm_extra_conf.py'
colorscheme molokai

" c) 指定非Github的Git仓库的插件,需要使用git地址  
Bundle 'git://git.wincent.com/command-t.git'  

" d) 指定本地Git仓库中的插件  
Bundle 'file:///Users/gmarik/path/to/plugin'  

filetype plugin indent on     " required!

" Backspace deletes like most programs in insert mode
set backspace=2
" Show the cursor position all the time
set ruler
" Display incomplete commands
set showcmd
" Set fileencodings
set fileencodings=utf-8,bg18030,gbk,big5

filetype plugin indent on

" Softtabs, 2 spaces
set tabstop=4
set shiftwidth=4
set shiftround
set expandtab

" Display extra whitespace
set list listchars=tab:»·,trail:·

" Make it obvious where 80 characters is
" set textwidth=80
" set colorcolumn=+1

" Numbers
set number
set numberwidth=5

set matchpairs+=<:>
set hlsearch

" NERD tree
let NERDChristmasTree=0
let NERDTreeWinSize=35
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\~$', '\.pyc$', '\.swp$']
let NERDTreeShowBookmarks=1
let NERDTreeWinPos="left"
" Automatically open a NERDTree if no files where specified
autocmd vimenter * if !argc() | NERDTree | endif
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Open a NERDTree
nmap <F5> :NERDTreeToggle<cr>

" Tagbar
let g:tagbar_width=35
let g:tagbar_autofocus=1
nmap <F6> :TagbarToggle<CR>

" ctrap
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.png,*.jpg,*.jpeg,*.gif " MacOSX/Linux
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
if executable('ag')
    " Use Ag over Grep
      set grepprg=ag\ --nogroup\ --nocolor
    " Use ag in CtrlP for listing files.
    let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
    " Ag is fast enough that CtrlP doesn't need to cache
    let g:ctrlp_use_caching = 0
endif

set laststatus=2 " Always display the status line
set statusline+=%{fugitive#statusline()} "  Git Hotness

4. vim8.0的安装

有时候安装YouCompleteMe的时候,会提示”YouCompleteMe unavailable: requires Vim 7.4.143+”,安装vim8.0就可以了,具体安装步骤如下:

a. 卸载vim:

sudo apt-get remove --purge vim
suso apt-get clean

b. 安装vim8.0

https://github.com/vim/vim上下载相应的vim压缩包,解压后

cd vim80
sudo make distclean
./configure --with-features=huge --enable-python3interp --with-python3-config-dir=/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu/ --enable-pythoninterp --with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu/ --enable-multibyte --prefix=/usr/local/vim/
sudo make
sudo make install
sudo ln -s /usr/local/bin/vim /usr/bin/vim

就完成了vim8.0的安装

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值