Start the ultimate Efficiency Shell Tour (1)

Source: Internet
Author: User

An efficient development environment is undoubtedly of great help to our daily work, and time is saved by these tiny details.

Next, I'll show you how to configure ZSH+INCR to create the ultimate and efficient development environment.


First, let's look at the effect:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/FF/wKioL1dokxTgJoKcAACmKq1_K0M058.png "title=" Incr.png "alt=" Wkiol1dokxtgjokcaacmkq1_k0m058.png "/>


If you want your shell to have this effect, first meet the following conditions:

    • install oh-my-zsh

    • download incr

    • add plugin execution Shell to. ZSHRC configuration file

Nonsense not much to say, I directly on the detailed steps:


1, installation zsh

MAC: Look directly at the next section

Redhat/centos:sudo Yum Install zsh

Ubuntu:sudo Apt-get Install zsh


2. Install Oh my zsh

Automatic installation:

wget Https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh-O-| Sh

Manual Installation:

git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zshcp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/. Zshrc



3. Download INCR

: http://mimosa-pudica.net/zsh-incremental.html

To prevent the URL from being inaccessible in the future, I extract the code as follows:

# incremental completion for zsh# by y.fujii <y-fujii at  mimosa-pudica.net>, public domainautoload -u compinitzle -n self-insert  Self-insert-incrzle -n vi-cmd-mode-incrzle -n vi-backward-delete-char-incrzle -n  backward-delete-char-incrzle -N expand-or-complete-prefix-incrcompinitbindkey -M  viins  ' ^['  vi-cmd-mode-incrbindkey -M viins  ' ^h '   vi-backward-delete-char-incrbindkey -m viins  ' ^? '  vi-backward-delete-char-incrbindkey -M viins  ' ^i '   expand-or-complete-prefix-incrbindkey -m emacs  ' ^h '  backward-delete-char-incrbindkey  -m emacs  ' ^? '  backward-delete-char-incrbindkey -M emacs  ' ^i '   Expand-or-complete-prefix-incrunsetopt automenucompdef -d scpcompdef -d tarcompdef  -d makecompdef -d jaVacompdef -d svncompdef -d cvs# todo:#     cp dir/now_ predict=0function limit-completion{if  ((compstate[nmatches] <= 1));  thenzle - m  "" elif  ((compstate[list_lines] > 6));  thencompstate[list]= "" zle -M  " Too many matches. " fi}function correct-prediction{if  ((now_predict == 1)); thenif [[  "$BUFFER"  !=  "$buffer _prd"  ]] | |   ((cursor != cursor_org)); thennow_predict=0fifi}function remove-prediction{if  ( (now_predict == 1));  thenbuffer= "$buffer _org" Now_predict=0fi}function show-prediction{# assert (now_predict ==  0) if ((pending == 0))  && ((cursor > 1))  &&[[  "$ Prebuffer " == " " ]] &&[[ " $BUFFER [CURSOR] " != "   "&NBSP;] Thencursor_org= "$CURSOR" buffer_orG= "$BUFFER" comppostfuncs= (limit-completion) zle complete-wordcursor_prd= "$CURSOR" buffer_prd= "$BUFFER" if  [[  "$buffer _org[1,cursor_org]"  ==  "$buffer _prd[1,cursor_org]"  ]]; thencursor= "$ Cursor_org "if [[ " $buffer _org " != " $buffer _prd " ]] | |   (CURSOR_ORG&NBSP;!=&NBSP;CURSOR_PRD)  thennow_predict=1fielsebuffer= "$buffer _org" cursor= "$cursor _ Org "fiecho -n " \e[32m "elsezle -m " "fi}function preexec{echo -n " \e[39m "} function vi-cmd-mode-incr{correct-predictionremove-predictionzle vi-cmd-mode}function  SELF-INSERT-INCR{CORRECT-PREDICTIONREMOVE-PREDICTIONIF&NBSP;ZLE&NBSP;.SELF-INSERT;&NBSP;THENSHOW-PREDICTIONFI} function vi-backward-delete-char-incr{correct-predictionremove-predictionif zle  vi-backward-delete-char; thenshow-predictionfi}function backward-delete-char-incr{ Correct-predictionremove-predictionif zle backward-delete-char; thenshow-predictionfi}function expand-or-complete-prefix-incr{correct-predictionif  ((now_predict ==  1)  thencursor= "$cursor _prd" now_predict=0comppostfuncs= (limit-completion) zle  LIST-CHOICESELSEREMOVE-PREDICTIONZLE&NBSP;EXPAND-OR-COMPLETE-PREFIXFI}


4. Execute the following command:

CD ~/.oh-my-zsh/plugins/mkdir-p incrcd Incrtouch incr-0.2.zsh (copy and paste the code from the link above into the incr-0.2.zsh file) chmod 777 Incr-0.2.zsh


5. Configure the. zshrc file:

Vim ~/.ZSHRC

Join at the end

SOURCE ~/.oh-my-zsh/plugins/incr/incr*.zsh


6. SOURCE ~/.ZSHRC #使其立即生效


7, to complete the configuration, close the current Shell Terminal window, and then re-open, you can see the effect. Do you think the bash you used earlier is a weak blast?


Also attached to the theme link on my zsh, like the toss of the brothers take to slowly modify it:

Https://github.com/robbyrussell/oh-my-zsh/wiki/themes


This article is from the "bitter coffee ' s Yun ' an Road" blog, please be sure to keep this source http://alsww.blog.51cto.com/2001924/1791232

Start the ultimate Efficiency Shell Tour (1)

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.