亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2100 | 回復: 0
打印 上一主題 下一主題

A sample .exrc file for vi editor users [復制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2007-05-02 11:44 |只看該作者 |倒序瀏覽

A sample .exrc file for vi editor users  
Introduction
This article presents a sample .exrc file that can be used by users of the vi editor.  The .exrc file, located in your home directory, is the startup (or configuration) file for the vi editor.
The intent of this brief article is to show some of the ways you can modify the configuration of the vi editor.
  
Brief discussion
Listing 1 shows our sample .exrc file. In this file we've changed the definition of some of the keystrokes within the editor.  Note that map commands are used to map keystrokes.  By configuring this .exrc file, we've mapped many of the function keys on your keyboard, including , , ...  (with the exception of ).
Note that the  key is mapped to run a more command on a file named .vi_help.  The .vi_help file is shown in Listing 2.  It's just a plain text file that provides some "help" for users of the vi editor.  When you hit the  key, this file will be displayed (if properly installed in your home directory).
The  key is now programmed to displayed line numbers when you select it.   performs the opposite function - it hides the line numbers, so these two keystrokes are essentially toggle switches for the number display.
  
  
set showmode
set autoindent
map #1 :!more /.vi_help
map #2 :set number
map #3 :set nonumber
map #5 o   #-------------------------------------------------------------------------#

map #6 A----------
map #7 o
map #8 o
map #9 :1,$s/
  
Listing 1:
  exrc - a sample .exrc file for users of the vi editor
  
Note that Listing 1 may appear a little unusual. That's because it includes control characters (such as ^V and ^M) that may not print properly on screen. If you download the .exrc file using the link shown at the end of this article, the file will be downloaded with these control characters, which it needs to work properly.
  
  
                                                                        vi Help
----------------                        -----------------
Editing Commands                        Deleting Commands
----------------                        -----------------
i        insert                                x        delete character
o        open a new line (below)                X        delete character to left
O        open a new line (above)                d0        delete to beginning of line
a        append                                d$        delete to end of line
A        append at end of line                dd        delete line
u        undo                                5dd        delete 5 lines
.        repeat last command
-------------------                        -----------------
Cutting and Pasting                        Movement Commands
-------------------                        -----------------
yy        yank                                H        move to top of screen (high)
5yy        yank 5 lines                        M        move to middle
p        paste                                L        move to low
P        paste above current position        10G        go to line 10
                                        w        go to next word
                                        b        go back to previous word
                                        0        beginning of line
                                        $        end of line
------------------
Searching Commands
------------------
/fred                search for "fred"
?fred                search backwards for "fred"
n                repeat the last search
----------------------------------
Function Key Mappings (Customized)
----------------------------------
F1:  get help (show this screen)
F2:  set number
F3:  set nonumber
F4:
F5:  insert a comment line
---------------------
Run External Commands
---------------------
:!ls -al                list current directory (long list)
:!pwd                        print working directory
----------------------
Miscellaneous Commands
----------------------
:r                        read contents of a file into the current file
:s/FRED/BARNEY/g        swap FRED with BARNEY (current line only)
:10,20s/FRED/BARNEY/g        swap FRED with BARNEY on lines 10 through 20
:1,$s/FRED/BARNEY/g        swap every occurrence of FRED with BARNEY (entire file)
:10,20d                delete lines 10 through 20
:10,20y                yank (copy) lines 10 through 20 to the buffer
----------------
Auto-Indentation
----------------
Your ~/.exrc file is configured to automatically indent each line.  
To move backwards (and eliminate indentation), hit
        ^d
  
Listing 2:
.vi_help - This file is displayed when the user hits the  function key.  Both this file and the .exrc file shown in Listing 1 must be installed in the user's home directory.
  
  
Installation and comments
If you're interested in seeing how the .exrc and .vi_help files affect your version of the vi editor, just download the files using the links shown below. After you've downloaded the files, just copy them to your home directory. (As always, if you have files with these same names in your home directory already, make a backup copy of them before installing these files.)
Once you've installed these files in your home directory, just start the vi editor, and try using the various function keys that we've defined.
If you have good ideas for a .exrc file, please feel free to
write us with your suggestions
.  We'd love to hear from you, and we'll include your thoughts/comments as an addition to this article!
Other commands that readers have recommended:

  • set ignorecase

Download the files
If you'd like to download these files, just click on the links below.  After you click on each file, just select File|Save As... from your browser to save the .profile to your local filesystem.

文件:
exrc.rar
大小:
1KB
下載:
下載



本文來自ChinaUnix博客,如果查看原文請點:http://blog.chinaunix.net/u/30557/showart_290513.html
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP