In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article shows you how to understand zsh Shell in Emacs under Windows. The content is concise and easy to understand. It will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
The advantage of running cross-platform shell (such as Bash or zsh) is that you can use the same syntax and scripts on multiple platforms. It's troublesome to set up (replace) shell on Windows, but the reward goes far beyond this small effort.
Zsh shell inside Emacs on Windows
The MSYS2 subsystem allows you to run shell such as Bash or zsh on Windows. It's important to use MSYS2 to make sure that the search paths point to the MSYS2 subsystem itself: there are too many dependencies.
After MSYS2 is installed, the default shell is Bash;zsh, which can be installed through the package manager:
Pacman-Sy zsh
You can set zsh as the default shell by modifying the etc/passwd file, for example:
Mkpasswd-c | sed-e's Accord bash mkpasswd'| tee-a / etc/passwd
This changes the default shell from bash to zsh.
To run zsh in Emacs on Windows, you need to modify the shell-file-name variable to point it to the zsh binary in the MSYS2 subsystem. The binary shell file is somewhere in the Emacs exec-path variable.
(setq shell-file-name (executable-find "zsh.exe"))
Don't forget to modify the PATH environment variable of Emacs, because the MSYS2 path should precede the Windows path. In the previous example, assuming that MSYS2 is installed in c:\ programs\ msys2, execute:
(setenv "PATH"C:\\ programs\\ msys2\\ mingw64\ bin;C:\\ programs\\ msys2\\ usr\\ local\\ bin;C:\\ programs\\ msys2\\ usr\ bin;C:\\ Windows\\ System32;C:\\ Windows")
After setting these two variables in the Emacs configuration file, run them in Emacs:
Mmurx shell
You should see the familiar zsh prompt.
The terminal settings (eterm) of Emacs are different from the standard terminal settings (xterm-256color) of MSYS2. This means that some plug-ins and topics (prompts) may not work properly-especially when using oh-my-zsh.
Detecting zsh otherwise running in Emacs is simple, using the variable $INSIDE_EMACS.
The following code snippet, taken from .zshrc (which is loaded when started in interactive shell mode), starts the git plug-in and changes the theme when zsh is running in Emacs:
# Disable some plugins while running in Emacsif [- n "$INSIDE_EMACS"]; then plugins= (git) ZSH_THEME= "simple" else ZSH_THEME= "compact-grey" fi
By setting the INSIDE_EMACS variable to the SendEnv variable in the local ~ / .ssh/config file.
Host myhostSendEnv INSIDE_EMACS
…… At the same time, it is set to the AcceptEnv variable in / etc/ssh/sshd_config of the ssh server.
AcceptEnv LANG LC_* INSIDE_EMACS
This makes it possible to log in to another ssh server running zsh through ssh in an Emacs shell session. When logging in remotely via ssh on the zsh in Emacs under Windows, remember to use the parameter-tjinghort parameter to force the allocation of pseudo terminals (this is necessary because the Emacs under Windows does not have a real tty).
The above is how to understand zsh Shell in Emacs under Windows. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 272
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.