Macvim: Unable to permanently remove fullscreen button from touchbar

Created on 9 Jan 2020  路  3Comments  路  Source: macvim-dev/macvim

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):

  • os: macOS 10.15.1
  • terminal: GUI
  • vim:
VIM - Vi IMproved 8.1 (2018 May 18, compiled Oct 30 2019 23:05:13)
macOS version
Included patches: 1-2234
Compiled by Homebrew
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl               +file_in_path      +mouse_urxvt       -tcl
+arabic            +find_in_path      +mouse_xterm       +termguicolors
+autocmd           +float             +multi_byte        +terminal
+autochdir         +folding           +multi_lang        +terminfo
-autoservername    -footer            -mzscheme          +termresponse
+balloon_eval      +fork()            +netbeans_intg     +textobjects
+balloon_eval_term +fullscreen        +num64             +textprop
+browse            -gettext           +odbeditor         +timers
++builtin_terms    -hangul_input      +packages          +title
+byte_offset       +iconv             +path_extra        +toolbar
+channel           +insert_expand     +perl              +transparency
+cindent           +job               +persistent_undo   +user_commands
+clientserver      +jumplist          +postscript        +vartabs
+clipboard         +keymap            +printer           +vertsplit
+cmdline_compl     +lambda            +profile           +virtualedit
+cmdline_hist      +langmap           -python            +visual
+cmdline_info      +libcall           +python3           +visualextra
+comments          +linebreak         +quickfix          +viminfo
+conceal           +lispindent        +reltime           +vreplace
+cryptv            +listcmds          +rightleft         +wildignore
+cscope            +localmap          +ruby              +wildmenu
+cursorbind        +lua               +scrollbind        +windows
+cursorshape       +menu              +signs             +writebackup
+dialog_con_gui    +mksession         +smartindent       -X11
+diff              +modify_fname      -sound             -xfontset
+digraphs          +mouse             +spell             +xim
+dnd               +mouseshape        +startuptime       -xpm
-ebcdic            +mouse_dec         +statusline        -xsmp
+emacs_tags        -mouse_gpm         -sun_workshop      -xterm_clipboard
+eval              -mouse_jsbterm     +syntax            -xterm_save
+ex_extra          +mouse_netterm     +tag_binary
+extra_search      +mouse_sgr         -tag_old_static
-farsi             -mouse_sysmouse    -tag_any_white
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm  -lncurses -liconv -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -fstack-protector  -L/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE -lperl  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.6```

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.

Most helpful comment

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>

All 3 comments

@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.

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

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>
Was this page helpful?
0 / 5 - 0 ratings