PREV Abbreviation Facilities UP Improvements over Vi NEXT New Commands

2.8: Movement and Markers

Viper can be set free from the line--limited movements in Vi, such as l refusing to move beyond the line, ESC moving one character back, etc. These derive from Ex, which is a line editor. If your `.viper' contains

(setq viper-ex-style-motion nil)

the motion will be a true screen editor motion. One thing you must then watch out for is that it is possible to be on the end-of-line character. The keys x and % will still work correctly, i.e., as if they were on the last character.

The word-movement commands w, e, etc., and the associated deletion/yanking commands, dw, yw, etc., can be made to understand Emacs syntax tables. If the variable viper-syntax-preference is set to strict-vi then the meaning of word is the same as in Vi. However, if the value is reformed-vi (the default) then the alphanumeric symbols will be those specified by the current Emacs syntax table (which may be different for different major modes) plus the underscore symbol _, minus some non-word symbols, like '.;,|, etc. Both strict-vi and reformed-vi work close to Vi in traditional cases, but reformed-vi does a better job when editing text in non-Latin alphabets.

The user can also specify the value emacs, which would make Viper use exactly the Emacs notion of word. In particular, the underscore may not be part of a word. Finally, if viper-syntax-preference is set to extended, Viper words would consist of characters that are classified as alphanumeric or as parts of symbols. This is convenient for writing programs and in many other situations.

viper-syntax-preference is a local variable, so it can have different values for different major modes. For instance, in programming modes it can have the value extended. In text modes where words contain special characters, such as European (non-English) letters, Cyrillic letters, etc., the value can be reformed-vi or emacs.

Changes to viper-syntax-preference should be done in the hooks to various major modes by executing viper-set-syntax-preference as in the following example:

(viper-set-syntax-preference nil "emacs")

The above discussion of the meaning of Viper's words concerns only Viper's movement commands. In regular expressions, words remain the same as in Emacs. That is, the expressions \w, \>, \<, etc., use Emacs' idea of what is a word, and they don't look into the value of variable viper-syntax-preference. This is because Viper doesn't change syntax tables in fear of upsetting the various major modes that set these tables.

Textmarkers in Viper remember the file and the position, so that you can switch files by simply doing 'a. If you set up a regimen for using Textmarkers, this is very useful. Contents of textmarkers can be viewed by [marker. (Contents of registers can be viewed by ]register).

PREV Abbreviation Facilities UP Improvements over Vi NEXT New Commands