An Introduction to the Visual Editor I. The most basic commands. Only a few commands are needed to start using the visual editor. This section discusses: 1) How to call up the editor. 2) How to exit the editor and write changes to disc. 3) The nine basic commands needed to edit any file. 1) Invoking vi. To call vi, simply type "vi filename," where "filename" is the name of the file to be edited. For example: vi junk will put the user into the file "junk". If junk does not exist, it is automatically created by vi. When the editor is called up, the crt screen is cleared. The cursor marks the current position in the file. Note that there are two modes to the editor, edit mode and insert mode. In edit mode, various characters on the keyboard have special meanings. For example, the 'j' key will move the cursor down. The 'h' key will move the cursor to the left. The 'i' key will cause the editor to change from edit mode to insert mode. In insert mode, any letter typed will be inserted into the file. Insert mode ends when the user types the "esc" key . In edit mode, the cursor cannot go beyond the bounds of text which is already in the file. For example, if there are only 11 lines in the file, the user can not move the cursor to line 12 until line 12 is created via insert mode. Attempts to go beyond the bounds of existing text will cause the terminal to beep. 2) Exiting vi. One way to exit from vi is to type "ZZ" from EDIT mode. (If ZZ is typed from INSERT mode, the letters ZZ will be inserted into the file. If in insert mode, hit and then type ZZ.) This causes all changes made in the editing session to be written to disc. It is possible to exit without writing changes by typing ":q!". This is useful if you have really messed things up and want to try anew. Here are some more useful commands for writing to disc and exiting the editor: :w write to disc; stay in the editor :q quit the editor (vi will complain about this if any changes have been made without a ':w'). :wq write to disc and leave the editor ZZ write to disc if changes have been made and leave the editor :q! quit without writing to disc. :w f1 write to the file named 'f1' (vi complains if f1 exists). :w! f1 write to the file named 'f1' (vi overwrites f1). :w>>f1 append the contents of this file to 'f1.' 3) Simple editing commands. The handful of commands needed to get started are listed below. Motion commands h - move the cursor to the left 1 character j - move the cursor down one line k - move the cursor up one line l - move the cursor to the right one character Insert and append i - insert text beginning just before the cursor. a - append text (beginning just after the cursor). delete dd - delete one line x - delete (cross out) one character undo u - undo the effect of the previous command. This can be used to get one out of trouble. With these commands the user is able to move anywhere within the file and insert or remove any text from the file. Clearly, if the file is 1000 lines long and you want to add text to the end of the file, it might take a while to get there using 'jjjjjjjjj....' This is why there are other commands available. It is a good idea to practice for a few minutes with the above commands, however, to get the feel for the editor. Note that nearly every key on the keypad has some special meaning to vi's edit mode. This includes both upper and lower case letters. For example, a lower case h means move the cursor to the left one character whereas an upper case H means move the cursor to the upper left hand corner of the screen. The keys also have special meaning to the editor. The vaste amount of commands may be somewhat confusing at first, but there is a pattern to the editor, and most of the commands are somewhat mnemonic. Before the editor pattern is discussed, it is useful to practice a bit with the commands already known and learn a few more simple commands. II. A Brief Tutorial Log in to the Unix machine of your choice and type the command: vi myfile You should now be in the editor and operating on the file "myfile." Try to type a 'j' to go down one line. Notice that the editor is beeping at you. You cannot move yet because there is no text in the file. This causes some claustrophobia among certain people. Now type 'i' to begin inserting text. Type the following text: This is the file myfile. It contains three lines. This is the third line. Then hit the key to end insertion. The cursor will be on the period of the last line. Try moving up with the 'k' key and then left and right with the h and l keys. Move around for a while. Now try the other commands. Append something to the second line by moving to the end of that line and typing the 'a' key. Whatever you type will be appended to the line. Remember to hit the key to get out of append mode. Now try the 'i' key. Insert some text. Don't forget to get out. Try to remove the word 'three' in the second line by moving the cursor to the 't' in "three" and typing 'x' five times. There is no need to hit this time since you have never gone out of EDIT mode. Finally, delete the last line of text with the command "dd". It will disappear. Now hit 'u' and see what happens. The deleted line will come back. Leave the editor by typing "ZZ". Now type the Unix command "cat myfile." The contents of myfile will appear on the screen. You have now successfully edited your first file. Now go back into the file so you can play with some more commands. Try these motion commands: G - Go to the end of the file 2G - Go to line 2 w - move forward one word $ - move to the end of the current line 0 - move to the beginning of the current line } - move to the end of the current paragraph ) - move to the end of the current sentence. Note how much easier it is to type 'G' than to type 1000 j's. These are motion commands. They move the cursor to various locations in the file. There are also action commands, which actually cause changes to be made in the file. Here are a few examples. cw - Change a word dw - Delete a word d} - Delete the rest of a paragraph Try the cw command. Set the cursor at the beginning of a word in the file and type "cw". A '$' will appear at the end of the word. Now type in a different word from the one that was there and hit the key. You have changed the word. Try 'dw' now with another word. Set the cursor at the beginning of the word and type 'dw'. The word will disappear. Now see what happens if you use 'd}'. III. A philosophical moment and a word of caution The number of commands available in vi is extraordinarily large. In command mode, nearly every key on a regular ascii keyboard has an action associated with it. These actions differ depending on whether the key is lower case or upper case. Furthermore, almost every control sequence (e.g. control-D, control-F, etc.) has a function. The function keys do not have actions associated with them, nor do alt sequences. Thus, there are in all, nearly 47x3, or 141 commands to learn. Fortunately, one does not need to learn all of these to make efficient use of the editor, much as one need not know all the words in a language to communicate in that language. A main disadvantage of vi is that one cannot just type text and expect it to appear in the file; one must first use an insert (i) or append (a) or other command to get into insert mode. However, this can also be an advantage. First, it allows the editor to be virtually independent of the keyboard being used. Only the key and the key need to be located. Secondly, for people who touch type, vi can be particularly nice because all the commands are on the keyboard and one need not constantly move from home row position to some wayward function key (or worse yet, gasp, that mouse thing that never seems to be where it's supposed to be). So much for politics. The word of caution is this. Since there are so many commands, it is possible to do strange things to your file if you begin typing without first getting into insert mode. Also, because the commands are case sensitive, it is not a good idea to use cap-lock mode while editing with vi. There are a handful of keys that have not function in the screen oriented mode of vi (although some of these are used in the line-oriented mode, ex). These commands are: # * _ = q g K \ V v ^A ^G ^K ^N ^O ^P ^Q ^S ^T ^W ^X It is useful to know these because these keys can be mapped to multiple stroke sequences with the :map command of ex. Of course, the function keys can similarly be mapped. In the text to follow, control sequences, i.e. what you get when you simultaneously hold down the "control" key and another key, are designated by the character ^. Thus, control-D is written as ^D. IV. How the editor really works. 1) action motion If you have tried the commands above, you are probably already saying, "Sure, you can do a lot of stuff with this editor, but it doesn't seem to have any rhyme or reason to it." Indeed, if you consider that 'dw' means "delete a word," you might think that "dp" would perhaps be "delete a paragraph." Such is not the case. The true syntax of the editor does make sense though. The sequence is action motion For example, c and d are action commands. One is change. The other is delete. 'w' is actually a motion command (meaning move forward to the next word). Hence, when you type 'dw', the action is delete and the motion is 'up to the next word'. That is "delete everything from here to the next word." In the command 'd}', 'd' is the action 'delete' and '}' is the motion 'to the end of the paragraph'. Hence 'd}' deletes to the end of the paragraph. Also, 'd$' "delete's" "to the end of the line." This syntax is particularly nice because ANY motion command can be used this way. 2) The motion commands Here is a more complete list of motion commands. Notes: A blank delineated word is one which has blanks on either side of it. For example, in "for the semi-big cat," "the" is blank delineated. Semi is token delineated because it ends in a '-' rather than a blank. (If you place the cursor on the 's' in 'semi' and type 'e', the cursor moves to the 'i'. If, instead, you type 'E', the cursor moves to the 'g' in big because 'E' considers the '-' to be part of the word). The expression below stands for a single arbitrary character. is a regular expression (a pattern, or group of arbitrary characters). '#' prior to a command is a decimal number (e.g. it could be 14). b - move back a word. (token delineated) B - move back a word. (blank delineated) e - move to the end of this word. (blank delineated) E - move to the end of this word. (token delineated) f - move forward to (on top of) the next occurrence of (see 'T','f', 'F', ',' and ';') F - move backword to (on top of) the next occurrence of (see 't', 'f', 'F', ',' and ';') G - go to line number # (end of file if # isn't specified). #h - move to the left # characters. H - move to the upper left hand corner of the screen. #j - move down # lines. #k - move up # lines. #l - move right # lines. L - move to lower left corner of the screen. M - move to middle of the screen. n - move to next occurrence of a (previously specified) search pattern (see also '/' and '?' and 'N'). N - move to previous occurrence of a search pattern (see '/', '?' and 'n'). t - move forward to just left of the next occurance of . (see 'T','t', 'F', ',' and ';') T - move backward to just right of the next occurance of . (see 'T','t', 'f', ',' and ';') w - move forward to the next word. (Token delineated) W - move forward to the next word. (Blank delineated) $ - move to the end of the current line. % - go to the matching '(', '{' or '[' ^ - go to the first non-white space in the file (white space is a blank or tab). ( - go to the beginning of the current sentence. ) - go to the end of the current sentence. { - go to the beginning of the current paragraph. } - go to the end of the current paragraph. [ - go to the previous 'section'. ] - go to the next 'section'. #- - go up # lines (same as 'k'). #+ - go down # lines (same as 'j'). #| - go to column number #. / - go forward to the next occurrence of (see 'n', 'N' and '?'). ? - go backward to the previous occurrence of . (see 'n', 'N' and '/'). 0 - go to the beginning of the line. , - go to #th previous 't', 'T', 'f', 'F' ; - go to #th next 't', 'T', 'f', 'F' '' - go to where you were before the last big jump `` - go to where you were before the last big jump These are clearly numerous. There are a few which should be mastered first (others you can probably get along without for a while). The important ones are probably 'G', '0', '$', 'h', 'j', 'k', 'l' and the pattern search commands, '/', '?', 'n', and 'N'. After these, the following are probably worth getting to know, '|', 't', 'f', ',', ';' 'H', 'L', 'M' '{' '}' '(' ')' and '%'. Try some 'action motion' commands with some of these motions. For example, it is paticularly pleasing that you can say 'd/frog' to delete everthing up to the next occurrence of the word 'frog'. ( stands for the return key here). Or, you can say 'dte' to delete up to the next occurrence of the character 'e' on the current line. (You will get beeped at if there is no 'e' on the line). 3) The action commands There are much fewer action commands than there are motion commands. The actions are: c - change d - delete y - yank (into a buffer) ! - execute a unix program with the specified lines as standard input. > - shift text to the right one tabstop < - shift text to the left one tabstop The yank command can be used to yank pieces of the file into a buffer. These pieces can be then put back into the file at any location with the 'p' and 'P' commands. For example, 'yw' would yank one word into the default buffer. To print this word somewhere else, simply move the cursor to where you want to put it and hit 'p'. This puts the text in the file just after the character that the cursor is sitting on. If you use 'P', the text is placed just before the character the cursor sits on. More on this topic can be found in the section 'yanking and putting' below. The '!' can be used to run unix utilities on small chunks of the text. For example, if one wished to sort lines 5 through 22 in the file, one could move the cursor to line 5 and say '!22Gsort'. The '!' is the action, the 22G is the motion. Then 'sort' is the name of the command to be run with the specified lines as standard input. Standard output is written into the file in place of those lines. The commands '>' and '<' insert and delete tabs from the beginning of the line, respectively. For example, '>j' shifts two lines over by one tab (the current line and the one below it). For all of these action commands, if the action character ('!', 'c', '>' etc.) is doubled, the action is performed on the current line only. For example, 'dd' deletes the current line and '>>' shifts the current line to the right. There are also the following idioms related to the above commands. D - same as d$ (delete to the end of the line). C - same as c$ (change to the end of the line). V. Insert mode (inserts and alterations). There are a number of commands which cause the user to enter insert mode. Some of these are used to insert text for the first time (a, A, i, I, o and O). Others are used to change text. The first- time insert mode commands are described here. In all cases, one hits the appropriate command key (a, A, i, I, o or O), then types the text, then hits the key to get back to edit mode. a - append text after the cursor A - append text at the end of the current line i - insert text before the cursor I - insert text before the first non-white character of the line o - open a new line below the current line. O - open a new line above the current line. Note that o is the same as A followed by a carriage return, or even $a followed by a carriage return. O is a synonym for '0i'. Thus, A, I, o and O are not strictly necessary, but they do save keystrokes. The change-text insert mode commands are listed here. Note that there is no limit to how much text can be inserted when one of these commands is typed. Once insert mode is entered, it remains in operation until an is typed. c - change (action command discussed above) C - change to the end of the line. R - replace text. The inserted text will write over old text character by character. #s - substitute (the typed text) for # characters. S - substitute (the typed text) for an entire line. Anoter command used to change text is 'r'. This changes a single character to another single character. For example, if the cursor is positioned on top of the letter 'h' and the user types 'rq', the letter 'h' is replaced with a 'q'. Note that insert mode is not entered in this case, so it is not necessary to type . r - replace a single character with another single character. VI. Positioning the screen (scrolling and redrawing) A number of commands exist not so much to move the cursor as to move the display on the screen. These commands are: ^F - Scroll forward one whole screen. ^B - Scroll backward one whole screen. ^D - Scroll down one half screen. ^U - Scroll up one half screen. ^E - Scroll down one line. ^Y - Scroll up one line. z - Place the line on which the cursor sits at a particular position on the screen. This command does other things as well, but, for example, z- will place the line at the bottom of the screen and z will place the line at the top of the screen. ^R - Redraw the screen from where the cursor is to the bottom. ^L - Redraw the entire screen. Note that ^L and ^R may not both work on a given terminal. If one doesn't work, try the other. These two commands are handy when the crt screen becomes scrambled (such as when some other user tries to "write" to you while you're in vi, or when a message comes to your screen to tell you that the status of a particular job has changed). VII. Text deletion commands There are three commands whose function is to remove pieces of text. These are 'd', 'D' and 'x'. These have already been discussed above, but are grouped together here. d - Delete text (see action motion above). D - Delete to the end of a line (same as d$). x - Delete (cross out) a character. VIII. Redo and Undo The Undo command is one of the most important commands in the entire editor. It undoes the effect of a previous command. For example, if one deletes 8 lines with "8dd", and then types 'u', the 8 lines reappear. If one inserts some jibberish with an 'i' command and then types 'u', the jibberish disappears. Note that 'u' only goes back one command, so it is best not to err twice in a row. There are, however, some mechanisms available for recovery from multiple errors. See the section on buffers below. An alternative undo command is 'U'. This undoes every change you have made on the current line since you last moved the cursor onto it. The redo command is quite useful. It re-does the previous command. If one wishes to change one word to another in several places throughout a file, one can do it as follows. Assume one wishes to change "cat" to "dog." First, search for the pattern "cat" by typing '/cat'. Then type 'cwdog' to change the first "cat" to "dog." Now type 'n' to go to the next occurrence of "cat." Type '.' and this will be changed to "dog." Continue to hit 'n.' until all changes have been made. If all occurrences of "cat" are to be changed to "dog," this can be done from the ex (line oriented) editor mode. However, the 'n.' technique allows the user to screen each occurrence of "cat" to be sure it is one of those which needs to be changed. The commands 'u' and '.' work with all commands which change the text. They do not work with motion commands. Hence, if one types "dd" to delete a line, then types '^F' to move forward one screen and types '.', the '.' command refers to 'dd' and not to '^F'. In summary: u - undo the previous text-altering command. . - redo the previous text-altering command. IX. Some Special Commands There are a few commands which are difficult to categorize. These are listed here. J - Join two lines together. ~ - Change the case of a single character. & - Repeat the previous ex-mode substitution The 'J' command joins the current line with the line below it. It adds a space between the two lines. If the current line ends with a period, 'J' will add two spaces between the lines. The '~' command changes upper case letters to lower case and lower case to upper case. The '&' command repeats a substitution on a given line. If one has used ex mode to change one word to another word on a line, then '&' will cause this change to happen on whatever line the cursor is on. (Note, to do such a substitution in ex mode, one types, for example ':s/cat/dog/'. This changes "cat" to "dog." X. Commands for use while in insert mode. Some commands can be used while one is in insert mode. These are typically control-commands (they use the key). Those listed below correspond to the stty settings for delete-word, kill-line, erase-character and insert-litteral respectively. ^W - erase the word just typed. ^H - erase the character just typed. ^U - kill the line just typed. ^V - insert a non-printing character in the text (e.g. ^V followed by will insert the in the file rather than taking the user out of insert mode. Another command is used to backspace over an autoindent. ^D - backspace over an autoindent. XI. Yanking and Putting (Cutting and Pasting) A typical example of how text can be yanked into a buffer is: "ay/banana The two characters "a stand for "buffer a." This says that whatever is yanked will be put int the buffer labeled 'a'. Thus, the command above will take all text from the current cursor location to the first occurrence of the word "banana" and stash it into buffer a. It does not change the existing text. Similarly, the command: "a8yy yanks 8 lines, beginning with the currentl line, into a buffer. Once text has been yanked into a particular buffer, it can be put anywhere with the 'p' command. Thus: "ap means "put buffer a." If no buffer is specified (as in 8yy or y/banana), the text goes into an unlabeled buffer and can be put with just p (or P). Thus, 'p' (or 'P') prints the most recent text yanked. It happens that any time text is deleted (e.g. 8dd), it is automatically yanked into the unlabeled buffer. To move a paragraph, for example, from one place in the file to another, one would go to the first character in the paragraph, type d} (delete to the end of the paragraph), move to the place where the paragraph is to be moved, and type p. The problem with this is that, if you happen to use a delete or change text command after you delete the paragraph, the unlabeled buffer no longer has that paragraph in it. Hence, the usefulness of labeled buffers. The editor does save several 'unlabeled buffers' at once, and it labels them as 1, 2, 3, .... If, for example, you delete 3 lines by typing dd, then dd, then dd, the third line will end up in buffer 1, the second in buffer 2 and the first in buffer 3. They can be recovered with "1p, "2p, and "3p. Text can also be deleted into a buffer in the same way that it can be yanked. The command "a3dd deletes three lines and puts a copy of them into buffer a. XII. Searching for Patterns Vi uses several standard notations in searches which can be helpful. As mentioned above, the basic search commands are /pattern, ?pattern, n and N. For example, /the will search from the current cursor position for the next occurrence of the three character string "the". One may optionaly add a second slash after the search (i.e. /the/). The only problem with this simple search is that it is not very specific. Words such as "there" and "these" and "atherosclerosis" will also be found. Certainly one could do something like / the / (delinate the search with blanks), but this doesn't work if "the" is at the beginning of a line, end of a sentence etc. One can thus search for "the" as a word with the command: /\ The character sequence \< marks the beginning of a word, and the sequence \> marks the end of a word. Another plot complication is when "the" is at the beginning of a sentence. In this case it can appear as "the" or "The". There are two choices here. The first is to set "ignorecase" (see the section on "ex mode" below). The second is to search for both 'T' and 't' simultaneously. To do this, type: /[Tt]he More generally, if you wanted to search for any occurence of a capital letter, you could type: /[A-Z] Or if you didn't know which vowel to use in the word ecdysiast you could type: /ecd[aeiouy]siast Another problem comes up in files where you want to find a certain pattern, but you only want to get it if it is at the beginning of a line. An example is when you're looking for a section heading in a long file. You can do this with the '^' character. For example, /^Echinoderm will find the word Echinoderm, but not Echinoderm or Mr. Echinoderm. Similarly the character '$' is used to look for things at the end of a line. By the way, if you want to actually find the characters ^ or $ or [, etc., preceed them with a backslash. Thus /\$ finds a dollar sign, whereas /$ finds the end of the current line. Two other characters which have special meaning in searches are '.' and '*'. The character '.' stands for any character, and '*' stands for any arbitrary number of characters. If you want to find a word, for example, and you don't know what the second character is, you could type, for example, /d.ve and this would find things like "dove", "dave", "dive", "dxve", etc. The character '*' works similarly. The command: /d*ve would find "dove", "dave", "drive", "dizzy stove," and a whole host of other things that start with 'd' and end with 've'. XIII. Marking and Returning The command 'm' stands for "mark". It labels the current cursor position with a one-character label. For example: ms marks the current cursor position with the label 's'. Once you have marked a location, you can return to the location with the command 's This is useful when you need to go somewhere else in a file to do something, but you want to return to where you are as soon as you're finished. For example, if you were editing a paper and you cited a reference, as in, "This was shown by Tweedledee [1]," and you wanted to go to the end of the file to type in the reference right away, but you wanted to come immediately back to where you were to finish the editing, you could mark it, then use 'G' to go to the end of the file, type in your reference and then type 's to return to the place that you marked. Another reson you might want to use this is if you wanted to cut something out, but there wasn't a convenient motion command. That is, if it's a paragraph, you can just do d} to delete the paragraph into a buffer. If it's 2 paragraphs, you could just do 2d}, but if it's some unspecified number of paragraphs and you're too lazy to count them, you can go to the end of the text you want to delete, type ms, then go to the start of the text you want to delete and type d's And everything up to the mark will be deleted into the standard buffer. If you make a long jump in the file (for example, with a /pattern command, a G command, or the ilk), you can return to the place you most recently came from with the command: '' or nearly equivalently, `` You might want to try this out. Go into a long file at some obscure position, then type G to go to the end of the file, then type '' and you should return to the obscure position again. XIV. Counts before Commnds Most vi commands will take a number before them which in general says to do the prescribed action that number of times. For example, if you use the ^F (control-F) command to move down one screen, you can use 3^F to move down 3 screens. Counts before the following commands have similar meanings. In the descriptions, # stands for the count that preceeds the command (i.e. in 3^F, # is 3). b,B - move back # words. e,E - move to the end of the #th word forward. f - move forward to (on top of) the #th occurrence of F - move backward to (on top of) the #th occurrence of t - move forward to (the left of) the #th occurrence of T - move backward to (the left of) the #th occurrence of #h - move to the left # characters. #j - move down # lines. #k - move up # lines. #l - move right # lines. w - move forward to the #th next word. (Token delineated) W - move forward to the #th next word. (Blank delineated) ( - go to the beginning of the (#th-1st) previous sentence. ) - go to the end of the (#th-1st) next sentence. { - go to the beginning of the (#th-1st) previous paragraph. } - go to the end of the (#th-1st) next paragraph. [ - go to the (#th-1st) previous 'section'. ] - go to the (#th-1st) next 'section'. - - go up # lines (same as 'k'). + - go down # lines (same as 'j'). , - go to #th previous 't', 'T', 'f', 'F' ; - go to #th next 't', 'T', 'f', 'F' ^D - scroll down # lines. This also changes the default number of lines for ^D to be #. ^U - same meaning as for ^D. Counts before the following commands have a slightly different meaning: G - go to line number # (end of file if # isn't specified). H - move # lines below the upper left hand corner of the screen. L - move # lines above the lower left corner of the screen. | - go to column number # (beginning of line if # is not given). z - put line number # at the top of the screen. Counts before the following commands have no meaning: M m N n $ % ^ / ? 0 '' `` ^F ^B Commands that change text also often take counts. Examples are: dd - delete # lines d - same as d#. For example, 4dw is the same as d4w, 4dj is the same as dj4 (which deletes 5 lines), 4d/pattern is the same as d4/pattern, which is illegal since counts do not mean anything before search commands. !,y,c, - counts have the same meaning as for 'd'. <,> Y - this will yank # lines. i - will insert the typed text # times at the current cursor location. This is often a point of confusion with novice vi users who are typing in data. They tend to go into the editor and start typing the data before they go into insert mode, (e.g. let's say they type the number 1023). Then they realize their mistake and type 'i' to get into insert mode. Then when they hit the escape key to get out of insert mode, they find that what they typed appears 1023 times in their file. This can be distressing. I,a,A - counts have the same meaning as for 'i'. J - join count lines together. r - replace # characters all to the same character. E.g., if the cursor is on the 'p' in "pretzel" and you type 4rx, you get xxxxzel. R - similar to r. If you type 2Rsum on the p of pretzel, you get sumsuml. s - removes # characters and puts you into insert mode to replace (substitute) those characters. S - removes # lines and puts you into insert mode to replace (substitute) those lines. x - delete # characters. ~ - capitalize/uncapitalize the next # characters. . - works as if you had put count before the previous command. e.g., if the previous command was dw, and you type 4., it's as if you typed 4dw. Counts have no meaning for the following (in some cases it's not clear why). o O p P C D u U Things that still need to be written about. moving about from file to file mapping .exrc file some useful ex mode commands :r :s/pat1/pat2/ :m :t :g//d Whatever @ does. suspend ^Z