Re: vi question: mapping a key to esc in insert mode
Thanks. That worked. I was readinging a semicolon from a file, but that was really a silly hack. Joel On Wed, Jan 02, 2002 at 02:33:18PM -0700, Dave Anselmi wrote: > Joel Hammer wrote: > > > I use vi. > > I'm sorry to hear that. > > No, no, just kidding. I use it too. ;-) > > > The biggest nuisance I have with it is constantly having to hit the esc > > button to exit the insert mode. I have remapped my ; key to do this. But, > > now I have to type cntrl-v59 to insert a semicolon into my document. > > I assume you used map! to remap the ; key and the F2 key. You can change this > behavior (macros calling other macros) by setting noremap: > > :set noremap > > If you want remap set, just unset it and reset it in the macro. Try this: > > map! ^[:set noremap^Ma;^[:set remap^Ma > map! ; ^[ > > The represents pressing the F2 key, ^[ means ctrl-vESC, and ^M means > ctrl-vctrl-m. If you reverse the order of the map! commands, you'll have to > use ctrl-v; rather than ; in the top one. > > I tested this in gvim 5.8, but I got the idea from a paper on vi so it should > work for you. The paper ("Vi Macros, Abbreviations, and Buffers" by Fred Buck) > is available here: > > http://www.mathsci.appstate.edu/~egp/misc/vi/macros > > Dave > > > ___ > Linux-users mailing list > Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users ___ Linux-users mailing list Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users
Re: vi question: mapping a key to esc in insert mode
Joel Hammer wrote: > I use vi. I'm sorry to hear that. No, no, just kidding. I use it too. ;-) > The biggest nuisance I have with it is constantly having to hit the esc > button to exit the insert mode. I have remapped my ; key to do this. But, > now I have to type cntrl-v59 to insert a semicolon into my document. I assume you used map! to remap the ; key and the F2 key. You can change this behavior (macros calling other macros) by setting noremap: :set noremap If you want remap set, just unset it and reset it in the macro. Try this: map! ^[:set noremap^Ma;^[:set remap^Ma map! ; ^[ The represents pressing the F2 key, ^[ means ctrl-vESC, and ^M means ctrl-vctrl-m. If you reverse the order of the map! commands, you'll have to use ctrl-v; rather than ; in the top one. I tested this in gvim 5.8, but I got the idea from a paper on vi so it should work for you. The paper ("Vi Macros, Abbreviations, and Buffers" by Fred Buck) is available here: http://www.mathsci.appstate.edu/~egp/misc/vi/macros Dave ___ Linux-users mailing list Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users
vi question: mapping a key to esc in insert mode
I use vi. The biggest nuisance I have with it is constantly having to hit the esc button to exit the insert mode. I have remapped my ; key to do this. But, now I have to type cntrl-v59 to insert a semicolon into my document. I have tried to map F2 to insert a ; but that is not possible. Hitting the F2 key just results in an esc command being sent, not a ; symbol. I have tried to define the F2 mapping with cntrl-v59, and that works, but the F2 key then sends a ; which results in the esc function being activated. So, I guess my problem is, how do you send an ascii code to vi and prevent it from being interpreted if it has been remapped? I can get around this by making up a file which contains the ; symbol, and reading that file into my document with a macro, but that seems really lame. Joel ___ Linux-users mailing list Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users