vi common problems and related configuration

This article introduces the common problems of vi (vim) software and related configurations.

1. Convert tab to 4 spaces

1. Find the vi or vim configuration file, such as /etc/virc, and add the following to the configuration file:

set tabstop=4
set expandtab
set softtabstop=4
set autoindent

in:

tabstop: indicates the number of spaces corresponding to a tab;
expandtab: indicates that the tab is represented by spaces;
softtabstop: indicates that when the backspace key is used in edit mode, the length of the retraction is returned, and it is recommended to use when expandtab is enabled;
autoindent: automatic indentation Enter option, if this option is turned on, when there is a space or tab at the beginning of a line, the new line after enter will be automatically indented to the same position.



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325190678&siteId=291194637