VIM 命令图解

vgod's vimrc


图转自:http://blog.vgod.tw/

 PDF版下載


Author: Tsung-Hsiang (Sean) Chang vgod@vgod.tw

Fork me on GITHUB https://github.com/vgod/vimrc.

ONE-STEP INSTALL

Use curl (for Mac OS X):

 curl -o - https://raw.githubusercontent.com/vgod/vimrc/master/auto-install.sh | sh

or wget (for most UNIX platforms):

 wget -O - https://raw.githubusercontent.com/vgod/vimrc/master/auto-install.sh | sh

MANUALLY INSTALL

  1. Check out from github

    git clone git://github.com/vgod/vimrc.git ~/.vim
    cd ~/.vim
    git submodule update --init
    
  2. Install ~/.vimrc and ~/.gvimrc

    ./install-vimrc.sh
    
  3. (Optional, if you want Command-T) Compile the Command-T plugin

    cd .vim/bundle/command-t/ruby/command-t
    ruby extconf.rb
    make
    

MANUALLY INSTALL ON WINDOWS

  1. Check out from github

    cd C:\Program Files\Vim   (or your installed path to Vim)
    rmdir /s vimfiles         (This deletes your old vim configurations. If you want to keep it, use move instead of rmdir.)
    git clone git://github.com/vgod/vimrc.git vimfiles
    git submodule update --init
    
  2. Install vimrc. Add the following line at the end of C:\Program Files\Vim\vimrc.

    source $VIM/vimfiles/vimrc
    

INSTALL & UPGRADE PLUGIN BUNDLES

All plugins (except vim-latex) were checked out as git submodules, which can be upgraded withgit pull. For example, to upgrade Command-T

 cd ~/.vim/bundle/command-t
 git pull

To install a new plugin as a git submoudle, type the following commands.

 cd ~/.vim
 git submodule add [GIT-REPOSITORY-URL] bundle/[PLUGIN-NAME]

HOW TO USE

see the "USEFUL SHORTCUTS" section in vimrc to learn my shortcuts.

PLUGINS

  • Pathogen: Pathogen let us install a plugin as a bundle in ~/.vim/bundle seprately.

  • Nerd Tree: A tree explorer plugin for navigating the filesystem.

    Useful commands:
    :Bookmark [name] - bookmark any directory as name
    :NERDTree [name] - open the bookmark [name] in Nerd Tree

  • AutoClose: Inserts matching bracket, paren, brace or quote.

  • vim-multiple-cursors: True Sublime Text style multiple selections for Vim.

  • vim-surround: deal with pairs of surroundings.

  • matchit: extended % matching for HTML, LaTeX, and many other languages.

  • xmledit: XML/HTML tags will be completed automatically.

  • Command-T: open and navigate between files withcmd-t.

  • SuperTab: Do all your insert-mode completion with Tab.

  • snipMate: TextMate-style snippets for Vim

    :help snipMate to see more info.

  • YankRing: Maintains a history of previous yanks, changes and deletes

    :help yankring to see more info.

  • VisIncr: Produce increasing/decreasing columns of numbers, dates, or daynames.

  • Cute Error Marker: showing error and warning icons on line.

    MacVim users need to enable "Use experimental renderer" to seegraphical icons.

  • vim-latex: Latex support.

  • OmniCppComplete: C/C++ omni-completion with ctags database.

  • JavaComplete: Java Omni-completion.

  • EasyMotion: An easy way to jump to a word.

    Useful commands:
    ,,w forward EasyMotion
    ,,b backward EasyMotion

  • TagBar: browsing the tags of source files ordered by classes.

    Useful commands:
    F7 toggles the TagBar

  • Indent Motion: Vim motions to the start and end of the current indentation-delimited block

    Useful commands:
    ,] move to the end of the current indentation-delimited block (very useful in Python and CoffeeScript),[ move to the beginning of the current indentation-delimited block (very useful in Python and CoffeeScript)

  • Zen Coding: expanding abbreviation like zen-coding.

    Useful commands:
    <ctrl-y>, expand zen-coding abbreviation.

  • ack.vim: run ack (a better grep) from vim, and shows the results in a split window.

    :Ack [options] {pattern} [{directory}]

  • Git Gutter: shows a git diff in the 'gutter' (sign column). It shows whether each line has been added, modified, and where lines have been removed.

Language specific supports

  • Latex: Read :help latex-suite.txt
  • Restructured Text: ctrl-u 1~5 inserts Part/Chapter/Section headers
  • HTML, Javascript, CoffeeScript, Python, CSS, C, C++, Java: use TAB to do omni-completion.
  • HTML/XML: End tags are automatically completed after typing a begin tag. (Typing > twice pushes the end tag to a new line.)

Other good references

Vim Visual Cheat Sheet

I've compiled and plotted a Vim Cheat Sheet for beginners. Welcome to download and learn Vim with it.

My Vim Visual Cheat Sheet

These Vim Visual Cheat Sheets are released under Creative Commons Attribution-ShareAlike 3.0 Unported License.

License

This vimrc project is released under Creative Commons Attribution-ShareAlike 3.0 Unported License.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 要在 Bash 中运行 Vim 命令并直接打开一个文件进行编辑,可以使用以下命令: ``` vim 文件名 ``` 其中“文件名”是您要编辑的文件的名称。如果该文件不存在,Vim 将创建一个新文件并打开它以供编辑。您可以在 Vim 中对文件进行编辑和保存。要退出 Vim 编辑器并返回到终端,可以按 Esc 键,然后输入“:wq”命令并按回车键。这将保存您所做的更改并退出 Vim。 ### 回答2: Bash是一种常用的shell工具,而Vim是一种文本编辑器,它们可以在Bash中一起使用。 要在Bash中执行Vim命令,需要先在终端中打开一个Bash shell。在终端中输入"vim"命令,然后按下回车键,就可以启动Vim编辑器。 启动Vim后,可以使用各种Vim命令来编辑文本文件。例如,可以使用"i"命令来进入插入模式,这样可以向文件中插入文本。还可以使用"dd"命令来删除一行文本,使用":wq"命令来保存并退出文件。 在Bash中执行Vim命令时,还可以通过输入参数来指定要编辑的文件。例如,可以使用"vim example.txt"命令来打开名为"example.txt"的文本文件进行编辑。 需要注意的是,Vim是一种高度可定制的文本编辑器,有许多配置选项可以设置。可以通过编辑Vim配置文件来定制Vim的行为,例如修改颜色方案、设置编码格式等。在Bash中执行Vim命令时,也可以指定配置文件,通过"-u"参数来加载指定的Vim配置文件。 总而言之,在Bash中执行Vim命令可以帮助用户进行文本编辑工作,使用Vim的强大功能和灵活性来满足不同的编辑需求。 ### 回答3: Bash是一种在Linux和Unix操作系统上常用的命令行工具,它可以执行各种命令和脚本。Vim是一款流行的文本编辑器,也可以在终端中使用。要在Bash中执行vim命令,需要按照以下步骤进行操作: 1. 打开终端:打开Linux或Unix操作系统上的终端应用程序。可以通过搜索终端应用程序的名称或者在任务栏或启动器中找到它。 2. 输入vim命令:在终端中,输入vim命令后,按下空格键,然后输入文件路径和名称。例如,如果要编辑名为“example.txt”的文件,可以输入:vim example.txt。 3. 模式切换:Vim编辑器有多种模式,包括命令模式、插入模式和可视模式。默认情况下,Vim处于命令模式。要切换到插入模式,可以按下键盘上的“i”键。在插入模式下,可以自由编辑文本。 4. 编辑文本:在插入模式下,可以使用键盘输入和编辑文本。可以随意修改文本,添加、删除和移动文本。 5. 退出vim:编辑完成后,可以按下Esc键,切换到命令模式。然后,输入:wq并按下回车键,保存修改并退出vim。 总结:要在Bash中执行vim命令,首先要打开终端,然后输入vim命令,进入vim编辑器并编辑文本,最后保存修改并退出vim

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值