Mac Vim Shell Configuration

Source: Internet
Author: User
Tags setf egrep macbook

One: Vim configuration

1 Catalogue/USR/SHARE/VIM/VIMRC

2 Python Auto Indent

http://blog.csdn.net/ikerpeng/article/details/18663055

Set Filetype=python

Au bufnewfile,bufread *.py,*.pyw setf python
Set Autoindent "Same level indent
Set Smartindent "Next level Indent
Set Expandtab
Set tabstop=4
Set shiftwidth=4

Set softtabstop=4

3 VIM color recommended use Molokai color Download: http://www.vim.org/scripts/script.php?script_id=2340

1190000002449640

ls /usr/share/vim/vim73/colors

The approximate output is as follows:

README.txt    default.vim   elflord.vim   morning.vim   peachpuff.vim slate.vimblue.vim      delek.vim     evening.vim   murphy.vim    ron.vim       torte.vimdarkblue.vim  desert.vim    koehler.vim   pablo.vim     shine.vim     zellner.vim

Then create the configuration file

jemy@jemy-MacBook ~/.vim $ cd ~jemy@jemy-MacBook ~ $ vim .vimrc

.vimsrcThe contents are as follows:

set nucolorscheme desert

The above configuration means:

    1. set nuTurn on line number
    2. colorscheme desertSet the color scheme todesert
4 Vim Paste non-indented http://www.cnblogs.com/end/archive/2012/06/01/2531142.html
 "Configuration file for vimSet modelines=0     "cve-2007-2438set Nu colorscheme Molokai"normally we use vim-extensions. If you want true vi-compatibility "Remove Change the following statementsSet nocompatible"Use Vim defaults instead of 100% VI compatibilitySet backspace=2     "More powerful backspacing "Don ' t write backup file if Vim is being called by"Crontab-e"Au bufwrite/private/tmp/crontab.*Set Nowritebackup nobackup"Don ' t write backup file if Vim is being called by"Chpass"Au bufwrite/private/etc/pw.*set Nowritebackup nobackup set filetype=python au bufnewfile,bufread*.py,*. Pyw setf python set autoindent"Same Level indentSet Smartindent"Next Level indentset Expandtab set TabStop=4Set Shiftwidth=4Set Softtabstop=4Syntax on

Two: Shell settings

http://linfan.info/blog/2012/02/27/colorful-terminal-in-mac/

Http://chaishiwei.com/blog/247.html

MAC OS X's terminal always lacks anything compared to Linux. Yes, it is color, the Linux ls command uses different colors to distinguish various file types, the Vim editor also supports syntax highlighting, and the Mac terminal is always in black and white. In fact, just a little bit to do some work, Mac terminal can also be colorful, please look down.

Output of the colored LS

The BSD LS command in Mac can use the -G parameter color output file list, need to configure the LSCOLORS environment variable definition color, the specific configuration method can be entered to man ls view.

However, I recommend installing the GNU coreutils for Linux to replace Mac with the LS command because:

    • Coreutils provides a configuration tool that is more convenient for defining color codes;
    • Coreutils contains more than LS, and as a Linux user, I'm more accustomed to using GNU's various shell tools.

Coreutils installation and configuration methods are as follows:

    1. Installing coreutils via Homebrew
      brew install xz coreutils
      Note: Coreutils is not dependent on XZ, but its source code is compressed in XZ format, install XZ to decompress.

    2. Generate a color definition file
      gdircolors --print-database > ~/.dir_colors

    3. ~/.bash_profileAdd the following code to the configuration file

12345      
 if Brew List | grep Coreutils >/dev/null; then path= "$ (Brew--prefix coreutils)/libexec/gnubin: $PATH"  alias ls< Span class= "o" >= ' ls-f--show-control-chars--color=auto '  eval  ' gdircolors-b  $HOME/.dir_colors fi               

The function of Gdircolor is to set the environment variable ls_colors (BSD is lscolors) used by the LS command, we can modify the color of the ~/.dir_colors customization file, the comments in this file already contain a description of the various color values.

See how the default color looks.

grep highlighting Keywords

This is very simple, plus the --color parameters can be, for ease of use, you can ~/.bash_profile add the alias definition in the configuration file.

123 
alias grep=‘grep --color‘alias egrep=‘egrep --color‘alias fgrep=‘fgrep --color‘
Vim Syntax highlighting

In vim, enter the command to :syntax on activate the syntax highlighting, if you need to automatically activate when Vim starts, ~/.vimrc add a line in syntax on .

Mac Vim Shell Configuration

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.