Code Monkey home page Code Monkey logo

vimrc's Introduction

vimrc

不用任何额外插件,把VIM配置成一个IDE!这个配置我已经用了好多年,希望对你有用。

安装

  • 把vimrc文件拷贝你的home目录下,改名为.vimrc
  • 在.bashrc中加入一行: stty -ixon 这是为了在VIM中可以按ctrl+s进入shell,后详

功能

主要功能有:

  • 显示行号和底部状态栏
  • 多文档编辑、切换
  • 在指定目录中查找关键字
  • 一键进入/退出shell
  • 集成Git命令:grep,diff,blame和log
  • 支持Pathogen VIM插件系统
  • ……

具体如下:

  • 使用2个空格替换一个tab
  • 缩进2个空格
  • 显示行号
  • 自动缩进
  • 自动把工作目录切换到当前打开文件所在的目录
  • 高亮显示搜索关键字
  • cursor所在行加下划线显示
  • 底部状态行显示当前文件路径、行号、列号等信息
  • 保存文件时自动删除行尾空格
  • 启用语法高亮
  • 根据文件类型自动设定缩进大小

它还定义了一些快捷键:

  • ctrl+s进入shell(需要在.bashrc中加入stty -ixon),从shell退回vim按ctrl+d
  • ctrl+j和ctrl+k可以在cursor不移动的情况下向下或向上滚动屏幕
  • ctrl+l列出当前打开的文件,然后你只需输入数字序号就可以切换到对应文件
  • ctrl+n和ctrl+p直接切换到打开文件列表里的下一个或者上一个文件
  • ctrl+o切换回刚才的文件
  • F2在工作目录(根据前面的设定会自动切换到当前打开文件所在的目录)下搜索cursor所在的word——这个命令不会立即执行,需要你回车确认,因此你可以在执行前修改命令参数,比如调整要搜索的关键字或者排除一些不要搜索的目录
  • F3打开搜索结果小窗户(如果还没有打开或者被关闭了的话)
  • +/-增加或者减小搜索结果窗的大小
  • F4关闭搜索结果窗
  • F5保存当前打开文件列表到~/.vim_recent_files(需要回车确认),这样下次就可以使用 vi -S ~/.vim_recent_files 命令打开这些文件
  • F6 Git grep当前word,即:在当前的Git Repo里查找,不会查找非Git目录,如项目的日志和临时目录等
  • F7 Git diff当前文件
  • F8 Git blame当前文件
  • F9 Git log当前文件

这个配置文件不到100行,但是基本的功能都有了,我已经用了很多年。它没有配置Tag、没有过多功能炫目的子窗口,但依我的经验,这已足够——我主要用它做Web开发以及服务器运维的工作。另外,它还包含大量注释,供你根据自己的需求进一步定制。

如果你需要更加强大的配置,请参考 https://github.com/coin8086/vim-settings

vimrc's People

Contributors

coin8086 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.