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

[FR] Colorscheme per project #179

Closed
guruor opened this issue Feb 2, 2024 · 6 comments
Closed

[FR] Colorscheme per project #179

guruor opened this issue Feb 2, 2024 · 6 comments

Comments

@guruor
Copy link

guruor commented Feb 2, 2024

I tried colorscheme by file type using filetype timing, I liked the idea of configuring color for each filetype initially but later when observed that, for each new filetype fallback colorscheme is applied. It causes constant switch between colorschemes.

For example, In my regular workflow I use plugins like fzf.lua and lf.nvim. Whenever I open fzf or lf buffer, it uses fallback colorscheme. Sometimes after closing the sub buffers, parent buffer doesn't even use its defined colorscheme as well.
I want these sub buffers to follow the same colorschemes as the parent buffer had but I didn't find any option to configure that.

I think an option to configure the colorscheme per project path can solve this. This will be helpful for people like me where we usually have majority of files of same filetype in a directory.

@linrongbin16
Copy link
Owner

hi @G0V1NDS ,

If let's remove the fallback option, and simply do thing when open a new filetype.

Will that satisfy your use case?

@guruor
Copy link
Author

guruor commented Feb 2, 2024

If we maintain previous colorscheme then it should work. As of now fallback is not optional, right?
I tried removing it and received below error:

[colorbox] failed to invoke function filter, please check your config!
Failed to run `config` for colorbox.nvim

....r/.local/share/nvim/lazy/colorbox.nvim/lua/colorbox.lua:484: invalid policy {
  mapping = {
    dbui = "onedark",
    go = "github_dark",
    http = "edge",
    markdown = "kanagawa",
    norg = "github_dark",
    python = "github_dark",
    sql = "onedark",
    yaml = "everforest"
  }
} for 'filetype' timing!

@linrongbin16
Copy link
Owner

If we maintain previous colorscheme then it should work. As of now fallback is not optional, right? I tried removing it and received below error:

[colorbox] failed to invoke function filter, please check your config!
Failed to run `config` for colorbox.nvim

....r/.local/share/nvim/lazy/colorbox.nvim/lua/colorbox.lua:484: invalid policy {
  mapping = {
    dbui = "onedark",
    go = "github_dark",
    http = "edge",
    markdown = "kanagawa",
    norg = "github_dark",
    python = "github_dark",
    sql = "onedark",
    yaml = "everforest"
  }
} for 'filetype' timing!

yeah, for now it's a must, I will submit a PR to make it work.

@guruor
Copy link
Author

guruor commented Feb 3, 2024

If we remove fallback colorscheme then what will be default colorscheme for filetypes which are not present in mapping?
Will there be an option to set primary colorscheme on neovim load, which can be used if we initially open a filetype which is not mapped.

@linrongbin16
Copy link
Owner

Hi, @G0V1NDS ,

In #180 , I make 'fallback' optional, this plugin will do nothing if the filetype is not mapped to any colorschemes.

And I also add the empty option. Which is: when the vim.bo.filetype (the filetype you're editing) is empty string "", the colorscheme you will use. It's also an optional config, just like fallback.

Come back to your question:

If we remove fallback colorscheme then what will be default colorscheme for filetypes which are not present in mapping?

It will depends the first buffer's filetype when you open nvim. If it's an empty filetype (e.g. "", for example a .txt file, or a .log file), then you could configure the empty option. if it's other file type, you will need to configure the colorscheme for that filetype.

For example for me, I'm always open nvim on a workspace (directory), and I'm always auto-start the neo-tree on the left side, so the filetype will always be neo-tree.

@guruor
Copy link
Author

guruor commented Feb 5, 2024

Thanks for quick update, making fallback optional solved my problem.

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