Erwin Müller

Set­up and Con­fig­ure Zsh, Bash-Com­ple­tion, Autojump

In­tro­duc­tion

  • Zsh is an in­ter­ac­tive shell that is most­ly com­pat­i­ble with Bash;
  • Bash-Com­ple­tion en­hances the shell with au­to­mat­ic and pro­gram­ma­ble com­mands and ar­gu­ments com­ple­tions. It works al­so on Win­dows and Mac OS X sys­tems be­cause it de­pends on­ly on the Bash shell;
  • Au­to­jump stores the last vis­it­ed di­rec­to­ries and al­lows for fast nav­i­ga­tion in the file sys­tem. It works al­so on Win­dows and Mac OS X sys­tems be­cause it us­es Python;

All three to­geth­er are re­al­ly use­ful tools that are go­ing to in­crease the pro­duc­tiv­i­ty of any con­sole-user im­mense­ly, al­though the Zsh shell should on­ly by used for the con­sole and not for scripts, be­cause of porta­bil­i­ty and in­ter­op­er­abil­i­ty is­sues. This ar­ti­cle will de­scribe how in­stall and con­fig­ure those tools on a De­bian Jessie sys­tem (but it should be the same on any oth­er GNU/Linux sys­tem). Ba­si­cal­ly, every­thing is con­tained in the Make­file and the sim­ple com­mand make will in­stall and con­fig­ure those tools. The make tar­gets will use op­tion­al en­vi­ron­ment vari­ables and ar­gu­ments to cus­tomize the tools.

Us­age

Down­load the archive from Github de­ven­t/zsh-set­up, un­pack the archive some­where, open a con­sole in­side the di­rec­to­ry where the archive was un­packed and run make.

[shell] wget https://​github​.com/​d​e​v​e​n​t​/​z​s​h​-​s​e​t​u​p​/​a​r​c​h​i​v​e​/​m​a​s​t​e​r​.​zip ‑O zsh​-set​up​.zip un­zip zsh​-set​up​.zip cd zsh-set­up-mas­ter make [/shell]

The fol­low­ing files and di­rec­to­ries are cre­at­ed by the de­fault make target.

  • /etc/sudoers.d/08proxy
  • /etc/apt/apt.conf.d/08proxy
  • /etc/profile.d/proxy.sh on­ly if any proxy en­vi­ron­ment vari­ables were set;
  • .user_rc the file is not re­moved or changed and is sup­pose to have user spe­cif­ic alias­es and functions;
  • .user_zshrc the file is not re­moved or changed and is sup­pose to have user spe­cif­ic Zsh settings;
  • .zshrc
  • /op­t/oh-my-zsh

En­vi­ron­ment Variables

  • http_proxy
  • https_proxy
  • ftp_proxy
  • no_proxy, if those en­vi­ron­ment vari­ables are present, the make tar­gets will con­fig­ure su­do­ers, apt and Zsh to use the en­vi­ron­ment variables.

Ar­gu­ments

  • WORK sets the work di­rec­to­ry, de­faults to the user home directory;
  • THEME sets the oh-my-zsh theme, de­faults to “gen­too”;
  • PLUGINS sets the plu­g­ins to load, de­faults to “”;
  • REMOTE_EDITOR sets the re­mote ed­i­tor to use, de­faults to “emacs”;
  • LOCAL_EDITOR sets the lo­cal ed­i­tor to use, de­faults to “emacs”;

Ad­di­tion­al Targets

  • clean re­moves the gen­er­at­ed files:
    • /etc/sudoers.d/08proxy
    • /etc/apt/apt.conf.d/08proxy
    • /etc/profile.d/proxy.sh
    • .zshrc
  • geom­e­try-theme in­stalls and sets the Geom­e­try theme

Test

Us­ing Va­grant a test sys­tem can be in­stalled in Vir­tu­al­Box to test and pre­view the tools. The tar­get will in­stall De­bian Jessie im­age in Vir­tu­al­Box, run make and en­ter the sys­tem via ssh. The proxy en­vi­ron­ment vari­ables men­tioned above are passed to the sys­tem. Af­ter the user re­viewed and ex­it the sys­tem, the sys­tem is removed.

Li­cense

Li­censed to the Apache Soft­ware Foun­da­tion (ASF) un­der one or more con­trib­u­tor li­cense agree­ments. See the NOTICE file dis­trib­uted with this work for ad­di­tion­al in­for­ma­tion re­gard­ing copy­right own­er­ship. The ASF li­cens­es this file to you un­der the Apache Li­cense, Ver­sion 2.0 (the “Li­cense”); you may not use this file ex­cept in com­pli­ance with the Li­cense. You may ob­tain a copy of the Li­cense at

Un­less re­quired by ap­plic­a­ble law or agreed to in writ­ing, soft­ware dis­trib­uted un­der the Li­cense is dis­trib­uted on an “AS ISBASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ei­ther ex­press or im­plied. See the Li­cense for the spe­cif­ic lan­guage gov­ern­ing per­mis­sions and lim­i­ta­tions un­der the License.

1 comment for “Set­up and Con­fig­ure Zsh, Bash-Com­ple­tion, Autojump

Leave a Reply to Erwin Cancel reply

Your email address will not be published.