[BACK]Return to FAQ CVS log [TXT][DIR] Up to [local] / src / usr.bin / vi

Annotation of src/usr.bin/vi/FAQ, Revision 1.2

1.2     ! michaels    1: @(#)FAQ        8.10 (Berkeley) 8/10/96
1.1       deraadt     2:
1.2     ! michaels    3: Q: How can I get vi to display my character set?
        !             4: A: Vi uses the C library routine isprint(3) to determine if a character
1.1       deraadt     5:    is printable, or should be displayed as an octal or hexadecimal value
1.2     ! michaels    6:    on the screen.  Generally, if vi is displaying printable characters
1.1       deraadt     7:    in octal/hexadecimal forms, your environment is not configured correctly.
                      8:    Try looking at the man pages that allow you to configure your locale.
                      9:    For example, to configure an ISO 8859-1 locale under Solaris using csh,
                     10:    you would do:
                     11:
                     12:        setenv LANG C
                     13:        setenv LC_CTYPE iso_8859_1
                     14:
                     15:    Other LC_CTYPE systems/values that I'm told work:
                     16:
                     17:    System      Value
                     18:    ======      =====
                     19:    FreeBSD     lt_LN.ISO_8859-1
                     20:    HP-UX  9.X  american.iso88591
                     21:    HP-UX 10.X  en_US.iso88591
                     22:    SunOS  4.X  iso_8859_1
                     23:    SunOS  5.X  iso_8859_1
                     24:
                     25: Q: My map won't work!
                     26: A: One thing that you should immediately check if a vi map doesn't work
                     27:    is if depends on the final cursor position after a P or p command.
                     28:    Historic vi's were inconsistent as to the final position of the cursor,
                     29:    and, to make matter worse, the final cursor position also depended on
1.2     ! michaels   30:    whether the put text came from a named or unnamed buffer!  Vi follows
1.1       deraadt    31:    the POSIX 1003.2 standard on this one, and makes this consistent, always
                     32:    placing the cursor on the first character.
                     33:
                     34: Q: I'm using ksh or csh as my vi edit option shell value, and file
                     35:    expansions don't work right!
                     36: A: The problem may be in your ksh or csh startup files, e.g., .cshrc.  Vi
                     37:    executes the shell to do name expansion, and the shell generally reads
                     38:    its startup files.  If the startup files are not correctly configured
                     39:    for non-interactive use, e.g., they always echo a prompt to the screen,
                     40:    vi will be unable to parse the output and things will not work
                     41:    correctly.
                     42:
                     43: Q: How does the iclower edit option differ from the ignorecase (i.e. ic)
                     44:    edit option?
                     45: A: The difference is that the ignorecase edit option always ignores the
                     46:    case of letters in the Regular Expression (RE), and the iclower edit
                     47:    option only ignores the case if there are no upper-case letters in the
                     48:    RE.  If any upper-case letters appear in the Regular Expression, then
                     49:    it will be treated case-sensitively, as if the ignorecase edit option
                     50:    was not set.
                     51:
1.2     ! michaels   52: Q: When I edit binary files, vi appends a <newline> to the last line!
1.1       deraadt    53: A: This is historic practice for vi, and further, it's required by the
                     54:    POSIX 1003.2 standard.  My intent is to provide a command line and/or
                     55:    edit option to turn this behavior off when I switch to version 2.0 of
                     56:    the Berkeley DB package.
                     57:
                     58: Q: My cursor keys don't work when I'm in text input mode!
                     59: A: A common problem over slow links is that the set of characters sent by
                     60:    the cursor keys don't arrive close enough together for vi to understand
                     61:    that they are a single keystroke, and not separate keystrokes.  Try
                     62:    increasing the value of the escapetime edit option, which will cause
                     63:    vi to wait longer before deciding that the <escape> character that
                     64:    starts cursor key sequences doesn't have any characters following it.
                     65:
1.2     ! michaels   66: Q: When I edit some files, vi seems to hang forever, and I have to kill it.
        !            67: A: Vi uses flock(2) and fcntl(2) to do file locking.  When it attempts to
1.1       deraadt    68:    acquired a lock for a file on an NFS mounted filesystem, it can hang
                     69:    for a very long (perhaps infinite) period of time.  Turning off the
1.2     ! michaels   70:    "lock" edit option will keep vi from attempting to acquire any locks
1.1       deraadt    71:    on the files you edit.
1.2     ! michaels   72:
        !            73: Q: When I compile vi I get lots of warnings about pointer assignments
        !            74:    being incompatible!
        !            75: A: Vi is partially written to support wide characters.  When this code
        !            76:    interfaces with the code that doesn't yet support wide characters,
        !            77:    the pointer types clash.  This will hopefully be fixed in the near
        !            78:    future, but I've been saying that for awhile, now.
        !            79:
        !            80: Q: I get jumpy scrolling behavior in the screen!
        !            81: A: This is almost certainly a problem with the system's terminfo or
        !            82:    termcap information for your terminal.  If the terminfo/termcap entry
        !            83:    doesn't have the settable scrolling region capabilities, or the more
        !            84:    powerful scrolling commands, these behaviors can result.  Historic
        !            85:    implementations of vi, and some of the vi clones, don't suffer from
        !            86:    this problem because they wrote their own screen support instead of
        !            87:    using the curses library.
        !            88:
        !            89:    The solution is to find a good terminfo or termcap entry for your
        !            90:    terminal, which will fix the problem for all of the applications on
        !            91:    your system, not just vi.  Eric Raymond maintains the freely
        !            92:    redistributable termcap/terminfo entries.  They can be downloaded
        !            93:    from http://www.ccil.org/~esr/ncurses.html, or you can contact him
        !            94:    at esr@snark.thyrsus.com.
        !            95:
        !            96: Q: The entire screen repaints on every keystroke!
        !            97: A: Your system's curses implementation is broken.  You should use the
        !            98:    curses implementation provided with vi or a curses replacment such as
        !            99:    ncurses.  Eric Raymond is one of the maintainers of the freely
        !           100:    redistributable ncurses package.  You can download ncurses from
        !           101:    http://www.ccil.org/~esr/ncurses.html, or you can contact him at
        !           102:    esr@snark.thyrsus.com.
        !           103:
        !           104: Q: When I use vi on a Sun console (terminal type sun-34) the screen
        !           105:    is occasionally trashed, usually when exiting vi!
        !           106: A: The Sun console can't handle the 'al' capability of the termcap
        !           107:    entry (the il1 capability of terminfo entries).  If you delete that
        !           108:    entry from your terminfo/termcap information everything should work
        !           109:    correctly.
        !           110:
        !           111: Q: I don't have a version of ctags (or I have ctags, but it doesn't tag
        !           112:    nearly enough things)!
        !           113: A: There's a version of ctags available on the 4.4BSD-Lite distributions,
        !           114:    as well as the FreeBSD, NetBSD, Linux and GNU distributions.  Or, you
        !           115:    might want to try Exuberant Ctags:
        !           116:
        !           117:        Title:          Exuberant Ctags
        !           118:        Version:        1.3
        !           119:        Entered-date:   16JUN96
        !           120:        Description:
        !           121:            A better ctags which generates tags for all possible tag types:
        !           122:            macro definitions, enumerated values (values inside enum{...}),
        !           123:            function and method definitions, enum/struct/union tags, external
        !           124:            function prototypes (optional), typedefs, and variable
        !           125:            declarations. It is far less easily fooled by code containing #if
        !           126:            preprocessor conditional constructs, using a conditional path
        !           127:            selection algorithm to resolve complicated choices, and a
        !           128:            fall-back algorithm when this one fails. Can also be used to print
        !           129:            out a list of selected objects found in source files.
        !           130:        Keywords:       ctags, tags, exuberant
        !           131:        Author:         darren@sirsi.com (Darren Hiebert)
        !           132:                        darren@hiwaay.net (Darren Hiebert)
        !           133:        Maintained-by:  darren@sirsi.com (Darren Hiebert)
        !           134:                        darren@hiwaay.net (Darren Hiebert)
        !           135:        Primary-site:   sunsite.unc.edu /pub/Linux/devel/lang/c
        !           136:                        27kB ctags-1.3.tar.gz
        !           137:        Alternate-site: ftp.halcyon.com /local/gvr
        !           138:                        27kB ctags-1.3.tar.gz
        !           139:        Original-site:
        !           140:        Platforms:      UNIX, MSDOS, WindowsNT, Windows95, OS/2, Amiga
        !           141:        Copying-policy: Public domain
        !           142:
        !           143: Q: When I update a file I already have open, and use :e to reread it, I
        !           144:    get nul's for the rest of the file!
        !           145: A: Your system's implementation of mmap(2) has a bug; you will have to
        !           146:    exit vi and re-execute it.