File: HIGH_ASCII

package info (click to toggle)
vimacs 0.95-1.2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 148 kB
  • ctags: 257
  • sloc: sh: 37; makefile: 29
file content (108 lines) | stat: -rw-r--r-- 4,125 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

> vimacs has a problem when trying to enter (some) umlauts in INSERT mode.
> It interprets the a with two dots above and the o with two dots above as
> commands for deletion. It seems that all other characters can be entered
> correctly.

Hi Marco,

This is because Vimacs remaps all the ASCII characters >= 128,
which are generated by all the Meta- key combinations.  e.g.
<M-a> is used in Vimacs to go to the start of the sentence, but
unfortunately it also generates the character "", which is
pretty common in many languages of the world.

There is no way for Vimacs to distinguish between the two, since
<M-a> generates that character.  Vimacs cannot know if the
semantic meaning of your keypress is "go back a sentence" or
"insert the character "".  So, we can solve this problem several
ways.  I'll put in the order of least intrusive to your current
style to most intrusive:

    1. Make a vimacs_override.vim file in your ~/.vim/plugin
       directory, which contains:

          iunmap <M-a>
	  iunmap <M-b>
	  iunmap <M-c>
	  ...
	  iunmap <M-z>
	  
       I would do this for you, but you may only want to override
       certain characters, and not the entire <M-a> to <M-z>
       range.

       You could also put:

          iunmap 
	  iunmap 
	  iunmap 

       in that file instead.  (Those characters are the actual
       8-bit characters inserted by <M-a>, <M-b> and <M-c>).

       (Note that the name of the "vimacs_override.vim" file is
       important; you want it to load _after_ the Vimacs plugin
       loads, so the filename must be lexicographically greater
       than "vimacs.vim".  vimacs_override.vim will load after
       vimacs.vim, but vimacs-override.vim will not.)

       Advantages: All the high-bit characters work exactly the
       way that you're used to.

       Disadvantages: You lose at least some (or all) of Vimacs'
       <M-> key mappings, including the commonly-used ones like
       <M-b> and <M-f>.

    2. You can use <C-q> to quote the character before inserting
       it, so that Vim will insert the next key sequence
       "literally".  So, to insert , you would type:

          <C-q><M-a>

       Advantages: Allows Vimacs to remap all the Meta- key
       combinations, and still enter digraphs/accents.

       Disadvantages: Pressing <C-q> all the time before
       inserting accents/digraphs can get really annoying.
       
    3. ":set digraph", and input high-bit characters that way.
       Do ":help digraph" for detailed help. For example, to
       insert , you would first type ', then a backspace to
       erase it, then a.  Vim will then insert the .

       Advantages: Allows Vimacs to remap all the Meta- key
       combinations, and still enter digraphs/accents.

       Disadvantages: It's relatively easy to produce digraphs
       accidentally using this method.

    4. ":set keymap=accents"; ":help keymap" for more
       information.  This is quite similar to the ":set digraph"
       workaround to the problem, but to insert a  character,
       you would type 'a, not '<BS>a.

       Advantages: Allows Vimacs to remap all the Meta- key
       combinations, and still enter digraphs/accents.

       Disadvantages: It's still relatively easy to produce
       digraphs accidently using this method.

If none of those solutions suit you, email me back and I'll try
to find a workaround.  I think that best solution might actually
be to remap the <M-> keys twice, so that to go back a sentence,
you'd have to press <M-a><M-a>.  Then, pressing <M-a> once will
insert a , but pressing it twice carries out the usual Vimacs
function.  (I'm guessing it quite rare that you want to insert
the same accented character twice in a row).

Marco, if you think that's a good idea, the next version of
Vimacs can have an option for that.

This is a difficult problem to handle because of the need to keep
the terminal and GUI versions of vim as close in behaviour as
possible, and also because I know almost nothing about support
for non-English languages.  (Sorry, my English-speaking
background is really showing itself here.)