1. 程式人生 > 其它 >第七章 Editing more than one file

第七章 Editing more than one file

技術標籤:我的 vim 幫助vim

usr_07 Editing more than one file

07.1 Edit another file

:edit foo.txt

07.2 A list of files

vim one.c two.c three.c
:next
:wnext

WHERE AM I?

        :args

MOVING TO OTHER ARGUMENTS

        :previous
        :wprevious
        :last
        :first
        :2next

AUTOMATIC WRITING

        :set autowrite

EDITING ANOTHER LIST OF FILES

        :args five.c six.c seven.h
        :args *.txt

DID YOU EDIT THE LAST FILE?

07.3 Jumping from file to file

ctrl-^

PREDEFINED MARKS

`"

回到過去

`.

回到改變的過去
FILE MARKS

mx
`x
50%mF
GmB
        :marks M
        :marks MCP

07.4 Backup files

        :set backup
        :set backupext=.bak

KEEPING THE ORIGINAL FILE

        :set patchmode=.orig

07.5 Copy text between files

        :edit thisfile
        /This
        vjjjj$y
        :edit otherfile
        /There
        p

USING REGISTERS
A register is a place where Vim stores text.

        "fyas
        "l3Y
        CTRL-Vjjww"by
        "fp
        "wdaw

APPENDING TO A FILE

        :write >> logfile

07.6 Viewing a file

To start Vim in readonly mode, use this command: >

vim -R file
view file
vim -M file
:set modifiable
:set write

07.7 Changing the file name

        :edit copy.c
        :saveas move.c
        :file move.c