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. C#结构(Struct)

    Struct简介: 结构是使用 struct 关键字定义的,与类相似,都表示可以包含数据成员和函数成员的数据结构. 1.结构是一种值类型,并且不需要堆分配. 它都放在堆栈上2.结构的实例化可以不使用 ...

  2. 可epoll队列

    什么是可epoll队列? 就可以使用epoll来监控队列中是否有数据的队列,当然也支持select和poll. 应用场景 一个线程,需要将队列(共享内存队列或普通队列均可)中的数据取出来,然后通过网络 ...

  3. 设计模式21:State 状态模式(行为型模式)

    State 状态模式(行为型模式) 动机(Motivation) 在软件构建过程中,某些对象的状态如果改变,其行为也会随之而发生变化,比如文档处于只读状态,其支持的行为和读写状态的行为就可能完全不同. ...

  4. ACM 超级楼梯 发工资

    超级楼梯 有一楼梯共M级,刚开始时你在第一级,若每次只能跨上一级或二级,要走上第M级,共有多少种走法? Input 输入数据首先包含一个整数N,表示测试实例的个数,然后是N行数据,每行包含一个整数M( ...

  5. 流程控制语句(if、for、while、do while、switch、 break、continue)

    3:流程控制语句    (1)顺序结构 从上往下,依次执行    (2)选择结构    按照不同的选择,执行不同的代码    (3)循环结构 做一些重复的代码 4:if语句    (1)三种格式   ...

  6. 【Head First Java 读书笔记】(七)继承

    继承与多态 了解继承 继承的关系意味着子类继承了父类的实例变量和方法.父类比较抽象,子类比较具体. 继承层次的设计 找出具有共同属性和行为的对象(用继承来防止子类中出现重复的程序代码) 设计代表共同状 ...

  7. jQuery-File-Upload外部按钮触发上传

    这个控件功能还不错,但是对于外部调用上传有点压力. 比如说,他可以实现在添加一个文件后为文件添加一个上传按钮,这个是写在add中的,可以调用data.submit()提交数据 但是如果我要实现外部按钮 ...

  8. Transaction And Lock--存储过程中使用事务的模板

    某公司内部使用的模板 create procedure [usp_my_procedure_name] as begin set nocount on; declare @trancount int; ...

  9. 2. Python的划分

    解释型:当程序运行时,将代码从上至下,一句一句解释成二进制,在执行. 典型:python,php 优点:开发速度快,可以跨平台. 缺点:执行效率慢 编译型:将源码一次性转化成二进制文件,然后在执行. ...

  10. log(m+n)找第k大

    递归 int find_kth(vector<int>& nums1, int begin1, int size1, vector<int>& nums2, i ...