diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lvim/config/defaults.lua | 2 | ||||
| -rw-r--r-- | lua/lvim/core/breadcrumbs.lua | 106 | ||||
| -rw-r--r-- | lua/lvim/core/builtins/init.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/core/illuminate.lua | 98 | ||||
| -rw-r--r-- | lua/lvim/core/theme.lua | 50 | ||||
| -rw-r--r-- | lua/lvim/lsp/config.lua | 2 | ||||
| -rw-r--r-- | lua/lvim/lsp/handlers.lua | 3 | ||||
| -rw-r--r-- | lua/lvim/lsp/init.lua | 11 | ||||
| -rw-r--r-- | lua/lvim/lsp/utils.lua | 18 | ||||
| -rw-r--r-- | lua/lvim/plugins.lua | 30 | 
10 files changed, 206 insertions, 115 deletions
| diff --git a/lua/lvim/config/defaults.lua b/lua/lvim/config/defaults.lua index 7546644f..91bc1130 100644 --- a/lua/lvim/config/defaults.lua +++ b/lua/lvim/config/defaults.lua @@ -1,6 +1,6 @@  return {    leader = "space", -  colorscheme = "onedarker", +  colorscheme = "tokyonight",    transparent_window = false,    format_on_save = {      ---@usage pattern string pattern used for the autocommand (Default: '*') diff --git a/lua/lvim/core/breadcrumbs.lua b/lua/lvim/core/breadcrumbs.lua index 3b038473..9289cb03 100644 --- a/lua/lvim/core/breadcrumbs.lua +++ b/lua/lvim/core/breadcrumbs.lua @@ -3,60 +3,66 @@ local M = {}  -- local Log = require "lvim.core.log"  M.config = function() +  lvim.builtin.breadcrumbs = { +    active = false, +    on_config_done = nil, +    options = { +      icons = { +        Text = " ", +        Method = " ", +        Function = " ", +        Constructor = " ", +        Field = " ", +        Variable = " ", +        Class = " ", +        Interface = " ", +        Module = " ", +        Property = " ", +        Unit = " ", +        Value = " ", +        Enum = " ", +        Keyword = " ", +        Snippet = " ", +        Color = " ", +        File = " ", +        Reference = " ", +        Folder = " ", +        EnumMember = " ", +        Constant = " ", +        Struct = " ", +        Event = " ", +        Operator = " ", +        TypeParameter = " ", +        Array = " ", +        Number = " ", +        String = " ", +        Boolean = "蘒", +        Object = " ", +        Package = " ", +        Namespace = "", +        Key = "", +        Null = "ﳠ", +      }, +      highlight = true, +      separator = " " .. ">" .. " ", +      depth_limit = 0, +      depth_limit_indicator = "..", +    }, +  } +end + +M.setup = function()    local status_ok, navic = pcall(require, "nvim-navic")    if not status_ok then      return    end -  navic.setup { -    icons = { -      Text = " ", -      -- Method = "m", -      -- Function = "", -      -- Constructor = "", -      Method = " ", -      Function = " ", -      Constructor = " ", -      Field = " ", -      -- Variable = "", -      Variable = " ", -      Class = " ", -      Interface = " ", -      -- Module = "", -      Module = " ", -      Property = " ", -      Unit = " ", -      Value = " ", -      Enum = " ", -      -- Keyword = "", -      Keyword = " ", -      -- Snippet = "", -      Snippet = " ", -      Color = " ", -      File = " ", -      Reference = " ", -      Folder = " ", -      EnumMember = " ", -      Constant = " ", -      Struct = " ", -      Event = " ", -      Operator = " ", -      TypeParameter = " ", -      Array = " ", -      Number = " ", -      String = " ", -      Boolean = "蘒", -      Object = " ", -      Package = " ", -      Namespace = "", -      Key = "", -      Null = "ﳠ", -    }, -    highlight = true, -    separator = " " .. ">" .. " ", -    depth_limit = 0, -    depth_limit_indicator = "..", -  } +  M.create_winbar() +  navic.setup(lvim.builtin.breadcrumbs.options) + +  if lvim.builtin.breadcrumbs.on_config_done then +    lvim.builtin.breadcrumbs.on_config_done() +  end  end  M.winbar_filetype_exclude = { @@ -199,6 +205,4 @@ M.create_winbar = function()    end  end -M.create_winbar() -  return M diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index 14afe4ea..36d09d2e 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/lua/lvim/core/builtins/init.lua @@ -1,6 +1,7 @@  local M = {}  local builtins = { +  "lvim.core.theme",    "lvim.core.which-key",    "lvim.core.gitsigns",    "lvim.core.cmp", diff --git a/lua/lvim/core/illuminate.lua b/lua/lvim/core/illuminate.lua index e29b091a..e0c8c775 100644 --- a/lua/lvim/core/illuminate.lua +++ b/lua/lvim/core/illuminate.lua @@ -1,53 +1,65 @@  local M = {}  M.config = function() +  lvim.builtin.illuminate = { +    active = true, +    on_config_done = nil, +    options = { +      -- providers: provider used to get references in the buffer, ordered by priority +      providers = { +        "lsp", +        "treesitter", +        "regex", +      }, +      -- delay: delay in milliseconds +      delay = 120, +      -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist +      filetypes_denylist = { +        "dirvish", +        "fugitive", +        "alpha", +        "NvimTree", +        "packer", +        "neogitstatus", +        "Trouble", +        "lir", +        "Outline", +        "spectre_panel", +        "toggleterm", +        "DressingSelect", +        "TelescopePrompt", +      }, +      -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist +      filetypes_allowlist = {}, +      -- modes_denylist: modes to not illuminate, this overrides modes_allowlist +      modes_denylist = {}, +      -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist +      modes_allowlist = {}, +      -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist +      -- Only applies to the 'regex' provider +      -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') +      providers_regex_syntax_denylist = {}, +      -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist +      -- Only applies to the 'regex' provider +      -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') +      providers_regex_syntax_allowlist = {}, +      -- under_cursor: whether or not to illuminate under the cursor +      under_cursor = true, +    }, +  } +end + +M.setup = function()    local status_ok, illuminate = pcall(require, "illuminate")    if not status_ok then      return    end -  -- default configuration -  illuminate.configure { -    -- providers: provider used to get references in the buffer, ordered by priority -    providers = { -      "lsp", -      "treesitter", -      "regex", -    }, -    -- delay: delay in milliseconds -    delay = 120, -    -- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist -    filetypes_denylist = { -      "dirvish", -      "fugitive", -      "alpha", -      "NvimTree", -      "packer", -      "neogitstatus", -      "Trouble", -      "lir", -      "Outline", -      "spectre_panel", -      "toggleterm", -      "DressingSelect", -      "TelescopePrompt", -    }, -    -- filetypes_allowlist: filetypes to illuminate, this is overriden by filetypes_denylist -    filetypes_allowlist = {}, -    -- modes_denylist: modes to not illuminate, this overrides modes_allowlist -    modes_denylist = {}, -    -- modes_allowlist: modes to illuminate, this is overriden by modes_denylist -    modes_allowlist = {}, -    -- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist -    -- Only applies to the 'regex' provider -    -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') -    providers_regex_syntax_denylist = {}, -    -- providers_regex_syntax_allowlist: syntax to illuminate, this is overriden by providers_regex_syntax_denylist -    -- Only applies to the 'regex' provider -    -- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') -    providers_regex_syntax_allowlist = {}, -    -- under_cursor: whether or not to illuminate under the cursor -    under_cursor = true, -  } + +  illuminate.configure(lvim.builtin.illuminate.options) + +  if lvim.builtin.illuminate.on_config_done then +    lvim.builtin.illuminate.on_config_done() +  end  end  return M diff --git a/lua/lvim/core/theme.lua b/lua/lvim/core/theme.lua new file mode 100644 index 00000000..c02aaa7e --- /dev/null +++ b/lua/lvim/core/theme.lua @@ -0,0 +1,50 @@ +local M = {} + +M.config = function() +  lvim.builtin.theme = { +    name = "tokyonight", +    options = { +      style = "night", -- The theme comes in three styles, `storm`, a darker variant `night` and `day` +      transparent = lvim.transparent_window, -- Enable this to disable setting the background color +      terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim +      styles = { +        -- Style to be applied to different syntax groups +        -- Value is any valid attr-list value for `:help nvim_set_hl` +        comments = { italic = true }, +        keywords = { italic = true }, +        functions = {}, +        variables = {}, +        -- Background styles. Can be "dark", "transparent" or "normal" +        sidebars = "dark", -- style for sidebars, see below +        floats = "dark", -- style for floating windows +      }, +      -- Set a darker background on sidebar-like windows. For example: `["qf", "vista_kind", "terminal", "packer"]` +      sidebars = { +        "qf", +        "vista_kind", +        "terminal", +        "packer", +        "spectre_panel", +        "NeogitStatus", +        "help", +      }, +      day_brightness = 0.3, -- Adjusts the brightness of the colors of the **Day** style. Number between 0 and 1, from dull to vibrant colors +      hide_inactive_statusline = false, -- Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. +      dim_inactive = false, -- dims inactive windows +      lualine_bold = false, -- When `true`, section headers in the lualine theme will be bold +      use_background = true, -- can be light/dark/auto. When auto, background will be set to vim.o.background +    }, +  } +end + +M.setup = function() +  local status_ok, theme = pcall(require, "tokyonight") +  if not status_ok then +    return +  end + +  theme.setup(lvim.builtin.theme.options) +  lvim.builtin.lualine.options.theme = "tokyonight" +end + +return M diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 7e91db52..d842f099 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -72,7 +72,7 @@ return {        end,      },    }, -  document_highlight = true, +  document_highlight = false,    code_lens_refresh = true,    float = {      focusable = true, diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index 45b1989d..81342885 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -12,6 +12,9 @@ function M.setup()      float = lvim.lsp.diagnostics.float,    }    vim.diagnostic.config(config) +  if not lvim.builtin.illuminate.active then +    vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.float) +  end    vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.float)  end diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index ac3f6925..1072329b 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -60,15 +60,6 @@ function M.common_on_init(client, bufnr)    end  end -local function attach_navic(client, bufnr) -  vim.g.navic_silence = true -  local status_ok, navic = pcall(require, "nvim-navic") -  if not status_ok then -    return -  end -  navic.attach(client, bufnr) -end -  function M.common_on_attach(client, bufnr)    if lvim.lsp.on_attach_callback then      lvim.lsp.on_attach_callback(client, bufnr) @@ -83,7 +74,7 @@ function M.common_on_attach(client, bufnr)    end    add_lsp_buffer_keybindings(bufnr)    add_lsp_buffer_options(bufnr) -  attach_navic(client, bufnr) +  lu.setup_document_symbols(client, bufnr)  end  function M.get_common_opts() diff --git a/lua/lvim/lsp/utils.lua b/lua/lvim/lsp/utils.lua index 3be7e52f..c2ffe3fa 100644 --- a/lua/lvim/lsp/utils.lua +++ b/lua/lvim/lsp/utils.lua @@ -1,6 +1,7 @@  local M = {}  local tbl = require "lvim.utils.table" +local Log = require "lvim.core.log"  function M.is_client_active(name)    local clients = vim.lsp.get_active_clients() @@ -82,6 +83,10 @@ function M.get_all_supported_filetypes()  end  function M.setup_document_highlight(client, bufnr) +  if lvim.builtin.illuminate.active then +    Log:debug "skipping setup for document_highlight, illuminate already active" +    return +  end    local status_ok, highlight_supported = pcall(function()      return client.supports_method "textDocument/documentHighlight"    end) @@ -114,6 +119,19 @@ function M.setup_document_highlight(client, bufnr)    })  end +function M.setup_document_symbols(client, bufnr) +  vim.g.navic_silence = false -- can be set to true to supress error +  local symbols_supported = client.supports_method "textDocument/documentSymbol" +  if not symbols_supported then +    Log:debug("skipping setup for document_symbols, method not supported by " .. client.name) +    return +  end +  local status_ok, navic = pcall(require, "nvim-navic") +  if status_ok then +    navic.attach(client, bufnr) +  end +end +  function M.setup_codelens_refresh(client, bufnr)    local status_ok, codelens_supported = pcall(function()      return client.supports_method "textDocument/codeLens" diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua index 85c1e80e..e84049dc 100644 --- a/lua/lvim/plugins.lua +++ b/lua/lvim/plugins.lua @@ -15,16 +15,11 @@ local core_plugins = {      end,    },    { -    "lunarvim/tokyonight.nvim", +    "folke/tokyonight.nvim",      config = function() -      pcall(function() -        if lvim and lvim.colorscheme == "tokyonight-night" then -          require("tokyonight-night").setup() -          lvim.builtin.lualine.options.theme = "tokyonight-night" -        end -      end) +      require("lvim.core.theme").setup()      end, -    disable = lvim.colorscheme ~= "tokyonight-night", +    disable = not vim.startswith(lvim.colorscheme, "tokyonight"),    },    {      "rcarriga/nvim-notify", @@ -208,7 +203,7 @@ local core_plugins = {      config = function()        require("lvim.core.breadcrumbs").setup()      end, -    -- disable = not lvim.builtin.breadcrumbs.active, +    disable = not lvim.builtin.breadcrumbs.active,    },    { @@ -267,6 +262,23 @@ local core_plugins = {    {      "RRethy/vim-illuminate", +    setup = function() +      require("lvim.core.illuminate").setup() +    end, +    disable = not lvim.builtin.illuminate.active, +  }, +  { +    "lunarvim/onedarker.nvim", +    branch = "freeze", +    config = function() +      pcall(function() +        if lvim and lvim.colorscheme == "onedarker" then +          require("onedarker").setup() +          lvim.builtin.lualine.options.theme = "onedarker" +        end +      end) +    end, +    disable = lvim.colorscheme ~= "onedarker",    },  } | 
