The most commonly used editor for Linux users is the VIM editor. In order to improve our editing speed, we often set some shortcuts in the editor. Today, Xiaobian will share with you the method of setting the Tab key to 4 spaces in the VIM editor.
Setting method:
Edit
vim ~ /.vimrc
The new file does not exist, the file already exists, an additional tail < Br>
Add
“ This code will only be executed if autocommands is supported.
if has(”autocmd“)
” Using file type checking and file-based auto-shrinking
filetype plugin indent on
&ldquo The length of the tab in the Makefiles file is 8.
autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab
endif
” For other cases, use 4 Space width TAB
set tabstop=4 “ The width of the TAB is set to 4 spaces.
” But still \\t. Just vim interprets it as 4 spaces wide, with other editors or \\t symbols
“ Vim will interpret it to be having< Br>
” a width of 4.
set shiftwidth=4 “ Indent using a width of 4 spaces.
set softtabstop=4 ” Set the number of columns occupied by the tab. When entering tab, set the width of 4 spaces.
set expandtab “ The extension tab is a space.
vim temporarily turns off indentation and annotation auto-indentation settings
VIM will automatically indent when pasting code, making the code messy, maybe even because of a comment on a line The following code is all commented out,
Method 1
set pastetoggle
to turn off automatic indentation
or set as a shortcut, the most convenient The method is to add a sentence to the .vimrc:
set pastetoggle=“F9”
In the insert mode, just press the F9 key to switch the automatic indent.
When you need to write your own code, enter the insert mode, the default is automatically indented.
Method 2
set paste
Then enter the insert mode paste, the code will not be automatically indented.
When you type the code, you need to automatically indent it. You need to change it back:
set nopaste
This is how to set the Tab key to 4 spaces in the VIM editor. Users who need to use the VIM editor frequently will set it up, which will improve your editing speed.
A lot of people have problems installing the boost library on Linux. When using c++
The TCP port range of the Linux system can be modified. Appropriately adjust the TC
Linux system, sometimes need to re-mount var partition to free up space, and the theoretical explana
As a Linux geek, it is not enough to master some basic system knowledge. You need t
How to compile and install Mono notes in Linux system
How to partition Linux VPS system disk?
How to deal with the problem of starting weblogic server error in Linux
What is the meaning of Linux beginners learning commands?
Solution with fstab file error causing Linux to fail to start
The role of the Linux system pwd command
RedHat6.5 network card common problems and solutions
How to change the Linux default startup level
How does Win10 close the browser to send user access history by default?
"Error 1606" appears in Windows 7 installation software
The mouse wheel under Win7 system 6 games
The Vista menu no longer pops up annoying tips
Linux server application: About Apache configuration and logging
Clear the way to automatically save the login username and password on the webpage
How to uninstall the KB3000850 patch to solve the incompatibility problem of the Win8 system