1、 Enable terminal color

 Modify the configuration file 
$ vim .bash_profile #enables colorin the terminal bash shell export
export CLICOLOR=1 #sets up thecolor scheme for list export
export LSCOLORS=gxfxcxdxbxegedabagacad #sets up theprompt color (currently a green similar to linux terminal)
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ ' #enables colorfor iTerm
export TERM=xterm-color Load configuration
$ source .bash_profile

among LSCOLORS The values of are expressed as follows :

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 file type :
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 The value set here gxfxaxdxcxegedabagacad Every two characters represent the foreground and background colors of a file type .
So you can see from this table , here directory The foreground color of the picture is g(cyan), The background color is x(default).

2、 All directories in the system begin with uppercase , It's not very convenient to switch , It's much more convenient if you ignore the size .

 Create a new one in the home directory .inputrc file 
$ vim .inputrc set completion-ignore-case on
set show-all-if-ambiguous on
TAB: menu-complete Loading directly here will report an error , Need to restart the terminal to take effect .

3、mac The system doesn't come with ll Command alias , This should be the most common command , Have to add .

$ vim .bash_profile
#alias
alias ll="ls -lG" $ source .bash_profile

4、 Set up vim, Enable syntax highlighting

$ vim .vimrc
syntax on # Enable syntax highlighting 
set ruler # Enable ruler , The coordinates of the current position of the cursor are displayed

5、 Set display git Branch , In fact, at this point zsh Can achieve very powerful git Prompt function , This is just the branch name .

$ vim .bash_profile
#display git branch in PS1
find_git_branch () { local dir=. head until [ "$dir" -ef / ]; do
if [ -f "$dir/.git/HEAD" ]; then
head=$(< "$dir/.git/HEAD")
if [[ $head = ref:\ refs/heads/* ]]; then
git_branch="(${head#*/*/})"
elif [[ $head != '' ]]; then
git_branch=" → (detached)"
else
git_branch=" → (unknow)"
fi
return
fi
dir="../$dir"
done git_branch=''
} PROMPT_COMMAND="find_git_branch; $PROMPT_COMMAND" black=$'\[\e[1;30m\]'
red=$'\[\e[1;31m\]'
green=$'\[\e[1;32m\]'
yellow=$'\[\e[1;33m\]'
blue=$'\[\e[1;34m\]'
magenta=$'\[\e[1;35m\]'
cyan=$'\[\e[1;36m\]'
white=$'\[\e[1;37m\]'
normal=$'\[\e[m\]' PS1="$green\u$white@$green\h:$cyan\w$yellow\$git_branch$normal\$ " $ source .bash_profile

After setting, the effect is as follows

MacBook Set the terminal color , Completion ignores case , Set command alias alias, Set up vim, Set display git More articles on the branch

  1. Mac Terminal auto completion ignores case

    Open the terminal , Input :nano .inputrc Paste the following sentence inside : set completion-ignore-case onset show-all-if-ambiguous onTAB: menu ...

  2. MAC terminal TAB Auto completion ignores case

    Open the terminal , Input : nano .inputrc Paste the following sentence inside : set completion-ignore-case onset show-all-if-ambiguous onTAB: men ...

  3. Mac Under the terminal automatic completion function

    Record some commands of the terminal , With the configuration of automatic completion , I'm afraid I'll forget later . 1. Configuration of terminal automatic completion Open the terminal , Input : nano .inputrc Write... In the file : set completion-ignore- ...

  4. Vim Set brackets to automatically complete and quickly jump out

    One . Set parentheses to complete automatically inoremap ' ''<ESC>i inoremap " ""<ESC>i inoremap ( ()<ESC&g ...

  5. ubuntu Use git when , The terminal does not display git Branch .

    1: Problem description : stay Windows Get used to it in the environment git bash operation git Branch , Recent learning linux Environmental Science , Find out linux The environment terminal does not display git Branch , The related phenomena are as follows :      The expected effect is : my linux Environmental Science ...

  6. Can display git The terminal prompt configuration of the branch

    I used to follow the trend , install zsh then oh-my-zsh, Choose a theme that looks good , A blind configuration , It's cool . But even if there's only one git plug-in unit ,oh-my-zsh It's slow every time it starts up , At least for a few seconds , And sometimes zsh Will ...

  7. Mac Ignore case settings when terminal commands use auto completion

    Mac  The terminal is in use  tab  Case sensitive by default when completing commands , The case can be ignored by the following settings , The same applies to  iTerm2. Enter the following command to open the terminal : nano .inputrc Copy the following command in : set ...

  8. Wing IDE Set up ( Automatic completion &amp; Comment shortcuts )

    Automatic completion ( By default Tab Key auto completion ) Modification method :edit  -> preferences -> Editor -> Auto-completion Put it on the right keys The place of , from tab Change to ...

  9. Spyder Set code auto completion

    1.spyder The setting mode of automatic code completion is tools->preferences->IPython console->advanced Settings below , hold User the gre ...

Random recommendation

  1. redis Learning notes (6)-cluster Cluster building

    Last time I wrote redis My study notes are still 2014 year , In the twinkling of an eye, it's almost 2 Years have passed , For a while ,redis One of the biggest changes is cluster The official release of the function , We used to do redis colony , With the help of consistency hash Do it yourself shardi ...

  2. java servlet

    review 1 What are the three elements ? entrance (login.html)      Handle (LoginServlet.java)   exit (success.jsp) 2 How to access the servlet http://IP:port/p ...

  3. thorough .net( Polymorphism two )

    Code optimization technology : adopt “ Inherit ” technology , Achieve code reuse , Reduce the amount of code . Because the child class inherits the parent class , With the parent class, all the public “ attribute ” and “ Method ”, therefore , In the system , You can completely replace the parent class with a subclass ( Richter's principle of substitution )! In the process of substitution ...

  4. C The processing of time in the program ——time Library function detailed explanation

    Include files :<sys/time.h> <time.h> One . stay C In language time_t, tm, timeval And so on 1.time_t time_t It's actually a long integer type , ...

  5. ORA-01439: column to be modified must be empty to change datatype

    Modify the database field type , But because the data table already has data , Can't modify : Display error :   writes ORA-01439: column to be modified must be empty to change dat ...

  6. nginx proxy Super times is wrong upstream timed out (110: Connec...

    Introduction to the environment   The server :centos6.4 service :nginx proxy Problem description : Then look for   /opt/usr/nginx/1.4.0/logs  error error.log The log prompts as follows 2015/01/0 ...

  7. winform Realization word Convert to PDF(.doc)

    Be careful : Realization word Convert to PDF file , I install Office by 2013; word Take the suffix as .doc For example, to achieve file type conversion , The details are as follows : Implementation steps : 1. Add a namespace reference ——using Microsof ...

  8. Swift - Summary of the realization methods of animation effect ( Sample attached )

    stay iOS in , There are two ways to achieve animation . One is unified animateWithDuration, The other is the combination beginAnimations and commitAnimations. All three methods are class methods . One , Use ...

  9. 8.Git Branch - Branch creation and merging -01

    1. The new branch  git checkout -b <branch-name>  Create a branch and switch to it .  git checkout -b <branch-name> = ...

  10. Delete sheet

    /// <summary> /// Delete sheet /// </summary> /// <param name="fileName">< ...