mac \"Terminal Highlight\" and \"vim syntax on\"

1、 Mac 下Terminal Highlight

针对terminal采用bash模式:

  1. 编辑 ~/.bash_profile, 加入以下代码:
    export CLICOLOR=1
    export LSCOLORS=gxfxaxdxcxegedabagacad
  2. 保存,然后重启terminal,搞定,恢复正常了.

详细讲解代码中的涵义:

  1. CLICOLOR: 前景色和背景色的字符串合并值
  2. LSCOLORS: 对于不同变量所采用的颜色方案,具体看如下表格:
    a       black
    b       red
    c       green
    d       brown
    e       blue
    f        magenta
    g      cyan
    h       light grey
    A      bold black, usually shows up as dark grey
    B       bold red
    C      bold green
    D      bold brown, usually shows up as yellow
    E       bold blue
    F       bold magenta
    G     bold cyan
    H      bold light grey; looks like bright white
    x       default foreground or background
    而文件类型列表如下:
    1. directory
    2. symbolic link
    3. socket
    4. pipe
    5. executable
    6. block special
    7. character special
    8. executable with setuid bit set
    9. executable with setgid bit set
    10. directory writable to others, with sticky bit
    11. directory writable to others, without sticky

所以对照这张表就可以得知:

gxfxaxdxcxegedabagacad

就是对于directory而言,它的前景色就是: g(cyan),而背景色就是:x(默认的背景色).

2、mac vim syntax on

Vim 是一款相当给力的源自UNIX平台的命令行文本编辑器,不过不给力的是,Mac OS X下并没有诸多Linux发行版上VIM那些牛逼哄哄的神马代码高亮显示啊,自动缩进啊神马的。

为了弥补这个缺憾,请按如下方法操作:

打开Terminal,输入如下命令:

cd /usr/share/vim

sudo vim vimrc

set ai                  " auto indenting

set history=100         " keep 100 lines of history

set ruler               " show the cursor position

syntax on               " syntax highlighting

set hlsearch            " highlight the last searched term

filetype plugin on      " use the file type plugins


" When editing a file, always jump to the last cursor position

autocmd BufReadPost *

\ if ! exists("g:leave_my_cursor_position_alone") |

\ if line("'\"") > 0 && line ("'\"") <= line("$") |

\ exe "normal g'\"" |

\ endif |

\ endif

然后保存退出VIM。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值