Sponsored Content
Top Forums UNIX for Dummies Questions & Answers help on vi (special characters) needed Post 302319405 by otheus on Monday 25th of May 2009 07:02:24 AM
Old 05-25-2009
You can use the :map commands. Vim understands UTF-8 and different file formats, and there are keymaps you can load with :set keymap=???, but for simplicity, you should be able to map your own key. Let's say you want to use CTRL-^ for the copyright character. First, you need to do
Code:
:set encoding=utf-8 fileencondings=

Then you can type the sequence
Code:
CTRL-V u 0 1 6 9

(no spaces here). If you are in text-mode vim (and not gvim), you will see a ? mark. Position the cursor over that question mark and type
Code:
:asc

On the status line, you will see:
Code:
<?> 361, Hex 0169, Octal 551

Bring this up in your HTML browser or whatever. If this isn't the character you expect, I don't know how to help.

Anyway, to map this to a keyboard character, say CTRL_^ you can do:
Code:
:map!  CTRL-VCTRL-^ CTRL-Vu0169

Now when you are insert mode, you can type CTRL-^ and you should see the ? mark. Do the :asc thing to make sure it's right. Finally, you can make an abbreviation so that typing (c) turns into this character:
Code:
:abbr (c) CTRL-Vu0169

That might be more intuitive in the long-run. If you need the sequence (c) without the abbreviation, you can type "(c)CTRL-V" and then a space, period, or whatever.

Note CTRL-V and CTRL-^ means holding down the Control key followed by V or ^ (often 6) or whatever.
 

10 More Discussions You Might Find Interesting

1. IP Networking

Special network tool needed

Hi everyone, I need some tool or a hint how to code it myself. I want a tool that listenes to a TCP/IP port and reads everything from that port and write it to a logfile. How can I do this? Regards, Steff (3 Replies)
Discussion started by: Tubbietoeter
3 Replies

2. UNIX for Dummies Questions & Answers

special characters

I have one file which is named ^? ( the DEL character ) I'd like to know how to rename or copy the file by using its i-node number TYIA (2 Replies)
Discussion started by: nawnaw
2 Replies

3. UNIX for Advanced & Expert Users

handling special characters

Hello everyone, I use Samba to copy mp3 files to my Red Hat 8.0 box so I can randomize them through a playlist. When I copy: Sigur Rós-Nýja Lagið.mp3 It shows in the mapped drive on Windows as: Sigur Rós-N_ja Lagi_.mp3 And via Putty as: Sigur R(grayed box)s-N_ja Lagi_.mp3 What is going... (1 Reply)
Discussion started by: effigy
1 Replies

4. UNIX for Dummies Questions & Answers

How to Remove Special Characters

Dear Members, We have a file which contains some special characters. I need to replace these special character by a new line character(\n). The Special character is \x85. I am not sure what this character means and how we can remove it. Any inputs are greatly appreciated. Thanks... (5 Replies)
Discussion started by: sandeep_1105
5 Replies

5. Shell Programming and Scripting

Special characters

When I open a file in vi, I see the following characters: \302\240 Can someone explain what these characters mean. Is it ASCII format? I need to trim those characters from a file. I am doing the following: tr -d '\302\240' ---------- Post updated at 08:35 PM ---------- Previous... (1 Reply)
Discussion started by: sid1982
1 Replies

6. UNIX for Dummies Questions & Answers

How to see special characters?

Hi all, I was wondering how can i see the special characters like \t, \n or anything else in a file by using Nano or any other linux command like less, more etc (6 Replies)
Discussion started by: gvj
6 Replies

7. Shell Programming and Scripting

special characters

Hey guys, I'm trying to replace "]Facebook" from the text but sed 's/]Facebook/Johan/g' is not working could you please help me with that? (6 Replies)
Discussion started by: Johanni
6 Replies

8. Shell Programming and Scripting

Replace special characters with Escape characters?

i need to replace the any special characters with escape characters like below. test!=123-> test\!\=123 !@#$%^&*()-= to be replaced by \!\@\#\$\%\^\&\*\(\)\-\= (8 Replies)
Discussion started by: laknar
8 Replies

9. Shell Programming and Scripting

Need help in replacing special characters

I am writing a ksh script. I need to replace a set of characters in an xml file. FROM="ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÛÚÜÝßàáâãäåçèéêëìíîïðñòóôõö¿¶ø®"; TO="AAAAAAACEEEEIIIIDNOOOOOOUUUUYSaaaaaaceeeeiiiionooooo N R" I have used the code- sed 's/$FROM/$TO/g'<abc.xml But its not working. Can anyone tell me the code to do this? (3 Replies)
Discussion started by: saga20
3 Replies

10. Shell Programming and Scripting

How to replace special characters?

Hi Unix Guru, I have an requirement for replace some specail characters in a file, my file came from mainframe. please see below example: when open it with vi 17896660|89059215|04/24/1998 00:00:00.000000| abc 123-453-1312^M<85>^M<85>|124557 if I run cat -v I got following:... (25 Replies)
Discussion started by: ken002
25 Replies
UNICODE_START(1)					      General Commands Manual						  UNICODE_START(1)

NAME
unicode_start - put keyboard and console in unicode mode SYNOPSIS
unicode_start [font [umap]] DESCRIPTION
The unicode_start command will put the keyboard and console into Unicode (UTF-8) mode. For the keyboard this means that one can attach 16-bit U+xxxx values to keyboard keys using loadkeys(1), and have these appear as UTF-8 input to user programs. Also, that one can type hexadecimal Alt-xxxx using the numeric keypad, and again produce UTF-8. For the console this means that the kernel expects UTF-8 output from user programs, and displays the output accordingly. The parameter font is a font that is loaded. It should have a built-in Unicode map, or, if it hasn't, such a map can be given explicitly as second parameter. When no font was specified, the current font is kept. NOTE
Unicode mode is a parameter with a value per virtual console. However, usually the font and keymap is common to all consoles. SEE ALSO
dumpkeys(1), kbd_mode(1), loadkeys(1), unicode_stop(1), utf-8(7), setfont(8) 3 Feb 2001 UNICODE_START(1)
All times are GMT -4. The time now is 05:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy