1. Trang chủ
  2. » Công Nghệ Thông Tin

Learning the vi Text Editor 6th phần 10 ppsx

25 363 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 25
Dung lượng 375,93 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

taglength Defines number of characters that are significant for tags.. Default zero means that all characters are significant.. By default, vi searches the file tags in the current direc

Trang 1

Appendix C Setting Options

This appendix describes the important set command options for

Solaris 2.6 vi, nvi 1.79, elvis 2.0, vim 5.1, and vile 8.0

C.1 Solaris 2.6 vi Options

Table C.1 contains brief descriptions of the important set command options In the first column, options are listed in alphabetical order; if the option can be abbreviated, that abbreviation is shown in parentheses The second column

shows the default setting that vi uses unless you issue an explicit set command

(either manually or in the exrc file) The last column describes what the option

does, when enabled

Table C.1 Solaris 2.6 vi Set Options

Option Default Description

beautify

(bf) nobf Ignores all control characters during input

(except tab, newline, or formfeed)

Despite the name, no actual version of ed

actually behaved this way

errorbells

(eb) errorbells Sounds bell when an error occurs

exrc (ex) noexrc Allows the execution of exrc files that reside

outside the user's home directory

Inserts indents in appropriate lisp format ( ),

{ }, [[, and ]] are modified to have meaning for lisp

list nolist

Prints tabs as ^I; marks ends of lines with $ (Use list to tell if end character is a tab or a space.)

magic magic Wildcard characters . (dot), * (asterisk), and []

Trang 2

(brackets) have special meaning in patterns

mesg mesg Permits system messages to display on terminal

while editing in vi

novice nonovice Requires the use of long ex command names,

such as copy or read

number (nu) nonu Displays line numbers on left of screen during

editing session

open open

Allows entry to open or visual mode from ex Although not in Solaris 2.6 vi, this option has traditionally been in vi, and may be in your UNIX's version of vi

optimize

(opt) noopt

Abolishes carriage returns at the end of lines when printing multiple lines, speeds output on dumb terminals when printing lines with leading whitespace (spaces or tabs)

paragraphs

(para) IPLPPPQP LIpplpipbp

Defines paragraph delimiters for movement by

{ or } The pairs of characters in the value are

the names of troff macros that begin

vi redraws the screen whenever edits are made

(in other words, insert mode pushes over existing characters, and deleted lines immediately close up) Default depends on line speed and terminal type noredraw is useful at slow speeds on a dumb terminal: deleted lines show up as @, and inserted text appears to overwrite existing text until you press ESC

remap remap Allows nested map sequences

report 5

Displays a message on the status line whenever you make an edit that affects at least a certain number of lines For example, 6dd reports the message "6 lines deleted."

scroll [ window] Number of lines to scroll with ^D and ^U

commands

sections

(sect) SHNHH HU

Defines section delimiters for [[ and ]]

movement The pairs of characters in the value

are the names of troff macros that begin

sections

shell (sh) /bin/sh

Pathname of shell used for shell escape (:!) and shell command (:sh) Default value is derived from shell environment, which varies on different systems

Trang 3

briefly to matching ( or { (If no match, rings the error message bell.) Very useful for programming

showmode noshowmode

In insert mode, displays a message on the prompt line indicating the type of insert you are making For example, "OPEN MODE," or

"APPEND MODE."

slowopen

(slow)

Holds off display during insert Default depends

on line speed and terminal type

tabstop (ts) 8

Defines number of spaces that a TAB indents during editing session (Printer still uses system tab of 8.)

taglength

Defines number of characters that are significant for tags Default (zero) means that all characters are significant

tags tags /usr/lib/tags

Defines pathname of files containing tags (See the UNIX ctags command.) (By default, vi searches the file tags in the current directory and /usr/lib/tags.)

tagstack tagstack Enables stacking of tag locations on a stack

terse noterse Displays shorter error messages

timeout (to) timeout Keyboard maps time out after 1 second.[A]

ttytype Sets terminal type This is just another name

writeany

(wa) nowa Allows saving to any file

[A] When you have mappings of several keys (for example, :map zzz 3dw ), you probably want to use

notimeout Otherwise you need to type zzz within 1 second When you have an insert mode mapping for a cursor key (for example, :map! ^[OB ^[ja ), you should use timeout Otherwise, vi won't react to ESC until

you type another key

C.2 nvi 1.79 Options

nvi 1.79 has a total of 78 options that affect its behavior Table C.2 summarizes the most important ones Most options described in Table C.1 are not repeated here

Table C.2 nvi 1.79 Set Options

Option Default Description

Trang 4

A string describing a backup filename to use The current contents of a file are saved in this file before writing the new data out For example, a value of "N%.bak" causes nvi to

include a version number at the end of the file; version numbers are always

When the first character of this string is

entered on the colon command line, nvi

opens a new window on the command history that you can then edit Hitting RETURN on any given line executes that line ESC is a good choice for this option (Use ^V

^[ to enter it.)

comment nocomment

If the first non-empty line begins with /*,

//, or #, nvi skips the comment text before

displaying the file This avoids displaying long, boring legal notices

directory

(dir)

environment variable

TMPDIR, or /tmp The directory where nvi puts its temporary files

extended noextended Searches use egrep-style extended regular

expressions

filec

When the first character of this string is

entered on the colon command line, nvi

treats the blank delimited word in front of the cursor as if it had an * appended to it and does shell-style filename expansion ESC

is a also good choice for this option (Use ^V

^[ to enter it.) When this character is the same as for the cedit option, command line editing is performed only when the character

is entered as the first character on the colon command line

iclower noiclower

Make all regular expression searches case insensitive, as long as the search pattern contains no uppercase letters

leftright noleftright Long lines scroll the screen left to right,

instead of wrapping

lock lock

nvi attempts to get an exclusive lock on the

file Editing a file that cannot be locked creates a read-only session

octal nooctal Displays unknown characters in octal,

instead of in hexadecimal

path A colon-separated list of directories in which

nvi will look for the file to be edited

recdir /var/tmp/vi.recover The directory where recovery files are stored

ruler noruler Displays the row and column of the cursor

searchincr nosearchincr Searches are done incrementally

Trang 5

secure nosecure

Turns off access to external programs via text filtering (:r!, :w!), disables the vi mode

! and ^Z commands, and the ex mode !,

shell, stop, and suspend commands Once set, it cannot be changed

shellmeta ~{[*?$`'"\

When any of these characters appear in a

filename argument to an ex command, the

argument is expanded by the program named by the shell option

showmode

(smd) noshowmode

Displays a string in the status line showing the current mode Displays an * if the file has been modified

sidescroll 16

The number of columns by which the screen

is shifted left or right when leftright is true

taglength

(tl) 0

Defines number of characters that are significant for tags Default (zero) means that all characters are significant

tags (tag) tags /var/db/libc.tags

/sys/kern/tags The list of possible tag files

tildeop notildeop The ~ command takes an associated motion,

not just a preceding count

wraplen

(wl) 0

Identical to the wrapmargin option, except that it specifies the number of characters from the left margin at which the line will be split The value of wrapmargin overrides

wraplen

C.3 elvis 2.0 Options

elvis 2.0 has a total of 144 options that affect its behavior Table C.3 summarizes the most important ones Most options described in Table C.1 are not repeated here

Table C.3 elvis 2.0 Set Options

Option Default Description

autoiconify

(aic) noautoiconify

Iconify the old window when de-iconifying a new one

backup (bk) nobackup Make a backup file (xxx.bak) before writing the

current file out to disk

binary (bin) The buffer's data is not text This option is set automatically

boldfont

(xfb) The name of the bold font

bufdisplay

(bd) normal

The default display mode for the buffer (hex,

html, man, normal, or syntax)

ccprg (cp) cc ($1?$1:$2)The shell command for :cc

commentfont

(cfont) The name of the font used for comments

Trang 6

(lpcols) 80 The width of a printer page; for :lpr

lpcrlf (lpc) nolpcrlf The printer needs CR-LF for newline in the file;

lpwrap (lpw) lpwrap Simulate line-wrap; for :lpr

makeprg (mp) make $1 The shell command for :make

(pfont) The font used for preprocessor commands

ruler (ru) noruler Display the cursor's line and column

(ss) 0 The sideways scrolling amount Zero mimics vi,

making lines wrap

stringfont

(sfont) The font used for strings

taglength 0 Defines number of characters that are significant

Trang 7

(tl) for tags Default (zero) means that all characters

The number of undoable commands Zero mimics

vi You probably want to set this to a bigger

number

variablefont

(vfont) The font used for variables

warpback

(wb) nowarpback Upon exit, move the pointer back to the xterm

which started elvis

warpto (wt) don't

How ^W ^W forces pointer movement: don't for

no movement, scrollbar moves the pointer to the scrollbar, origin moves the pointer to the upper left corner, and corners moves it to the corners furthest from and nearest to the current cursor position This forces the X display to pan,

to make sure the window is entirely onscreen

C.4 vim 5.1 Options

vim 5.1 has a total of 170 options that affect its behavior Table C.4 summarizes the most important ones Most options described in Table C.1 are not repeated here

The summaries in the table here are of necessity very brief Much more

information about each option may be found in the vim online help

Table C.4 vim 5.1 Set Options

Values are: 0 for vi compatibility, 1 to

backspace over newlines, and 2 to backspace over the start of insert Using a value of 3 allows both

backup (bk) nobackup

Make a backup before overwriting a file, then leave it around after the file has been successfully written To have a backup file just while the file is being written, use the

Trang 8

create a backup file The name (dot) means the same directory as where the edited file is

backupext

(bex) ~ The string which is appended to a file name

to make the name of the backup file

binary (bin) nobinary

Changes a number of other options to make

it easier to edit binary files The previous values of these options are remembered and restored when bin is switched back off Each buffer has its own set of saved option

values This option should be set before

editing a binary file You can also use the -b

command line option

cindent (cin) nocindent Enables automatic smart C program

cinoptions

(cino) Affects the way C program See the online help for details cindent reindents lines in a

cinwords

(cinw) if, else, while, do, for, switch

These keywords start an extra indent in the next line when smartindent or cindent is set For cindent this is only done at an appropriate place (inside { })

.vimrc file is found

Makes vim behave more like vi in too many

ways to describe here It is on by default, to

avoid surprises Having a vimrc turns off the

vi compatibility; usually this is a desirable

side effect

cpoptions

(cpo) aABceFs

A sequence of single character flags, each

one indicating a different way in which vim will or will not exactly mimic vi When empty, the vim defaults are used See the

on-line help for details

define (def) ^#\s*define

A search pattern that describes macro definitions The default value is for C programs For C++, use ^\(#\s*define\

|[a-z]*\s*const\s*[a-z]*\) When using the :set command, you need to double the backslashes

(dot) means to put the swap file in the same directory as the edited file Using . first in the list is recommended so that editing the same file twice will result in a warning

equalprg (ep) External program to use for = command

Trang 9

When this option is empty the internal formatting functions are used

errorfile

(ef) errors.err

Name of the errorfile for the quickfix mode

When the -q command line argument is

used, errorfile is set to the following argument

automatically

fileformats

(ffs) dos,unix

Lists the line-terminating conventions that

vim will try to apply to a file when reading

Multiple names enable automatic end-of-line detection when reading a file

gdefault (gd) nogdefault Causes the substitute command to change

all instances

guifont (gfn) A comma-separated list of fonts to try when starting the GUI version of vim

hidden (hid) nohidden Hides the current buffer when it is unloaded

from a window, instead of abandoning it

Controls how many ex commands, search

strings and expressions are remembered in the command history

icon noicon

vim attempts to change the name of the icon

associated with the window where it is running Overridden by the iconstring

option

iconstring String value used for the icon name of the window

include (inc) ^#\s*include

Defines a search pattern for finding include commands The default value is for C programs

options, below

isident (isi) @,48-57,_,192-255 A list of characters that can be included in

identifiers Non-UNIX systems may have

Trang 10

different default values

iskeyword

(isk) @,48-57,_,192-255

A list of characters that can be included in keywords Non-UNIX systems may have different default values Keywords are used

in searching and recognizing with many commands, such as w, [i, and many more

isprint (isp) @,161-255

A list of characters that can be displayed directly to the screen Non-UNIX systems may have different default values

makeef (mef) /tmp/vim##.err

The errorfile name for the :make command Non-UNIX systems have different default values The ## is replaced by a number to make the name unique

makeprg (mp) make The program to use for the :make command

% and # in the value are expanded

mouse Enable the mouse in non-GUI versions of vim This works for MS-DOS, Win32, and

xterm See the online help for details

mousehide

(mh) nomousehide

Hides the mouse pointer during typing Restores the pointer when the mouse is moved

paste nopaste

Changes a large number of options so that

pasting into a vim window with a mouse

does not mangle the pasted text Turning it off restores those options to their previous values See the online help for details

ruler (ru) noruler Shows the line and column number of the

(sp) The shell string to use for capturing the output from :make into a file The default

value depends upon the shell

shellredir

(srr) The shell string for capturing the output of a filter into a temporary file The default value

depends upon the shell

suffixes *.bak,~,.o,.h, .info,.swp

When multiple files match a pattern during filename completion, the value of this variable sets a priority among them, in order

to pick the one vim will actually use

taglength

Defines number of characters that are significant for tags Default (zero) means that all characters are significant

Trang 11

tagrelative

(tr)

vim default: tr, vi

default: notr

Filenames in a tags file from another

directory are taken to be relative to the

directory where the tags file is

tags (tag) ./tags,tags

Filenames for the :tag command, i.e., add the colon and put the whole thing in courier, separated by spaces or commas The leading

./ is replaced with the full path to the current file

tildeop (top) notildeop Makes the ~ command behave like an

operator

undolevels

The maximum number of changes that can

be undone A value of 0 means vi

compatibility: one level of undo and uundoes itself Non-UNIX systems may have different default values

viminfo (vi)

Reads the viminfo file upon startup and

writes it upon exiting The value is complex;

it controls the different kinds of information

that vim will store in the file See the online

help for details

writebackup

(wb) writebackup

Make a backup before overwriting a file The backup is removed after the file was

successfully written, unless the backup

option is also on

C.5 vile 8.0 Options

vile 8.0 has a total of 92 options that affect its behavior Table C.5 summarizes the most important ones Most options described in Table C.1 are not repeated here

Table C.5 vile 8.0 Set Options

alt-tabpos noatp

Controls whether the cursor sits at the left or right end of the whitespace representing a TAB character

animated animated

Automatically updates the contents of scratch buffers when their contents would change

autobuffer (ab)autobuffer

Uses "most-recently-used" style buffering; the buffers are sorted in order of use Otherwise, buffers remain

in the order in which they were edited

autosave (as) noautosave

Automatic file saving Writes the file after every autosavecnt characters of inserted text

Trang 12

hello.c~ backups under UNIX

bcolor Sets the background color on systems that support it

check-modtime nocheck-modtime

Issues a file newer than buffer warning

if the file has changed since last read or written, and prompts for confirmation

cmode off A built-in major mode for C code

comment-prefix ^\s*\(\s*[#*>]\)\+

Describes the leading part of a line that should be left alone when reformatting comments The default value is good for

Makefile, shell and C comments, and

email

comments ^\s*/\?\(\s*[#*>] \)\+/\?\s*$

A regular expression defining commented paragraph delimiters Its purpose is to preserve paragraphs inside comments when reformatting

vile checks each name when scanning

directories for filename completion This allows you to distinguish between directory names and filenames in the prompt

Strips out the CR from CR-LF pairs when reading files, and puts them back when writing New buffers for non-existent files inherit the line-style of the operating system, whatever the value

fence-if ^\s*#\s*if

fence-elif ^\s*#\s*elif\>

fence-else ^\s*#\s*else\>

fence-fi ^\s*#\s*endif\>

Regular expression marking the start,

"else if," "else," and end of oriented, nested fences, such as C-preprocessor control lines

line-fence-pairs { }( )[ ] Each pair of characters denotes a set of

"fences" that should be matched with %

glob !echo %s

Controls how wildcard characters (e.g.,

* and ?) are treated in prompts for filenames A value of off disables expansion, and on uses the internal globber, which can handle normal shell wildcards and ~ notation The default value for UNIX guarantees compatibility with your shell

history (hi) history Logs commands from the colon

Ngày đăng: 08/08/2014, 21:23