


Linux Tips: Cancel automatic indentation when pasting in vim
Preface
vim is a powerful text editing tool that has gained great popularity on Linux.
When I was using vim on another server recently, I encountered a strange problem: when I copied and pasted a locally written script into a blank file on the server, automatic indentation occurred.
To use a simple example, the script I wrote locally is as follows:
aaa bbb ccc ddd
When I copied the above content and pasted it into a blank file on the server, what I got was:
aa bbb ccc ddd
Obviously, vim automatically indents the format for us. However, this automatic is a bit unintelligent.
Record the solution here.
Solution: Set up the .vimrc configuration file
We create a new text file named .vimrc
in the home directory and write in it:
set noai " 取消了自动缩进和智能缩进 autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o " 禁用自动换行和自动复制注释符号
In this way, strange indentations will no longer appear when pasted into the server.
In addition, record a few good settings:
set nonu " 不显示行号 set hlsearch " 搜索时高亮显示被找到的文本 syntax on " 自动语法高亮 set cursorline " 突出显示当前行 set ruler " 打开状态栏标尺 set tabstop=4 " 设定 tab 长度为 4 set autoindent " 设置每次单击Enter键后,光标移动到下一行时与上一行的起始字符对齐
The above is the detailed content of Linux Tips: Cancel automatic indentation when pasting in vim. For more information, please follow other related articles on the PHP Chinese website!

What is zlib1.dll? Some people encountered the “zlib1.dll is missing” error or zlib1.dll not found error when they attempt to open an application that includes zlib1.dll. To fix these related errors, this article on php.cn Website can give you some i

Some of you might find that AutoFill is not working in Excel. Can you come up with any solutions on that? If not, then you have come to the right spot. This post on php.cn Website will provide you with 6 ways to solve Excel AutoFill not working.

What is Windows 7 Starter Edition? What are the limitations of Windows 7 Starter Edition? How to get the Windows 7 Starter Edition ISO? This post from php.cn provides detailed information about Windows 7 Starter Edition for you.

When running an App, are you troubled with changing accounts by logging out of the present one and then logging in to another? php.cn has collected some effective ways to help you run apps as a different user in Windows 10 and Windows 11.

Are you suffering from the “Dropbox there was an error downloading your file” error in Windows? Now read this post given by php.cn to get several useful solutions to this problem.

Are you troubled by the problem of “selected files are not highlighted in File Explorer”? Do you know how to fix it? If not, you can read this post on php.cn to get several feasible solutions to make selected files visible in File Explorer.

The language bar is essential if you work with multilanguage. You can change the input language by tweaking the setting from the taskbar. But the language bar might disappear one day when you open the computer. How to fix the language bar missing fro

Want to use an external drive to expand your phone’s storage? It is possible to do this. This php.cn post shows you a guide on how to connect an external drive to a phone. Besides, if you need to recover data from your external drive, you can try php


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor