Linux vim: Correct indentation of copy&paste

Other language site
ja ja
Google Translate
  • -

    シェア
  • ---

    LINEで送る
  • -

    はてなブックマーク
    ブックマーク
  • -

    pocket
  • -

    rss
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.

linux-cmd-vim-set-autoindent-none-min

Indentation is out of order.

By default vim is on.

Correct the deviation.

linux-cmd-vim-set-noautoindent-min

I will copy and paste again.

linux-cmd-vim-set-noautoindent-result-min

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.

SNS also distributes articles.
Leave a Reply

*

If you like this article, share it!