Installing autojump on MAC

Time:2021-10-23

1、 What is autojump?

To know what autojump is, let’s first look at shell, Bash and Zsh.

shell

Shell is what we often call a shell command. In fact, it is a program written in C language. Users type commands on the command line and pass them to the operating system (kernel) for execution after shell interpretation.

For example, the simplest one is: ` CD enters the directory`

It can not only interpret and execute user input commands interactively, but also define various variables and parameters, and provide many control structures only in high-level languages, including loops and branches.

There are many types of shells, including bash, SH, KSH, CSH, Zsh, etc.

1. bash

Bash (Bourne again shell) is the default shell for most Linux systems and Mac OS X. in other words, Bash is an instance of the shell.

2. zsh

Although almost all Linux and Mac OS X use bash by default, the really powerful shell is the hidden Zsh, commonly known as the ultimate shell. It is compatible with Bash and has a variety of powerful functions. Those who want to learn can specifically find the information in this regard and configure learning.

autojump

Autojump is a command line tool. It can use shortcut commands to jump directly to the configured directory, regardless of where it is now and relying on Zsh.

2、 How to install

  1. Installation Zsh:sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  2. Set Zsh as the default shell:chsh -s /bin/zsh(restart shell)
  3. echo $SHELLYou can see which shell to use (bash or Zsh)
  4. To install autojump:brew install autojump(make sure there is brew)
  5. usevim .zshrcOpen. Zshrc (some people can’t find the. Zshrc file. In fact, only when Zsh is installed will. Zshrc be available. It is in the default open terminal directory. You can open the terminal andls -aView).
    a. Findplugins=, add autojump after:plugins=(git autojump)
    b. Create a new line and add:[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
    c. :wqSave, exit and restart the terminal.

3、 How to use

After restarting the terminal, autojump can be used.

  1. Add a shortcut key:j -a s '/Users/XXX/Desktop/code/shark’

Meaning of this Code:J - a shortcut command you defined 'directory location to jump to'

  1. After that, if you want to enter the shark directory, in addition to the traditional CD level entry, you can also directly use the command:j s

PS:

A new version of autojump v22.5.1 has been installed recently. It is found that the j setting does not work. However, as long as the CD has entered the directory, you can directlyPart J file nameYou can jump.
You can enter the autojump folder to view the accessed files. The path is/Users / user name / library / autojump / autojump.txt

Installing autojump on MAC