Clean out themes + lots of clean up (#87)
* refactor: remove extra themes * feat: clean up theme setup * refactor: move highlights/colors to galaxyline plugin * feat: add lualine sections * feat: add lualine icons * feat: add user config override for lualine * refactor: remove galaxy line :D * refactor: clean out notify-nvim configs * refactor: clean up utils * refactor: clean up utils - icons
This commit is contained in:
parent
803a69b015
commit
7e81d05408
40 changed files with 303 additions and 1312 deletions
|
@ -56,23 +56,16 @@ local config = {
|
||||||
},
|
},
|
||||||
-- See https://github.com/ray-x/lsp_signature.nvim#full-configuration-with-default-values
|
-- See https://github.com/ray-x/lsp_signature.nvim#full-configuration-with-default-values
|
||||||
lsp_signature = {},
|
lsp_signature = {},
|
||||||
|
-- See https://github.com/nvim-lualine/lualine.nvim#default-configuration
|
||||||
|
lualine = {},
|
||||||
-- See https://github.com/L3MON4D3/LuaSnip/blob/577045e9adf325e58f690f4d4b4a293f3dcec1b3/README.md#config
|
-- See https://github.com/L3MON4D3/LuaSnip/blob/577045e9adf325e58f690f4d4b4a293f3dcec1b3/README.md#config
|
||||||
luasnip = {},
|
luasnip = {},
|
||||||
-- Default statusline icon
|
|
||||||
statusline = {
|
|
||||||
main_icon = '★',
|
|
||||||
},
|
|
||||||
-- See :h telescope.setup
|
-- See :h telescope.setup
|
||||||
telescope = {},
|
telescope = {},
|
||||||
-- Theming, don't forget to run :CosmicReloadSync when changing themes
|
|
||||||
-- Options: 'catppuccin', 'dracula', 'enfocado', 'github', 'gruvbox', 'kanagawa', 'nightfox', 'nord', 'onedark', 'rose-pine',
|
|
||||||
theme = 'tokyonight', -- don't define or set to nil, if you want to enable your own theme in cosmic/config/plugins.lua
|
|
||||||
-- See https://github.com/folke/todo-comments.nvim#%EF%B8%8F-configuration
|
-- See https://github.com/folke/todo-comments.nvim#%EF%B8%8F-configuration
|
||||||
todo_comments = {},
|
todo_comments = {},
|
||||||
-- See :h nvim-treesitter-quickstart
|
-- See :h nvim-treesitter-quickstart
|
||||||
treesitter = {},
|
treesitter = {},
|
||||||
-- See :h notify.setup
|
|
||||||
notify = {},
|
|
||||||
-- See :h cmp-usage
|
-- See :h cmp-usage
|
||||||
nvim_cmp = {},
|
nvim_cmp = {},
|
||||||
-- See :h nvim-tree.setup
|
-- See :h nvim-tree.setup
|
||||||
|
@ -89,14 +82,15 @@ local config = {
|
||||||
disable_builtin_plugins = {
|
disable_builtin_plugins = {
|
||||||
--[[
|
--[[
|
||||||
'auto-session',
|
'auto-session',
|
||||||
'nvim-cmp',
|
|
||||||
'colorizer',
|
'colorizer',
|
||||||
|
'comment-nvim',
|
||||||
'dashboard',
|
'dashboard',
|
||||||
'fugitive',
|
'fugitive',
|
||||||
'gitsigns',
|
'gitsigns',
|
||||||
'comment-nvim',
|
'lualine',
|
||||||
|
'noice',
|
||||||
|
'nvim-cmp',
|
||||||
'nvim-tree',
|
'nvim-tree',
|
||||||
'galaxyline',
|
|
||||||
'telescope',
|
'telescope',
|
||||||
'terminal',
|
'terminal',
|
||||||
'theme',
|
'theme',
|
||||||
|
|
|
@ -6,8 +6,8 @@ vim.api.nvim_create_autocmd('VimResized', {
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
command! CosmicUpdate lua require('cosmic.utils').update()
|
command! CosmicUpdate lua require('cosmic.utils.cosmic').update()
|
||||||
command! CosmicReload lua require('cosmic.utils').reload_user_config(true)
|
command! CosmicReload lua require('cosmic.utils.cosmic').reload_user_config(true)
|
||||||
command! CosmicReloadSync lua require('cosmic.utils').reload_user_config_sync()
|
command! CosmicReloadSync lua require('cosmic.utils.cosmic').reload_user_config_sync()
|
||||||
command! LspFormat lua vim.lsp.buf.format()
|
command! LspFormat lua vim.lsp.buf.format()
|
||||||
]])
|
]])
|
||||||
|
|
|
@ -19,32 +19,28 @@ return packer.startup(function()
|
||||||
'MunifTanjim/nui.nvim',
|
'MunifTanjim/nui.nvim',
|
||||||
{
|
{
|
||||||
'rcarriga/nvim-notify',
|
'rcarriga/nvim-notify',
|
||||||
config = function()
|
|
||||||
--[[ manually resetup notify to get our custom setup ]]
|
|
||||||
require('cosmic.plugins.notify')
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- initialize theme plugins
|
-- initialize theme plugins
|
||||||
require('cosmic.theme.plugins').init(use, user_config)
|
use({ -- color scheme
|
||||||
|
'folke/tokyonight.nvim',
|
||||||
use({
|
as = 'tokyonight',
|
||||||
'kyazdani42/nvim-web-devicons',
|
config = function()
|
||||||
after = user_config.theme,
|
-- set up theme
|
||||||
|
require('cosmic.plugins.tokyonight')
|
||||||
|
end,
|
||||||
|
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'tokyonight'),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- theme stuff
|
-- theme stuff
|
||||||
use({ -- statusline
|
use({
|
||||||
'NTBBloodbath/galaxyline.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
branch = 'main',
|
|
||||||
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
|
|
||||||
config = function()
|
config = function()
|
||||||
require('cosmic.plugins.galaxyline')
|
require('cosmic.plugins.lualine')
|
||||||
end,
|
end,
|
||||||
after = user_config.theme,
|
requires = { 'nvim-tree/nvim-web-devicons' },
|
||||||
disable = vim.tbl_contains(user_config.disable_builtin_plugins, 'galaxyline'),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- file explorer
|
-- file explorer
|
||||||
|
|
|
@ -9,7 +9,6 @@ local default_config = {
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
disable_builtin_plugins = {},
|
disable_builtin_plugins = {},
|
||||||
add_plugins = {},
|
add_plugins = {},
|
||||||
theme = 'tokyonight',
|
|
||||||
lsp = {
|
lsp = {
|
||||||
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
||||||
format_timeout = 3000,
|
format_timeout = 3000,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
local mods = {
|
local mods = {
|
||||||
'cosmic.compiled',
|
'cosmic.compiled',
|
||||||
'cosmic.core',
|
'cosmic.core',
|
||||||
'cosmic.theme',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, mod in ipairs(mods) do
|
for _, mod in ipairs(mods) do
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local icons = require('cosmic.theme.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local config = require('cosmic.core.user')
|
local config = require('cosmic.core.user')
|
||||||
|
|
||||||
-- set up LSP signs
|
-- set up LSP signs
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local icons = require('cosmic.theme.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
g.dashboard_custom_header = {
|
g.dashboard_custom_header = {
|
||||||
|
|
|
@ -1,518 +0,0 @@
|
||||||
local galaxy = require('galaxyline')
|
|
||||||
local gls = galaxy.section
|
|
||||||
local diag = require('galaxyline.providers.diagnostic')
|
|
||||||
local condition = require('galaxyline.condition')
|
|
||||||
local fileinfo = require('galaxyline.providers.fileinfo')
|
|
||||||
local u = require('cosmic.utils')
|
|
||||||
local colors = require('cosmic.theme.colors')
|
|
||||||
local set_highlight = require('cosmic.theme.utils').set_highlight
|
|
||||||
local icons = require('cosmic.theme.icons')
|
|
||||||
local config = require('cosmic.core.user')
|
|
||||||
local get_highlight = require('cosmic.theme.utils').get_highlight
|
|
||||||
local statusline_colors = get_highlight('StatusLine')
|
|
||||||
|
|
||||||
local defaults = u.merge({
|
|
||||||
main_icon = icons.cosmic,
|
|
||||||
}, config.statusline or {})
|
|
||||||
local main_icon = defaults.main_icon
|
|
||||||
|
|
||||||
local get_mode = function()
|
|
||||||
local mode_colors = {
|
|
||||||
[110] = { 'NORMAL', colors.normal, colors.bg_highlight },
|
|
||||||
[105] = { 'INSERT', colors.insert, colors.bg_highlight },
|
|
||||||
[99] = { 'COMMAND', colors.command, colors.bg_highlight },
|
|
||||||
[116] = { 'TERMINAL', colors.normal, colors.bg_highlight },
|
|
||||||
[118] = { 'VISUAL', colors.visual, colors.bg_highlight },
|
|
||||||
[22] = { 'V-BLOCK', colors.visual, colors.bg_highlight },
|
|
||||||
[86] = { 'V-LINE', colors.visual, colors.bg_highlight },
|
|
||||||
[82] = { 'REPLACE', colors.replace, colors.bg_highlight },
|
|
||||||
[115] = { 'SELECT', colors.replace, colors.bg_highlight },
|
|
||||||
[83] = { 'S-LINE', colors.replace, colors.bg_highlight },
|
|
||||||
}
|
|
||||||
|
|
||||||
local mode_data = mode_colors[vim.fn.mode():byte()]
|
|
||||||
if mode_data ~= nil then
|
|
||||||
return mode_data
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_basename(file)
|
|
||||||
return file:match('^.+/(.+)$')
|
|
||||||
end
|
|
||||||
|
|
||||||
local function get_git_root()
|
|
||||||
local git_dir = require('galaxyline.providers.vcs').get_git_dir()
|
|
||||||
if not git_dir then
|
|
||||||
return 'not a git dir '
|
|
||||||
end
|
|
||||||
|
|
||||||
local git_root = git_dir:gsub('/.git/?$', '')
|
|
||||||
return get_basename(git_root) .. ' '
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_git_and_buffer = function()
|
|
||||||
return condition.check_git_workspace() and condition.buffer_not_empty()
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_buffer_and_width = function()
|
|
||||||
return condition.buffer_not_empty() and condition.hide_in_width()
|
|
||||||
end
|
|
||||||
|
|
||||||
local FilePathShortProvider = function()
|
|
||||||
local fp = vim.fn.fnamemodify(vim.fn.expand('%'), ':~:.:h')
|
|
||||||
local tbl = u.split(fp, '/')
|
|
||||||
local len = #tbl
|
|
||||||
|
|
||||||
if len > 2 and tbl[1] ~= '~' then
|
|
||||||
return icons.dotdotdot .. '/' .. table.concat(tbl, '/', len - 1) .. '/'
|
|
||||||
else
|
|
||||||
return fp .. '/'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local LineColumnProvider = function()
|
|
||||||
local line_column = fileinfo.line_column()
|
|
||||||
line_column = line_column:gsub('%s+', '')
|
|
||||||
return ' ' .. icons.line_number .. line_column
|
|
||||||
end
|
|
||||||
|
|
||||||
local PercentProvider = function()
|
|
||||||
local line_column = fileinfo.current_line_percent()
|
|
||||||
line_column = line_column:gsub('%s+', '')
|
|
||||||
return line_column .. ' ☰'
|
|
||||||
end
|
|
||||||
|
|
||||||
local BracketProvider = function(icon, cond)
|
|
||||||
return function()
|
|
||||||
local result
|
|
||||||
|
|
||||||
if type(cond) == 'boolean' then
|
|
||||||
result = cond
|
|
||||||
else
|
|
||||||
result = cond()
|
|
||||||
end
|
|
||||||
|
|
||||||
if result == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(result) == 'number' then
|
|
||||||
if result > 0 then
|
|
||||||
return icon
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(result) == 'boolean' and result == true then
|
|
||||||
return icon
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(result) == 'string' then
|
|
||||||
if #result > 0 then
|
|
||||||
return icon
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
galaxy.short_line_list = {
|
|
||||||
'packer',
|
|
||||||
'NvimTree',
|
|
||||||
'floaterm',
|
|
||||||
'fugitive',
|
|
||||||
'fugitiveblame',
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.left = {
|
|
||||||
{
|
|
||||||
GhostLeftBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_left_filled, true),
|
|
||||||
highlight = 'GalaxyViModeNestedInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Ghost = {
|
|
||||||
provider = BracketProvider(main_icon, true),
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViModeLeftBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled, true),
|
|
||||||
highlight = 'GalaxyViMode',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViMode = {
|
|
||||||
provider = function()
|
|
||||||
local m = get_mode()
|
|
||||||
if m == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local label, mode_color, mode_nested = unpack(m)
|
|
||||||
set_highlight('GalaxyViMode', {
|
|
||||||
guibg = mode_color,
|
|
||||||
guifg = mode_nested,
|
|
||||||
})
|
|
||||||
set_highlight('GalaxyViModeInv', {
|
|
||||||
guibg = mode_nested,
|
|
||||||
guifg = mode_color,
|
|
||||||
})
|
|
||||||
set_highlight('GalaxyViModeNested', {
|
|
||||||
guibg = mode_nested,
|
|
||||||
guifg = 'StatusLine',
|
|
||||||
})
|
|
||||||
set_highlight('GalaxyViModeNestedInv', {
|
|
||||||
guibg = 'StatusLine',
|
|
||||||
guifg = mode_nested,
|
|
||||||
})
|
|
||||||
set_highlight('GalaxyPercentBracket', {
|
|
||||||
guibg = 'StatusLine',
|
|
||||||
guifg = mode_color,
|
|
||||||
})
|
|
||||||
set_highlight('GalaxyGitLCBracket', {
|
|
||||||
guibg = mode_nested,
|
|
||||||
guifg = mode_color,
|
|
||||||
})
|
|
||||||
|
|
||||||
if condition.buffer_not_empty() then
|
|
||||||
set_highlight('GalaxyViModeBracket', {
|
|
||||||
guibg = mode_nested,
|
|
||||||
guifg = mode_color,
|
|
||||||
})
|
|
||||||
else
|
|
||||||
if condition.check_git_workspace() then
|
|
||||||
set_highlight('GalaxyGitLCBracket', {
|
|
||||||
guibg = 'StatusLine',
|
|
||||||
guifg = mode_color,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
set_highlight('GalaxyViModeBracket', {
|
|
||||||
guibg = 'StatusLine',
|
|
||||||
guifg = mode_color,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
return ' ' .. label .. ' '
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
ViModeBracket = {
|
|
||||||
provider = BracketProvider(icons.arrow_right_filled, true),
|
|
||||||
highlight = 'GalaxyViModeBracket',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GitIcon = {
|
|
||||||
provider = BracketProvider(' ' .. icons.branch .. ' ', true),
|
|
||||||
condition = check_git_and_buffer,
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GitBranch = {
|
|
||||||
provider = function()
|
|
||||||
local vcs = require('galaxyline.providers.vcs')
|
|
||||||
local branch_name = vcs.get_git_branch()
|
|
||||||
if not branch_name then
|
|
||||||
return ' no git '
|
|
||||||
end
|
|
||||||
if string.len(branch_name) > 28 then
|
|
||||||
return string.sub(branch_name, 1, 25) .. icons.dotdotdot
|
|
||||||
end
|
|
||||||
return branch_name .. ' '
|
|
||||||
end,
|
|
||||||
condition = check_git_and_buffer,
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
separator = icons.arrow_right,
|
|
||||||
separator_highlight = 'GalaxyViModeInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FileIcon = {
|
|
||||||
provider = function()
|
|
||||||
local icon = fileinfo.get_file_icon()
|
|
||||||
if condition.check_git_workspace() then
|
|
||||||
return ' ' .. icon
|
|
||||||
end
|
|
||||||
|
|
||||||
return ' ' .. icon
|
|
||||||
end,
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FilePath = {
|
|
||||||
provider = FilePathShortProvider,
|
|
||||||
condition = check_buffer_and_width,
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FileName = {
|
|
||||||
provider = 'FileName',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
separator = icons.arrow_right_filled,
|
|
||||||
separator_highlight = 'GalaxyViModeNestedInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiffAdd = {
|
|
||||||
provider = 'DiffAdd',
|
|
||||||
icon = ' ' .. icons.diff_add,
|
|
||||||
condition = check_git_and_buffer,
|
|
||||||
highlight = { colors.diffAdd, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiffModified = {
|
|
||||||
provider = 'DiffModified',
|
|
||||||
condition = check_git_and_buffer,
|
|
||||||
icon = ' ' .. icons.diff_modified,
|
|
||||||
highlight = { colors.diffModified, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiffRemove = {
|
|
||||||
provider = 'DiffRemove',
|
|
||||||
condition = check_git_and_buffer,
|
|
||||||
icon = ' ' .. icons.diff_remove,
|
|
||||||
highlight = { colors.diffDeleted, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.right = {
|
|
||||||
-- Error
|
|
||||||
{
|
|
||||||
DiagnosticErrorLeftBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_left_filled, diag.get_diagnostic_error),
|
|
||||||
highlight = 'DiagnosticError',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiagnosticError = {
|
|
||||||
provider = diag.get_diagnostic_error,
|
|
||||||
highlight = 'DiagnosticErrorInv',
|
|
||||||
icon = ' ' .. icons.error .. ' ',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiagnosticErrorRightBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled .. ' ', diag.get_diagnostic_error),
|
|
||||||
highlight = 'DiagnosticError',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- Warning
|
|
||||||
{
|
|
||||||
DiagnosticWarnLeftBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_left_filled, diag.get_diagnostic_warn),
|
|
||||||
highlight = 'DiagnosticWarn',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiagnosticWarn = {
|
|
||||||
provider = diag.get_diagnostic_warn,
|
|
||||||
highlight = 'DiagnosticWarnInv',
|
|
||||||
icon = ' ' .. icons.warn .. ' ',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiagnosticWarnRightBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled .. ' ', diag.get_diagnostic_warn),
|
|
||||||
highlight = 'DiagnosticWarn',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- Hint
|
|
||||||
{
|
|
||||||
DiagnosticHintLeftBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_left_filled, diag.get_diagnostic_hint),
|
|
||||||
highlight = 'DiagnosticHint',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiagnosticHint = {
|
|
||||||
provider = diag.get_diagnostic_hint,
|
|
||||||
icon = ' ' .. icons.hint .. ' ',
|
|
||||||
highlight = 'DiagnosticHintInv',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
DiagnosticHintRightBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled .. ' ', diag.get_diagnostic_hint),
|
|
||||||
highlight = 'DiagnosticHint',
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- Git
|
|
||||||
{
|
|
||||||
GitBranchRightBracket = {
|
|
||||||
provider = BracketProvider(icons.arrow_left_filled, true),
|
|
||||||
condition = check_buffer_and_width,
|
|
||||||
highlight = 'GalaxyViModeNestedInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
LSPStatus = {
|
|
||||||
provider = function()
|
|
||||||
local clients = u.get_active_lsp_client_names()
|
|
||||||
local client_str = ''
|
|
||||||
|
|
||||||
if #clients < 1 then
|
|
||||||
return client_str
|
|
||||||
end
|
|
||||||
|
|
||||||
for i, client in ipairs(clients) do
|
|
||||||
client_str = client_str .. client
|
|
||||||
if i < #clients then
|
|
||||||
client_str = client_str .. ', '
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if client_str:len() < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return ' (' .. client_str .. ')'
|
|
||||||
end,
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
condition = check_buffer_and_width,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
LSPStatusArrow = {
|
|
||||||
provider = BracketProvider(' ' .. icons.arrow_left, true),
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
condition = check_buffer_and_width,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GitRoot = {
|
|
||||||
provider = get_git_root,
|
|
||||||
condition = check_buffer_and_width,
|
|
||||||
icon = ' ' .. icons.file .. ' ',
|
|
||||||
highlight = 'GalaxyViModeInv',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- Editor info
|
|
||||||
{
|
|
||||||
LineColumn = {
|
|
||||||
provider = {
|
|
||||||
LineColumnProvider,
|
|
||||||
function()
|
|
||||||
return ' '
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
highlight = 'GalaxyViMode',
|
|
||||||
separator = icons.arrow_left_filled,
|
|
||||||
separator_highlight = 'GalaxyGitLCBracket',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PerCent = {
|
|
||||||
provider = {
|
|
||||||
PercentProvider,
|
|
||||||
},
|
|
||||||
highlight = 'GalaxyViMode',
|
|
||||||
separator = icons.arrow_left .. ' ',
|
|
||||||
separator_highlight = 'GalaxyViModeLeftBracket',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
PercentRightBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled, true),
|
|
||||||
highlight = 'GalaxyPercentBracket',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.short_line_left = {
|
|
||||||
{
|
|
||||||
GhostLeftBracketShort = {
|
|
||||||
provider = BracketProvider(icons.rounded_left_filled, true),
|
|
||||||
highlight = { colors.white, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GhostShort = {
|
|
||||||
provider = BracketProvider(main_icon, true),
|
|
||||||
highlight = { 'StatusLine', colors.white },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GhostRightBracketShort = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled, true),
|
|
||||||
highlight = { colors.white, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FileIconShort = {
|
|
||||||
provider = {
|
|
||||||
function()
|
|
||||||
return ' '
|
|
||||||
end,
|
|
||||||
'FileIcon',
|
|
||||||
},
|
|
||||||
condition = function()
|
|
||||||
return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree'
|
|
||||||
end,
|
|
||||||
highlight = {
|
|
||||||
require('galaxyline.providers.fileinfo').get_file_icon,
|
|
||||||
'StatusLine',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FilePathShort = {
|
|
||||||
provider = FilePathShortProvider,
|
|
||||||
condition = function()
|
|
||||||
return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree'
|
|
||||||
end,
|
|
||||||
highlight = { colors.white, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
FileNameShort = {
|
|
||||||
provider = 'FileName',
|
|
||||||
condition = function()
|
|
||||||
return condition.buffer_not_empty() and vim.bo.filetype ~= 'NvimTree'
|
|
||||||
end,
|
|
||||||
highlight = { colors.white, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
gls.short_line_right = {
|
|
||||||
{
|
|
||||||
GitRootShortLeftBracket = {
|
|
||||||
provider = BracketProvider(icons.arrow_left_filled, true),
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
highlight = { colors.white, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GitRootShort = {
|
|
||||||
provider = get_git_root,
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
icon = ' ' .. icons.file .. ' ',
|
|
||||||
highlight = { statusline_colors.guibg, colors.white },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
GitRootShortRightBracket = {
|
|
||||||
provider = BracketProvider(icons.rounded_right_filled, true),
|
|
||||||
condition = condition.buffer_not_empty,
|
|
||||||
highlight = { colors.white, 'StatusLine' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
92
lua/cosmic/plugins/lualine/init.lua
Normal file
92
lua/cosmic/plugins/lualine/init.lua
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
local config = require('cosmic.core.user')
|
||||||
|
local utils = require('cosmic.utils')
|
||||||
|
local lsp_utils = require('cosmic.utils.lsp')
|
||||||
|
local icons = require('cosmic.utils.icons')
|
||||||
|
|
||||||
|
local custom_sections = {
|
||||||
|
branch = { 'b:gitsigns_head', icon = icons.branch },
|
||||||
|
diff = {
|
||||||
|
'diff',
|
||||||
|
source = utils.diff_source(),
|
||||||
|
symbols = {
|
||||||
|
added = icons.diff_add .. ' ',
|
||||||
|
modified = icons.diff_modified .. ' ',
|
||||||
|
removed = icons.diff_remove .. ' ',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
shortenedFilePath = {
|
||||||
|
'filename',
|
||||||
|
path = 0,
|
||||||
|
symbols = {
|
||||||
|
modified = icons.diff_modified,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
relativeFilePath = {
|
||||||
|
'filename',
|
||||||
|
path = 1,
|
||||||
|
symbols = {
|
||||||
|
modified = icons.diff_modified,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('lualine').setup(utils.merge({
|
||||||
|
options = {
|
||||||
|
theme = 'tokyonight',
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_a = { 'mode' },
|
||||||
|
lualine_b = {
|
||||||
|
{
|
||||||
|
'filetype',
|
||||||
|
icon_only = true,
|
||||||
|
padding = {
|
||||||
|
left = 1,
|
||||||
|
right = 0,
|
||||||
|
},
|
||||||
|
separator = '',
|
||||||
|
},
|
||||||
|
custom_sections.shortenedFilePath,
|
||||||
|
},
|
||||||
|
lualine_c = { custom_sections.diff },
|
||||||
|
lualine_x = { 'diagnostics' },
|
||||||
|
lualine_y = { lsp_utils.get_lsp_status_str },
|
||||||
|
lualine_z = { 'location', 'progress' },
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_a = {},
|
||||||
|
lualine_b = {
|
||||||
|
{
|
||||||
|
'filetype',
|
||||||
|
icon_only = true,
|
||||||
|
padding = {
|
||||||
|
left = 1,
|
||||||
|
right = 0,
|
||||||
|
},
|
||||||
|
separator = '',
|
||||||
|
},
|
||||||
|
custom_sections.shortenedFilePath,
|
||||||
|
},
|
||||||
|
lualine_c = { custom_sections.diff },
|
||||||
|
lualine_x = { 'diagnostics' },
|
||||||
|
lualine_y = { 'location', 'progress' },
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
winbar = {
|
||||||
|
lualine_a = { utils.get_short_cwd },
|
||||||
|
lualine_b = { custom_sections.branch },
|
||||||
|
lualine_c = { custom_sections.relativeFilePath },
|
||||||
|
lualine_x = { 'filetype' },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
inactive_winbar = {
|
||||||
|
lualine_a = { utils.get_short_cwd },
|
||||||
|
lualine_b = { custom_sections.branch },
|
||||||
|
lualine_c = { custom_sections.relativeFilePath },
|
||||||
|
lualine_x = { 'filetype' },
|
||||||
|
lualine_y = {},
|
||||||
|
lualine_z = {},
|
||||||
|
},
|
||||||
|
extensions = { 'quickfix', 'fugitive', 'nvim-tree' },
|
||||||
|
}, config.lualine or {}))
|
|
@ -1,43 +0,0 @@
|
||||||
local _, colors = pcall(require, 'cosmic.theme.colors')
|
|
||||||
if not colors then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local set_highlight = require('cosmic.theme.utils').set_highlight
|
|
||||||
-- notification highlights
|
|
||||||
set_highlight('NotifyINFOBorder', {
|
|
||||||
guifg = colors.hint,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyINFOTitle', {
|
|
||||||
guifg = colors.hint,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyINFOIcon', {
|
|
||||||
guifg = colors.hint,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyWARNBorder', {
|
|
||||||
guifg = colors.warn,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyWARNTitle', {
|
|
||||||
guifg = colors.warn,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyWARNIcon', {
|
|
||||||
guifg = colors.warn,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyERRORBorder', {
|
|
||||||
guifg = colors.error,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyERRORTitle', {
|
|
||||||
guifg = colors.error,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyERRORIcon', {
|
|
||||||
guifg = colors.error,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyTRACEBorder', {
|
|
||||||
guifg = colors.trace,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyTRACETitle', {
|
|
||||||
guifg = colors.trace,
|
|
||||||
})
|
|
||||||
set_highlight('NotifyTRACEIcon', {
|
|
||||||
guifg = colors.trace,
|
|
||||||
})
|
|
|
@ -1,20 +0,0 @@
|
||||||
local config = require('cosmic.core.user')
|
|
||||||
local icons = require('cosmic.theme.icons')
|
|
||||||
local u = require('cosmic.utils')
|
|
||||||
|
|
||||||
require('notify').setup(u.merge({
|
|
||||||
icons = {
|
|
||||||
ERROR = icons.error,
|
|
||||||
WARN = icons.warn,
|
|
||||||
INFO = icons.info,
|
|
||||||
DEBUG = icons.debug,
|
|
||||||
TRACE = icons.trace,
|
|
||||||
},
|
|
||||||
stages = 'slide',
|
|
||||||
background_colour = require('cosmic.theme.colors').bg,
|
|
||||||
}, config.notify or {}))
|
|
||||||
|
|
||||||
-- folke/noice will do this for us :)
|
|
||||||
--[[ vim.notify = require('notify') ]]
|
|
||||||
|
|
||||||
require('cosmic.plugins.notify.highlights')
|
|
|
@ -2,7 +2,7 @@ local cmp = require('cmp')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require('luasnip')
|
||||||
local user_config = require('cosmic.core.user')
|
local user_config = require('cosmic.core.user')
|
||||||
local icons = require('cosmic.theme.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local config = require('cosmic.core.user')
|
local config = require('cosmic.core.user')
|
||||||
local icons = require('cosmic.theme.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
local augroup_name = 'CosmicNvimNvimTree'
|
local augroup_name = 'CosmicNvimNvimTree'
|
||||||
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local actions = require('telescope.actions')
|
local actions = require('telescope.actions')
|
||||||
local config = require('cosmic.core.user')
|
local config = require('cosmic.core.user')
|
||||||
local icons = require('cosmic.theme.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
local default_mappings = {
|
local default_mappings = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local set_highlight = require('cosmic.theme.utils').set_highlight
|
local set_highlight = require('cosmic.utils.theme').set_highlight
|
||||||
|
|
||||||
-- terminal highlights
|
-- terminal highlights
|
||||||
set_highlight('FloatBorder', {
|
set_highlight('FloatBorder', {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
local config = require('cosmic.core.user')
|
local config = require('cosmic.core.user')
|
||||||
local icons = require('cosmic.theme.icons')
|
local icons = require('cosmic.utils.icons')
|
||||||
local u = require('cosmic.utils')
|
local u = require('cosmic.utils')
|
||||||
|
|
||||||
require('todo-comments').setup(u.merge({
|
require('todo-comments').setup(u.merge({
|
||||||
|
|
9
lua/cosmic/plugins/tokyonight/config.lua
Normal file
9
lua/cosmic/plugins/tokyonight/config.lua
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
local config = {
|
||||||
|
|
||||||
|
-- use the night style
|
||||||
|
style = 'night',
|
||||||
|
light_style = 'moon',
|
||||||
|
sidebars = { 'qf', 'packer', 'help' },
|
||||||
|
}
|
||||||
|
|
||||||
|
return config
|
5
lua/cosmic/plugins/tokyonight/init.lua
Normal file
5
lua/cosmic/plugins/tokyonight/init.lua
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
local config = require('cosmic.plugins.tokyonight.config')
|
||||||
|
|
||||||
|
require('tokyonight').setup(config)
|
||||||
|
|
||||||
|
vim.cmd('color tokyonight')
|
|
@ -1,16 +0,0 @@
|
||||||
local config = require('cosmic.core.user')
|
|
||||||
local colors = {}
|
|
||||||
local mod = 'cosmic.theme.integrated.'
|
|
||||||
local supported_themes = require('cosmic.theme.plugins').supported_themes
|
|
||||||
|
|
||||||
for _, theme in pairs(supported_themes) do
|
|
||||||
if theme == config.theme then
|
|
||||||
colors = require(mod .. theme)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.tbl_isempty(colors) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
return colors
|
|
|
@ -1,32 +0,0 @@
|
||||||
local _, colors = pcall(require, 'cosmic.theme.colors')
|
|
||||||
if not colors then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local get_highlight = require('cosmic.theme.utils').get_highlight
|
|
||||||
local set_highlight = require('cosmic.theme.utils').set_highlight
|
|
||||||
local statusline_colors = get_highlight('StatusLine')
|
|
||||||
local error_colors = get_highlight('DiagnosticError')
|
|
||||||
local warning_colors = get_highlight('DiagnosticWarn')
|
|
||||||
local hint_colors = get_highlight('DiagnosticHint')
|
|
||||||
local info_colors = get_highlight('DiagnosticInfo')
|
|
||||||
|
|
||||||
set_highlight('DiagnosticErrorInv', {
|
|
||||||
guibg = error_colors.guifg,
|
|
||||||
guifg = statusline_colors.guibg,
|
|
||||||
})
|
|
||||||
|
|
||||||
set_highlight('DiagnosticWarnInv', {
|
|
||||||
guibg = warning_colors.guifg,
|
|
||||||
guifg = statusline_colors.guibg,
|
|
||||||
})
|
|
||||||
|
|
||||||
set_highlight('DiagnosticHintInv', {
|
|
||||||
guibg = hint_colors.guifg,
|
|
||||||
guifg = statusline_colors.guibg,
|
|
||||||
})
|
|
||||||
|
|
||||||
set_highlight('DiagnosticInfoInv', {
|
|
||||||
guibg = info_colors.guifg,
|
|
||||||
guifg = statusline_colors.guibg,
|
|
||||||
})
|
|
|
@ -1,24 +0,0 @@
|
||||||
local theme = require('catppuccin.core.color_palette')
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme.white,
|
|
||||||
bg = theme.gray2,
|
|
||||||
bg_highlight = theme.black4,
|
|
||||||
normal = theme.maroon,
|
|
||||||
insert = theme.pink,
|
|
||||||
command = theme.red,
|
|
||||||
visual = theme.yellow,
|
|
||||||
replace = theme.flamingo,
|
|
||||||
diffAdd = theme.blue,
|
|
||||||
diffModified = theme.teal,
|
|
||||||
diffDeleted = theme.red,
|
|
||||||
trace = theme.red,
|
|
||||||
hint = theme.white,
|
|
||||||
info = theme.teal,
|
|
||||||
error = theme.flamingo,
|
|
||||||
warn = theme.red,
|
|
||||||
floatBorder = theme.black4,
|
|
||||||
selection_caret = theme.maroon,
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors
|
|
|
@ -1,50 +0,0 @@
|
||||||
local a = {
|
|
||||||
bg = '#282A36',
|
|
||||||
fg = '#F8F8F2',
|
|
||||||
selection = '#44475A',
|
|
||||||
comment = '#6272A4',
|
|
||||||
red = '#FF5555',
|
|
||||||
orange = '#FFB86C',
|
|
||||||
yellow = '#F1FA8C',
|
|
||||||
green = '#50fa7b',
|
|
||||||
purple = '#BD93F9',
|
|
||||||
cyan = '#8BE9FD',
|
|
||||||
pink = '#FF79C6',
|
|
||||||
bright_red = '#FF6E6E',
|
|
||||||
bright_green = '#69FF94',
|
|
||||||
bright_yellow = '#FFFFA5',
|
|
||||||
bright_blue = '#D6ACFF',
|
|
||||||
bright_magenta = '#FF92DF',
|
|
||||||
bright_cyan = '#A4FFFF',
|
|
||||||
bright_white = '#FFFFFF',
|
|
||||||
menu = '#21222C',
|
|
||||||
visual = '#3E4452',
|
|
||||||
gutter_fg = '#4B5263',
|
|
||||||
nontext = '#3B4048',
|
|
||||||
white = '#ABB2BF',
|
|
||||||
black = '#191A21',
|
|
||||||
}
|
|
||||||
|
|
||||||
local theme = require('dracula').colors()
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme.white,
|
|
||||||
bg = theme.nontext,
|
|
||||||
bg_highlight = theme.nontext,
|
|
||||||
normal = theme.bright_green,
|
|
||||||
insert = theme.bright_cyan,
|
|
||||||
command = theme.orange,
|
|
||||||
visual = theme.bright_purple,
|
|
||||||
replace = theme.bright_red,
|
|
||||||
diffAdd = theme.bright_green,
|
|
||||||
diffModified = theme.orange,
|
|
||||||
diffDeleted = theme.bright_red,
|
|
||||||
trace = theme.orange,
|
|
||||||
hint = theme.bright_cyan,
|
|
||||||
info = theme.bright_green,
|
|
||||||
error = theme.bright_red,
|
|
||||||
warn = theme.orange,
|
|
||||||
floatBorder = theme.bright_blue,
|
|
||||||
selection_caret = theme.bright_blue,
|
|
||||||
}
|
|
||||||
return colors
|
|
|
@ -1,46 +0,0 @@
|
||||||
local theme = {
|
|
||||||
bg_0 = '#181818',
|
|
||||||
bg_1 = '#252525',
|
|
||||||
bg_2 = '#3B3B3B',
|
|
||||||
dim_0 = '#777777',
|
|
||||||
fg_0 = '#B9B9B9',
|
|
||||||
fg_1 = '#DEDEDE',
|
|
||||||
red = '#ED4A46',
|
|
||||||
green = '#70B433',
|
|
||||||
yellow = '#DBB32D',
|
|
||||||
blue = '#368AEB',
|
|
||||||
magenta = '#EB6EB7',
|
|
||||||
cyan = '#3FC5B7',
|
|
||||||
orange = '#E67F43',
|
|
||||||
violet = '#A580E2',
|
|
||||||
br_red = '#FF5E56',
|
|
||||||
br_green = '#83C746',
|
|
||||||
br_yellow = '#EFC541',
|
|
||||||
br_blue = '#4F9CFE',
|
|
||||||
br_magenta = '#FF81CA',
|
|
||||||
br_cyan = '#56D8C9',
|
|
||||||
br_orange = '#FA9153',
|
|
||||||
br_violet = '#B891F5',
|
|
||||||
}
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme.dim_0,
|
|
||||||
bg = theme.bg_1,
|
|
||||||
bg_highlight = theme.bg_2,
|
|
||||||
normal = theme.dim_0,
|
|
||||||
insert = theme.dim_0,
|
|
||||||
command = theme.dim_0,
|
|
||||||
visual = theme.dim_0,
|
|
||||||
replace = theme.dim_0,
|
|
||||||
diffAdd = theme.green,
|
|
||||||
diffModified = theme.yellow,
|
|
||||||
diffDeleted = theme.red,
|
|
||||||
trace = theme.br_magenta,
|
|
||||||
hint = theme.br_blue,
|
|
||||||
info = theme.br_yellow,
|
|
||||||
error = theme.br_red,
|
|
||||||
warn = theme.br_orange,
|
|
||||||
floatBorder = theme.fg_0,
|
|
||||||
selection_caret = theme.fg_0,
|
|
||||||
}
|
|
||||||
return colors
|
|
|
@ -1,25 +0,0 @@
|
||||||
local config = require('github-theme.config')
|
|
||||||
local theme_colors = require('github-theme.colors').setup(config.schema)
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme_colors.bright_white,
|
|
||||||
bg = theme_colors.bg,
|
|
||||||
bg_highlight = theme_colors.bg_highlight,
|
|
||||||
normal = theme_colors.blue,
|
|
||||||
insert = theme_colors.green,
|
|
||||||
command = theme_colors.bright_magenta,
|
|
||||||
visual = theme_colors.yellow,
|
|
||||||
replace = theme_colors.red,
|
|
||||||
diffAdd = theme_colors.git.add,
|
|
||||||
diffModified = theme_colors.git.change,
|
|
||||||
diffDeleted = theme_colors.git.delete,
|
|
||||||
trace = theme_colors.orange,
|
|
||||||
hint = theme_colors.hint,
|
|
||||||
info = theme_colors.info,
|
|
||||||
error = theme_colors.error,
|
|
||||||
warn = theme_colors.warn,
|
|
||||||
floatBorder = theme_colors.border,
|
|
||||||
selection_caret = theme_colors.magenta,
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors
|
|
|
@ -1,23 +0,0 @@
|
||||||
local theme = require('gruvbox.colors')
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme.light0_hard,
|
|
||||||
bg = theme.dark0,
|
|
||||||
bg_highlight = theme.dark1,
|
|
||||||
normal = theme.neutral_yellow,
|
|
||||||
insert = theme.neutral_green,
|
|
||||||
command = theme.neutral_orange,
|
|
||||||
visual = theme.neutral_purple,
|
|
||||||
replace = theme.neutral_red,
|
|
||||||
diffAdd = theme.neutral_green,
|
|
||||||
diffModified = theme.neutral_orange,
|
|
||||||
diffDeleted = theme.neutral_red,
|
|
||||||
trace = theme.neutral_orange,
|
|
||||||
hint = theme.neutral_blue,
|
|
||||||
info = theme.neutral_green,
|
|
||||||
error = theme.neutral_red,
|
|
||||||
warn = theme.neutral_orange,
|
|
||||||
floatBorder = theme.dark3,
|
|
||||||
selection_caret = theme.neutral_blue,
|
|
||||||
}
|
|
||||||
return colors
|
|
|
@ -1,24 +0,0 @@
|
||||||
local theme_colors = require('kanagawa.colors').setup()
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme_colors.fujiWhite,
|
|
||||||
bg = theme_colors.sumiInk0,
|
|
||||||
bg_highlight = theme_colors.sumiInk2,
|
|
||||||
normal = theme_colors.sumiInk4,
|
|
||||||
insert = theme_colors.waveBlue2,
|
|
||||||
command = theme_colors.boatYellow2,
|
|
||||||
visual = theme_colors.dragonBlue,
|
|
||||||
replace = theme_colors.autumnRed,
|
|
||||||
diffAdd = theme_colors.autumnGreen,
|
|
||||||
diffModified = theme_colors.autumnYellow,
|
|
||||||
diffDeleted = theme_colors.autumnRed,
|
|
||||||
trace = theme_colors.surimiOrange,
|
|
||||||
hint = theme_colors.dragonBlue,
|
|
||||||
info = theme_colors.waveAqua1,
|
|
||||||
error = theme_colors.samuraiRed,
|
|
||||||
warn = theme_colors.roninYellow,
|
|
||||||
floatBorder = theme_colors.sumiInk4,
|
|
||||||
selection_caret = theme_colors.oniViolet,
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors
|
|
|
@ -1,25 +0,0 @@
|
||||||
local palette = require('monokai').classic;
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = palette.white,
|
|
||||||
bg = palette.base2,
|
|
||||||
bg_highlight = palette.base1,
|
|
||||||
normal = palette.aqua,
|
|
||||||
insert = palette.green,
|
|
||||||
command = palette.orange,
|
|
||||||
visual = palette.yellow,
|
|
||||||
replace = palette.red,
|
|
||||||
diffAdd = palette.diff_add,
|
|
||||||
diffModified = palette.diff_change,
|
|
||||||
diffDeleted = palette.diff_remove,
|
|
||||||
trace = palette.orange,
|
|
||||||
hint = palette.aqua,
|
|
||||||
info = palette.green,
|
|
||||||
error = palette.red,
|
|
||||||
warn = palette.orange,
|
|
||||||
floatBorder = palette.border,
|
|
||||||
selection_caret = palette.pink,
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors
|
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
local palette = require('nightfox.palette').load('nightfox')
|
|
||||||
local spec = require('nightfox.spec').load('nightfox')
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = palette.fg2,
|
|
||||||
bg = palette.bg1,
|
|
||||||
bg_highlight = palette.bg3,
|
|
||||||
normal = palette.blue.base,
|
|
||||||
insert = palette.cyan.base,
|
|
||||||
command = palette.orange.base,
|
|
||||||
visual = palette.magenta.base,
|
|
||||||
replace = palette.red.base,
|
|
||||||
diffAdd = spec.git.add,
|
|
||||||
diffModified = spec.git.change,
|
|
||||||
diffDeleted = spec.git.delete,
|
|
||||||
trace = palette.orange.base,
|
|
||||||
hint = palette.cyan.base,
|
|
||||||
info = palette.green.bright,
|
|
||||||
error = palette.magenta.bright,
|
|
||||||
warn = palette.orange.base,
|
|
||||||
floatBorder = palette.bg3,
|
|
||||||
selection_caret = palette.pink.base,
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors
|
|
|
@ -1,22 +0,0 @@
|
||||||
local theme = require('nord.colors')
|
|
||||||
local colors = {
|
|
||||||
white = theme.nord4_gui,
|
|
||||||
bg = theme.nord1_gui,
|
|
||||||
bg_highlight = theme.nord1_gui,
|
|
||||||
normal = theme.nord9_gui,
|
|
||||||
insert = theme.nord14_gui,
|
|
||||||
command = theme.nord13_gui,
|
|
||||||
visual = theme.nord15_gui,
|
|
||||||
replace = theme.nord11_gui,
|
|
||||||
diffAdd = theme.nord14_gui,
|
|
||||||
diffModified = theme.nord13_gui,
|
|
||||||
diffDeleted = theme.nord11_gui,
|
|
||||||
trace = theme.nord13_gui,
|
|
||||||
hint = theme.nord8_gui,
|
|
||||||
info = theme.nord9_gui,
|
|
||||||
error = theme.nord11_gui,
|
|
||||||
warn = theme.nord13_gui,
|
|
||||||
floatBorder = theme.nord3_gui,
|
|
||||||
selection_caret = theme.nord9_gui,
|
|
||||||
}
|
|
||||||
return colors
|
|
|
@ -1,23 +0,0 @@
|
||||||
local theme = require('onedark.colors')
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme.fg,
|
|
||||||
bg = theme.bg3,
|
|
||||||
bg_highlight = theme.bg3,
|
|
||||||
normal = theme.green,
|
|
||||||
insert = theme.cyan,
|
|
||||||
command = theme.orange,
|
|
||||||
visual = theme.purple,
|
|
||||||
replace = theme.red,
|
|
||||||
diffAdd = theme.green,
|
|
||||||
diffModified = theme.orange,
|
|
||||||
diffDeleted = theme.red,
|
|
||||||
trace = theme.orange,
|
|
||||||
hint = theme.cyan,
|
|
||||||
info = theme.green,
|
|
||||||
error = theme.red,
|
|
||||||
warn = theme.orange,
|
|
||||||
floatBorder = theme.bg3,
|
|
||||||
selection_caret = theme.purple,
|
|
||||||
}
|
|
||||||
return colors
|
|
|
@ -1,23 +0,0 @@
|
||||||
local theme = require('rose-pine.palette')
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = theme.text,
|
|
||||||
bg = theme.surface,
|
|
||||||
bg_highlight = theme.surface,
|
|
||||||
normal = theme.pine,
|
|
||||||
insert = theme.foam,
|
|
||||||
command = theme.gold,
|
|
||||||
visual = theme.iris,
|
|
||||||
replace = theme.rose,
|
|
||||||
diffAdd = theme.foam,
|
|
||||||
diffModified = theme.pine,
|
|
||||||
diffDeleted = theme.rose,
|
|
||||||
trace = theme.rose,
|
|
||||||
hint = theme.pine,
|
|
||||||
info = theme.foam,
|
|
||||||
error = theme.love,
|
|
||||||
warn = theme.rose,
|
|
||||||
floatBorder = theme.rose,
|
|
||||||
selection_caret = theme.iris,
|
|
||||||
}
|
|
||||||
return colors
|
|
|
@ -1,25 +0,0 @@
|
||||||
local theme = require('tokyonight.colors')
|
|
||||||
local themeColors = theme.setup()
|
|
||||||
|
|
||||||
local colors = {
|
|
||||||
white = themeColors.fg_dark,
|
|
||||||
bg = themeColors.bg,
|
|
||||||
bg_highlight = themeColors.bg_highlight,
|
|
||||||
normal = themeColors.blue,
|
|
||||||
insert = themeColors.teal,
|
|
||||||
command = themeColors.orange,
|
|
||||||
visual = themeColors.magenta,
|
|
||||||
replace = themeColors.red,
|
|
||||||
diffAdd = themeColors.git.add,
|
|
||||||
diffModified = themeColors.git.change,
|
|
||||||
diffDeleted = themeColors.git.delete,
|
|
||||||
trace = themeColors.orange,
|
|
||||||
hint = themeColors.teal,
|
|
||||||
info = themeColors.green2,
|
|
||||||
error = themeColors.magenta2,
|
|
||||||
warn = themeColors.orange,
|
|
||||||
floatBorder = themeColors.border_highlight,
|
|
||||||
selection_caret = themeColors.purple,
|
|
||||||
}
|
|
||||||
|
|
||||||
return colors
|
|
|
@ -1,180 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
M.supported_themes = {
|
|
||||||
'catppuccin',
|
|
||||||
'dracula',
|
|
||||||
'enfocado',
|
|
||||||
'github',
|
|
||||||
'gruvbox',
|
|
||||||
'kanagawa',
|
|
||||||
'monokai',
|
|
||||||
'nightfox',
|
|
||||||
'nord',
|
|
||||||
'onedark',
|
|
||||||
'rose-pine',
|
|
||||||
'tokyonight',
|
|
||||||
}
|
|
||||||
|
|
||||||
function M.init(use, config)
|
|
||||||
use({ -- color scheme
|
|
||||||
'folke/tokyonight.nvim',
|
|
||||||
as = 'tokyonight',
|
|
||||||
config = function()
|
|
||||||
vim.g.tokyonight_style = 'night'
|
|
||||||
vim.g.tokyonight_sidebars = { 'qf' }
|
|
||||||
vim.cmd('color tokyonight')
|
|
||||||
end,
|
|
||||||
commit = '8223c970677e4d88c9b6b6d81bda23daf11062bb',
|
|
||||||
disable = config.theme ~= 'tokyonight',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'catppuccin/nvim',
|
|
||||||
as = 'catppuccin',
|
|
||||||
config = function()
|
|
||||||
local catppuccin = require('catppuccin')
|
|
||||||
catppuccin.setup({
|
|
||||||
styles = {
|
|
||||||
comments = 'italic',
|
|
||||||
functions = 'NONE',
|
|
||||||
keywords = 'NONE',
|
|
||||||
strings = 'NONE',
|
|
||||||
variables = 'NONE',
|
|
||||||
},
|
|
||||||
integrations = {
|
|
||||||
gitsigns = true,
|
|
||||||
telescope = true,
|
|
||||||
dashboard = true,
|
|
||||||
nvimtree = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
vim.cmd('colorscheme catppuccin')
|
|
||||||
end,
|
|
||||||
commit = 'b66d9a335e2562ca2c4758c12e384a9e7491ff29',
|
|
||||||
disable = config.theme ~= 'catppuccin',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'shaunsingh/nord.nvim',
|
|
||||||
as = 'nord',
|
|
||||||
config = function()
|
|
||||||
vim.g.nord_contrast = true
|
|
||||||
vim.g.nord_borders = true
|
|
||||||
require('nord').set()
|
|
||||||
end,
|
|
||||||
commit = 'db98740c9429232508a25a98b7d41705f4d2fc1c',
|
|
||||||
disable = config.theme ~= 'nord',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'ellisonleao/gruvbox.nvim',
|
|
||||||
as = 'gruvbox',
|
|
||||||
requires = { 'rktjmp/lush.nvim' },
|
|
||||||
config = function()
|
|
||||||
vim.o.background = 'dark'
|
|
||||||
vim.cmd('colorscheme gruvbox')
|
|
||||||
end,
|
|
||||||
commit = '8135da3a90b257a2c902614e71d9cbbef8308cad',
|
|
||||||
disable = config.theme ~= 'gruvbox',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'rose-pine/neovim',
|
|
||||||
as = 'rose-pine',
|
|
||||||
config = function()
|
|
||||||
vim.g.rose_pine_variant = 'moon'
|
|
||||||
vim.cmd('colorscheme rose-pine')
|
|
||||||
end,
|
|
||||||
commit = '3f0a6c06da29c7b0f3fa49a313ae4d56f0dc58b8',
|
|
||||||
disable = config.theme ~= 'rose-pine',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'EdenEast/nightfox.nvim',
|
|
||||||
as = 'nightfox',
|
|
||||||
config = function()
|
|
||||||
vim.cmd('color nightfox')
|
|
||||||
end,
|
|
||||||
commit = 'b85c5c3a0e3b309ffa7d0a6ca33e430c91532ba0',
|
|
||||||
disable = config.theme ~= 'nightfox',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'navarasu/onedark.nvim',
|
|
||||||
as = 'onedark',
|
|
||||||
config = function()
|
|
||||||
vim.cmd('color onedark')
|
|
||||||
end,
|
|
||||||
commit = '52b1ebd80831dd1232b396b82a77fba977fb6e2c',
|
|
||||||
disable = config.theme ~= 'onedark',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'Mofiqul/dracula.nvim',
|
|
||||||
as = 'dracula',
|
|
||||||
config = function()
|
|
||||||
vim.cmd('color dracula')
|
|
||||||
end,
|
|
||||||
commit = 'a219971291c56bcca3827cb7bd40aaaef23feeca',
|
|
||||||
disable = config.theme ~= 'dracula',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'wuelnerdotexe/vim-enfocado',
|
|
||||||
as = 'enfocado',
|
|
||||||
config = function()
|
|
||||||
vim.g.enfocado_style = 'nature'
|
|
||||||
vim.g.enfocado_plugins = {
|
|
||||||
'cmp',
|
|
||||||
'dashboard',
|
|
||||||
'floaterm',
|
|
||||||
'gitsigns',
|
|
||||||
'lsp',
|
|
||||||
'lsp-installer',
|
|
||||||
'notify',
|
|
||||||
'packer',
|
|
||||||
'telescope',
|
|
||||||
'todo-comments',
|
|
||||||
'tree',
|
|
||||||
'treesitter',
|
|
||||||
}
|
|
||||||
vim.cmd('autocmd VimEnter * ++nested colorscheme enfocado')
|
|
||||||
end,
|
|
||||||
commit = 'd7faf362f3573b1219c76b3a6ec22da4e568131e',
|
|
||||||
disable = config.theme ~= 'enfocado',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'rebelot/kanagawa.nvim',
|
|
||||||
as = 'kanagawa',
|
|
||||||
config = function()
|
|
||||||
vim.cmd('colorscheme kanagawa')
|
|
||||||
end,
|
|
||||||
commit = '76df2251e813fdec244b2b593be62accea930119',
|
|
||||||
disable = config.theme ~= 'kanagawa',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'projekt0n/github-nvim-theme',
|
|
||||||
as = 'github',
|
|
||||||
config = function()
|
|
||||||
require('github-theme').setup()
|
|
||||||
end,
|
|
||||||
commit = '1cc4a8d508bc6b846c72b9e629e8188ac24d0f13',
|
|
||||||
disable = config.theme ~= 'github',
|
|
||||||
})
|
|
||||||
|
|
||||||
use({
|
|
||||||
'tanvirtin/monokai.nvim',
|
|
||||||
as = 'monokai',
|
|
||||||
config = function()
|
|
||||||
require('monokai').setup()
|
|
||||||
end,
|
|
||||||
disable = config.theme ~= 'monokai',
|
|
||||||
commit = 'bff619d7a911cd8d8dcb5168db9ee6dfcc344934',
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
98
lua/cosmic/utils/cosmic.lua
Normal file
98
lua/cosmic/utils/cosmic.lua
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
local M = {}
|
||||||
|
local augroup_name = 'CosmicNvimUtils'
|
||||||
|
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
||||||
|
local function clear_cache()
|
||||||
|
vim.cmd(':LuaCacheClear')
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_install_dir()
|
||||||
|
local config_dir = os.getenv('COSMICNVIM_INSTALL_DIR')
|
||||||
|
if not config_dir then
|
||||||
|
return vim.fn.stdpath('config')
|
||||||
|
end
|
||||||
|
return config_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
local function unload(module_pattern, reload)
|
||||||
|
reload = reload or false
|
||||||
|
for module, _ in pairs(package.loaded) do
|
||||||
|
if module:match(module_pattern) then
|
||||||
|
package.loaded[module] = nil
|
||||||
|
if reload then
|
||||||
|
require(module)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function post_reload(msg)
|
||||||
|
local Logger = require('cosmic.utils.logger')
|
||||||
|
unload('cosmic.utils', true)
|
||||||
|
unload('cosmic.theme', true)
|
||||||
|
unload('cosmic.plugins.statusline', true)
|
||||||
|
msg = msg or 'User config reloaded!'
|
||||||
|
Logger:log(msg)
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.reload_user_config_sync()
|
||||||
|
clear_cache()
|
||||||
|
unload('cosmic.core.user', true)
|
||||||
|
unload('cosmic.core.pluginsInit', true)
|
||||||
|
vim.api.nvim_create_autocmd('User PackerComplete', {
|
||||||
|
callback = function()
|
||||||
|
post_reload()
|
||||||
|
end,
|
||||||
|
group = group,
|
||||||
|
once = true,
|
||||||
|
})
|
||||||
|
vim.cmd(':PackerSync')
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.reload_user_config(compile)
|
||||||
|
compile = compile or false
|
||||||
|
unload('cosmic.core.user', true)
|
||||||
|
if compile then
|
||||||
|
vim.api.nvim_create_autocmd('User PackerCompileDone', {
|
||||||
|
callback = function()
|
||||||
|
post_reload()
|
||||||
|
end,
|
||||||
|
group = group,
|
||||||
|
once = true,
|
||||||
|
})
|
||||||
|
vim.cmd(':PackerCompile')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- update instance of CosmicNvim
|
||||||
|
function M.update()
|
||||||
|
local Logger = require('cosmic.utils.logger')
|
||||||
|
local Job = require('plenary.job')
|
||||||
|
local path = get_install_dir()
|
||||||
|
local errors = {}
|
||||||
|
|
||||||
|
Job
|
||||||
|
:new({
|
||||||
|
command = 'git',
|
||||||
|
args = { 'pull', '--ff-only' },
|
||||||
|
cwd = path,
|
||||||
|
on_start = function()
|
||||||
|
Logger:log('Updating...')
|
||||||
|
end,
|
||||||
|
on_exit = function()
|
||||||
|
if vim.tbl_isempty(errors) then
|
||||||
|
Logger:log('Updated! Running CosmicReloadSync...')
|
||||||
|
M.reload_user_config_sync()
|
||||||
|
else
|
||||||
|
table.insert(errors, 1, 'Something went wrong! Please pull changes manually.')
|
||||||
|
table.insert(errors, 2, '')
|
||||||
|
Logger:error('Update failed!', { timeout = 30000 })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_stderr = function(_, err)
|
||||||
|
table.insert(errors, err)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
:sync()
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
|
@ -16,7 +16,7 @@ local icons = {
|
||||||
hint = '',
|
hint = '',
|
||||||
perf = ' ',
|
perf = ' ',
|
||||||
note = '',
|
note = '',
|
||||||
branch = '',
|
branch = '',
|
||||||
file = '',
|
file = '',
|
||||||
dotdotdot = '…',
|
dotdotdot = '…',
|
||||||
information = '',
|
information = '',
|
||||||
|
@ -30,9 +30,9 @@ local icons = {
|
||||||
file2 = '',
|
file2 = '',
|
||||||
clock = '',
|
clock = '',
|
||||||
word = '',
|
word = '',
|
||||||
diff_add = ' ',
|
diff_add = '',
|
||||||
diff_modified = ' ',
|
diff_modified = '',
|
||||||
diff_remove = ' ',
|
diff_remove = '',
|
||||||
git = {
|
git = {
|
||||||
unstaged = '✗',
|
unstaged = '✗',
|
||||||
staged = '✓',
|
staged = '✓',
|
|
@ -1,6 +1,4 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
local augroup_name = 'CosmicNvimUtils'
|
|
||||||
local group = vim.api.nvim_create_augroup(augroup_name, { clear = true })
|
|
||||||
|
|
||||||
function M.map(mode, lhs, rhs, opts)
|
function M.map(mode, lhs, rhs, opts)
|
||||||
local defaults = {
|
local defaults = {
|
||||||
|
@ -31,115 +29,34 @@ function M.split(str, sep)
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_active_lsp_client_names()
|
function M.get_short_file_path(path)
|
||||||
local active_clients = vim.lsp.get_active_clients()
|
local dirs = {}
|
||||||
local client_names = {}
|
for dir in string.gmatch(path, '([^/]+)') do
|
||||||
for _, client in pairs(active_clients or {}) do
|
table.insert(dirs, dir)
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
|
||||||
-- only return attached buffers
|
|
||||||
if vim.lsp.buf_is_attached(buf, client.id) then
|
|
||||||
table.insert(client_names, client.name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if not vim.tbl_isempty(client_names) then
|
local n = #dirs
|
||||||
table.sort(client_names)
|
if n > 3 then
|
||||||
|
return '../' .. dirs[n - 2] .. '/' .. dirs[n - 1] .. '/' .. dirs[n]
|
||||||
end
|
end
|
||||||
return client_names
|
|
||||||
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
local function unload(module_pattern, reload)
|
function M.get_short_cwd()
|
||||||
reload = reload or false
|
local parts = vim.split(vim.fn.getcwd(), '/')
|
||||||
for module, _ in pairs(package.loaded) do
|
return parts[#parts]
|
||||||
if module:match(module_pattern) then
|
|
||||||
package.loaded[module] = nil
|
|
||||||
if reload then
|
|
||||||
require(module)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function clear_cache()
|
function M.diff_source()
|
||||||
vim.cmd(':LuaCacheClear')
|
local gitsigns = vim.b.gitsigns_status_dict
|
||||||
end
|
if gitsigns then
|
||||||
|
return {
|
||||||
function M.post_reload(msg)
|
added = gitsigns.added,
|
||||||
local Logger = require('cosmic.utils.logger')
|
modified = gitsigns.changed,
|
||||||
unload('cosmic.utils', true)
|
removed = gitsigns.removed,
|
||||||
unload('cosmic.theme', true)
|
}
|
||||||
unload('cosmic.plugins.statusline', true)
|
|
||||||
msg = msg or 'User config reloaded!'
|
|
||||||
Logger:log(msg)
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.reload_user_config_sync()
|
|
||||||
clear_cache()
|
|
||||||
unload('cosmic.core.user', true)
|
|
||||||
unload('cosmic.core.pluginsInit', true)
|
|
||||||
vim.api.nvim_create_autocmd('User PackerComplete', {
|
|
||||||
callback = function()
|
|
||||||
M.post_reload()
|
|
||||||
end,
|
|
||||||
group = group,
|
|
||||||
once = true,
|
|
||||||
})
|
|
||||||
vim.cmd(':PackerSync')
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.reload_user_config(compile)
|
|
||||||
compile = compile or false
|
|
||||||
unload('cosmic.core.user', true)
|
|
||||||
if compile then
|
|
||||||
vim.api.nvim_create_autocmd('User PackerCompileDone', {
|
|
||||||
callback = function()
|
|
||||||
M.post_reload()
|
|
||||||
end,
|
|
||||||
group = group,
|
|
||||||
once = true,
|
|
||||||
})
|
|
||||||
vim.cmd(':PackerCompile')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_install_dir()
|
|
||||||
local config_dir = os.getenv('COSMICNVIM_INSTALL_DIR')
|
|
||||||
if not config_dir then
|
|
||||||
return vim.fn.stdpath('config')
|
|
||||||
end
|
|
||||||
return config_dir
|
|
||||||
end
|
|
||||||
|
|
||||||
-- update instance of CosmicNvim
|
|
||||||
function M.update()
|
|
||||||
local Logger = require('cosmic.utils.logger')
|
|
||||||
local Job = require('plenary.job')
|
|
||||||
local path = M.get_install_dir()
|
|
||||||
local errors = {}
|
|
||||||
|
|
||||||
Job
|
|
||||||
:new({
|
|
||||||
command = 'git',
|
|
||||||
args = { 'pull', '--ff-only' },
|
|
||||||
cwd = path,
|
|
||||||
on_start = function()
|
|
||||||
Logger:log('Updating...')
|
|
||||||
end,
|
|
||||||
on_exit = function()
|
|
||||||
if vim.tbl_isempty(errors) then
|
|
||||||
Logger:log('Updated! Running CosmicReloadSync...')
|
|
||||||
M.reload_user_config_sync()
|
|
||||||
else
|
|
||||||
table.insert(errors, 1, 'Something went wrong! Please pull changes manually.')
|
|
||||||
table.insert(errors, 2, '')
|
|
||||||
Logger:error('Update failed!', { timeout = 30000 })
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_stderr = function(_, err)
|
|
||||||
table.insert(errors, err)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
:sync()
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
42
lua/cosmic/utils/lsp.lua
Normal file
42
lua/cosmic/utils/lsp.lua
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.get_active_lsp_client_names()
|
||||||
|
local active_clients = vim.lsp.get_active_clients()
|
||||||
|
local client_names = {}
|
||||||
|
for _, client in pairs(active_clients or {}) do
|
||||||
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
|
-- only return attached buffers
|
||||||
|
if vim.lsp.buf_is_attached(buf, client.id) then
|
||||||
|
table.insert(client_names, client.name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if not vim.tbl_isempty(client_names) then
|
||||||
|
table.sort(client_names)
|
||||||
|
end
|
||||||
|
return client_names
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.get_lsp_status_str()
|
||||||
|
local clients = M.get_active_lsp_client_names()
|
||||||
|
local client_str = ''
|
||||||
|
|
||||||
|
if #clients < 1 then
|
||||||
|
return client_str
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, client in ipairs(clients) do
|
||||||
|
client_str = client_str .. client
|
||||||
|
if i < #clients then
|
||||||
|
client_str = client_str .. ', '
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if client_str:len() < 1 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
return client_str
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
21
readme.md
21
readme.md
|
@ -32,9 +32,10 @@ Full featured native LSP functionality!
|
||||||
|
|
||||||
- Custom rename and code action popups via [Cosmic-UI](https://github.com/CosmicNvim/cosmic-ui)
|
- Custom rename and code action popups via [Cosmic-UI](https://github.com/CosmicNvim/cosmic-ui)
|
||||||
- Amazing default theme via [tokyonight.nvim](https://github.com/folke/tokyonight.nvim)
|
- Amazing default theme via [tokyonight.nvim](https://github.com/folke/tokyonight.nvim)
|
||||||
|
- UI enhancements via [noice](https://github.com/folke/noice.nvim)
|
||||||
- Enhanced syntax highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
|
- Enhanced syntax highlighting via [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
|
||||||
- Dashboard via [dashboard-nvim](https://github.com/glepnir/dashboard-nvim)
|
- Dashboard via [dashboard-nvim](https://github.com/glepnir/dashboard-nvim)
|
||||||
- Hand-built statusline via [galaxyline](https://github.com/CosmicNvim/galaxyline.nvim)
|
- Custom statusline via [lualine](https://github.com/nvim-lualine/lualine.nvim)
|
||||||
- Explore files via [nvim-tree](https://github.com/kyazdani42/nvim-tree.lua)
|
- Explore files via [nvim-tree](https://github.com/kyazdani42/nvim-tree.lua)
|
||||||
- Fuzzy finder via [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
- Fuzzy finder via [Telescope](https://github.com/nvim-telescope/telescope.nvim)
|
||||||
- Floating terminal with [vim-floaterm](https://github.com/voldikss/vim-floaterm)
|
- Floating terminal with [vim-floaterm](https://github.com/voldikss/vim-floaterm)
|
||||||
|
@ -43,7 +44,6 @@ Full featured native LSP functionality!
|
||||||
- Additional TypeScript support via [nvim-lsp-ts-utils](https://github.com/jose-elias-alvarez/nvim-lsp-ts-utils)
|
- Additional TypeScript support via [nvim-lsp-ts-utils](https://github.com/jose-elias-alvarez/nvim-lsp-ts-utils)
|
||||||
- Snippet support via [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
|
- Snippet support via [LuaSnip](https://github.com/L3MON4D3/LuaSnip)
|
||||||
- Session management via [auto-session](https://github.com/rmagatti/auto-session)
|
- Session management via [auto-session](https://github.com/rmagatti/auto-session)
|
||||||
- Notifications via [nvim-notify](https://github.com/rcarriga/nvim-notify)
|
|
||||||
- Additional custom highlighting
|
- Additional custom highlighting
|
||||||
- Floating windows for references, renaming, diagnostics, code actions and more!
|
- Floating windows for references, renaming, diagnostics, code actions and more!
|
||||||
|
|
||||||
|
@ -82,22 +82,7 @@ CosmicNvim uninstallation [details](https://github.com/CosmicNvim/CosmicNvim/wik
|
||||||
|
|
||||||
## 🎨 Theming
|
## 🎨 Theming
|
||||||
|
|
||||||
CosmicNvim comes with first-class support for the following themes:
|
_New documentation coming soon!_
|
||||||
|
|
||||||
- [Catppuccin](https://github.com/catppuccin/catppuccin)
|
|
||||||
- [Dracula](https://github.com/Mofiqul/dracula.nvim)
|
|
||||||
- [Enfocado](https://github.com/wuelnerdotexe/vim-enfocado)
|
|
||||||
- [Github](https://github.com/projekt0n/github-nvim-theme)
|
|
||||||
- [Gruvbox](https://github.com/ellisonleao/gruvbox.nvim)
|
|
||||||
- [Kanagawa](https://github.com/rebelot/kanagawa.nvim)
|
|
||||||
- [Monokai](https://github.com/tanvirtin/monokai.nvim)
|
|
||||||
- [Nightfox](https://github.com/EdenEast/nightfox.nvim)
|
|
||||||
- [Nord](https://github.com/shaunsingh/nord.nvim)
|
|
||||||
- [Onedark](https://github.com/navarasu/onedark.nvim)
|
|
||||||
- [Rose-pine](https://github.com/rose-pine/neovim)
|
|
||||||
- [Tokyonight](https://github.com/folke/tokyonight.nvim)
|
|
||||||
|
|
||||||
[Additional Screenshots](https://github.com/CosmicNvim/CosmicNvim/wiki/Theme-Screenshots)
|
|
||||||
|
|
||||||
## ⚙️ Configuration
|
## ⚙️ Configuration
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/Users/matt/.config/nvim/snapshots
|
|
Loading…
Add table
Reference in a new issue