mirror of
https://github.com/isabelroses/nvim.git
synced 2025-04-09 13:29:34 +00:00
feat: switch to neocord
note that it does not have proper button support
This commit is contained in:
parent
2f0e3bef64
commit
9bfd7073a2
6 changed files with 45 additions and 105 deletions
40
_sources/generated.json
generated
40
_sources/generated.json
generated
|
@ -519,6 +519,26 @@
|
|||
},
|
||||
"version": "ce0a05ab4e2839e1c48d072c5236cce846a387bc"
|
||||
},
|
||||
"neocord": {
|
||||
"cargoLocks": null,
|
||||
"date": "2024-04-24",
|
||||
"extract": null,
|
||||
"name": "neocord",
|
||||
"passthru": null,
|
||||
"pinned": false,
|
||||
"src": {
|
||||
"deepClone": false,
|
||||
"fetchSubmodules": false,
|
||||
"leaveDotGit": false,
|
||||
"name": null,
|
||||
"owner": "IogaMaster",
|
||||
"repo": "neocord",
|
||||
"rev": "aa7a58023166533da83ca7b11c0d2569e45d7381",
|
||||
"sha256": "sha256-oVWdnQlgXIMzMiybMq7yR/WfEW+Fm5RmhWx0RWprlfQ=",
|
||||
"type": "github"
|
||||
},
|
||||
"version": "aa7a58023166533da83ca7b11c0d2569e45d7381"
|
||||
},
|
||||
"neodev": {
|
||||
"cargoLocks": null,
|
||||
"date": "2024-07-06",
|
||||
|
@ -779,26 +799,6 @@
|
|||
},
|
||||
"version": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683"
|
||||
},
|
||||
"presence": {
|
||||
"cargoLocks": null,
|
||||
"date": "2023-01-29",
|
||||
"extract": null,
|
||||
"name": "presence",
|
||||
"passthru": null,
|
||||
"pinned": false,
|
||||
"src": {
|
||||
"deepClone": false,
|
||||
"fetchSubmodules": false,
|
||||
"leaveDotGit": false,
|
||||
"name": null,
|
||||
"owner": "andweeb",
|
||||
"repo": "presence.nvim",
|
||||
"rev": "87c857a56b7703f976d3a5ef15967d80508df6e6",
|
||||
"sha256": "sha256-ZpsunLsn//zYgUtmAm5FqKVueVd/Pa1r55ZDqxCimBk=",
|
||||
"type": "github"
|
||||
},
|
||||
"version": "87c857a56b7703f976d3a5ef15967d80508df6e6"
|
||||
},
|
||||
"py_lsp": {
|
||||
"cargoLocks": null,
|
||||
"date": "2024-02-15",
|
||||
|
|
24
_sources/generated.nix
generated
24
_sources/generated.nix
generated
|
@ -313,6 +313,18 @@
|
|||
};
|
||||
date = "2024-06-28";
|
||||
};
|
||||
neocord = {
|
||||
pname = "neocord";
|
||||
version = "aa7a58023166533da83ca7b11c0d2569e45d7381";
|
||||
src = fetchFromGitHub {
|
||||
owner = "IogaMaster";
|
||||
repo = "neocord";
|
||||
rev = "aa7a58023166533da83ca7b11c0d2569e45d7381";
|
||||
fetchSubmodules = false;
|
||||
sha256 = "sha256-oVWdnQlgXIMzMiybMq7yR/WfEW+Fm5RmhWx0RWprlfQ=";
|
||||
};
|
||||
date = "2024-04-24";
|
||||
};
|
||||
neodev = {
|
||||
pname = "neodev";
|
||||
version = "46aa467dca16cf3dfe27098042402066d2ae242d";
|
||||
|
@ -469,18 +481,6 @@
|
|||
};
|
||||
date = "2024-05-20";
|
||||
};
|
||||
presence = {
|
||||
pname = "presence";
|
||||
version = "87c857a56b7703f976d3a5ef15967d80508df6e6";
|
||||
src = fetchFromGitHub {
|
||||
owner = "andweeb";
|
||||
repo = "presence.nvim";
|
||||
rev = "87c857a56b7703f976d3a5ef15967d80508df6e6";
|
||||
fetchSubmodules = false;
|
||||
sha256 = "sha256-ZpsunLsn//zYgUtmAm5FqKVueVd/Pa1r55ZDqxCimBk=";
|
||||
};
|
||||
date = "2023-01-29";
|
||||
};
|
||||
py_lsp = {
|
||||
pname = "py_lsp";
|
||||
version = "278db39aedd697613851861b5ea8b0d9138fc06f";
|
||||
|
|
|
@ -104,6 +104,10 @@ src.git = "https://github.com/nvim-lualine/lualine.nvim"
|
|||
fetch.github = "L3MON4D3/LuaSnip"
|
||||
src.git = "https://github.com/L3MON4D3/LuaSnip"
|
||||
|
||||
[neocord]
|
||||
fetch.github = "IogaMaster/neocord"
|
||||
src.git = "https://github.com/IogaMaster/neocord"
|
||||
|
||||
[neodev]
|
||||
fetch.github = "folke/neodev.nvim"
|
||||
src.git = "https://github.com/folke/neodev.nvim"
|
||||
|
@ -156,10 +160,6 @@ src.git = "https://github.com/epwalsh/obsidian.nvim"
|
|||
fetch.github = "nvim-lua/plenary.nvim"
|
||||
src.git = "https://github.com/nvim-lua/plenary.nvim"
|
||||
|
||||
[presence]
|
||||
fetch.github = "andweeb/presence.nvim"
|
||||
src.git = "https://github.com/andweeb/presence.nvim"
|
||||
|
||||
[py_lsp]
|
||||
fetch.github = "hallerpatrick/py_lsp.nvim"
|
||||
src.git = "https://github.com/hallerpatrick/py_lsp.nvim"
|
||||
|
|
|
@ -386,10 +386,10 @@ rec {
|
|||
};
|
||||
|
||||
# discord integration
|
||||
presence = {
|
||||
src = srcs.presence;
|
||||
neocord = {
|
||||
src = srcs.neocord;
|
||||
event = "VeryLazy";
|
||||
config = ./presence.lua;
|
||||
config = ./neocord.lua;
|
||||
};
|
||||
|
||||
# deps
|
||||
|
|
6
plugins/neocord.lua
Normal file
6
plugins/neocord.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return function()
|
||||
require("neocord").setup({
|
||||
logo = "https://raw.githubusercontent.com/IogaMaster/neovim/main/.github/assets/nixvim-dark.webp",
|
||||
main_image = "logo",
|
||||
})
|
||||
end
|
|
@ -1,66 +0,0 @@
|
|||
return function()
|
||||
require("presence").setup({
|
||||
auto_update = true,
|
||||
neovim_image_text = "neovim",
|
||||
-- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
|
||||
blacklist = {},
|
||||
show_time = false,
|
||||
|
||||
-- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`,
|
||||
-- or a function(buffer: string, repo_url: string|nil): table)
|
||||
--
|
||||
-- we have to reimplement this in my repo beacuse it breaks when using custom urls, so i have a check to alter the url based on what it provides
|
||||
buttons = function(_, parent_dirpath)
|
||||
-- Retrieve the git repository URL
|
||||
local repo_url
|
||||
if parent_dirpath then
|
||||
-- Escape quotes in the file path
|
||||
local path = parent_dirpath:gsub([["]], [[\"]])
|
||||
local git_url_cmd = "git config --get remote.origin.url"
|
||||
local cmd = string.format([[cd "%s" && %s]], path, git_url_cmd)
|
||||
|
||||
-- Trim and coerce empty string value to nil
|
||||
repo_url = vim.trim(vim.fn.system(cmd))
|
||||
repo_url = repo_url ~= "" and repo_url or nil
|
||||
end
|
||||
|
||||
-- Proceed if repo_url is valid
|
||||
if repo_url then
|
||||
-- Handle short SSH syntax
|
||||
local domain, project = repo_url:match("^git@(.+):(.+)$")
|
||||
if domain and project then
|
||||
repo_url = string.format("https://%s/%s", domain, project)
|
||||
end
|
||||
|
||||
-- Custom protocols
|
||||
local custom_protocols = {
|
||||
github = "https://github.com/",
|
||||
gitlab = "https://gitlab.com/",
|
||||
aur = "https://aur.archlinux.org/",
|
||||
srht = "https://git.sr.ht/",
|
||||
codeberg = "https://codeberg.org/",
|
||||
me = "https://git.isabelroses.com/",
|
||||
aux = "https://git.auxolotl.org/",
|
||||
}
|
||||
|
||||
-- Check if repo URL uses a valid custom protocol
|
||||
local protocol, relative = repo_url:match("^(.-):(.+)$")
|
||||
if custom_protocols[protocol] and relative then
|
||||
repo_url = custom_protocols[protocol] .. relative
|
||||
return { { label = "View Repository", url = repo_url } }
|
||||
end
|
||||
|
||||
-- Check if repo URL uses a valid standard protocol
|
||||
local protocols = { "ftp", "git", "http", "https", "ssh" }
|
||||
protocol, relative = repo_url:match("^(.+)://(.+)$")
|
||||
if protocol and relative then
|
||||
if vim.tbl_contains(protocols, protocol) then
|
||||
return { { label = "View Repository", url = repo_url } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
end,
|
||||
})
|
||||
end
|
Loading…
Add table
Reference in a new issue