In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to improve the skills of using Vim". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Vim is one of the most popular text editors, so it's definitely worth your time to learn how to use it. Even if you just learn to use this ubiquitous Vi (m) command line text editor to open files, enter and edit some text, save edited files, and exit programs, you will benefit a lot.
You will find that scenarios that are very convenient to use Vim almost always involve the task of running remote Shell operations. If you use ssh from time to time, such as:
$ssh user@hostname.provider.com
And working in a virtual private server (VPS) or local virtualization container, you can benefit a lot from these powerful Vim skills.
Set Vim as the default text editor
In almost all modern Linux (or BSD) distributions, you can use Vim from the shell command prompt of the terminal emulator. Once you have defined Vim as the default editor in your user shell program, you can use the familiar Vim key bindings to navigate through built-in utilities such as man. I'll show you how to use Bash and Z shell (zsh) to do this, and zsh is now the default shell for macOS users (since Catalina).
(1) set Vim as the default in Bash
Bash manages settings through a combination of point files. The most common practice is to add your editor to the .bashrc file in the home directory, but you can also add it to .bash _ profile. Read the GNU Bash documentation to see the difference between the two.
Set Vim as the default editor by adding the following to ~ / .bashrc:
# set default editor to Vim export EDITOR=vim
Lines that start with # are optional comments, which is a good way to remind yourself of the purpose of the command.
(2) set Vim as the default in zsh
Zsh is an increasingly popular terminal emulator, especially since Apple's FreeBSD-based Darwin system recently moved from Bash to zsh.
Zsh dot files are equivalent to Bash files, so you can choose between ~ /. Zshrc or ~ /. Zprofile. For more information about when to use which one, see zsh.
Set it as the default:
# set default editor to Vim export EDITOR=vim
Optimize Vim configuration
Vim, like the terminal emulator shell, uses point files to set personal preferences. If you find this pattern, you may have guessed that it is ~ / .vimrc.
The first setting you may want to change is to switch to off for traditional Vi compatibility mode. Because Vim is a superset of Vi, all the features in Vi are available in Vim, and there are great improvements in Vim, and you can get many advanced features. The latest version (8.2) allows you to open a terminal as a child process shell in a split window.
By the way, explicitly turning off compatibility with traditional Vi doesn't seem to work (in fact, it probably doesn't). When Vim encounters a .vimrc file, it secretly automatically switches compatibility mode to off. But sometimes it's still important to turn it off explicitly. The abbreviation nocp is synonymous with nocompatible, and its function is the same. All roads lead to Rome, and there are many ways to switch preferences.
In the .vimrc syntax, the lines that start with "are comments (like # in the .bashrc file), which can help you remember things such as why you chose an obscure setting name.
To turn off Vi compatibility, add the following to the ~ / .vimrc file:
"ensure that legacy compatibility mode is off" documentation:
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: 0
*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.