Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

vim, meson and tabulations story [solved]

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
5 posts • Page 1 of 1
Author
Message
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

vim, meson and tabulations story [solved]

  • Quote

Post by netfab » Wed Mar 25, 2026 9:02 am

My vim is configured to NOT insert spaces for each tabulation, i.e. tabulations are tabulations.
Years ago I wrote some meson.build files.
In those files tabulations are tabulations.

Today, if I edit these files, and press the TAB key, each tabulation is replaced by spaces.
If I open a new file using vim :

Code: Select all

$ vim /tmp/foo
Each tabulation is a tabulation.

If I open a new meson.build file :

Code: Select all

$ vim /tmp/meson.build
Each tabulation is replaced by spaces.

My question : is there something that change on gentoo in default vim configuration regarding meson.build files ? where ?

Thank you.
Last edited by netfab on Wed Mar 25, 2026 2:11 pm, edited 1 time in total.
Top
Banana
Moderator
Moderator
User avatar
Posts: 2378
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Wed Mar 25, 2026 11:50 am

maybe the command :set can show anything to analyse.
Run it on both and compare.
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
Hu
Administrator
Administrator
Posts: 24385
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Wed Mar 25, 2026 1:36 pm

This sounds like something is setting expandtab on you. Various filetype plugins do this, including /usr/share/vim/vim91/ftplugin/meson.vim, which seems like a likely culprit, given the initial report. As I read that vim file, this is because someone considers expandtab to be "Meson recommended style." Fortunately, the author included a hook you can use to override this:

Code: Select all

if get(g:, "meson_recommended_style", 1)
  setlocal expandtab
  setlocal shiftwidth=2
  setlocal softtabstop=2
  let b:undo_ftplugin .= " | setl et< sts< sw<"
endif
Therefore, set that variable to 0, and this plugin should stop applying these settings. Beware that if this is Meson recommended style, then deviating from it may cause other Meson users to complain when reading content you wrote under the override, or even cause syntax errors if the parser reacts badly to mixing tabs and spaces in a single file, and you edit a "recommended style" file while using this override.
Top
Banana
Moderator
Moderator
User avatar
Posts: 2378
Joined: Fri May 21, 2004 12:02 pm
Location: Germany
Contact:
Contact Banana
Website

  • Quote

Post by Banana » Wed Mar 25, 2026 1:56 pm

And according to portagefilelist there maybe multiple packages and files involved. I haven't check the contents of those.

https://www.portagefilelist.de/index.ph ... im#panchor

Code: Select all

/usr/share/vim/vimfiles/indent/meson.vim => dev-build/meson
/usr/share/nvim/runtime/syntax/meson.vim => app-editors/neovim
/usr/share/nvim/runtime/syntax/meson.vim => app-editors/neovim
/usr/share/vim/vim91/syntax/meson.vim => app-editors/vim-core
Forum Guidelines

PFL - Portage file list - find which package a file or command belongs to.
My delta-labs.org snippets do expire
Top
netfab
Advocate
Advocate
Posts: 2066
Joined: Thu Mar 03, 2005 1:27 pm
Location: 127.0.0.1

  • Quote

Post by netfab » Wed Mar 25, 2026 2:10 pm

Banana wrote:maybe the command :set can show anything to analyse.
Run it on both and compare.
Yes, this comparison shows that expandtab was forced, even if I set noexpandtab in my ~/.vimrc.
Hu wrote:This sounds like something is setting expandtab on you. Various filetype plugins do this, including /usr/share/vim/vim91/ftplugin/meson.vim, which seems like a likely culprit, given the initial report. As I read that vim file, this is because someone considers expandtab to be "Meson recommended style." Fortunately, the author included a hook you can use to override this:

Code: Select all

if get(g:, "meson_recommended_style", 1)
  setlocal expandtab
  setlocal shiftwidth=2
  setlocal softtabstop=2
  let b:undo_ftplugin .= " | setl et< sts< sw<"
endif
Therefore, set that variable to 0, and this plugin should stop applying these settings. Beware that if this is Meson recommended style, then deviating from it may cause other Meson users to complain when reading content you wrote under the override, or even cause syntax errors if the parser reacts badly to mixing tabs and spaces in a single file, and you edit a "recommended style" file while using this override.
Thank you, that's it. I plan to convert all meson files, but it drove me crazy to not understand. Internal vim change without any notification.
Top
Post Reply

5 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic