vim 8.0

安装

git clone https://github.com/vim/vim.git

sudo apt-get install libncurses5-dev  # vim依赖一个ncurses的古老库

./configure --prefix=~/usr/vim-8.0/ --enable-pythoninterp --enable-multibyte --enable-rubyinterp

make

make install

查看当前vim环境

:scriptname 查看加载的配置文件

:verbose map [key_name] 查看key_name按键映射

:verbose set 查看所有set,如set paste

:verbose history 查看历史命令

:function [fun-name] 列出函数

F5运行当前脚本

map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
if &filetype == 'c'
:!if gcc % -o %<; then time ./%<; fi
elseif &filetype == 'cpp'
:!if g++ % -o %<; then time ./%<; fi
elseif &filetype == 'sh'
:!time bash %
elseif &filetype == 'python'
:!time python %
endif
endfunc

Vundle插件管理器

1 下载vundle

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

2 配置.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()
Plugin 'VundleVim/Vundle.vim' " Keep Plugin commands between vundle#begin/end.
call vundle#end() " required
filetype plugin indent on " required

vim基本配置

从vim的default.vim中修改的

set nocompatible
set backspace=indent,eol,start "Allow backspacing over everything in insert mode.
set history= " keep 200 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set wildmenu " display completion matches in a status line
set hlsearch " hightlight searched phase
set ttimeout " time out for key codes
set ttimeoutlen= " wait up to 100ms after Esc for special key
set display=truncate " Show @@@ in the last line if it is truncated.
set scrolloff= "Show a few lines of context around the cursor
set incsearch " Do incremental searching when it's possible to timeout.
set mouse=a
set number
set expandtab
set tabstop=
set shiftwidth=
set softtabstop= syntax on " Don't use Ex mode, use Q for formatting. Revert with ":unmap Q".
map Q gq " Only do this part when compiled with support for autocommands.
if has("autocmd") " Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
" Revert with ":filetype off".
filetype plugin indent on " Put these in an autocmd group, so that you can revert them with:
" ":augroup vimStartup | au! | augroup END"
augroup vimStartup
au! " When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") >= && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif augroup END endif " has("autocmd") " Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
" Only define it when not defined already.
" Revert with: ":delcommand DiffOrig".
if !exists(":DiffOrig")
command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis
\ | wincmd p | diffthis
endif if has('langmap') && exists('+langremap')
" Prevent that the langmap option applies to characters that result from a
" mapping. If set (default), this may break plugins (but it's backward
" compatible).
set nolangremap
endif

YouCompleteMe

  1. vundlle管理YCM,在.vimrc相应位置加上Plugin 'Valloric/YouCompleteMe'
  2. 打开vim,运行:PluginInstall,安装插件
  3. 进入~/.vim/bundle/YouCompleteMe/,运行./install.py(--clang-completer支持C系列语言补全,需要安装llvm+clang)

可能需要注意:

  1. vim python support
  2. git用来下载YCM的问题
  3. cmake默认编译器的问题(export CC和CXX到高版本的编译器)

vim安装与配置的更多相关文章

  1. Vim 安装、配置及复制粘贴操作

    1.安装:sudo apt-get install vim 2.配置:cd ~ #进入用户主目录 touch .vimrc #.后缀文件不可见 vi .vimrc #打开文件 输入: set cind ...

  2. Vim 安装和配置、优化

    Vim 介绍 Vim 官网:http://www.vim.org/ Vim 安装 CentOS:sudo yum install -y vim Ubuntu:sudo apt-get install ...

  3. Ubuntu 16.04 Vim安装及配置【转】

    转自:http://www.cnblogs.com/ace-wu/p/6273031.html 安装VIM 默认已经安装了VIM-tiny acewu@acewu-computer:~$ locate ...

  4. Ubuntu 16.04 Vim安装及配置

    安装VIM 默认已经安装了VIM-tiny acewu@acewu-computer:~$ locate vi | grep 'vi$' |xargs ls -al lrwxrwxrwx 1 root ...

  5. CentOS6 下Vim安装和配置

    1.系统只安装了vim-minimal,执行以下命令安装另外两个组件 yum install vim-common yum install vim-enhanced 2.安装ctags yum ins ...

  6. vim 安装

    Ubuntu 16.04 下 Vim安装及配置 默认已经安装了VIM-tiny linuxidc@linuxidc:~$ locate vi | grep 'vi$' |xargs ls -al lr ...

  7. Ubuntu下VIM的安装及其配置——Linux篇

    一.Ubuntu系统默认内置: 实际上ubuntu默认没有安装老版本的vi,只装了vim.vi是vim.tiny(vim的最小化版本,不含 GUI,并且仅含有一小部分功能,并且默认与vi兼容.此软件包 ...

  8. CentOS 7下的Vim自动补齐插件YouCompleteMe安装及配置

    备注:现在对于 YouCompleteMe 的安装应采用更为简单的方法,即利用 Vundle 来安装这个插件.具体方法可见: Vundle 主页 YouCompleteMe 主页 而 .vimrc 的 ...

  9. Vim安装使用和配置

    卸载vim sudo apt-get remove --purge vim (--purge 是完全删除,会连配置文件一起删除) 也可以使用yum等其它方式安装 ,如果提示apt-get命令不存在可以 ...

随机推荐

  1. Java SimpleDateFormat用法

      ? Java中怎么才能把日期转换成想要的格式呢,或把字符串转换成一定格式的日期,如把数据库中的日期或时间转换成自己想要的格式,JAVA中提供了SimpleDateFormat类可以实现,以下是Si ...

  2. java Random类和Math.Rondom

      Java中存在着两种Random函数: 一.java.lang.Math.Random; 调用这个Math.Random()函数能够返回带正号的double值,该值大于等于0.0且小于1.0,即取 ...

  3. 《深入理解Elasticsearch》README

    书目 <深入理解ElasticSearch>拉斐尔·酷奇,马雷克·罗戈任斯基[著]张世武,余洪森,商旦[译] 机械工业出版社,2016.1 本系列包括以下8篇笔记 第01章 Elastic ...

  4. 编写高质量代码改善C#程序的157个建议——建议114:MD5不再安全

    建议114:MD5不再安全 MD5不再安全不是就算法本身而言的.如果从可逆性的角度出发,MD5值不存在被破解的可能性. MD5被广泛应用于密码验证和消息完整性验证.假设新注册一个用户,当注册用户的密码 ...

  5. solr&lucene3.6.0源码解析(二)

    上文描述了solr3.6.0怎么采用maven管理的方式在eclipse中搭建开发环境,在solr中,为了提高搜索性能,采用了缓存机制,这里描述的是LRU缓存,这里用到了 LinkedHashMap类 ...

  6. HTTP 常见异常状态及Delphi IDHTTP 控件处理方式

    以下部分为网上查找,部分为工作中整理 200:请求成功 202:请求被接受,但处理尚未完成 302:请求到的资源在一个不同的URL处临时保存     处理方式:重定向到临时的URL(IDHTTP处理方 ...

  7. WPF成长之路------视频

    今天偶然看到一篇博文,发现WPF原来还可以直接播放视频!于是在这里记录一下,以后方便使用: <MediaElement Source="C:\WINDOWS\system32\oobe ...

  8. pageadmin网站制作 如何修改和管理网站模板

    在使用pageadmin CMS 的同时,遇到问题可以参考官网帮助中心.1.网站模板目录地址/templates目录, 2.点击展开后,每个目录就是一个网站模板, 前端设计师制作的新版本都可以放到这个 ...

  9. JDBC mysql 中文查询不到数据解决

    问题现象: Selenium自动测试中,使用JDBC查询mysql数据库中数据,查询条件为中文,例如: select * from XXX where name ='我是测试数据'; 查询结果为空:但 ...

  10. 转载:quartz详解:quartz由浅入深

    转载网址:http://blog.itpub.net/11627468/viewspace-1763498/ 一.quartz核心概念 先来看一张图:         scheduler 任务调度器 ...