Smart Home Key


Ⅰ. 插件描述

Home key toggles between ^ and 0

Ⅱ. 基本信息

创建日期:  2010-11-22
使用用户:  12
Github星:  3
插件作者:  andrew lyon

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin '/smart-home-key'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle '/smart-home-key'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug '/smart-home-key'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/vim-scripts/Smart-Home-Key

Ⅳ. 文档说明

This plugin will give you a command called :SmartHomeKey. You can bind this to any key, but I like to use <Home>. When you are in your code, and you call :SmartHomeKey, if the cursor is anywhere but ^ (the first non-blank character on the line), it will go to ^. If you are on ^ and you call :SmartHomeKey again, the cursor will be placed at 0 (first character on line, blank or non-blank). If you hold <Home>, it will just toggle between ^ and 0.

This emulates the behavior of the home key in Eclipse, which is what I used before switching to Vim.

This script is really simple, but I'm new to Vim scripting so let me know if you have problems (or if I did something stupid).

添加新评论