How can I activate Vim color schemes in OS X's Terminal?

前端 未结 6 1872
情书的邮戳
情书的邮戳 2020-12-25 09:51

I\'m working with the Vim 7.2 that comes with Mac OS 10.6.1 (Leopard), using the Mac\'s \"Terminal\" app. I\'d like to use a fancy color scheme. I did this...



        
相关标签:
6条回答
  • 2020-12-25 10:29

    You might want to consider using a version of Vim that is a native Mac app (that runs in a window).

    MacVim has great color schemes and you can still launch it from Terminal like so:

    $ mvim file.txt
    

    That will open your file in a new Vim window.

    0 讨论(0)
  • 2020-12-25 10:40

    You need to create file ~/.vimrc and add syntax on in that file

    vi ~/.vimrc

    syntax on

    save the file and run your vim

    0 讨论(0)
  • 2020-12-25 10:40

    @ashcatch - Can't leave a comment, but wanted to add that iTerm has other advantages over Terminal.app such as sensible copy and paste (configurable 'word' regex for easy double click selection of paths/urls, middle click paste) and terminal mouse support (:se mouse=a in vi to get mouse text selection, moving of window borders etc.)

    I'd be lost without it.

    0 讨论(0)
  • 2020-12-25 10:42

    The Terminal.app supports AFAIK only 16 colors; iTerm supports more colors or you use mvim (as suggested by Daniel).

    0 讨论(0)
  • 2020-12-25 10:44

    Add "syntax on" to the file /usr/share/vim/vimrc and you'll get highlighting in your files every time you edit one.

    # vi /usr/share/vim/vimrc

    Add this line at the end of the file:

    syntax on
    

    Now you'll get highlighting when you edit whatever's file.

    0 讨论(0)
  • 2020-12-25 10:47

    Create vimrc file on your home folder and then edit it. You can try adding syntax on inside ~/.vimrc file.

    $cat ~/.vimrc
    syntax on
    

    It will highlight your code syntax on vim

    0 讨论(0)
提交回复
热议问题