Vim on MacOS Incorrectly Indenting

43 views
Skip to first unread message

Adrian Keister

unread,
May 17, 2019, 1:53:27 PM5/17/19
to vim_use
I'm having difficulty with vim on Mac OS. It's indenting incorrectly. The attached txt file is the test file, and the two screenshots show how different they look on Mac versus Windows. The Windows gVim is the look I want. I've tried everything from brew install vim to re-installing MacVim, no joy. It does not appear to be a vimrc issue, because I've tried the troubleshotting page here, with no joy:

https://github.com/macvim-dev/macvim/wiki/Troubleshooting

Any ideas? Thanks for your time!
test.txt
Mac OS MacVim.png
Windows GVIM.png

Jürgen Krämer

unread,
May 20, 2019, 3:15:08 AM5/20/19
to vim...@googlegroups.com
Hi,
your file contains tabs at the start of lines 5 to 9. On Windows the 'tabstop'
option is probably set to 4, while on Mac it seems to be 8 (the default).

Regards,
Jürgen

--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

Adrian Keister

unread,
May 20, 2019, 12:22:13 PM5/20/19
to vim_use
Jürgen,

That could be it, but then I have two questions:

1. Why can't I navigate to the very beginning of the line where the indenting is different? This is behavior on the Mac, to be clear, not on Windows.

2. Why doesn't adding
set tabstop=4
in my Mac's vimrc fix the problem?

Thanks for your time!

Cheers,
Adrian

Jürgen Krämer

unread,
May 20, 2019, 5:15:44 PM5/20/19
to vim mailing list

Hello Adrian,

Adrian Keister schrieb am 20.05.2019 um 18:22:
> On Monday, May 20, 2019 at 2:15:08 AM UTC-5, jott...@googlemail.com wrote:
>> Hi,
>>
>> Adrian Keister schrieb am 17.05.2019 um 19:19:
>>> I'm having difficulty with vim on Mac OS. It's indenting incorrectly. The attached txt file is the test file, and the two screenshots show how different they look on Mac versus Windows. The Windows gVim is the look I want. I've tried everything from brew install vim to re-installing MacVim, no joy. It does not appear to be a vimrc issue, because I've tried the troubleshotting page here, with no joy:
>>>
>>> https://github.com/macvim-dev/macvim/wiki/Troubleshooting
>>>
>>> Any ideas? Thanks for your time!
>>
>> your file contains tabs at the start of lines 5 to 9. On Windows the 'tabstop'
>> option is probably set to 4, while on Mac it seems to be 8 (the default).
>
> Jürgen,
>
> That could be it, but then I have two questions:
>
> 1. Why can't I navigate to the very beginning of the line where the indenting is different? This is behavior on the Mac, to be clear, not on Windows.

you have tabs at the start of line. Normally when on a tab the cursor is
put at the end of the tab. You can change this with the 'virtualedit'
option. Set it to 'all' and you can move through a tab cell by cell.

> 2. Why doesn't adding
> set tabstop=4
> in my Mac's vimrc fix the problem?

Maybe that option has been changed by a (filetype) plugin. If you
execute

:verbose set tabstop?

Vim will tell you where that option was changed last.

Regards,
Jürgen

Adrian Keister

unread,
May 20, 2019, 5:31:02 PM5/20/19
to vim_use
Jürgen,

Excellent! Alas, I won't have access to my Mac for the rest of this week, but I will try those out next week and post back here.

Thanks again!

Cheers,
Adrian

Christian Brabandt

unread,
May 21, 2019, 2:17:34 AM5/21/19
to vim mailing list

On Mo, 20 Mai 2019, 'Jürgen Krämer' via vim_use wrote:

> you have tabs at the start of line. Normally when on a tab the cursor is
> put at the end of the tab. You can change this with the 'virtualedit'
> option. Set it to 'all' and you can move through a tab cell by cell.

Also, if you enable listmode (:set list), the cursor will automatically
be positioned at the beginning of the tab, instead of the end.

Best,
Christian
--
Wenn man sein Ohr ganz leicht auf die heiße Herdplatte drückt,
kann man riechen wie blöd man ist.

Adrian Keister

unread,
May 28, 2019, 11:50:27 AM5/28/19
to vim_use
On Friday, May 17, 2019 at 12:53:27 PM UTC-5, Adrian Keister wrote:
Many thanks to Jürgen and Christian for your help! The .gvimrc file was overriding the .vimrc file for the tabstop setting, so that was one problem. Then I actually had tabs in the file, as noted by others. I don't actually want those tabs in there, so the :1,$s/\t/ /g command replaced all tabs by four spaces like I want. Now MacVim looks just like Windows.

Cheers.
Reply all
Reply to author
Forward
0 new messages