NVI FAQ Source: https://sites.google.com/a/bostic.com/keithbostic/the-berkeley-vi-editor-home-page/nvi-faq 1. HOW CAN I GET VI TO DISPLAY MY CHARACTER SET? Vi uses the C library routine isprint(3) to determine if a character is printable, or should be displayed as an octal or hexadecimal value on the screen. Generally, if vi is displaying printable characters in octal/hexadecimal forms, your environment is not configured correctly. Try looking at the man pages that allow you to configure your locale. For example, to configure an ISO 8859-1 locale under Solaris using csh: setenv LANG C setenv LC_CTYPE iso_8859_1 If there is no other solution, you can use the print and noprint edit options of vi to specify that a specific character is printable or not printable. 2. MY MAP COMMANDS WON'T WORK One thing that you should immediately check if a vi map does not work is if it depends on the final cursor position after a P or p command. Historic vi implementations were inconsistent regarding the final cursor position. Vi follows the POSIX 1003.2 standard and always places the cursor on the first character. 3. I'M USING KSH OR CSH AS MY VI EDIT OPTION SHELL VALUE, AND FILE EXPANSIONS DON'T WORK RIGHT The problem may be in your shell startup files, such as: .cshrc Vi executes the shell to perform name expansion, and the shell generally reads its startup files. If the startup files are not correctly configured for non-interactive use, vi may be unable to parse the output. For example, startup files that always echo prompts or messages to the screen can break expansion handling. 4. HOW DOES THE ICLOWER EDIT OPTION DIFFER FROM THE IGNORECASE (IC) EDIT OPTION? The ignorecase edit option always ignores the case of letters in regular expressions. The iclower edit option only ignores case if there are no uppercase letters in the regular expression. If any uppercase letter appears in the expression, matching becomes case-sensitive. 5. WHEN I EDIT BINARY FILES, VI APPENDS A TO THE LAST LINE This is historic vi behavior and is required by the POSIX 1003.2 standard. Future versions were expected to provide an option to disable this behavior. 6. MY CURSOR KEYS DON'T WORK WHEN I'M IN TEXT INPUT MODE A common problem over slow links is that the characters generated by cursor keys do not arrive close enough together for vi to interpret them as a single escape sequence. Try increasing the value of the escapetime edit option. This causes vi to wait longer before deciding that an escape sequence has ended. 7. WHEN I EDIT SOME FILES, VI SEEMS TO HANG FOREVER Vi uses flock(2) and fcntl(2) for file locking. When editing files on NFS-mounted filesystems, lock operations may hang for a very long time. Turning off the lock edit option prevents vi from attempting to acquire locks on edited files. 8. WHEN I COMPILE VI I GET LOTS OF WARNINGS ABOUT POINTER ASSIGNMENTS BEING INCOMPATIBLE Vi is partially written to support wide characters. Some interfaces still mix wide-character and non-wide-character code, causing pointer type mismatches during compilation. 9. I GET JUMPY SCROLLING BEHAVIOR IN THE SCREEN This is usually caused by broken or incomplete terminfo/termcap entries. If scrolling region capabilities are missing or incorrect, screen updates may appear unstable. Historic vi implementations often avoided this problem because they implemented their own screen handling instead of using curses libraries. The recommended solution is to install a proper terminfo or termcap entry for the terminal. 10. THE ENTIRE SCREEN REPAINTS ON EVERY KEYSTROKE Your system curses implementation is likely broken. Use the curses implementation provided with vi or use an alternative implementation such as ncurses. 11. WHEN I USE VI ON A SUN CONSOLE (SUN-34) THE SCREEN IS OCCASIONALLY TRASHED The Sun console cannot properly handle the 'al' (insert line) terminal capability. Removing the problematic capability from the terminfo/termcap entry fixes the issue. 12. I DON'T HAVE A VERSION OF CTAGS (OR IT DOESN'T TAG ENOUGH THINGS) The FAQ references multiple ctags implementations, including Exuberant Ctags. Exuberant Ctags supported: - macro definitions - enumerated values - functions and methods - struct/union/enum tags - typedefs - variable declarations and more. 13. WHEN I UPDATE A FILE I ALREADY HAVE OPEN, AND USE :e TO REREAD IT, I GET NULS The system mmap(2) implementation likely contains a bug. The workaround is to exit vi and reopen the file. 14. WHERE CAN I GET CSCOPE? The FAQ references commercial UNIX versions and an Open Source version of cscope. Open Source cscope: http://cscope.sourceforge.net/ 15. THE WORD BOUNDARY MATCHING IN REGULAR EXPRESSIONS ISN'T WORKING Make sure you are using the regular expression package supplied with nvi. Word boundary matching was an extension to the POSIX 1003.2 regular expression standard and many vendor implementations did not support it. NOTES This FAQ reflects classic Unix and BSD engineering practices from the 1990s. Many topics remain relevant today, including: - locale configuration - UTF-8 handling - terminal descriptions - curses behavior - shell startup scripts - NFS locking - regular expression portability - screen repaint issues The document also provides historical insight into traditional vi behavior and portability concerns. ------------------------------------------------------------------ Last Modified: 2026-05-09 23:46:00 UTC