macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.55k stars 683 forks source link

Unable to permanently remove fullscreen button from touchbar #997

Closed mathsaey closed 4 years ago

mathsaey commented 4 years ago

Describe the bug

I have removed the "toggle full screen button" from my touchbar by putting the following in my gvimrc:

if has("gui_macvim")
  " Remove existing icons from touch bar
  aunmenu TouchBar.
endif

However, once I re-enter fullscreen once, the button reappears. I'm guessing that this is related to the logic that toggles the button between "enter fullscreen" and "leave fullscreen".

To Reproduce

  1. Place the snippet above in .gvimrc
  2. Start macvim (if not in fullscreen, goto 4, otherwise, goto 3)
  3. Leave fullscreen
  4. (Re-)enter fullscreen
  5. The removed button should have reappeared.

Expected behavior I expect the cleared button to not reappear.

Environment (please complete the following information):

Additional context

I want to remove the button in question since it's quite easy to accidentally hit it when reaching for the "esc" key. Placing it on the right by default might be an idea worth thinking about.

eirnym commented 4 years ago

@mathsaey Thank you for an issue,

it's true, as the code handling this will be executed every time. The funny thing, I wonder why it won't be added every time you exit from fullscreen. Probably Apple handles this well.

ychin commented 4 years ago

Will fix this next update. It was a mistake in the way I set it up.

ychin commented 4 years ago

I want to remove the button in question since it's quite easy to accidentally hit it when reaching for the "esc" key. Placing it on the right by default might be an idea worth thinking about.

I was working on Touch Bar stuff and remembered this issue. @mathsaey I didn't think about this back then, but if you want to put the fullscreen Touch Bar button on the right you just need the following in your vimrc. No need to turn off the button really:

anoremenu 1.1 TouchBar.-flexspace- <Nop>
tlnoremenu 1.1 TouchBar.-flexspace- <Nop>
rappazzo commented 3 years ago

Another tip for those who find this issue later on - I had to put

"Disable the fullscreen toggle touchbar icon
let g:macvim_default_touchbar_fullscreen=0

At the top of my vimrc file in order to disable the fullscreen toggle. It didn't work further down in that file.