Add :silent in xolox#misc#os#is_mac() to prevent junk on terminal.#29
Open
drmikehenry wants to merge 1 commit intoxolox:masterfrom
Open
Add :silent in xolox#misc#os#is_mac() to prevent junk on terminal.#29drmikehenry wants to merge 1 commit intoxolox:masterfrom
:silent in xolox#misc#os#is_mac() to prevent junk on terminal.#29drmikehenry wants to merge 1 commit intoxolox:masterfrom
Conversation
The function `xolox#misc#os#is_mac()` uses Vim's `system()` function to
invoke `uname` for platform detection. By default, Vim's `system()`
function sets the terminal to "cooked" mode during execution of the
external program. Normally this would not be a problem, but there are
some sensitive moments during Vim startup where terminal settings are
being negotiated; at these times, changing to "cooked" mode can disrupt
this negotiation.
In particular, the vim-session plugin uses this `is_mac()` function
during a `VimEnter` auto-command. When processing `VimEnter`, terminals
such as Kitty are in the midst of terminal negotiations. The visible
effect is that escape sequences such as the below may end up on screen
after invoking `vim` with no arguments:
^[[2;2R^[[3;1R^[[>1;4000;20c^[]10;rgb:dddd/dddd/dddd^[\^[]11;rgb:0000/0000/0000^[\
To avoid this, use `:silent` with `system()` as recommended in
`:help system()`.
This problem can be demonstrated in complete isolation from any plugins
by having an empty `~/.vim` directory and the below three lines as the
sole contents of `~/.vimrc`:
augroup Something
au VimEnter * call system("true", "")
augroup END
Using Kitty, the above will reliable generate the junk characters shown
above when invoking `vim` with no arguments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The function
xolox#misc#os#is_mac()uses Vim'ssystem()function toinvoke
unamefor platform detection. By default, Vim'ssystem()function sets the terminal to "cooked" mode during execution of the
external program. Normally this would not be a problem, but there are
some sensitive moments during Vim startup where terminal settings are
being negotiated; at these times, changing to "cooked" mode can disrupt
this negotiation.
In particular, the vim-session plugin uses this
is_mac()functionduring a
VimEnterauto-command. When processingVimEnter, terminalssuch as Kitty are in the midst of terminal negotiations. The visible
effect is that escape sequences such as the below may end up on screen
after invoking
vimwith no arguments:^[[2;2R^[[3;1R^[[>1;4000;20c^[]10;rgb:dddd/dddd/dddd^[^[]11;rgb:0000/0000/0000^[\
To avoid this, use
:silentwithsystem()as recommended in:help system().This problem can be demonstrated in complete isolation from any plugins
by having an empty
~/.vimdirectory and the below three lines as thesole contents of
~/.vimrc:augroup Something
au VimEnter * call system("true", "")
augroup END
Using Kitty, the above will reliable generate the junk characters shown
above when invoking
vimwith no arguments.