Skip to content
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

Neovim adaptor? #4

Open
Gnurou opened this issue Nov 21, 2022 · 5 comments
Open

Neovim adaptor? #4

Gnurou opened this issue Nov 21, 2022 · 5 comments

Comments

@Gnurou
Copy link

Gnurou commented Nov 21, 2022

Hi,

Kary Pro Colors is my absolute favorite theme and I'd love to be able to use it in Neovim. The idea behind themeX is great, but at the moment it seems to support only a few editors - do you think it would be difficult to write an adaptor for Neovim?

@pouyakary
Copy link
Owner

@Gnurou hey man, so glad to hear that :)

No actually writing an adapter is easier than you can think. However there is a huge problem in doing so with the neovim. Currently Pro Colors is built on top of the grammars that ship for the vscode. In theory you can use the same grammars on say Sublime, Atom, TextMate or any other system that supports the tmLanguage specification and you're going to be good. However while you can very easily write an adapter that translates the very basic rules like comment, keyword ... it is going to be really hard to make an adapter that understands the 500+ rules inside the Pro Color's definition which relies on about 40~50 different grammar files directly on the vscode or in its store.

I'm actually a huge fan of the possibility of this because then I can ship Pro Colors to many other places (which I really would love to) but I'm blocked on the matter of each editor having their own very incompatible grammars. If you can dig into the problem and see what's possible, it could turn amazing.

@Gnurou
Copy link
Author

Gnurou commented Nov 23, 2022

Thanks for the details!

I guess one could just have a mapping table between the VSCode grammar's and Vim's highlight groups (or what any other editor uses). There would probably be holes here and there, but since the VScode grammar looks rather complete it probably makes sense to use it as the reference one.

I'll see if I can come with something for the basic rules first, while keeping looking at how Vim's highlight groups are organized.

@pouyakary
Copy link
Owner

That could be really interesting. I'd love to ship Pro Colors to other editors really :)

@Gnurou
Copy link
Author

Gnurou commented Dec 7, 2022

I tried taking a short look but after installing themex (`sudo npm -g install themex) I cannot build ProColors:

$ make
themex pro-colors.themeX
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• themeX ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

 ✓ parsing theme files

 ✕ Internal Error: "Error: Cannot find module '../../libs/tmTheme'
Require stack:
- /usr/local/lib/node_modules/themex/build/adaptors/sublime.adaptorX/index.js
- /usr/local/lib/node_modules/themex/build/buildcore.js
- /usr/local/lib/node_modules/themex/build/main.js"

 ✓ running adaptor vscode.adaptorX (v1.0.0)

cp -f pro-colors.themeX/builds/sublime/karyprocolors-dark.tmTheme foo/karyprocolors-dark.tmTheme
cp: cannot stat 'pro-colors.themeX/builds/sublime/karyprocolors-dark.tmTheme': No such file or directory
make: *** [Makefile:18: karyprocolors-dark.tmTheme] Error 1

Do you have any idea about what I am doing wrong here?

@pouyakary
Copy link
Owner

Wow, okay that's my bad :) perks of using mac to code :)
You're probably using Windows or Linux and the file source/adaptors/sublime.adptorX/index.ts is requiring the tmTheme file. Now the second T in the naming is not capital in the actual source code address and its tmtheme so your file system is not finding it... You have to fix the file name to tmTheme and it'll work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants