How can I make a number sign show up???
feedback
|
|
There is the very remote possibility that the user is using an antique unix that has # mapped to delete and @ mapped to kill (^U on most traditional modern systems). If his system is configured this way, he will not be able to type a # because every time he does it will delete whatever character is to the left of where he is trying to type the #. The simplest way to fix this is stty erase (ctrl-V)(backspace key). This is unlikely to be the case -- it's not likely that anyone is running irix 5.4 or hp/ux 10.20 these days, but who knows, right? | |||||
feedback
|
|
| |||
|
feedback
|
|
Assuming a US keyboard, Press i to go into insert mode, and then shift-3. You can use either shift key, and press it the same time as the '3' key. The three key is after two, and before four. | |||||
feedback
|
|
If you're in insert mode, it should be just the same as any other application. If it doesn't say "--INSERT--" at the bottom of the terminal, hit i, then try typing. When you're done, hit escape to get out of insert mode and back to "command mode". On the off chance you're using a Mac with a UK keyboard layout, you need to use alt+3 to get a # symbol. | |||||
feedback
|
|
Although insert mode is often considered the preferred method, as previous answers have suggested, needing to type 'i' can be needlessly complicated for a beginner in vi. The following solution will achieve the same basic effect without resorting to insert mode at all. First of all, when you're in the text file you want to edit, type the following command
Yes, the colon is part of the command. If it doesn't work, you may need to hit ESC a few times to get back to command mode. You may have to hit ENTER after the command has run, depending on what version of vi you're running. What this does, is utilizes the shell to feed a number sign into the text file 'numsign'. This file can be subsequently loaded into your current text document using the following command
Again, the colon is part of the command. If you've done everything corrently, this will insert the number sign onto the line immediately succeeding your current line. Of course, chances are that's not where you want your number sign to show up. The following bit of vi-magic can be used to place it wherever you want. First, move your cursor (I'll leave this as an exercise to the reader) to the number sign, and type vi's 'delete character' command
Which will cut the character and store it in a buffer. This character can then be pasted by using either of vi's 'paste' commands
Yeah, all vi commands are case-sensitive, you'll get used to it. You can move your cursor to wherever you want your number sign to go, and press either of the paste commands to paste it either before, or after, the current cursor position. This can be repeated as many times as necessary, assuming you haven't overwritten your paste buffer with anything else. One unfortunate side-effect of this method is that it may leave a blank line in your text document where your number sign was originally read into the file. This can be easily remedied using vi's 'delete line' command
But be warned that this will overwrite the number sign in your buffer, and replace it with the blank line. Only use this command if you're sure it's what you want to do - it can be very dangerous in the wrong hands. | ||||
|
feedback
|
