feat: some clean up
This commit is contained in:
parent
c936c64849
commit
1c1b7adfd4
7 changed files with 24 additions and 71 deletions
|
@ -16,28 +16,28 @@
|
||||||
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
"lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
"mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "b2881eeb395d2b268de5fe9b5e201a8f1816beb8" },
|
"neodev.nvim": { "branch": "main", "commit": "627b5b543f4df551fcddb99c17a8e260c453400d" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
|
"noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" },
|
||||||
"none-ls.nvim": { "branch": "main", "commit": "fa9be1679db7bf57d44128a018db43da5488a07f" },
|
"none-ls.nvim": { "branch": "main", "commit": "fa9be1679db7bf57d44128a018db43da5488a07f" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
|
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
|
||||||
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
|
"nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
|
"nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "7384e7149e79365c96dc623d9fa3444737776982" },
|
"nvim-lspconfig": { "branch": "master", "commit": "6516abf5ac7d017480c8c8e08c0d24066bcb8d43" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
|
"nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "80cfeadf179d5cba76f0f502c71dbcff1b515cd8" },
|
"nvim-tree.lua": { "branch": "master", "commit": "46e1f776f0a714099b9160604fbb62fba2540376" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "0df364926d39f59471ebc5ca83054d74e457350e" },
|
"nvim-treesitter": { "branch": "master", "commit": "d87629647614b779fb2aad8f0042fe2864253ea6" },
|
||||||
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
|
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" },
|
||||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "6c30f3c8915d7b31c3decdfe6c7672432da1809d" },
|
"nvim-ts-context-commentstring": { "branch": "main", "commit": "ead792ccdace6a9d64a8119909af243ed0105465" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "3523d6e6d40ab11fd66c1b2732b3d6b60affa951" },
|
"nvim-web-devicons": { "branch": "master", "commit": "e2f6e0e299e193d7e9c48634d355f7a6eb3020b4" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
"plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" },
|
||||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "18774ec7929c8a8003a91e9e1f69f6c32258bbfe" },
|
"telescope.nvim": { "branch": "master", "commit": "18774ec7929c8a8003a91e9e1f69f6c32258bbfe" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
"todo-comments.nvim": { "branch": "main", "commit": "4a6737a8d70fe1ac55c64dfa47fcb189ca431872" },
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
"tokyonight.nvim": { "branch": "main", "commit": "f247ee700b569ed43f39320413a13ba9b0aef0db" },
|
||||||
"vim-floaterm": { "branch": "master", "commit": "b1d93789faf8bfe1f3e17eec03b8312c2939fcf2" },
|
"vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
|
"vim-fugitive": { "branch": "master", "commit": "46eaf8918b347906789df296143117774e827616" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||||
}
|
}
|
|
@ -68,11 +68,11 @@ end
|
||||||
|
|
||||||
M.capabilities = u.merge(capabilities, {
|
M.capabilities = u.merge(capabilities, {
|
||||||
-- See: https://github.com/neovim/neovim/issues/23291
|
-- See: https://github.com/neovim/neovim/issues/23291
|
||||||
--[[ workspace = { ]]
|
workspace = {
|
||||||
--[[ didChangeWatchedFiles = { ]]
|
didChangeWatchedFiles = {
|
||||||
--[[ dynamicRegistration = false, ]]
|
dynamicRegistration = false,
|
||||||
--[[ }, ]]
|
},
|
||||||
--[[ }, ]]
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
M.root_dir = function(fname)
|
M.root_dir = function(fname)
|
||||||
|
|
|
@ -56,7 +56,7 @@ return {
|
||||||
custom_sections.diff,
|
custom_sections.diff,
|
||||||
},
|
},
|
||||||
lualine_x = { 'diagnostics' },
|
lualine_x = { 'diagnostics' },
|
||||||
lualine_y = { lsp_utils.get_lsp_status_str },
|
lualine_y = { lsp_utils.get_active_clients_str },
|
||||||
lualine_z = { 'location', 'progress' },
|
lualine_z = { 'location', 'progress' },
|
||||||
},
|
},
|
||||||
inactive_sections = {
|
inactive_sections = {
|
||||||
|
@ -73,7 +73,9 @@ return {
|
||||||
},
|
},
|
||||||
custom_sections.shortenedFilePath,
|
custom_sections.shortenedFilePath,
|
||||||
},
|
},
|
||||||
lualine_c = { custom_sections.diff },
|
lualine_c = {
|
||||||
|
custom_sections.diff,
|
||||||
|
},
|
||||||
lualine_x = { 'diagnostics' },
|
lualine_x = { 'diagnostics' },
|
||||||
lualine_y = { 'location', 'progress' },
|
lualine_y = { 'location', 'progress' },
|
||||||
lualine_z = {},
|
lualine_z = {},
|
||||||
|
|
|
@ -66,6 +66,7 @@ return {
|
||||||
'MunifTanjim/nui.nvim',
|
'MunifTanjim/nui.nvim',
|
||||||
{ 'rcarriga/nvim-notify', opts = {
|
{ 'rcarriga/nvim-notify', opts = {
|
||||||
timeout = 1000,
|
timeout = 1000,
|
||||||
|
fps = 60,
|
||||||
} },
|
} },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ end
|
||||||
|
|
||||||
-- update instance of CosmicNvim
|
-- update instance of CosmicNvim
|
||||||
function M.update()
|
function M.update()
|
||||||
local Logger = require('cosmic.utils.logger')
|
|
||||||
local Job = require('plenary.job')
|
local Job = require('plenary.job')
|
||||||
local path = M.get_install_dir()
|
local path = M.get_install_dir()
|
||||||
local errors = {}
|
local errors = {}
|
||||||
|
@ -21,16 +20,16 @@ function M.update()
|
||||||
args = { 'pull', '--ff-only' },
|
args = { 'pull', '--ff-only' },
|
||||||
cwd = path,
|
cwd = path,
|
||||||
on_start = function()
|
on_start = function()
|
||||||
Logger:log('Updating...')
|
vim.notify('Updating...')
|
||||||
end,
|
end,
|
||||||
on_exit = function()
|
on_exit = function()
|
||||||
if vim.tbl_isempty(errors) then
|
if vim.tbl_isempty(errors) then
|
||||||
Logger:log('Updated! Running CosmicReloadSync...')
|
vim.notify('Updated! Running CosmicReloadSync...')
|
||||||
M.reload_user_config_sync()
|
M.reload_user_config_sync()
|
||||||
else
|
else
|
||||||
table.insert(errors, 1, 'Something went wrong! Please pull changes manually.')
|
table.insert(errors, 1, 'Something went wrong! Please pull changes manually.')
|
||||||
table.insert(errors, 2, '')
|
table.insert(errors, 2, '')
|
||||||
Logger:error('Update failed!', { timeout = 30000 })
|
vim.notify('Update failed!', vim.log.levels.ERROR)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_stderr = function(_, err)
|
on_stderr = function(_, err)
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
local Logger = {}
|
|
||||||
Logger.__index = Logger
|
|
||||||
|
|
||||||
local title = 'CosmicNvim'
|
|
||||||
|
|
||||||
Logger = {}
|
|
||||||
Logger.__index = Logger
|
|
||||||
|
|
||||||
local function log(type, msg, opts)
|
|
||||||
local ok, notify = pcall(require, 'notify')
|
|
||||||
if ok then
|
|
||||||
notify(
|
|
||||||
msg,
|
|
||||||
type,
|
|
||||||
vim.tbl_deep_extend('force', {
|
|
||||||
title = title,
|
|
||||||
}, opts)
|
|
||||||
)
|
|
||||||
else
|
|
||||||
if vim.tbl_islist(msg) then
|
|
||||||
-- regular vim.notify can't take tables of strings
|
|
||||||
local tmp_list = msg
|
|
||||||
msg = ''
|
|
||||||
for _, v in pairs(tmp_list) do
|
|
||||||
msg = msg .. v
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.notify(msg, type)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Logger:log(msg, opts)
|
|
||||||
log(vim.log.levels.INFO, msg, opts or {})
|
|
||||||
end
|
|
||||||
|
|
||||||
function Logger:warn(msg, opts)
|
|
||||||
log(vim.log.levels.WARN, msg, opts or {})
|
|
||||||
end
|
|
||||||
|
|
||||||
function Logger:error(msg, opts)
|
|
||||||
log(vim.log.levels.ERROR, msg, opts or {})
|
|
||||||
end
|
|
||||||
|
|
||||||
return Logger
|
|
|
@ -48,7 +48,7 @@ function M.format(bufnr, timeout)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_active_lsp_client_names()
|
function M.get_active_lsp_clients()
|
||||||
local active_clients = vim.lsp.get_clients()
|
local active_clients = vim.lsp.get_clients()
|
||||||
local client_names = {}
|
local client_names = {}
|
||||||
for _, client in pairs(active_clients or {}) do
|
for _, client in pairs(active_clients or {}) do
|
||||||
|
@ -65,12 +65,12 @@ function M.get_active_lsp_client_names()
|
||||||
return client_names
|
return client_names
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.get_lsp_status_str()
|
function M.get_active_clients_str()
|
||||||
local clients = M.get_active_lsp_client_names()
|
local clients = M.get_active_lsp_clients()
|
||||||
local client_str = ''
|
local client_str = ''
|
||||||
|
|
||||||
if #clients < 1 then
|
if #clients < 1 then
|
||||||
return client_str
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, client in ipairs(clients) do
|
for i, client in ipairs(clients) do
|
||||||
|
@ -80,10 +80,6 @@ function M.get_lsp_status_str()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if client_str:len() < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
return client_str
|
return client_str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue