vim安装与配置
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
- vundlle管理YCM,在.vimrc相应位置加上Plugin 'Valloric/YouCompleteMe'
- 打开vim,运行:PluginInstall,安装插件
- 进入~/.vim/bundle/YouCompleteMe/,运行./install.py(--clang-completer支持C系列语言补全,需要安装llvm+clang)
可能需要注意:
- vim python support
- git用来下载YCM的问题
- cmake默认编译器的问题(export CC和CXX到高版本的编译器)
vim安装与配置的更多相关文章
- Vim 安装、配置及复制粘贴操作
1.安装:sudo apt-get install vim 2.配置:cd ~ #进入用户主目录 touch .vimrc #.后缀文件不可见 vi .vimrc #打开文件 输入: set cind ...
- Vim 安装和配置、优化
Vim 介绍 Vim 官网:http://www.vim.org/ Vim 安装 CentOS:sudo yum install -y vim Ubuntu:sudo apt-get install ...
- Ubuntu 16.04 Vim安装及配置【转】
转自:http://www.cnblogs.com/ace-wu/p/6273031.html 安装VIM 默认已经安装了VIM-tiny acewu@acewu-computer:~$ locate ...
- Ubuntu 16.04 Vim安装及配置
安装VIM 默认已经安装了VIM-tiny acewu@acewu-computer:~$ locate vi | grep 'vi$' |xargs ls -al lrwxrwxrwx 1 root ...
- CentOS6 下Vim安装和配置
1.系统只安装了vim-minimal,执行以下命令安装另外两个组件 yum install vim-common yum install vim-enhanced 2.安装ctags yum ins ...
- vim 安装
Ubuntu 16.04 下 Vim安装及配置 默认已经安装了VIM-tiny linuxidc@linuxidc:~$ locate vi | grep 'vi$' |xargs ls -al lr ...
- Ubuntu下VIM的安装及其配置——Linux篇
一.Ubuntu系统默认内置: 实际上ubuntu默认没有安装老版本的vi,只装了vim.vi是vim.tiny(vim的最小化版本,不含 GUI,并且仅含有一小部分功能,并且默认与vi兼容.此软件包 ...
- CentOS 7下的Vim自动补齐插件YouCompleteMe安装及配置
备注:现在对于 YouCompleteMe 的安装应采用更为简单的方法,即利用 Vundle 来安装这个插件.具体方法可见: Vundle 主页 YouCompleteMe 主页 而 .vimrc 的 ...
- Vim安装使用和配置
卸载vim sudo apt-get remove --purge vim (--purge 是完全删除,会连配置文件一起删除) 也可以使用yum等其它方式安装 ,如果提示apt-get命令不存在可以 ...
随机推荐
- 认证服务号Thinkphp微信支付
公众号配置 1.微信支付过程中需要获取用户的openid,所以,仍需填写 网页授权域名 2.微信支付授权目录 Thinkphp目录格式为www.xxx.cn/home/wxpay/ 这里目录不能填写 ...
- python传递任意数量的实参
1.传递任意的实参 def make(*test):#带*号 print(test) make("one")#传递一个实参 make("one","t ...
- (转)走进AngularJs(六) 服务
原文地址:http://www.cnblogs.com/lvdabao/p/3464015.html 今天学习了一下ng的service机制,作为ng的基本知识之一,有必要做一个了解,在此做个笔记记录 ...
- Understanding sun.misc.Unsafe
转自: https://dzone.com/articles/understanding-sunmiscunsafe The biggest competitor to the Java virtua ...
- 从swing分发线程机制上理解多线程[转载]
本文参考了 http://space.itpub.net/13685345/viewspace-374940,原文作者:javagui 在多线程编程当中,总会提到图形编程,比如java中的swing, ...
- spring源码研究之IoC容器在web容器中初始化过程
转载自 http://ljbal.iteye.com/blog/497314 前段时间在公司做了一个项目,项目用了spring框架实现,WEB容器是Tomct 5,虽然说把项目做完了,但是一直对spr ...
- 数据库_mysql多表操作
多表操作 实际开发中,一个项目通常需要很多张表才能完成.例如:一个商城项目就需要分类表(category).商品表(products).订单表(orders)等多张表.且这些表的数据之间 ...
- 从golang的垃圾回收说起(下篇)
文章来自网易云社区 4 Golang垃圾回收的相关参数 4.1 触发GC gc触发的时机:2分钟或者内存占用达到一个阈值(当前堆内存占用是上次gc后对内存占用的两倍,当GOGC=100时) # 表示 ...
- NOIP simulation
NOIP 模拟赛Day 1题目名称LGTB 玩扫雷LGTB 学分块LGTB 打THD英文代号mine divide thd时限1 秒1 秒1 秒输入文件mine.in divide.in thd.in ...
- 洛谷P4097 [HEOI2013]Segment(李超线段树)
题面 传送门 题解 调得咱自闭了-- 不难发现这就是个李超线段树,不过因为这里加入的是线段而不是直线,所以得把线段在线段树上对应区间内拆开之后再执行李超线段树的操作,那么复杂度就是\(O(n\log^ ...