Home > Web Front-end > JS Tutorial > body text

How to reload .vimrc files in Linux/Unix

php中世界最好的语言
Release: 2018-05-09 11:26:25
Original
1520 people have browsed it

This time I will bring you the method of reloading .vimrc files in Linux/Unix. What are the precautions for reloading .vimrc files in Linux/Unix? Here are actual cases, let’s take a look.

I am a new Vim Editor user. I usually use :vs ~/.vimrc to load the ~/.vimrc configuration. And when I edit .vimrc, I need to reload it without restarting the Vim session. In Linux or Unix-like systems, how to reload .vimrc after editing it without restarting Vim?

Vim is a free, open source and upwardly compatible editor with Vi. It can be used to edit all kinds of text. It is particularly useful when editing programs written in C/Perl/Python. You can use it to edit Linux/Unix configuration files. ~/.vimrc is your personal Vim initialization and customization file.

How to reload .vimrc without restarting the Vim session

The process of reloading .vimrc in Vim without restarting :

  1. Enter vim filename to start vim

  2. Press Esc and then enter: vs ~/.vimrc to load vim configuration

  3. Add custom configuration like this:

filetype indent plugin on set number syntax on

4. Use `:wq` to save the file, And exit from the `~/.vimrc` window
5. Enter any of the following commands to reload `~/.vimrc`: `:so $MYVIMRC` or `:source ~/.vimrc`.

[![How to reload .vimrc file without restarting vim][1]][1]

*Figure 1: Edit ~/.vimrc and reload it when needed without Exit vim so you can continue editing the program *

`:so[urce]! {file}` This vim command will read from the given file such as `~/.vimrc` Config. These commands are executed in normal mode just as you type them. When you are following `:global`, :`argdo`, `:windo`, `:bufdo`, in a loop, or following another command, the display no longer updates on command execution.

How to set the keys to edit and reload ~/.vimrc

Follow your `~/.vimrc` with these:

" Edit vimr configuration file nnoremap confe :e $MYVIMRC " Reload vims configuration file nnoremap confr :source $MYVIMRC

Now just press `Esc` and enter `confe` to edit `~/.vimrc`. Press `Esc` followed by `confr` to reload. Some people like to use the `` key in `.vimrc`. Therefore the above mapping becomes:

" Edit vimr configuration file nnoremap ve :e $MYVIMRC " Reload vimr configuration file nnoremap vr :source $MYVIMRC

` The key is mapped by default to `\` key. So just type `\` followed by `ve` to edit the file. Press `\` followed by `vr` to reload `~/vimrc`.

This is done, you can reload `.vimrc` without restarting Vim.

About the author

The author is the creator of nixCraft, an experienced system administrator, and a trainer of Linux/Unix shell scripts. He has worked with global clients and a variety of industries including IT, education, defense and space research, and the not-for-profit sector. Follow him on [Twitter][9], [Facebook][10], [Google][11]. Get the latest tutorials on system administration, Linux/Unix, and open source topics via [RSS/XML subscription][5].

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:
How Vue uses dynamic refresh Echarts component


Case analysis of using selectpicker drop-down box

# #####

The above is the detailed content of How to reload .vimrc files in Linux/Unix. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!