vim paste option bracks expandtab option

Bug #1576583 reported by Oliver Mueller on 2016-04-29
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
vim (Ubuntu)
Undecided
Unassigned

Bug Description

i am using ubuntu xenial.

when I use vim options at the end of a file like the following:

# vim: syntax=yaml ts=2 sw=2 et sr softtabstop=2 autoindent paste

it should convert an entered tab into spaces (pressing tab should result into 2 spaces). in the past it actually did. currently it does not anymore. the problem here seems to be the last option "paste". if i leave out the paste options the expandtab (et) option works again. the paste option should not have any effect on the expandtab option though.

steps to reproduce:

- create a file with "# vim: syntax=yaml ts=2 sw=2 et sr softtabstop=2 autoindent paste" at the end of the file.
- save it
- reopen it with vim
- in insert mode: press tab key
- the tab should have been converted into 2 spaces (but it doesn't)
- remove the paste option "# vim: syntax=yaml ts=2 sw=2 et sr softtabstop=2 autoindent"
- save it
- reopen it with vim
- in insert mode: press tab key again
- now the tab is converted into 2 spaces

AntonOlsen (anton-antonolsen) wrote :

You can test this without a .vimrc

:set expandtab

Leading tabs get converted to spaces.
:set all shows expantab.

:set paste

Leading tabs no longer get converted to tabs.
:set all shows "noexpandtab"

The converse is not true though, setting expandtab does not affect the setting of paste. If you put set paste near the top of the vimrc it should work as expected.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in vim (Ubuntu):
status: New → Confirmed
Will Gray (graywh) wrote :

This is not a bug, but the defined behavior of the 'paste' setting.

> When the 'paste' option is switched on (also when it was already on):
> - 'expandtab' is reset

Changed in vim (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers