论坛风格切换切换到宽版
  • 6128阅读
  • 8回复

[问题求助][CentOS] 命令行的CentOS 5.2里,如何退出VI编辑器? [复制链接]

上一主题 下一主题
离线gjj3000gjj.
 
发帖
2013
C币
-140552
威望
393
贡献值
1
银元
-3
铜钱
4575
人人网人气币
0
只看楼主 倒序阅读 使用道具 楼主  发表于: 2009-05-01
命令行的CentOS 5.2里,如.何退出VI.编辑器?--------------彩票

进入是输入vi吗?

退出是输入q吗?

我的.电脑,怎么没反应.的?不能退出。只好直接关闭电源了。(        游戏          )

http://upload.bbs.csuboy.com/Mon_1004/126_7059_841324b0ca21639.gif[/img] http://upload.bbs.csuboy.com/Mon_1004/126_7059_841324b0ca21639.gif[/img]http://upload.bbs.csuboy.com/Mon_1004/126_7059_841324b0ca21639.gif[/img]<性病>

评价一下你浏览此帖子的感受

精彩

感动

搞笑

开心

愤怒

无聊

灌水
发帖
2063
C币
-60532
威望
431
贡献值
1
银元
-1
铜钱
4810
人人网人气币
0
只看该作者 沙发  发表于: 2010-04-13
Re:[CentOS]


按ESC
在输入:
在输入q!

在reboot


发帖
2110
C币
-235576
威望
380
贡献值
1
银元
-4
铜钱
4875
人人网人气币
0
只看该作者 板凳  发表于: 2010-04-13
Re:[CentOS]
楼上正解,先退出VI的编辑状态,按ESC键。然后输入:q!,表示不保存退出

离线wdsguying.
发帖
2182
C币
-60076
威望
416
贡献值
1
银元
-4
铜钱
4927
人人网人气币
0
只看该作者 地板  发表于: 2010-04-13
Re:[CentOS]
VI Editor Commands

Vi has two modes insertion mode and command mode.
The editor begins in command mode, where cursor movement and copy/paste editing occur.
Most commands execute as soon as typed except for "colon" commands which execute when you press the return key.

Switch to Text or Insert mode:
                    
Open line above cursor
        O                                        
Insert text at beginning of line
        I        
Insert text at cursor
        i        
Insert text after cursor
        a        
Append text at line end
        A
                    
Open line below cursor
        o                                        

Switch to Command mode:
Switch to command mode
        <ESC>

Cursor Movement (command mode):
                    
Scroll Backward 1 screen
        <ctrl>b                    
                    
Scroll Up 1/2 screen
        <ctrl>u                    
Go to beginning of line
        0        
Go to line n
        nG        
Go to end of line
        $
                    
Scroll Down 1/2 screen
        <ctrl>d        
Go to line number ##
        :##
                    
Scroll Forward 1 screen
        <ctrl>f                    
                    
Go to last line
        G                    
Scroll by sentence f/b         ( )                                        
Scroll by word f/b         w b         Move left, down, up, right         h j k l        
Left 6 chars
        6h
Scroll by paragraph f/b         { }         Directional Movement         Arrow Keys        
Go to line #6
        6G

Deleting text (command mode):
Change word
        cw        
Replace one character
        r                    
Delete word
        dw        
Delete text at cursor
        x        
Delete entire line (to buffer)
        dd
                    
Delete (backspace) text at cursor
        X        
Delete 5 lines (to buffer)
        5dd
                    Delete current to end of line         D        
Delete lines 5-10
        :5,10d

Editing (command mode):
Copy line
        yy        
Copy n lines
        nyy        
Copy lines 1-2/paste after 3
        :1,2t 3
Paste above current line
        P        
                            
Paste below current line
        p                            
Move lines 4-5/paste after 6
        :4,5m 6
                                        
Join previous line
        J
Search backward for string
        ?string        
Search forward for string
        /string         Find next string occurrence         n
% (entire file) s (search and replace) /old text with new/ c (confirm) g (global - all)
        :%s/oldstring/newstring/cg                            
Ignore case during search
        :set ic
Repeat last command
        .        
Undo previous command
        u        
Undo all changes to line
        U

Save and Quit (command mode):
Save changes to buffer
        :w        
Save changes and quit vi
        :wq        
Save file to new file
        :w file
                    
Quit without saving
        :q!        
Save lines to new file
        :10,15w file

发帖
2004
C币
-193467
威望
388
贡献值
1
银元
-1
铜钱
4541
人人网人气币
0
只看该作者 4楼 发表于: 2010-04-13
Re:[CentOS]
原来要按两下。我以为一次性按两个键。



离线免失志.
发帖
2221
C币
5540
威望
451
贡献值
0
银元
0
铜钱
5030
人人网人气币
0
只看该作者 5楼 发表于: 2010-04-13
Re:[CentOS]
按ESC
输入:
输入q

离线sharpgun.
发帖
2091
C币
-61352
威望
408
贡献值
1
银元
-2
铜钱
4672
人人网人气币
0
只看该作者 6楼 发表于: 2010-04-13
Re:[CentOS]
命令模式下的 ZZ 也是保存退出,实在不行还可以换 tty 么~

离线实焕子.
发帖
2015
C币
-263004
威望
352
贡献值
3
银元
-5
铜钱
4354
人人网人气币
0
只看该作者 7楼 发表于: 2010-04-13
Re:[CentOS]
楼主头像好可爱。

离线喜多多.
发帖
2009
C币
-235365
威望
366
贡献值
1
银元
-5
铜钱
4496
人人网人气币
0
只看该作者 8楼 发表于: 2010-04-13
Re:[CentOS]
过掌。

这可是熊猫烧香呀。不过,好像Linux当时没有感染过。

不知道为什么。


快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个