Mofiqul / vscode.nvim

Neovim/Vim color scheme inspired by Dark+ and Light+ theme in Visual Studio Code
MIT License
692 stars 111 forks source link

Configure options #169

Closed horga83 closed 6 months ago

horga83 commented 6 months ago

Hi sorry to ask but if I run vscode like so from my .config/nvim/init.lua it all works fine. For the life of me I can't figure out how to move the configuration part to a lua/plugins/vscode.lua file so the setup stays in .config/nvim/init.lua but everthing else is in a pluigin folder.

Please help.

I have tried moving everything after "-- vscode plugin from Lazy configuration" to the vscode.lua file but I receive errors about get_colors and if I remove that I can't get the plugin to run. I did get it to run once by removing all the config settings but then I couldn't configure it.

Thanks in advance

require("lazy").setup('plugins'{
  'Mofiqul/vscode.nvim',
})

-- vscode plugin from Lazy configuration
local c = require('vscode.colors').get_colors()
require('vscode').setup({
    -- Alternatively set style in setup
    -- style = 'light'

    -- Enable transparent background
    transparent = false,

    -- Enable italic comment
    italic_comments = true,

    -- Disable nvim-tree background color
    disable_nvimtree_bg = true,

    -- Override colors (see ./lua/vscode/colors.lua)
    color_overrides = {
        vscLineNumber = '#FFFFFF',
    },

    -- Override highlight groups (see ./lua/vscode/theme.lua)
    group_overrides = {
        -- this supports the same val table as vim.api.nvim_set_hl
        -- use colors from this colorscheme by requiring vscode.colors!
        Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true },
    }
horga83 commented 6 months ago

And of course I have been working on this for a few hours over a day or so and as soon as I ask my question I figure it out. The answer: In ~/.config/nvim/init.lua

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system({
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable",
        lazypath,
    })
end
vim.opt.rtp:prepend(lazypath)

require("config.globals")
require("config.options")
require("config.keymaps")

require("lazy").setup("plugins", {
}) 

And in ~/.config/nvim/lua/plugins/vscode.lua

return {
   'Mofiqul/vscode.nvim',

   -- optionally, override the default options:
    config = function()
      local c = require('vscode.colors').get_colors()
      require('vscode').setup({
        -- Alternatively set style in setup
        -- style = 'light'

        -- Enable transparent background
        transparent = false,

        -- Enable italic comment
        italic_comments = true,

        -- Disable nvim-tree background color
        disable_nvimtree_bg = true,

        -- Override colors (see ./lua/vscode/colors.lua)
        color_overrides = {
            vscLineNumber = '#FFFFFF',
        },

        -- Override highlight groups (see ./lua/vscode/theme.lua)
        group_overrides = {
            -- this supports the same val table as vim.api.nvim_set_hl
            -- use colors from this colorscheme by requiring vscode.colors!
           Cursor = { fg=c.vscDarkBlue, bg=c.vscLightGreen, bold=true },
        }
    })
   require('vscode').load()
   end,
}
smsossah commented 3 months ago

@horga83 I am using lazy as well but keep running into an issue when I update the plugin.. it says something about "attempt to call method 'flatten' (a nil value)". Did you run into this issue? If so would you mind sharing how you resolved it? Thanks!!