nvim-tree / nvim-tree/nvim-web-devicons

Add ambiwidth option

Open
#116 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
2.7k
Forks
239
Avg merge
3d 16h
Merged PRs (30d)
3

Description

I want an option to tell Neovim what to do with East Asian Width Class Ambiguous.

Neovim already has ambiwidth option but it's unstable since it applies to all the characters in Neovim.

						*'ambiwidth'* *'ambw'*
'ambiwidth' 'ambw'	string (default: "single")
			global
	Tells Vim what to do with characters with East Asian Width Class
	Ambiguous (such as Euro, Registered Sign, Copyright Sign, Greek
	letters, Cyrillic letters).

	There are currently two possible values:
	"single":	Use the same width as characters in US-ASCII.  This is
			expected by most users.
	"double":	Use twice the width of ASCII characters.
							*E834* *E835*
	The value "double" cannot be used if 'listchars' or 'fillchars'
	contains a character that would be double width.

	There are a number of CJK fonts for which the width of glyphs for
	those characters are solely based on how many octets they take in
	legacy/traditional CJK encodings.  In those encodings, Euro,
	Registered sign, Greek/Cyrillic letters are represented by two octets,
	therefore those fonts have "wide" glyphs for them.  This is also
	true of some line drawing characters used to make tables in text
	file.  Therefore, when a CJK font is used for GUI Vim or
	Vim is running inside a terminal (emulators) that uses a CJK font
	(or Vim is run inside an xterm invoked with "-cjkwidth" option.),
	this option should be set to "double" to match the width perceived
	by Vim with the width of glyphs in the font.  Perhaps it also has
	to be set to "double" under CJK MS-Windows when the system locale is
	set to one of CJK locales.  See Unicode Standard Annex #11
	(http://www.unicode.org/reports/tr11).

I've already implemented this in my dotfiles, so I want to port this to upstream.
https://github.com/sei40kr/dotfiles/blob/master/config/neovim/lua/config/plugins/nvim-web-devicons.lua#L14-L18
https://github.com/sei40kr/yonvim/blob/main/lua/yvim/plugin/web-devicons.lua

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing implementation in config/plugins/nvim-web-devicons.lua and lua/yvim/plugin/web-devicons.lua. Trace how the ambiwidth option is configured there, then determine the corresponding upstream entry point and verify that the option controls the handling of East Asian Width Class Ambiguous characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.