Send by LINE
B! Bookmarks in Hate-bu
Bookmarks in Pocket
RSS feeds

Linux vim: Correct indentation of copy&paste

Other language site
No available translations found
Google Translate
programing image

When copying and pasting source with ssh connection etc., space indent may be converted to tab without permission and it may be shifted.

This can be solved by changing the auto indent setting.

Set the auto command of the number of lines in vim command mode.

The command mode is an operation that can be entered at the lower left of the editor by pressing the Esc key and pressing the colon ':' when opening with vim.

Turn OFF.

:set noautoindent

It is the operation before turning off.


Indentation is out of order.

By default vim is on.

Correct the deviation.


I will copy and paste again.


Indentation deviation cured.

Turn it ON.

:set autoindent

Revert to default.

For me, I never use this.

This setting disappears when the terminal editor connection (ssh) expires.

When connecting again, it is necessary to set 'noautoindent' again.

Leave a Reply