⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elvis.9

📁 操作系统设计与实现源码
💻 9
📖 第 1 页 / 共 3 页
字号:





Command:   elvis - clone of the Berkeley vi editor
Syntax:    elvis [-Rerv] [-t tag] [file] ...
Flags:     -R  Set the read-only option
           -e  Start up emulating ex
           -r  Tell the user to use elvrec instead
           -t  Start editing at the given tag
           -v  Start up emulating vi
Examples:  elvis                    # Call the editor
           elvis prog.c             # edit prog.c

     Elvis is  a  full-screen  editor  closely  modeled  on  the  famous
Berkeley  vi  editor.  It provides essentially the same interface to the
user as vi, but the code is completely new, written from scratch.   This
document  provides  a brief introduction to vi.  It is not intended as a
tutorial for beginners.  Most books on UNIX cover vi.

     Like vi, elvis can operate as a screen editor (vi  mode)  or  as  a
line  editor  (ex)  mode.  It can be called either as elvis vi,or as ex,
depending on which is desired.  They are all links to the same file.

Vi Commands

     Below is a list  of  the  vi  commands  supported.   The  following
symbols are used in the table:

   count       Integer parameter telling how many or how much
   key         One character parameter to the command
   inp         Interactive input expected
   mv          Indicates how much for commands like delete and change:
                     (  Previous sentence
                     )  Next sentence
                     {  Previous paragraph
                     }  Next paragraph (delimited by  blank  line,  .PP,
                        .LP, .IP etc.)
                     [  Previous section (delimited by .SH or .NH)
                        A repeated command character means the scope  is
                        this line
   MOVE        Indicates commands that may also  be  used  where  mv  is
               specified
   EDIT        These commands affect text and may be repeated by  the  .
               command

In addition to  the  above  notation,  the  caret  (^)  is  used  as  an
abbreviation for CTRL.  For example, ^A means CTRL-A.

Count       Command     Description                            Type
            ^A          (Not defined)
            ^B          Move toward the top of the file by 1 screenful
            ^C          (Not defined)
count       ^D          Scroll down count lines (default 1/2 screen)


                                                                        



                                                                        


count       ^E          Scroll up count lines
            ^F          Move  toward  the  bottom  of  the  file  by   1
                        screenful
            ^G          Show file status, and the current line
count       ^H          Move left, like h                      MOVE
            ^I          (Not defined)
count       ^J          Move down                              MOVE
            ^K          (Not defined)
            ^l          Redraw the screen
count       ^M          Move to the front of the next line     MOVE
count       ^N          Move down                              MOVE
            ^O          (Not defined)
count       ^P          Move up                                MOVE
            ^Q          (Not defined)
            ^R          Redraw the screen
            ^S          (Not defined)
            ^T          (Not defined)
count       ^U          Scroll up count lines (default 1/2 screen)
            ^V          (Not defined)
            ^W          (Not defined)
            ^X          (Not defined)
count       ^Y          Scroll down count lines
            ^Z          (Not defined)
            ESC         (Not defined)
            ^\          (Not defined)
            ^]          If the cursor is on a tag name, go to that tag
            ^^          Save this file and edit the previous file
            ^_          (Not defined)
count       SPACE       Move right,like l                      MOVE
            ! mv        Run the selected lines thru an  external  filter
                        program
            " key       Select which cut buffer to use next
            #           (Not defined)
            $           Move to the rear of the current line   MOVE
            %           move to the matching (){}[] character  MOVE
            &           (Not defined)
            ' key       Move to a marked line                  MOVE
count       (           Move backward count sentences          MOVE
count       )           Move forward count sentences           MOVE
            *           (Not defined)
count       +           Move to the front of the next line     MOVE
count       ,           Repeat the previous [fFtT]  but  the  other  way
                        MOVE
count       -           Move to the front of the preceding line MOVE
            .           Repeat the previous 'edit' command
            /           Text search forward for  a  given  regular  expr
                        MOVE
            0           If not part of count, move to 1st char  of  this
                        line
                        MOVE


                                                                        



                                                                        


            1           Part of count
            2           Part of count
            3           Part of count
            4           Part of count
            5           Part of count
            6           Part of count
            7           Part of count
            8           Part of count
            9           Part of count
            :           Text. Run single ex cmd
count       ;           Repeat the previous [fFtT] cmd         MOVE
count       < mv        Shift text left                        EDIT
            =           (Not defined)
count       > mv        Shift text right                       EDIT
            ? text      Search backward for a given  regular  expression
                        MOVE
            @           (Not defined)
count       A inp       Append at end of the line              EDIT
count       B           Move back Word                         MOVE
            C inp       Change text from cursor through end of line EDIT
            D           Delete text from  cursor  through  end  of  line
                        EDIT
count       E           Move end of Word                       MOVE
count       F key       Move leftward to a given character     MOVE
count       G           Move to line #count (default is the bottom line)
                        MOVE
count       H           Move to home row (the line at  the  top  of  the
                        screen)
count       I inp       Insert at the front of the line (after  indents)
                        EDIT
count       J           Join lines, to form one big line       EDIT
            K           Look up keyword
count       L           Move to last row (the line at the bottom of  the
                        screen)
            M           Move to middle row (the line in the middle)
            N           Repeat previous search,  but  the  opposite  way
                        MOVE
count       O inp       Open up a new line above the current line EDIT
            P           Paste text before the cursor
            Q           Quit to EX mode
            R inp       Overtype                               EDIT
count       S inp       Change lines, like countcc
count       T key       Move leftward almost to a given character MOVE
            U           Undo all recent changes to the current line
            V           (Not defined)
count       W           Move forward count Words               MOVE
count       X           Delete the  character(s)  to  the  left  of  the
                        cursor
                        EDIT
count       Y           Yank text line(s) (copy them into a cut buffer)


                                                                        



                                                                        


            Z Z         Save the file & exit
            [ [         Move back 1 section                    MOVE
            \           (Not defined)
            ] ]         Move forward 1 section                 MOVE
            ^           Move to the front of  the  current  line  (after
                        indent)
                        MOVE
            _           (Not defined)
            ` key       Move to a marked character             MOVE
count       a inp       Insert text after the cursor           EDIT
count       b           Move back count words                  MOVE
            c mv        Change text                            EDIT
            d mv        Delete text                            EDIT
count       e           Move forward to the end of the current word MOVE
count       f key       Move rightward to a given character    MOVE
            g           (Not defined)
count       h           Move left                              MOVE
count       i inp       Insert text at the cursor              EDIT
count       j           Move down                              MOVE
count       k           Move up                                MOVE
count       l           Move right                             MOVE
            m key       Mark a line or character
            n           Repeat the previous search             MOVE
count       o inp       Open a new line below the current line EDIT
            p           Paste text after the cursor
            q           (Not defined)
count       r key       Replace count chars by a given character EDIT
count       s inp       Replace count chars with text from the user EDIT
count       t key       Move rightward almost to a given character MOVE
            u           Undo the previous edit command
            v           (Not defined)
count       w           Move forward count words               MOVE
count       x           Delete the character that the cursor's on EDIT
            y mv        Yank text (copy it into a cut buffer)
            z key       Scroll  current  line  to  the  screen's   +=top
                        -=bottom .=middle
count       {           Move back count paragraphs             MOVE
count       |           Move to column count (the leftmost column is 1)
count       }           Move forward count paragraphs          MOVE
count       ~           Switch a character between upper  &  lower  case
                        EDIT
            DEL         (Not defined)

Ex Commands

     Below is  a  list  of  the  ex  commands  supported.   All  can  be
abbreviated.





                                                                        



                                                                        


General


[line]        append
              args          [files]
              cd            [directory]
              chdir         [directory]
[line][,line] change
[line][,line] copy          line
[line][,line] debug[!]
[line][,line] Delete        ['x]
              edit[!]       [file]
              ex[!]         [file]
              file
[line][,line] global        /regexp/ command
[line]        Insert
[line][,line] join
[line][,line] list
              map[!]        key mapped_to
[line]        mark          x
              mkexrc
[line][,line] Move          line
              next[!]       [files]
              Next[!]
              previous[!]
[line][,line] print
[line]        put           ['x]
              quit[!]
[line]        read          file
              rewind[!]
              set           [options]
[line][,line] substitute    /regexp/replacement/[p][g]
              tag[!]        tagname
[line][,line] to            line
              Undo
              unmap[!]      key
              validate[!]
              version
[line][,line] vglobal       /regexp/ command
              visual
              wq
[line][,line] write[!]      [[>>]file]
              xit[!]
[line][,line] yank          ['x]
[line][,line] !             command
[line][,line] <
[line][,line] =
[line][,line] >




                                                                        



                                                                        


Text Entry



[line]        append
[line][,line] change ['x]
[line]        Insert

The (a)ppend command inserts text after the specified line.

The (i)nsert command inserts text before the specified line.

The (c)hange command copies the  range  of  lines  into  a  cut  buffer,
deletes them, and inserts new text where the old text used to be.

For all of these commands, you indicate  the  end  of  the  text  you're
inserting  by  hitting  ^D  or  by entering a line which contains only a
period.



Cut & Paste



[line][,line] Delete ['x]
[line][,line] yank ['x]
[line]        put[!] ['x]
[line][,line] copy line
[line][,line] to line
[line][,line] Move line

The (d)elete command copies the specified range  of  lines  into  a  cut
buffer, and then deletes them.

The (y)ank command copies the  specified  range  of  lines  into  a  cut
buffer, but does not delete them.

The (pu)t command inserts text from a cut  buffer  after  the  specified
line----or before it if the ! is present.

The (co)py and (t)o commands yank the specified range of lines and  then
immediately paste them after some other line.

The (m)ove command  deletes  the  specified  range  of  lines  and  then
immediately  pastes them after some other line.  If the destination line
comes after the deleted text, then it will be adjusted automatically  to
account for the deleted lines.




                                                                        



                                                                        


Displaying Text


[line][,line] print
[line][,line] list

The (p)rint command displays the specified range of lines.

The (l)ist command also displays them, but it is careful to make control
characters visible.


Global Operations


[line][,line] global /regexp/ command
[line][,line] vglobal /regexp/ command

The (g)lobal command searches through the lines of the  specified  range
(or  through  the  whole  file  if no range is specified) for lines that
contain a given regular expression.  It then moves the cursor to each of
these lines and runs some other command on them.

The (v)global command is similar, but it searches for lines that do  not
contain the regular expression.


Line Editing


[line][,line] join
[line][,line] ! program
[line][,line] <
[line][,line] >
[line][,line] substitute /regexp/replacement/[p][g]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -