GithubHelp home page GithubHelp logo

vyfor / cord.nvim Goto Github PK

View Code? Open in Web Editor NEW
68.0 1.0 4.0 5.38 MB

๐Ÿš€ Discord Rich Presence plugin for Neovim written in Rust

License: Apache License 2.0

Lua 27.72% Rust 72.00% Batchfile 0.13% Shell 0.15%
discord lua neovim plugin rich-presence rpc rust nvim

cord.nvim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

cord.nvim's Issues

View Repository fails when repository cloned with ssh config label

Description

If the git repository contains a submodule, the 'View Repository' button redirects to the submodule's url instead of the projects repository.

Operating system

Arch Linux

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478

Steps to reproduce

  1. Create empty git repo
  2. Add git submodule
  3. Edit file in git repo
  4. Press 'View Repository' and notice how it redirects to submodule's url

Expected behavior

Expected to redirect to the projects git repository

Actual behavior

No response

Minimal configuration

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

require('lazy').setup({
  {
    'vyfor/cord.nvim',
    build = './build',
    opts = {
        usercmds = true,
        log_level = nil,
        timer = {
          interval = 1500,
          reset_on_idle = false,
          reset_on_change = false,
        },
        editor = {
          image = nil,
          client = 'neovim',
          tooltip = 'The Superior Text Editor',
        },
        display = {
          show_time = true,
          show_repository = true,
          show_cursor_position = false,
          swap_fields = false,
          swap_icons = false,
          workspace_blacklist = {},
        },
        lsp = {
          show_problem_count = false,
          severity = 1,
          scope = 'workspace',
        },
        idle = {
          enable = true,
          show_status = true,
          timeout = 1800000,
          disable_on_focus = true,
          text = 'Idle',
          tooltip = '๐Ÿ’ค',
        },
        text = {
          viewing = 'Viewing {}',
          editing = 'Editing {}',
          file_browser = 'Browsing files in {}',
          plugin_manager = 'Managing plugins in {}',
          lsp_manager = 'Configuring LSP in {}',
          vcs = 'Committing changes in {}',
          workspace = 'In {}',
        },
        buttons = {
          {
            label = 'View Repository',
            url = 'git',
          },
        },
        assets = {},
    },
  },
}, {})

[Icon] LSP

Description

Filetypes: lspinfo, mason

View Repository redirects me to https://github.com/:user/repo

Description

The view repository button in the rpc redirects me to https://github.com/:user/repo instead of https://github.com/user/repo

Operating system

Arch BTW

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202

Steps to reproduce

start connecting

Expected behavior

No response

Actual behavior

No response

Minimal configuration

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

require('lazy').setup({
  {
    'vyfor/cord.nvim',
    build = './build',
    opts = {
      usercmds = true,
      timer = {
        enable = true,
        interval = 1500,
        reset_on_idle = false,
        reset_on_change = false,
      },
      editor = {
        image = nil,
        client = 'neovim',
        tooltip = 'The Superior Text Editor',
      },
      display = {
        show_time = true,
        show_repository = true,
        show_cursor_position = true,
        swap_fields = false,
        workspace_blacklist = {},
      },
      lsp = {
        show_problem_count = false,
        severity = 1,
        scope = 'workspace',
      },
      idle = {
        show_idle = true,
        timeout = 300000,
        disable_on_focus = true,
        text = 'Idle',
        tooltip = '๐Ÿ’ค',
      },
      text = {
        viewing = 'Viewing {}',
        editing = 'Editing {}',
        file_browser = 'Browsing files in {}',
        plugin_manager = 'Managing plugins in {}',
        workspace = 'In {}',
      },
      buttons = {
        {
          label = 'View repository',
          url = 'git',
        },
      },
    },
  },
}, {})

Add 'hide presence on idle'

Description

I would appreciate it if you could add an optional feature to hide the cord's discord presence when idle and show it again when unidle.

Additional information

No response

Lunarvim lazygit dont show the git Icon

Description

I use lazygit with lunarvim. I'm not sure how lunarvim handles lazygit, if through the plugin or something else, seems like it's calling the lazygit executable with toggleterm which is another plugin.

Screenshot from 2024-06-03 11-54-47

The expected behaviour is to have the same icon as git filetypes:
Screenshot from 2024-06-03 11-59-32

Additional information

No response

`workspace_blacklist` not working

Description

I want to mask my user directory when I edit a file in it, as the folder name is basically my full name.
I've tried blocking just the username or just the whole path. Neither worked.

Operating system

Windows 10 Pro 22H2 19041

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068

Steps to reproduce

  1. Put a directory name into your workspace_blacklist array.
  2. Open Neovim in that folder
  3. Check Discord

Expected behavior

The workspace name should be hidden.

Actual behavior

The workspace shows normally.

Minimal configuration

{
        "vyfor/cord.nvim",
        build = "./build",
        event = LazyFile,
        init = function()
            local username, homepath
            if vim.loop.os_uname().sysname == "Windows_NT" then
                username = os.getenv("USERNAME")
                homepath = os.getenv("USERPROFILE")
            else
                username = os.getenv("USER")
                homepath = os.getenv("HOME")
            end
            if username == nil then
                username = ""
            else
                username = tostring(username)
            end
            if homepath == nil then
                homepath = ""
            else
                homepath = tostring(homepath)
            end
            require("cord").setup({
                display = {
                    workspace_blacklist = {username, homepath},
                },
            })
        end,
    },

icon: maven

Description

filetype: xml
filename: pom.xml

feat: Support Git-related filetypes and plugins

Description

[File]
gitattributes, gitconfig, gitsendemail

[Git]
gitcommit, gitrebase
fugitive, fugitiveblame
magit
git.nvim
lazygit1
Neogit...2

These plugins have their own logos but will use the default Git icon due to the following reasons:

Footnotes

  1. No SVG / transparent variant found. โ†ฉ

  2. Does not match with the existing Git icon design. โ†ฉ

Add the shell icon to zshell files

Description

Currently, the zshell type files has no icons (default txt icon is displayed), for example, the .zshrc file, I tried to put it manually via the assets config like this:

  assets = {
    ['zsh'] = 'shell',
  },

But is not working as expected:
image

'zsh' is the type recognized by vim. Maybe I'm doing something wrong, but still, would be good to have it by default since zshell is widely used.

Manually fetch GitHub repository

The current approach uses the git command to retrieve the repository URL. Although git is relatively fast, from what I've tested, launching a shell to execute a command is often quite slow and leads to unexpected delays in Neovim. A more efficient approach would be to directly access Git's config file to obtain the URL. On that note, I believe it's better to move this logic to the Rust codebase.

Update README packer installation

Hello just want to point out that I think run='./build' is deprecated and raises a warning, the new method is build = './build'.

{
  'vyfor/cord.nvim',
  run = './build',
}

Btw, thank you so much for this plugin, is the best rich presence for neovim I've ever seen.

failed to run config when config `log_level` is nil

Description

image

Operating system

MacOS 14.3.1

Neovim version

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202

Steps to reproduce

  {
    "vyfor/cord.nvim",
    build = "./build",
    event = "VeryLazy",
    opts = {
      log_level = nil,
      ...
    }
  }

Expected behavior

Should have fallback log level when log_level is nil

Actual behavior

No response

Minimal configuration

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

require('lazy').setup({
  {
    'vyfor/cord.nvim',
    build = './build',
    opts = {
      usercmds = true,
      timer = {
        enable = true,
        interval = 1500,
        reset_on_idle = false,
        reset_on_change = false,
      },
      editor = {
        image = nil,
        client = 'neovim',
        tooltip = 'The Superior Text Editor',
      },
      display = {
        show_time = true,
        show_repository = true,
        show_cursor_position = true,
        swap_fields = false,
        workspace_blacklist = {},
      },
      lsp = {
        show_problem_count = false,
        severity = 1,
        scope = 'workspace',
      },
      idle = {
        show_idle = true,
        timeout = 300000,
        disable_on_focus = true,
        text = 'Idle',
        tooltip = '๐Ÿ’ค',
      },
      text = {
        viewing = 'Viewing {}',
        editing = 'Editing {}',
        file_browser = 'Browsing files in {}',
        plugin_manager = 'Managing plugins in {}',
        workspace = 'In {}',
      },
      buttons = {
        {
          label = 'View repository',
          url = 'git',
        },
      },
    },
  },
}, {})

Support for ssh git repos

Description

the current code only supports git repos with urls that start with "http" as you can see here
my proposal is to also add support for urls of ssh form, e.g. [email protected]:owner/repo, [email protected]:owner/repo and substitute them with a https url, https://github.com/owner/repo (and the same for gitlab).

(I'm not a Rust expert so I don't really know the best way to implement it)

Additional information

No response

Add missing language icons

  • AHK
  • Clojure
  • Crystal
  • D
  • Elixir
  • Erlang
  • F#
  • Git
  • GML
  • Gradle (Groovy & Kotlin)
  • Groovy
  • LaTeX
  • LICENSE (Text)
  • Lisp
  • Nim
  • Nix
  • OCaml
  • Pascal
  • PostCSS
  • R
  • Sass
  • Svelte
  • V
  • Vue
  • Zig

Build error (and was also erroring during runtime)

Description

  Failed (1)
    โ— cord.nvim 3.2ms โœ” build
        dir    /Users/ravibrock/.local/share/nvim/lazy/cord.nvim
        url    https://github.com/vyfor/cord.nvim
        branch master
        commit 188840a
        readme README.md
        event  ๎ช† VeryLazy 

      โœ” [task] clone 1649.81ms
        Cloning into '/Users/ravibrock/.local/share/nvim/lazy/cord.nvim'...
        remote: Enumerating objects: 409, done.        
        remote: Counting objects: 100% (75/75), done.        
        remote: Compressing objects: 100% (70/70), done.        
        remote: Total 409 (delta 6), reused 26 (delta 2), pack-reused 334        
        Receiving objects: 100% (409/409), 56.87 KiB | 1021.00 KiB/s, done.
        Resolving deltas: 100% (216/216), done.
      โœ” [task] checkout 0.19ms
      โœ” [task] docs 0ms
      โœ” [task] build 1128.6ms
        dyld[46514]: Symbol not found: __ZN4llvm10PGOOptionsC1ENSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES7_S7_S7_NS_18IntrusiveRefCntPtrINS_3vfs10FileSystemEEENS0_9PGOActionENS0_11CSPGOActionEbb
          Referenced from: <EEB49284-2EAD-3371-9401-139E8557678B> /opt/homebrew/Cellar/rust/1.77.2_1/lib/librustc_driver-3dc17bded25d4e59.dylib
          Expected in:     <B0C4597F-D1E6-36D5-83FD-81D0ACE34F6C> /opt/homebrew/Cellar/llvm/18.1.4/lib/libLLVM.dylib
        ./build: line 3: 46514 Abort trap: 6           rustc --crate-type=cdylib -C opt-level=3 -C panic=abort -C lto=fat -o cord src/lib.rs

I'm getting a build error here after trying to reinstall the plugin โ€“ before reinstalling it was throwing the "symbol not found" error when running Neovim. I don't know Rust, unfortunately, so I can't really speculate as to why this is happening. My configuration is below:

{
    "vyfor/cord.nvim",
    event = "VeryLazy",
    build = "./build",
    opts = {
        display = {
            show_repository = false,
            show_cursor_position = false,
        },
        text = {
            viewing = "Coding โœ๏ธ",
            editing = "Coding โœ๏ธ",
            file_browser = "Browsing files ๐Ÿ“‘",
            plugin_manager = "Managing plugins ๐Ÿ”Œ",
            workspace = "",
        },
    },
},

Operating system

MacOS Sonoma 14.4.1

Neovim version

NVIM v0.10.0-dev-2194+g3ab6f60dc-Homebrew
Build type: Release
LuaJIT 2.1.1713773202

Steps to reproduce

  1. Install cord.nvim with lazy.nvim
  2. Run build step

Expected behavior

Instalilng and building normally.

Actual behavior

See issue description.

Minimal configuration

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

require('lazy').setup({
  {
    'vyfor/cord.nvim',
    build = './build',
  },
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.