-
Notifications
You must be signed in to change notification settings - Fork 458
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
fix(font-encoding): fix invalid characters on windows, fix #639 #659
Conversation
…eencoding` in neovim to `utf-8`
for the icon overlapping issue could be fixed if use wezterm as a workaround. it seems like a long term issue in windows terminal. |
@CharlesChiuGit Sorry for the late reply. I just did some testings on my Windows 10 VM. The known issues are:
For the first three items, I'll propose a draft solution ASAP. For the last item, manually installing all fonts ending in Then use |
I think supporting
Can u explain more on "command mode IO"? I not sure what do u mean. I can run most Windows command with
Ys, I follow the step in
Ys, I also discovered that installing nerd-font via third-party package manager like
Ys, use the |
IMO we could
I mean we should further specify how PowerShell works - e.g., whether to start in non interactive-mode/read user-configuration/set useful environment variables, with the goal of simulating bash's
I just tested this and it seems feasible to install the
btw, are the icons displaying in Windows Terminal (toggleterm) now? Looks like the byte string wasn't properly pasted to Write-Host "`u{ebb1}" |
actually "pwsh" is not the same as "windows powershell" lol pwsh is the cross-platform version. |
interesting! didn't knw that lol |
Write-Host "`u{ebb1}" will try once i got home. |
Great!
We're gonna need massive reference to about_PowerShell_exe and about_Pwsh 😄 |
Updated. It seems fine using pure ASCII, no matter where u use it. But |
Hmm maybe this is because those multi-byte icons were not properly pasted to |
@CharlesChiuGit The following are all possible flags that we could further discuss:
- -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();$PSDefaultParameterValues['Out-File:Encoding']='utf-8';
+ -Command $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding
LEGEND:
|
8282c80 cc @CharlesChiuGit If you have time to review & discuss this! |
Damn! I totally forgot to test this. Will test soon! |
|
I also notice sth. I'm not sure why, but current settings seem to increase noticeable startup time comparing to my original draft. |
It's actually working, notice that: Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help. have disappeared.
Oh yes, I forgot
We probably need to add
Sounds very reasonable 😄 Will remove this flag.
Maybe u are missing something from about_Profiles?
Hmm that's strange... The current settings work fine with PowerShell core on macOS, will test this issue on Windows later ;) |
From
I think I found why shell = string.format(
"%s %s;",
vim.o.shell,
"-NoLogo -NoLogo -NoProfileLoadTime -NonInteractive -ExecutionPolicy RemoteSigned"
), -- change the default shell However, flags after The extra delay startup time seems to related to waiting for lsp to start, not directly related to the PR. |
After hours of debugging and reading the docs, I just don't think manual-inputed icons can be display correctly on But everything just works fine in wezterm. So I think it's a native flaw on windows terminal. I think we need to cut the losses, we had already invested too much time in this trial font issue. |
This is exactly what I was concerned about before:
That "extra line" containing ANSI escape sequences is actually the user's PowerShell custom prompt. If Also, we should consider users who use local basecmd = "-NoLogo -MTA -ExecutionPolicy RemoteSigned"
local ctrlcmd = "-Command [console]::InputEncoding = [console]::OutputEncoding = [System.Text.Encoding]::UTF8" The following configuration will handle the issue of vim.api.nvim_set_option_value("shellredir", '-RedirectStandardOutput %s -NoNewWindow -Wait', {})
vim.api.nvim_set_option_value("shellpipe", '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode', {})
💯💯 agreed. If the above proposal works properly, we should just merge this PR. As for the actual behavior of |
Ys,
That's reasonable. Agreed.
Agreed.
Both of those new settings works fine on my win11. |
A minor patch for consistent code style: f2f3c2c. |
* chore(README): bump supported version * feat(options): support new options shipped with v0.9 * feat(scripts): support v0.9 * feat!: add initial support for lsp semantic tokens (#633) * feat(utils): use neovim builtin to get highlights (#632) * fix: remove deprecated options for nvim-tree. * fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix #624 #634 (#637) * fix&feat: introduce suda.vim to write file with sudo * chore(kind_text): cleanup (#648) * feat(alpha): add custom highlight groups (#650) * fix: install `psutils` by default for Windows users * revert: bind `SudaWrite` to `<A-s>` ref: #641 (comment) * fix(cmp): nil `vim_item` * perf(core-mapping): add some useful mapping * fix(nvim-tree): `hide_root_folder` is deprecated * perf: load fidget.nvim after `LspAttach` * minor fix 1. remove `<nop>` at "n|Q" 2. use visual mode instead of visual-line mode for "n|<C-a>" * perf: align style * perf(0.9): `stabilize.nvim` had been upstream to `0.9` * chore(project.nvim): update legacy code * chore(README): update branch info * chore(mapping): cleanup (#657) * fix(icon): update invalid cmp icon (#665) * chore/lspsaga_move (#667) * fix: paint word boundary in python (#669) * fix(bufferline): `show_buffer_default_icon` is now deprecate * feat(formatting): notify users for files under disabled dirs * chore(formatting): rephrase messages * fix(font-encoding): fix invalid characters on windows, fix #639 (#659) Co-authored-by: 冷酔閑吟 <[email protected]> * pref: unify code style for PowerShell commands * perf: better guidance to `Discussions` and `Wiki` (#680) * pref(ISSUE_TEMPLATE): fix typos and format with prettier * fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier * feat(scripts): abort for nvim v0.7 and its antecedent * feat(settings): allow customization of `transparent_background` (#687) * fix(bufferline): use defaults for `get_element_icon` (#685) * feat(auto-session): remember opened buffers (#688) * revert(keymap): remove redundant mappings. * fix(catppuccin): properly detect `g:colors_name` (#695) Ref: upstream breaking change [catppuccin/nvim@7a7a664] --------- Co-authored-by: ayamir <[email protected]> Co-authored-by: Charles Chiu <[email protected]> Co-authored-by: CharlesChiuGit <[email protected]> Co-authored-by: Xie Zejian <[email protected]> Co-authored-by: AngelontheRoad <[email protected]> Co-authored-by: Saafo <[email protected]>
* chore(README): bump supported version * feat(options): support new options shipped with v0.9 * feat(scripts): support v0.9 * feat!: add initial support for lsp semantic tokens (ayamir#633) * feat(utils): use neovim builtin to get highlights (ayamir#632) * fix: remove deprecated options for nvim-tree. * fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix ayamir#624 ayamir#634 (ayamir#637) * fix&feat: introduce suda.vim to write file with sudo * chore(kind_text): cleanup (ayamir#648) * feat(alpha): add custom highlight groups (ayamir#650) * fix: install `psutils` by default for Windows users * revert: bind `SudaWrite` to `<A-s>` ref: ayamir#641 (comment) * fix(cmp): nil `vim_item` * perf(core-mapping): add some useful mapping * fix(nvim-tree): `hide_root_folder` is deprecated * perf: load fidget.nvim after `LspAttach` * minor fix 1. remove `<nop>` at "n|Q" 2. use visual mode instead of visual-line mode for "n|<C-a>" * perf: align style * perf(0.9): `stabilize.nvim` had been upstream to `0.9` * chore(project.nvim): update legacy code * chore(README): update branch info * chore(mapping): cleanup (ayamir#657) * fix(icon): update invalid cmp icon (ayamir#665) * chore/lspsaga_move (ayamir#667) * fix: paint word boundary in python (ayamir#669) * fix(bufferline): `show_buffer_default_icon` is now deprecate * feat(formatting): notify users for files under disabled dirs * chore(formatting): rephrase messages * fix(font-encoding): fix invalid characters on windows, fix ayamir#639 (ayamir#659) Co-authored-by: 冷酔閑吟 <[email protected]> * pref: unify code style for PowerShell commands * perf: better guidance to `Discussions` and `Wiki` (ayamir#680) * pref(ISSUE_TEMPLATE): fix typos and format with prettier * fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier * feat(scripts): abort for nvim v0.7 and its antecedent * feat(settings): allow customization of `transparent_background` (ayamir#687) * fix(bufferline): use defaults for `get_element_icon` (ayamir#685) * feat(auto-session): remember opened buffers (ayamir#688) * revert(keymap): remove redundant mappings. * fix(catppuccin): properly detect `g:colors_name` (ayamir#695) Ref: upstream breaking change [catppuccin/nvim@7a7a664] --------- Co-authored-by: ayamir <[email protected]> Co-authored-by: Charles Chiu <[email protected]> Co-authored-by: CharlesChiuGit <[email protected]> Co-authored-by: Xie Zejian <[email protected]> Co-authored-by: AngelontheRoad <[email protected]> Co-authored-by: Saafo <[email protected]>
* chore(README): bump supported version * feat(options): support new options shipped with v0.9 * feat(scripts): support v0.9 * feat!: add initial support for lsp semantic tokens (ayamir#633) * feat(utils): use neovim builtin to get highlights (ayamir#632) * fix: remove deprecated options for nvim-tree. * fix(cmp): support dynamic `kind_text` from cmp source: `treesitter`, fix ayamir#624 ayamir#634 (ayamir#637) * fix&feat: introduce suda.vim to write file with sudo * chore(kind_text): cleanup (ayamir#648) * feat(alpha): add custom highlight groups (ayamir#650) * fix: install `psutils` by default for Windows users * revert: bind `SudaWrite` to `<A-s>` ref: ayamir#641 (comment) * fix(cmp): nil `vim_item` * perf(core-mapping): add some useful mapping * fix(nvim-tree): `hide_root_folder` is deprecated * perf: load fidget.nvim after `LspAttach` * minor fix 1. remove `<nop>` at "n|Q" 2. use visual mode instead of visual-line mode for "n|<C-a>" * perf: align style * perf(0.9): `stabilize.nvim` had been upstream to `0.9` * chore(project.nvim): update legacy code * chore(README): update branch info * chore(mapping): cleanup (ayamir#657) * fix(icon): update invalid cmp icon (ayamir#665) * chore/lspsaga_move (ayamir#667) * fix: paint word boundary in python (ayamir#669) * fix(bufferline): `show_buffer_default_icon` is now deprecate * feat(formatting): notify users for files under disabled dirs * chore(formatting): rephrase messages * fix(font-encoding): fix invalid characters on windows, fix ayamir#639 (ayamir#659) Co-authored-by: 冷酔閑吟 <[email protected]> * pref: unify code style for PowerShell commands * perf: better guidance to `Discussions` and `Wiki` (ayamir#680) * pref(ISSUE_TEMPLATE): fix typos and format with prettier * fixup! pref(ISSUE_TEMPLATE): fix typos and format with prettier * feat(scripts): abort for nvim v0.7 and its antecedent * feat(settings): allow customization of `transparent_background` (ayamir#687) * fix(bufferline): use defaults for `get_element_icon` (ayamir#685) * feat(auto-session): remember opened buffers (ayamir#688) * revert(keymap): remove redundant mappings. * fix(catppuccin): properly detect `g:colors_name` (ayamir#695) Ref: upstream breaking change [catppuccin/nvim@7a7a664] --------- Co-authored-by: ayamir <[email protected]> Co-authored-by: Charles Chiu <[email protected]> Co-authored-by: CharlesChiuGit <[email protected]> Co-authored-by: Xie Zejian <[email protected]> Co-authored-by: AngelontheRoad <[email protected]> Co-authored-by: Saafo <[email protected]> (cherry picked from commit 08c4561)
@CharlesChiuGit I just ran into a similar problem, and after some investigation, this also seems to be an encoding issue b/c:
Perhaps this is indeed related to the way WezTerm (or other similar emulators), PowerShell, and PSReadLine handle the input stack. The reason why everything works fine except for the glyphs provided by NF is probably that they all have fixed representation. E.g.: Windows 終端機 � <- Glyph representing PowerShell
|Latin| |CJK Unified Ideograph| |Private Use Area| After WezTerm "warms up", all components should be configured as UTF-8 compatible, so everything will work normally from that time on. |
Cool! Let's really interesting! Thanks for your observation! |
cmd
topowershell
.1fileendoing
to useutf-8
onlyAll screenshots are taken in windows terminal
TODO:
icon overlapping(if anyone have this issue, just try another nerdfont)toggleterm.nvim
, it only works in the neovim built-in terminal.Results:


Footnotes
pwsh
would be better, but it's not installed on windows by default. Onlycmd
andpowershell
are. ↩