ºìÁªLinuxÃÅ»§
Linux°ïÖú

Vim/Vi±à³ÌÌáËÙ

·¢²¼Ê±¼ä:2007-07-02 00:35:47À´Ô´:ºìÁª×÷Õß:Enbrain
Vim/ViÒ»Ö±ÊÇUNIX/LinuxϵͳÉÏ×îÁ÷ÐеÄÎı¾±à¼­Æ÷£¬´Ó2001Äê½Ó´¥UNIXÖÁ½ñ£¬Vim/ViʼÖÕÊÇÎÒÐÞ¸ÄϵͳÎļþ¡¢±àд¼òµ¥³ÌÐòµÄÊ×Ñ¡±à¼­Æ÷£¬ÊǾӼÒÂÃÐбر¸Ö®¹¤¾ß¡£ÈçºÎÌáÉýËüµÄ±àдËٶȣ¬±¾ÎÄ×ÅÖؽéÉÜÁËһЩʹÓü¼Çɹ©´ó¼Ò²Î¿¼¡£

Ó¦Óü¼ÇÉÒ»£º¿ìËÙ×¢ÊÍ

1¡¢Á¬ÐøÐÐ×¢ÊÍ

ʹÓÃVim/Vi±à¼­shell½Å±¾£¬ÔÚ½øÐе÷ÊÔµÄʱºò£¬ÐèÒª½øÐжàÐеÄ×¢ÊÍ£¬Ã¿´Î¶¼ÒªÏÈÇл»µ½²åÈëģʽ£¬ÔÚÐÐÊ×ÊäÈë×¢ÊÍ·û¡°#¡±£¬ÔÙÍË»ØÃüÁîģʽ£¬·Ç³£Âé·³¡£ÆäʵÈç¹ûҪעÊÍÁ¬ÐøÐУ¬¿ÉÔÚÃüÁîģʽÏÂÖ´ÐУ¬¸ñʽÈçÏ£º

:ÆðʼÐÐ,ÖÕÖ¹ÐÐs/ÒªÌæ»»×Ö·û/Ì滻ΪÐÂ×Ö·û/g

ÈçÐè×¢Ê͵Ú1Ðе½µÚ20ÐУ¬¿ÉÒÔÖ´ÐУº

:1,20s/^/#/g

ÆäÖС°^¡±±íʾÔÚÐÐÊײåÈ룬¡°#¡±ÎªÒª²åÈëµÄ×Ö·û£¬¡°g¡±±íʾִÐÐÌ滻ʱ²»È·ÈÏ£¬ÈôÏ£ÍûÿÐн»»¥Ñ¯ÎÊÊÇ·ñÖ´ÐУ¬¿É½«¡°g¡±¸ÄΪ¡°c¡±¡£

Èç¹û±à¼­PHP½Å±¾£¬×¢ÊÍÒªÉÔ΢Âé·³Ò»µã£¬ÈçҲҪעÊ͵Ú1Ðе½µÚ20ÐУ¬ÒªÖ´ÐУº

:1,20s/^/\/\//g

PHPµÄ×¢ÊÍ·û¡°//¡±ÒªÌØÊâ´¦Àí£¬ÒòΪVim/ViÌæ»»ÃüÁî¸ñʽÖÐĬÈÏ¡°/¡±Îª·Ö¸ô·û£¬ÕâÑù¾ÍÐèҪʹÓÃתÒå·û¡°\¡±£¬±íʾ¡°/¡±¾ÍҪд³É¡°\/¡±²Å¿ÉÒÔ£¬ËùÒÔÃüÁîÈçÉÏËùʾ¡£

Ç¿ÁÒ½¨Òé¸÷λ¿´¹ÙʹÓã¬Ê¡Ê±Ê¡Á¦Ê¡¼üÅÌ»¹Ê¡ÊÖָͷ¡£

2¡¢·ÇÁ¬ÐøÐÐ×¢ÊÍ

Èç¹û×¢ÊÍ·ÇÁ¬ÐøµÄ¶àÐУ¬¿ÉÒÔ¶¨Òå¿ì½Ý¼ü¼ò»¯£¬¸ñʽΪ£º

:map ¿ì½Ý¼ü Ö´ÐÐÃüÁî

È綨Òå¿ì½Ý¼üCtrl+PΪÔÚµ±Ç°ÐÐÐÐÊ×Ìí¼Ó¡°#¡±×¢ÊÍ£¬¿ÉÒÔÖ´ÐУº

:map ^P I//

¡°^P¡±Îª¶¨Òå¿ì½Ý¼üCtrl+P£¬Òª×¢ÒâµÄÊDZØÐëͬʱ°´¡°Ctrl+v+p¡±°´³ö´Ë¡°^P¡±·½²ÅÓÐЧ£¬»òÏÈ°´¡°Ctrl+v¡±ÔÙ°´¡°Ctrl+p¡±Ò²¿ÉÒÔ£»¡°I//¡±¾ÍÊÇ´Ë¿ì½Ý¼üÒª´¥·¢µÄ¶¯×÷£¬¡°I¡±ÎªÔÚ¹â±êËùÔÚÐÐÐÐÊײåÈ룬¡°//¡±ÎªÒªÊäÈëµÄ×Ö·û£¬¡°¡±±íʾÍË»ØÃüÁîģʽ£¬¡°¡±ÒªÖð¸ö×Ö·û¼üÈ룬²»¿ÉÖ±½Ó°´¼üÅ̵ġ°Esc¡±¼ü¡£Ö´Ðгɹ¦ºó£¬Ö±½ÓÔÚÈÎÒâÐèҪעÊ͵ÄÐÐÉÏ°´¡°Ctrl+P¡±¾Í×Ô¶¯»áÔÚÐÐÊ×¼ÓÉÏ¡°//¡±ºÅÁ˷dz£·½±ã¡£

Èç¹ûҪȡÏû´Ë¿ì½Ý¼ü£¬Ö»ÐèÊäÈëÃüÁ

:unmap ^P

ÎÒд³ÌÐò»òÎĵµÏ²»¶ÔÚĩβעÊÍÖÐдÉÏ×Ô¼ºµÄÓÊÏ䣬ÿ´Î¼ÈëÊ®·ÖÂé·³£¬Ë÷ÐÔ¶¨ÒåÁËÒ»¸ö¿ì½Ý¼ü£¬ÈçÏ£º

:map ^M isam_helen@vip.163.com

ÒÔºóдÍêÄÚÈݺó£¬Ö±½ÓÔÚ×¢ÊÍÖÐCtrl+M¾Í¼ÈëÁË°³µÄÓÊÏäÁË£¨´Ë´¦ÑÏÖر©Â¶ÁË×÷ÕßÓÊÏ䣬Ö÷ÒªÆÚ´ý¸÷λ¿´´ËÎÄÕµÄMM¶à¶àÁªÏµ£¬¶ÔµÆµ»¸æÖ÷±à´óÈ˲»ÒªÉ¾³ý£©¡£


Ó¦Óü¼Çɶþ£ºÂÒÆß°ËÔãµÄ¼¼ÇÉ

1¡¢ ´«ËµÖеÄÃüÁî¡°ab¡±

ÃüÁî¡°ab¡±£¬Í¬Ñù¿ÉÒÔ½â¾öÉÏÊöÊäÈëÓÊÏäµÄÎÊÌ⣬ÒòΪÎÒÔÚVim/ViÖж¨ÒåÁËÌ«¶à¿ì½Ý¼ü£¬ÈçÊäÈëµç×ÓÓÊÏäµÄ¡¢ÊäÈëͨÐŵØÖ·µÄ¡¢ÊäÈëÁªÏµµç»°µÄ¡¢ÊäÈëÇóż±ê×¼µÄ¡¢ÊäÈëPHPChina¹ÜÀíÔ±ÈýΧµÄ¡­¡­ºóÀ´×Ô¼º¶¼¼Ç²»×¡ÁË¡£Ö®ºóÒ»ÌìÉîÒ¹µçÉÁÀ×Ãù£¬ÎÒͻȻ·¢ÏÖÁËÕâÌõÃüÁî----¡°ab¡±£¬²ÔÌì°¡´óµØ°¡£¬ÎÒÖÕÓÚÕÒµ½½â¾öÎÊÌâµÄ·½·¨ÁË£¡oh yeah£¡

Ô­À´ÊäÈë¾­³£ÓõÄÐÅÏ¢¿ÉÒÔÈç´Ë¼òµ¥£¬LOOK----

:ab Ìæ´ú·û ԭʼÐÅÏ¢

ʾÀýÈçÏ£º

:ab sammail sam_helen@vip.163.com

Ö´ÐÐÖ®ºó£¬ÔÚÊäÈëģʽÈκεط½Â¼Èë¡°sammail¡±£¬ÔÙÇÃÈÎÒâ×Öĸ·ûºÅ»òÕ߻سµ¿Õ¸ñ£¬ßÇàêһϣ¬ÀûÂí¾Í±ä³É¡°sam_helen@vip.163.com¡±£¬ÄÇÕæÊÇÏ൱µÄ·½±ã°¡£¡£¨Ô­ÁÂÎÒ´Ë´¦Ôٴα©Â¶ÓÊÏ䣬ÉùÃ÷һϣ¬ÄС°Í¬Ö¾¡±¾Í²»Òª·¢Óʼþ¸øÎÒÁË£¬ÔÚϲ»ºÃÕâ¸ö£¬Ð»Ð»£©

2¡¢ Ô­À´¿ÉÒÔË«½£ºÏÒ»

ÔÚVim/ViÖÐÓÐÁ½¸öС¼¼ÇÉ£º

No.1 ¿ÉÒÔÖ±½ÓÔÚVim/ViÖÐÖ´ÐÐUNIX/LinuxÃüÁî²»ÐèÍ˳öVim/Vi

ÓÐʱ±àдһЩϵͳ½Å±¾£¬ÐèÒªÁ˽âϵͳÐÅÏ¢£¬ºÜ¶àͬѧ¾ÍÍ˳öVim/ViÈ»ºóÖ´ÐÐÃüÁ»ñµÃÐÅÏ¢ºóÔÙ½øÐб༭¡£Æäʵ´ó¿É²»±Ø£¬ÈçÏë»ñµÃ/tmpĿ¼ÏÂÄÚÈÝ£¬Ö»ÐèÔÚVim/ViÃüÁîģʽÏÂÖ±½ÓÖ´ÐУº

:!ls /etc

²é¿´ÍêÃüÁî½á¹û£¬Ö±½Ó»Ø³µ£¬¾Í¿ÉÒÔ¼ÌÐø±à¼­·Ç³£·½±ã¡£

ÔÚVim/ViÖÐÖ´ÐÐÃüÁ¸ñʽ¾ÍÊÇÕâô¼òµ¥£º

:!ÃüÁî

No.2 ¿ÉÒÔÖ±½Ó½«ÆäËûÎļþÄÚÈݵ¼È뵱ǰ±à¼­ÎļþÖÐ

¸ñʽ£º

:r ÎļþÃû

È磬ÐèÒªµ¼ÈëÎļþ/etc/issueµÄÄÚÈÝ£¬Ö´ÐУº

:r /etc/issue

Á½¸ö·Ç³£·Ç³£easyµÄС¼¿Á©£¬¾ÍÔÚÒ»¸öÎҷdz£ÓôÃƵÄÏÂÎ磬¿ñÇüüÅÌʱһ²»Ð¡ÐÄûÁôÉñ·¢ÏÖÁËÕâÑùÒ»¸öСÃØÃÜ----Ô­À´ËüÃÇ¿ÉÒÔ½áºÏÆðÀ´Óã¡

ÏȾٸöÀý×Ó£¬ºÜ¶à³ÌÐòԱϲ»¶Ð´Íê³ÌÐòºóÔÚ×¢ÊÍÖÐдÈ뵱ǰʱ¼ä£¬ÎÒÓиöºÃ°ì·¨¼´Ê¡ÊÂÓÖ¿ìËÙ»¹×¼È·£¬Ö»ÐèÒªÔÚÃüÁîģʽÏÂÖ´ÐУº

:r !date

µ±Ç°Ê±¼ä¾Í×Ô¶¯±»µ¼ÈëÁË£¬ÈκÎÃüÁîµÄ½á¹ûµ¼Èëµ½µ±Ç°±à¼­ÎļþÖУ¬¸ñʽΪ£º

:r !ÃüÁî

3¡¢ ÖúÁ¦±à³ÌµÄ²éѯ¹¦ÄÜ

ÒÔÇ°ÔÚLinuxϵͳÏÂдһЩCÓïÑÔ³ÌÐò£¬ÓÐʱ¼ÇÐÔ²»ºÃ£¬Íü¼ÇÁËÓï·¨¸ñʽ£¬Ê¹ÓÃVim/Vi±àдʱ¿ÉÖ±½Ó²éѯ¡£Èçд³ÌÐòдµ½forkʱ£¬Í»È»Ê§ÒäÁË£¨Ê§È¥Á˶ÔÕâ¸ö¶«¶«µÄ¼ÇÒ䣩£¬¾Í¿ÉÒÔÖ±½Ó°Ñ¹â±êÒƶ¯µ½forkÉÏ£¬°´¡°K¡±£¨´óдµÄK£©£¬Ö±½Ó¾Í»áÌøµ½Linux³ÌÐòÔ±Êֲᣬ¿´µ½forkµÄ°ïÖú£¬¿´Íêºó»Ø³µ¼ÌÐø±àд£¬Ë¬°¡----

4¡¢ÅäÖÃÎļþ.vimrc

Ç°ÃæÌáµ½µÄ¿ì½Ý¼ü¡¢abÃüÁîµÈµÄÓ¦Óã¬ÉèÖúóÖ»ÔÚµ±Ç°±à¼­ÎļþÖÐÓÐЧ£¬Èç¹ûÏëÈÃËüÓÀ¾ÃÉúЧÐèÒª±à¼­Óû§ËÞÖ÷Ŀ¼ÏµÄ.vimrcÎļþ£¬ÈçÄãÊÇrootÓû§£¬Ôò±à¼­/root/.vimrc£¨´ËÎļþĬÈϲ»´æÔÚ£©¡£

дÈëÄã³£ÓõÄÉèÖÃÃüÁî¼´¿É£¬È磺

:set nu

:map ^M isam_helen@vip.163.com

:ab sammail limingkillyou@163.com

¡­¡­

ÒÔºó¾ÍÓÀ¾ÃÉúЧÁË£¡
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 10 ÌõÆÀÂÛ

  1. qxfsy ÓÚ 2013-12-27 11:19:10·¢±í:

    ºÃ¶«Î÷£¡

  2. jeffkuang1 ÓÚ 2013-10-12 20:18:03·¢±í:

    ÕæµÄºÃÇ¿´óѽ¡£

  3. honglianqxw123 ÓÚ 2012-12-19 09:10:13·¢±í:

    лл¥Ö÷µÄ·ÖÏí¡£

  4. Vermilioner ÓÚ 2012-12-16 22:22:32·¢±í:

    7# 1152217987



    ¸Ðл¥Ö÷µÄ·ÖÏí£¬£¬£¬£¬£¬

  5. 1152217987 ÓÚ 2012-11-03 11:32:16·¢±í:

    ѧϰÁË£¡

  6. wqerttyu ÓÚ 2012-10-27 22:50:45·¢±í:

    ºÜºÃºÜÇ¿´ó¡£¡£¡£

  7. wqerttyu ÓÚ 2012-10-27 22:49:43·¢±í:

    ºÜºÃºÜÇ¿´ó¡£¡£¡£

  8. ÓÚ 2012-10-27 09:37:58·¢±í:

    Ctrl+P±¾ÉíÊÇÊäÈëģʽϵÄ×Ô¶¯²¹È«¿ì½Ý¼ü¡£

  9. 11420205 ÓÚ 2012-05-22 20:36:27·¢±í:

    °¥

  10. ²ÐÑôÒ¹Îè ÓÚ 2007-07-03 16:07:51·¢±í:

    ѧϰÁË