Smart Home Key : Home key toggles between ^ and 0
script karma |
Rating 23/12,
Downloaded by 1339 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
andrew lyon |
|
script type |
utility |
|
description |
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). |
|
install details |
Create ~/.vim/plugin/ (~\vimfiles\plugin\ on Win) if it doesn't exist. Drop in smarthomekey.vim. This will give you the command :SmartHomeKey which you can bind in your .vimrc:
map <silent> <Home> :SmartHomeKey <CR>
imap <silent> <Home> <C-O>:SmartHomeKey<CR>
|
|
script versions (upload new version)
Click on the package to download.
ip used for rating: 142.132.191.50
|