Vim on Mac OS X not showing

I recently started using Mac OS X Lion and tried to use Vim in the terminal. I used to have a .vimrc file on my Ubuntu system and had the F2 and F5 keys mapped in pastetoggle and launching the python interpreter. Here are two lines that I have for this:

set pastetoggle=<F2> map <buffer> <F5> :wa<CR>:!/usr/bin/env python % <CR> 

It works great on Ubuntu, but no longer works on Mac. (The above two lines are in .vimrc in my home directory.) I disabled certain Mac functions as I wanted, so the function keys are not used for things like volume. Right now, pressing F5 seems to use all the letters up to the next word, and F2 seems to delete the next line and insert O .....

Is there anything else I need to do to make it work as expected?

Also, I used solar power as my color scheme and tried to have the same color scheme now on a Mac. It seems that the schema command is being read from .vimrc, but the colors match the standard colors. Although the .vim / colors files are the same as before. Is this a related error that I need to fix? Perhaps another settings file is being read after my own? (I searched for _vimrc and .gvimrc does not exist.)

Thanks!

+6
source share
4 answers

Finally, I got my functional mappings by resorting to adding such mappings:

 if has('mac') && ($TERM == 'xterm-256color' || $TERM == 'screen-256color') map <Esc>OP <F1> map <Esc>OQ <F2> map <Esc>OR <F3> map <Esc>OS <F4> map <Esc>[16~ <F5> map <Esc>[17~ <F6> map <Esc>[18~ <F7> map <Esc>[19~ <F8> map <Esc>[20~ <F9> map <Esc>[21~ <F10> map <Esc>[23~ <F11> map <Esc>[24~ <F12> endif 

The answers to these questions were useful if you need to make sure that these escape sequences match your terminal or set your own:

display function keys in vim
Associate special keys as vim shortcuts

It probably depends on how the terminal emulators behave consistently (laughter), but @Mark Carey's suggestion was not enough for me (I would like it to be that simple). With iTerm2 in OS X, I already configured it for xterm-256color and tmux for screen-256color , but the functional mappings still won't work. Thus, has('mac') may not be necessary if these sequences from iTerm2 are xterm compatible, I have not tested it yet, so I left it in my own configuration for now.

You may need some versions of imap . Note that you should not use the noremap options, since you do want these mappings to be cascaded (to call everything you mapped to <Fx> ).

+4
source

Regarding your color / sunny question - make sure you set up the terminal (or iTerm2, which I prefer) using the solarized profiles available in the full solarized distribution, which you can download here: http://ethanschoonover.com/solarized/files /solarized.zip .

Then the only other problem you may encounter is to install your $ TERM xterm-256color or screen-256color if you are using screen or tmux.

You can see my dotfiles for a working setup, but don't forget to configure the Terminal / iTerm color profiles as a first step.

+1
source

see this answer: fooobar.com/questions/903033 / ...

By essentially changing my TERM type to xterm-256color, I was able to correctly display the function keys.

+1
source

I used the following in my vimrc to copy and paste

 if &term =~ "xterm.*" let &t_ti = &t_ti . "\e[?2004h" let &t_te = "\e[?2004l" . &t_te function XTermPasteBegin(ret) set pastetoggle=<Esc>[201~ set paste return a:ret endfunction map <expr> <Esc>[200~ XTermPasteBegin("i") imap <expr> <Esc>[200~ XTermPasteBegin("") cmap <Esc>[200~ <nop> cmap <Esc>[201~ <nop> endif 

I got it from here fooobar.com/questions/92547 / ...

0
source

Source: https://habr.com/ru/post/903032/


All Articles