简体   繁体   中英

Vim 8.0: Can't disable autoindent on Ubuntu 18.04 LTS

I'm using Ubuntu 18.04 LTS and install vim by sudo apt get install vim . Package version is 8.x. Event I set noautoindent and set nosmartindent but the indentation still happens automatically. It looks more like a "smart" one because if I type "end" after typing enter in a *.rb file, the indentation is automatically removed.

:filetype plugin indent off ?

Also consider 'pastetoggle' to disable indent temporarily for pasting.

The Ubuntu 18.04 LTS working solution was given by Roman Odaisky in one of the comments. I am just moving it here and expanding on a little bit for the future users, since it took me some time to find a way to disable this annoyance:

  1. To turn off all autoindent temporarily in VIM session issue the following command while in vi:

     :setl noai nocin nosi inde= 
  2. To have VIM remember the setting, add it to your .vimrc :

     $ vi ~/.vimrc --- setlocal noautoindent setlocal nocindent setlocal nosmartindent setlocal indentexpr= 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM