Finally solved the problem of using Vim in gnome-terminal in Ubuntu to implement key-key ing in insert mode.

Source: Internet
Author: User
Tags imap

The title is very long and happy!

In ubuntu, VIM is selected because the command line of window is very difficult to use, and the color scheme and input method are not fixed. These are not problems in gnome-terminal. I don't know whether it is my own Vim compilation or gnome-terminal. I cannot use it in Vim. <F1> ~ <F12> for ing, pressing in terminal will print ~ Or other characters. While in gnome-terminal, it is an escape sequence of ESC (which I don't quite understand ), therefore, when I use imap <F9> <c-x> <c-o>, the adjacent characters are converted to uppercase and lowercase letters. For example, OS. Path. d <F9> is changed to OS. Path. D and switched to normal mode. This problem makes me very depressed. Fortunately, neocomplcache is not manually <c-x> <c-o> acceptable.

But these two angels suddenly found a problem, when I press the direction key in insert mode, the characters A, B, C, and D are inserted above the current row. After checking the Internet, set nocompatible is enough, but this is the first line of my vimrc. Fortunately, we still have Google. We accidentally saw a blog saying that there is a solution to this problem in VIM wiki: http://vim.wikia.com/wiki/fix_arrow_keys_that_display_a_ B _c_d_on_remote_shell. The characters in the terminal correspond to a character sequence. You can use help t_ku to view many characters. For example, my <up> key corresponds to ^ [O * a, and when I set term = ANSI, this is changed to ^ [OA. When trying solution 1, you can find that the problem is true, but the speed is a little slow. If you press it quickly, it will switch back to normal mode. After repeated attempts, we found that xterm is set using the default term, while the escape sequence of <up> uses ANSI perfectly solved the problem IMAP ^ [[OA <ESC> Ki, I don't know why this still produces a very good side effect <F1> ~ <F12> also changed, which can be directly used for ing.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.