分享

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

 byrbzdl 2007-01-17
发信人: 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 <C-Y> dd           " delete current line to cache
"
"  *** transfer one block between vim sessions ***
map ;C :‘m,.w! $MyEnv/vim/vimswp<CR>        
map ;P :r $MyEnv/vim/vimswp<CR>          
map ;D :‘m,.w! $MyEnv/vim/vimswp<CR>d‘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 <F1> :exe ":!man ".expand("<cword>")<CR>
"
" / list matches with the words under cursor, input your choice, q for quit
map <F2> [I:let nr = input("Which one: ")<Bar>exe "normal " . nr ."[\t"<CR>
"
" * show the position information on the right
"map <F3> :set ru!<CR>:set ru?<CR>       
"
" - switch between showing line number and not   
map <F4> :set nu!<CR>:set nu?<CR>
"
" 4 show the TAB as ^I and End as & (used for makefile)
map <F5> :set list!<CR>:set list?<CR>
"
" 5 switch between hlsearch and nohlsearch
map <F6> :set nohls!<CR>:set nohls?<CR>
"
" 6 for C-indent
map <F7> :set cin!<CR>:set cin?<CR>
"
" + expand <Tab> to spaces in Insert mode
map <F8> :set et!<CR>:set et?<CR>
"
" 7 automatically set the indent of a new line
map <F9> :set ai!<CR>:set ai?<CR>
"
" switch between syntax_on and syntax_off
map <C-Q> :if exists("syntax_on")<bar>syn off<bar>else<bar>syn on
<bar>endif<C-M>
--
      祝所有我关心的人 幸福 快乐
      祝所有关心我的人 快乐 幸福
 
      当回首往事时,后悔没有去做的事总比后悔做了的事情多

※ 来源:·BBS 水木清华站 smth.org·[FROM: 166.111.68.*]

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约