Home  >  Article  >  Web Front-end  >  What are the methods to reload .vimrc without restarting Vim?

What are the methods to reload .vimrc without restarting Vim?

php中世界最好的语言
php中世界最好的语言Original
2018-04-11 14:00:092463browse

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:

This time I will bring you the methods of reloading .vimrc without restarting Vim, and reloading .vimrc without restarting VimNote What are the matters? Below are practical cases. Let’s take a look.

Vim is a free and open source editor that is upward compatible 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

filetype
 indent plugin on set number syntax on

Use `:wq` to save the file and exit from the `~/.vimrc` window

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 if needed without exiting vim, so you can continue editing your program*

`:so[urce]! {file}` This vim command will extract data from a given file such as `~/.vimrc`

Read configuration. These commands are executed in normal mode just as you type them. When you use `:global`, :`argdo`, `:windo`, `:bufdo` Later, in a loop, or following another command, the display no longer updates when the command is executed.

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

Follow your `~/.vimrc` with this:

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

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

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

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

That's done, you can reload `.vimrc` without restarting Vim.

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:

What are the reasons why using v-show in vuejs does not work

detailed explanation of vue calculated properties

The above is the detailed content of What are the methods to reload .vimrc without restarting Vim?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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