Skip to content

Would like to set 'guitablabel' from ~/.vim/pack/mypackage #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mikesep opened this issue Jun 5, 2019 · 5 comments · Fixed by #903
Closed

Would like to set 'guitablabel' from ~/.vim/pack/mypackage #899

mikesep opened this issue Jun 5, 2019 · 5 comments · Fixed by #903
Milestone

Comments

@mikesep
Copy link

mikesep commented Jun 5, 2019

First of all, huge thanks to the maintainers of MacVim for all the great work that you do! 😃

In #635, the team merged, discussed, and then reverted (via #637) a change to make the macvim base gvimrc allow users to override 'guitablabel' in other places besides their .gvimrc.

@chdiza said:

I don't see the point of this unless one is desperately trying to avoid needing to have a ~/.gvimrc in the first place. If you already have a ~/.gvimrc, there is no reason not to put your guitablabel setting in it, and there is no reason to put that setting in ~/.vimrc.

I am in fact someone who is trying to avoid needing a ~/.vimrc or ~/.gvimrc. My personal configurations are stored in a vim package (e.g. ~/.vim/pack/mypackage) that contains my settings as well as the plugins I use.

Because vim packages are loaded in step 4 of initialization, and GUI initialization happens in step 8, the MacVim base gvimrc overrides the 'guitablabel' setting from my package.

Would you reconsider making the MacVim gvimrc more permissive to allow this type of configuration? It didn't seem like there were any drawbacks mentioned in #635.

/cc @ychin @chdiza @splhack from the original PR.

@chdiza
Copy link
Contributor

chdiza commented Jun 6, 2019

I am in fact someone who is trying to avoid needing a ~/.vimrc or ~/.gvimrc. My personal configurations are stored in a vim package

I'm not sure that MacVim should be catering to this extremely niche case.

At any rate, wouldn't it work if you put an autocmd somewhere in the pack, tied to GuiEnter, that sets &guitablabel?

@mikesep
Copy link
Author

mikesep commented Jun 6, 2019

It would work to use an autocmd, though I've tried to stay away from them where possible because I've found them hard to debug.

I personally don't feel that MacVim should be taking a strong stance on where I put my configuration settings. You are right that .gvimrc exists to put GUI-specific settings, but has("gui_running") exists so that I can do things conditionally. I think there's a good practice to putting related settings together. If I were customizing my tab line for vim for both terminal and GUI modes, I'd want to put that setting together, either in my .vimrc or a package file or a plugin or wherever. I find it cumbersome to always be comparing a .vimrc against a .gvimrc to see whether a setting was overridden later.

Nearly everything else in MacVim's base gvimrc has a way to be skipped/enabled: macvim_skip_colorscheme, macvim_skip_cmd_opt_movement, macvim_hig_shift_movement. Is it a burden to wrap the guitablabel line in an if exists check? I wouldn't think it would make testing or maintenance more difficult, but I might be missing something.

@ychin
Copy link
Member

ychin commented Jun 9, 2019

I was thinking more about it, and yes while GUI configs "should" be placed in .gvimrc it does seem odd that we would impose such a strong restriction on MacVim's side, especially Vim itself doesn't (this only happens because MacVim has its own gvimrc that it sources). I think there's a good point to be made such that MacVim should aim to be as un-intrusive a change to a Vim user as humanly possible and this override isn't respecting that. Let me see if I could go back to fix that.

@ychin ychin added this to the snapshot-156 milestone Jun 9, 2019
ychin added a commit to ychin/macvim that referenced this issue Jun 9, 2019
If guitablabel is already set in .vimrc, don't have the MacVim default
gvimrc override it. Even though Vim's docs recommend putting GUI
settings in gvimrc, that's mostly for technical reasons, and MacVim
should still aim to respect settings that a user has already set. This
also makes it behave more similarly with Vim (you can set 'guitablabel'
in vimrc or gvimrc and it would still work).

This was previously done in macvim-dev#635 but reverted, but macvim-dev#899 raised this
issue again.

Close macvim-dev#899
@ychin
Copy link
Member

ychin commented Jun 9, 2019

I have filed PR #903 which will fix this. This is a simple fix and while a little messy will do the right thing in respecting the user's preferences and I don't think anyone who cares will be negatively affected by this.

I'm generally a little dissatisfied with how MacVim's gvimrc works as it's an extra configuration file that gets injected into the configuration chain. I think other settings in src/MacVim/gvimrc like printexpr probably should be done as a native default in the C code (this way you could do something like set printexpr& in MacVim and it will work properly) but that's outside the scope of particular issue.

@mikesep
Copy link
Author

mikesep commented Jun 10, 2019

Thanks @ychin! My quick tests of #903 look good on my machine.

ychin added a commit to ychin/macvim that referenced this issue Jun 11, 2019
Vim patch 8.1.1517

Security Fixes:

- Fix modeline security vulnerability (CVE-2019-12735). macvim-dev#898 (fixed in
  Vim 8.1.265)

Features:

- Add new option 'MMTitlebarAppearsTransparent' that will make the title
  bar transparent and use the background color in the color scheme
  (10.14 or above only). macvim-dev#888

Fixes:

- Fix filename parsing error when opening a file with special characters
  like '$' in file path. macvim-dev#863
- Fix blurry I-beam mouse cursor. macvim-dev#755
- Fix silently failing to save a file when conversion error is present.
  macvim-dev#671. (Vim 8.1.1349)
- Fix failing to save to a network shared SMB folder macvim-dev#861.
  (Vim 8.1.0957)

Misc:

- 'guitablabel' can now be set in .vimrc, without MacVim overriding it.
  macvim-dev#899

Targets macOS 10.8+

Script interfaces have compatibility with these versions:

- Lua 5.3
- Perl 5.18
- Python2 2.7
- Python3 3.7
- Ruby 2.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants