Vim Tutorial Study(8)

Chapter 8 Basic Abbreviations, Keyboard Mapping, and Initialization Files
enable you to automate repetitive tasks
abbreviation: enables you to type in part of a word and let Vim type the rest
remap the keyboard: redefine a key to be a whole set of commands
save them to an initialization file that will automatically be read the next tiem you start Vim
Abbreviations
:abbreviate ad advertisement
??????But how to remove one abbreviation??????
about <space>: it is really very amazing!
Usually Vim ignores spaces between the abbreviation and the expansion, to avoid that problem, you can use <space> istead!
Example:
:abbreviate #b /***************************************   (40 chars, designed so that the right side is aligned to a tab stop)
:abbreviate #e <space>**************************************/
Mapping
suppose you need to surround certain words with curly braces
Example: change a word 'amount' into '{amount}'
:map <F5> i{<Esc>ea}<Esc>
1. there is an implicit <Enter>
2. you can either press F5 key or by entering the characters < F 5 >
3. you must enter <Esc> as characters, or type CTRL-V followed by the <Esc> key (the CTRL-V tells Vim literally instead of acting on it.)
Listing Your Mappings
:map
Saving Your Settings
:mkvimrc file: writes all your settings to a file
:source fiel: read file
During startup, Vim editor looks for an initialization file. If it is found, it is automatically executed. (Only the first file found is read.)
UNIX
    $HOME/.vimrc
    $HOME/_vimrc
    $HOME/.exrc
    $HOME/_exrc
One way to find out which initialization files are read is to use the :version command
:version
.exrc is used by the old Vi editor
:mkexrc: writes the mappings to the .exrc file

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值