感觉比较顺手的几个自定义键

来源:百度文库 编辑:神马文学网 时间:2024/04/29 02:52:19
发信人: neman (行胜于言), 信区: VIM
标  题: 感觉比较顺手的几个自定义键
发信站: BBS 水木清华站 (Mon May 24 08:33:49 2004), 站内
因为个人比较喜欢键盘操作,所以不同软件加起来自定义的键就比较多。
除了功能键,vim中常用的键我都用分号";"开头。
下面是拷贝粘贴的快捷键:
不同文件之间拷贝粘贴需要一个临时文件。
"  *** current file copy and paste ***
map ;c mn"py‘m‘n       " mark curr line ‘n‘ and copy from ‘m to ‘n to cache
map ;p "pp             " paste the lines in cache after curr line
map ;d "pd‘m           " delete lines from ‘m to curr line to cache
map dd           " delete current line to cache
"
"  *** transfer one block between vim sessions ***
map ;C :‘m,.w! $MyEnv/vim/vimswp
map ;P :r $MyEnv/vim/vimswp
map ;D :‘m,.w! $MyEnv/vim/vimswpd‘m
"
"  *** column mode copy and paste ***
"  *** select lines by moving ‘h j k l‘ in visual mode
vmap  ;c "*y           " copy lines
vmap  ;p "*p           " paste lines
vmap  ;d "*x           " delete lines
下面是功能键的定义,可惜不够用。
" NL show you the contents of manning function under the cursor
map :exe ":!man ".expand("")
"
" / list matches with the words under cursor, input your choice, q for quit
map [I:let nr = input("Which one: ")exe "normal " . nr ."[\t"
"
" * show the position information on the right
"map :set ru!:set ru?
"
" - switch between showing line number and not
map :set nu!:set nu?
"
" 4 show the TAB as ^I and End as & (used for makefile)
map :set list!:set list?
"
" 5 switch between hlsearch and nohlsearch
map :set nohls!:set nohls?
"
" 6 for C-indent
map :set cin!:set cin?
"
" + expand to spaces in Insert mode
map :set et!:set et?
"
" 7 automatically set the indent of a new line
map :set ai!:set ai?
"
" switch between syntax_on and syntax_off
map :if exists("syntax_on")syn offelsesyn on
endif
--
祝所有我关心的人 幸福 快乐
祝所有关心我的人 快乐 幸福
当回首往事时,后悔没有去做的事总比后悔做了的事情多
※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.68.*]