Git Product home page Git Product logo

vim's Introduction

我的VIM配置和插件,地址 xianyo/vim. 基于wklken-vim

安装步骤

clone到本地,配置到linux个人目录

git clone https://github.com/xianyo/vim.git ~/.vim
cd ~/.vim               
./install.sh setup

快捷键

修改的快捷键和插件快捷键

<leader>  ;

F1 废弃这个键,防止调出系统帮助
F2 set nu/nonu,行号开关,用于鼠标复制代码用
F3 打开file tree
F4 Tagbar 
F5 set paste/nopaste,粘贴模式paste_mode开关,用于有格式的代码粘贴
F6 代码格式优化化
F7 编译运行
F8 C,C++的调试
F9 代码浏览
F10 
F11 分割窗口最大化
F12 vimshell

ctrl + jkhl 进行上下左右窗口跳转,不需要ctrl+w+jkhl
;/      去除匹配高亮

<- / -> 前后buffer
; + tn  新tab
; + to  tabonly
; + tc  close
; + tm  tab move
; + te  new tab edit
; + sa    select all,全选
; + v     选中段落
; + w     :w,保存
; + q     :q!,退出vim

插件

  1. ####插件管理 gmarik/vundle

    必装,用于管理所有插件 命令行模式下管理命令:

     :BundleInstall     install
     :BundleInstall!    update
     :BundleClean       remove plugin not in list
    
  2. ####代码自动补全 Valloric/YouCompleteMe

    需要编译这个插件(见github文档)

    这个需要自己去看官方的配置方式,演示在官方github有

    需要Vim 7.3.584 以上版本(如何编译vim)

    这个插件包含了以下几个插件功能,所以不需要装下面:

     clang_complete
     AutoComplPop
     Supertab
     neocomplcache
     jedi(对python的补全)
    

    快捷键:

     ;gd  跳到声明位置, 仅 filetypes: c, cpp, objc, objcpp, python 有效
    
  3. ####代码片段快速插入 SirVer/ultisnips +honza/vim-snippets

    必装,效率杀手锏,快速插入自定义的代码片段

    代码片段集合,有缺陷

    自动补全加这个,高效必备, 针对各种语言已经带了一份配置了,可以到安装目录下查看具体,我有针对性补全一份,在my_snippets目录下,可自行修改

    演示

    ultisnips

  4. ####Tagbar majutsushi/tagbar

      [sd] <F4> 打开
    

    演示

    tagbar

  5. ####Markdown plasticboy/vim-markdown

    markdown语法,编辑md文件

  6. ####状态栏增强 bling/vim-airline

    演示

    airline

  7. ####vim-bufferline bling/vim-bufferline

    状态栏显示buffer

    演示

    in the statusline

    vim-bufferline

    or the command bar

    vim-bufferline

  8. ####vimcdoc asins/vimcdoc

    vim中文帮助文档

  9. ####多语言语法检查 scrooloose/syntastic

    建议安装,静态语法及风格检查,支持多种语言

    修改了下标记一列的背景色,原有的背景色在solarized下太难看了…..

    演示

    syntastic

  10. ####搜索 kien/ctrlp.vim

    文件搜索,ack/Command-T需要依赖于外部包,不喜欢有太多依赖的,除非十分强大, 具体 文档

    [sd] ;p  打开ctrlp搜索
    [sd] ;f  相当于mru功能,show recently opened files
    
    ctrl + j/k 进行上下移动
    ctrl + x/v 分屏打开该文件
    ctrl + t   在新tab中打开该文件
    

    演示

    ctrip

    插件: 当前文件快速函数搜索:tacahiroy/ctrlp-funky

    解决问题:使用tagbar当函数比较多的时候,移动耗时较长,使用快速搜索快很多

    ;fu   进入当前文件函数搜索
    ;fuu   搜索光标下单词对应函数
    
  11. ####目录树 scrooloose/nerdtree

    必装,开启目录树导航

    [sd]
        ;n  打开 关闭树形目录结构 或者F3
    
        在nerdtree窗口常用操作:(小写当前,大写root)
        x.......收起当前目录树
        X.......递归收起当前目录树
        r.......刷新当前目录
        R.......刷新根目录树
    
        p.......跳到当前节点的父节点
        P.......跳到root节点
        k/j.....上下移动
        K.......到同目录第一个节点
        J.......最后一个节点
    
        o.......Open files, directories and bookmarks
        i.......split上下分屏
        s.......vsplit左右分屏
        c.......将当前目录设为根节点
        q.......关闭
    

    演示

    thenerdtree

  12. ####快速注释 scrooloose/nerdcommenter

    必装,另一个大大提升效率的地方,快速批量加减注释

    [d] shift+v+方向键选中(默认当前行)
        -> ;cc  加上注释
        -> ;cu 解开注释
    

    演示

    nerdcommenter

    附:注释还有其他两种插件可选tcommenttpope/vim-commentary

  13. ####区块伸缩 terryma/vim-expand-region

    视图模式下可伸缩选中部分,用于快速选中某些块

    [sd]
    + 增加选中范围(+/=按键)
    _ 减少选中范围(_/-按键)
    

    演示(直接取链到其github图)

    expand-region

  14. ####多光标选中编辑 terryma/vim-multiple-cursors

    多光标批量操作

    [sd]
    ctrl + m 开始选择
    ctrl + p 向上取消
    ctrl + x 跳过
    esc   退出
    

    演示(官方演示图)

    multiple-cursors

  15. ####git 常用操作 tpope/vim-fugitive

    git插件, 编辑文件时进行一些diff操作,例如diff

    不是很习惯,所以用的次数太少,目前和现有配置快捷键有冲突,尚未解决

    [sd]
    ;ge   = git diff edit[gd被ycm占用了]
    

    没有配置其他快捷键,可以参照github,自己增加修改映射

  16. ####git状态 airblade/vim-gitgutter

    git,在同一个文件内,通过标记和高亮,显示本次文件变更点

    [sd]
    ;gs   = show diff status [gd被ycm占用了]
    

    gitgutter

  17. ####位置跳转Lokaltog/vim-easymotion

    必装,效率提升杀手锏,跳转到光标后任意位置

    配置(我的leader键配置 let g:mapleader = ';')

    ;; + w  跳转
    ;; + fe  查找'e',快速跳转定位到某个字符位置
    

    演示

    easy_motion

  18. ####快速编辑 tpope/vim-surround +tpope/vim-repeat

    必装,很给力的功能,快速给词加环绕符号,例如引号

    repeat进行增强,'.'可以重复命令

    [d]
    cs"' [inside]
    "Hello world!" -> 'Hello world!'
    ds"
    "Hello world!" -> Hello world!
    ysiw"
    Hello -> "Hello"
    

    演示

    surround

  19. ####赋值语句代码对齐 godlygeek/tabular

    将代码,或者json等,进行对齐,具体见 tabular-vim

    [sd]  可以选中多行,不选中默认操作当前行
        ;a= 对齐等号表达式
        ;a: 对齐冒号表达式(json/map等)
    
  20. ####mark跳转 kshenoy/vim-signature

    显示marks - 方便自己进行标记和跳转
    m[a-zA-Z] add mark
    '[a-zA-Z] go to mark
    m<Space>  del all marks
    
  21. ####文件时光机 sjl/gundo.vim

    编辑文件时光机

    [sd] ;h  查看文件编辑历史
    

    附:同类插件 mbbill/undotree

  22. ####括号上色高亮 kien/rainbow_parentheses.vim

    演示

    rainbow

  23. ####solarized主题altercation/vim-colors-solarized

经典主题 solarized

  1. ####molokai主题tomasr/molokai

用sublime text2的同学应该很熟悉, 另一个主题,可选,偶尔换换味道 molokai

  1. ####Buffer fholgado/minibufexpl.vim

    buffer管理

    注释掉了。用vim-bufferline

    [sd]
        <Tab>  切换buffer
        左右方向键  切换buffer
        ;bn   切到后一个
        ;bp   切到前一个
        ;bd   关闭当前buffer
    
  2. ####YankRing YankRing.vim

  3. ####SrcExpl wesleyche/SrcExpl

  4. ####ZoomWin ZoomWin

  5. ####std_c std_c.zip

  6. ####vimshell Shougo/vimshell.vim

  7. ####vimim vimim/vimim

VIM TIPS

vim-cheat-sheet-full.png vim_keyboard.png vim_cheat_sheet_for_programmers.png vim_for_programmers.png

vim's People

Contributors

brain-zhang avatar fangwentong avatar maogm12 avatar spacewander avatar xianyo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.