In Linux/Unix, reload the. vimrc file without restarting Vim. vimrc

Source: Internet
Author: User

In Linux/Unix, reload the. vimrc file without restarting Vim. vimrc

I am a new Vim editor user. I usually use:vs ~/.vimrc To load~/.vimrc Configuration. When I edit. vimrc, I need to reload it without restarting the Vim session. In Linux or Unix-like systems, how does one reload vimrc after editing it without restarting Vim?

Vim is a free and open-source editor compatible with Vi. It can be used to edit various texts. It is particularly useful when editing programs written in C/Perl/Python. You can use it to edit the Linux/Unix configuration file. ~ /. Vimrc is your personal Vim initialization and custom file.

How to reload. vimrc without restarting the Vim session

Reload. vimrc in Vim without restarting:

  1. Input vim filename to start vim
  2. Press Esc and enter: ~ /. Vimrc to load vim configurations
  3. Add a custom configuration as follows:

Filetype indent plugin on set number syntax on

4. Use ': wq' to save the file and '~ /. Exit the vimrc' window
5. Input 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 as needed without exiting vim, so that you can continue to edit the Program *

': So [urce]! {File} 'the vim command will start from the specified file, for example '~ /. Vimrc' read the configuration. As you entered, these commands are executed in normal mode. When you are following ': global',: 'argdo', ': windo', ': bufdo', repeating or following another command, the display will not be updated when the command is executed.

### How to set buttons to edit and reload ~ /. Vimrc

In your '~ /. Vimrc follow these steps:

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

Now, you only need to press 'esc 'and enter 'confe' to edit '~ /. Vimrc '. Press 'esc ', and then enter 'conf' to reload. Some people prefer to use the '<Leader>' key in '. vimrc. Therefore, the above Ing becomes:

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

<Leader> the 'key is mapped to the '\' key by default. Therefore, you only need to input '\' and then 've' to edit the file. Press '\' and then '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 for Linux/Unix shell scripts. He has worked with customers around the world, as well as IT, education, defense, space research, and non-profit sectors. Follow him on [Twitter] [9], [Facebook] [10], [Google +] [11. Use [RSS/XML subscription] [5] to obtain the latest system management, Linux/Unix, and open-source topic tutorials.

--------------------------------------------------------------------------------

Via: https://www.cyberciti.biz/faq/how-to-reload-vimrc-file-without-restarting-vim-on-linux-unix/

Author: [Vivek Gite] [a]
[Geekpi] (https://github.com/geekpi)
Proofread: [wxy] (https://github.com/wxy)

This article was originally compiled by [LCTT] (https://github.com/LCTT/TranslateProject), [Linux China] (https://linux.cn/) honors launched

[A]: https://www.cyberciti.biz/
[1]: https://www.cyberciti.biz/media/new/faq/2018/02/How-to-reload-.vimrc-file-without-restarting-vim.jpg
[2]: https://twitter.com/nixcraft
[3]: https://facebook.com/nixcraft
[4]: https://plus.google.com/+CybercitiBiz
[5]: https://www.cyberciti.biz/atom/atom.xml

Summary

The above section describes how to reload Vim without restarting Linux/Unix. the procedure of the vimrc file is helpful to you. If you have any questions, please leave a message and the editor will reply to you in time. Thank you very much for your support for the help House website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.