Skip to content

My own dynamic by languages Neovim theme 💎🌈

License

Notifications You must be signed in to change notification settings

FrancoBujakiewicz/prisma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prisma theme

Prisma theme for Neovim. Why have a single global theme when each language can have its own, define a colorscheme for each one and Prisma will load it when you open a file or switch to a tab have that language.

It has two layers of theming: default — the base theme, where you define common styles across languages, default is also applied when the file has no detected type or when there isn't a specific theme defined for that type in lang directory. That's where you must create .lua files with the language name: lang/java.lua, lang/python.lua, etc.

In the main branch of this repository is testfiles with different languages files which you can use to test the theme.

Usage

Integrating Prisma into your Neovim configuration:

  • Clone the repository (Use the config branch if you just want configuration files):
git clone --branch config --single-branch https://github.com/FrancoBujakiewicz/prisma ~/.config/nvim/lua/
  • To load Prisma in your Neovim configuration (init.lua):
require('prisma')

Considerations

  • Ensure directory structure:
~/.config/nvim/
├─init.lua
├─lua/
  ├─lang/ # Languages specific themes.
  | ├─java.lua
  | ├─lua.lua
  | ├─ruby.lua
  ├─default.lua # Default theme.
  ├─prisma.lua # Dynamic loader.
  • The default theme includes elements from plugins (e.g. GitSignsAdd or TelescopeNormal) it's based on this Neovim configuration: https://github.com/FrancoBujakiewicz/dotfiles/blob/main/nvim/init.lua.

  • As I said, Prisma was tested in my relatively minimal configuration, not in frameworks like AstroVim or LazyVim. But since Prisma isn't so large, you can reuse the code and adapt it to your setup.

Future improvements

Theme loading

As you can see in prisma.lua, there can be some conceptual fixes with the packages loading. Performance shouldn't be an issue, it's uncommon have so many language files and switch between them so quickly. I made it in a way that works, not focused to optimization for now. These issues could be:

  • The default is reloaded each time the language changes.
  • Should be better check if the language doesn't change between files.
  • They are loaded from disk each time instead of being catched for reuse.

Automatic theme definitions

Idea to generate themes from a single template, without creating a file for each one — just define a color palette to apply the template automatically, this approach is good if you want the languages share the color distribution. This automatization gives you less control, so there's no reason to discard the option to defining the languages themes manually, both automatic generation and specific files.

Credits

Example code you see in the screenshots and testfiles/ come from other repositories:

hardware-configuration.nix isn't in my NixOS repository, it is auto-generated by NixOS.

They are used purely for illustrative and testing only purposes.

About

My own dynamic by languages Neovim theme 💎🌈

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages