美文网首页
vim 学习笔记

vim 学习笔记

作者: 43daf5f8181f | 来源:发表于2016-12-17 01:31 被阅读77次

0. Install MacVim

brew install macvim --with-cscope --with-lua --with-override-system-vim --with-luajit --with-python3

1. 使用 Vundle 管理插件

1.1. Set up Vundle

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

1.2. Configure Plugins

Put this at the top of your .vimrc to use Vundle. Remove plugins you don't need, they are for illustration purposes.

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()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
Plugin 'ascenator/L9', {'name': 'newL9'}

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

1.3. Usage

  • Install plugins: :PluginInstall
  • Update plugins: :PluginUpdate
  • Search plugins: :PluginSearch

1.4 安装必要的插件

http://vimawesome.com 网站

Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'majutsushi/tagbar'
Plugin 'airblade/vim-gitgutter'
Plugin 'valloric/youcompleteme'
Plugin 'klen/python-mode'
Plugin 'nathanaelkane/vim-indent-guides'

主意 youcompleteme 插件安装需要在 ~/.vim/bundle/youcompleteme 目录下运行 ./install.py --all 或者 ./install.py

2. 插件 usage

2.0. vim 操作

tab 操作

  • :tabe <file> to open file in new tab
  • gt: go to next tab
  • gT: go to previous tab
  • {i}gt: go to tab in position i

2.1. ctrlp

  • Use <c-t> or <c-v>, <c-x> to open the selected entry in a new tab or in a new split.
  • Use <c-j>, <c-k> or the arrow keys to navigate the result list.

2.2. NERDTree

Create a command shortcut for NERDTree in Vim editor. 在 .vimrc 中添加:

Plugin 'scrooloose/nerdtree'
let mapleader = ","
nmap <leader>ne :NERDTree<cr>

So when I need NERDTree I just write ,ne in normal mode.

Some NERDTree tips: Type :help NERDTreeMappings to read through all of the default keyboard shortcuts. These are the ones I use the most frequently:

  • t: Open the selected file in a new tab
  • I: Toggle hidden files
  • m: Show the NERD Tree menu
  • ?: Toggle NERD Tree's quick help

2.3. UltiSnips

参考这里

Plugin 'SirVer/ultisnips'
Plugin 'honza/vim-snippets'

2.4. neocomplete

Plugin 'shougo/neocomplete.vim'
let g:neocomplete#enable_at_startup = 1

2.5. python-mode

Plugin 'klen/python-mode', {'branch': 'develop'}
let g:pymode_rope=0

相关文章

  • Python学习笔记-第十八天

    Django官方学习笔记Django快速搭建blogrunoob Django教程vim python搭建1vim...

  • vim学习笔记

    三种模式 vim分为3种模式:一般模式,编辑模式,命令行模式。 1. 一般模式 打开文档即为一般模式。 移动移动光...

  • 【vim】学习笔记

    按功能划分出命令 光标移动 w移动光标到下一个单词的词首,b移动光标到上一个单词的词首;e移动光标到下一个单词的结...

  • VIM学习笔记

    一些迟疑,还是决定要好好掌握vim 基本操作键

  • vim 学习笔记

    0. Install MacVim 1. 使用 Vundle 管理插件 1.1. Set up Vundle 1....

  • vim学习笔记

    vim 配置文件 在vim启动过程中,首先将查找配置文件并执行其中的命令,配置文件有三类 vimrc gvimrc...

  • VIM学习笔记

    原文地址:LoveDev 移动 单词移动 整行移动 根据行号来移动 行位置插入 tips1:10I*先输...

  • Vim学习笔记

    基础部分 安装Vim 打开官网的页面如下: 下载安装 下载结束之后安装成功如下 为什么下载下来是三个文件呢?用哪一...

  • Vim 学习笔记

    http://einverne.github.io/post/2015/05/vim-notes.html#adv...

  • Vim 学习笔记

    概念 什么是 vim Vim是从 vi 发展出来的一个文本编辑器。代码补完、编译及错误跳转等方便编程的功能特别丰富...

网友评论

      本文标题:vim 学习笔记

      本文链接:https://www.haomeiwen.com/subject/hefomttx.html