🚀 Discord Rich Presence plugin for Neovim written in Rust

Overview

đŸ§© Cord

Stargazers Apache-2.0 License Forks

🚀 Cord is a Discord Rich Presence plugin designed for Neovim, written in Rust.

Cord Banner

💎 Features

  • Lightweight and dependency-free
  • Cross-platform support (Windows, Linux, macOS)
  • Blazingly fast startup due to non-blocking, asynchronous nature
  • Highly configurable in Lua
  • Offers more than 60 icons for languages and components
  • Automatically detects working directory and repository based on VCS
  • Identifies problems across active buffers
  • Supports configurable idle status detection
  • Provides user commands for managing the presence
  • Is written in native code and uses Lua FFI for integration

🔌 Requirements

📩 Installation

lazy.nvim
{
  'vyfor/cord.nvim',
  build = './build',
  event = 'VeryLazy'
}
pckr.nvim
{
  'vyfor/cord.nvim',
  run = './build'
}
other

Same steps apply to other plugin managers. Just make sure to add/run this build command:

./build

🔧 Configuration

Note: setup() has to be called to initialize the plugin.

require('cord').setup({
  usercmds = true,                              -- Enable user commands
  timer = {
    enable = true,                              -- Enable automatically updating presence
    interval = 1500,                            -- Interval between presence updates in milliseconds (min 500)
    reset_on_idle = false,                      -- Reset start timestamp on idle
    reset_on_change = false,                    -- Reset start timestamp on presence change
  },
  editor = {
    image = nil,                                -- Image ID or URL in case a custom client id is provided
    client = 'neovim',                          -- vim, neovim, lunarvim, nvchad, astronvim or your application's client id
    tooltip = 'The Superior Text Editor',       -- Text to display when hovering over the editor's image
  },
  display = {
    show_time = true,                           -- Display start timestamp
    show_repository = true,                     -- Display 'View repository' button linked to repository url, if any
    show_cursor_position = false,               -- Display line and column number of cursor's position
    swap_fields = false,                        -- If enabled, workspace is displayed first
    workspace_blacklist = {},                   -- List of workspace names to hide
  },
  lsp = {
    show_problem_count = false,                 -- Display number of diagnostics problems
    severity = 1,                               -- 1 = Error, 2 = Warning, 3 = Info, 4 = Hint
    scope = 'workspace',                        -- buffer or workspace
  },
  idle = {
    enable = true,                              -- Enable idle status
    show_status = true,                         -- Display idle status, disable to hide the rich presence on idle
    timeout = 1800000,                          -- Timeout in milliseconds after which the idle status is set, 0 to display immediately
    disable_on_focus = true,                    -- Do not display idle status when neovim is focused
    text = 'Idle',                              -- Text to display when idle
    tooltip = 'đŸ’€',                             -- Text to display when hovering over the idle image
  },
  text = {
    viewing = 'Viewing {}',                     -- Text to display when viewing a readonly file
    editing = 'Editing {}',                     -- Text to display when editing a file
    file_browser = 'Browsing files in {}',      -- Text to display when browsing files (Empty string to disable)
    plugin_manager = 'Managing plugins in {}',  -- Text to display when managing plugins (Empty string to disable)
    lsp_manager = 'Configuring LSP in {}',      -- Text to display when managing LSP servers (Empty string to disable)
    workspace = 'In {}',                        -- Text to display when in a workspace (Empty string to disable)
  },
  buttons = {
    {
      label = 'View Repository',                -- Text displayed on the button
      url = 'git',                              -- URL where the button leads to ('git' = Git repository URL)
    },
    -- {
    --   label = 'View Plugin',
    --   url = 'https://github.com/vyfor/cord.nvim',
    -- }
  },
  assets = {                                    -- Custom file icons
    -- lazy = {                                 -- Vim filetype or file name or file extension = table or string (see wiki)*
    --   name = 'Lazy',                         -- Optional override for the icon name, redundant for language types
    --   icon = 'https://example.com/lazy.png', -- Rich Presence asset name or URL
    --   tooltip = 'lazy.nvim',
    --   type = 2,                              -- 0 = language, 1 = file browser, 2 = plugin manager, 3 = lsp manager; defaults to language
    -- },
    -- ['Cargo.toml'] = 'crates',
  },
})

* Wiki: Add or change file icons

⌚ User commands

  • :CordConnect - Initialize presence client internally and connect to Discord
  • :CordReconnect - Reconnect to Discord
  • :CordDisconnect - Disconnect from Discord
  • :CordTogglePresence - Toggle presence
  • :CordShowPresence - Show presence
  • :CordHidePresence - Hide presence
  • :CordToggleIdle - Toggle idle status
  • :CordIdle - Show idle status
  • :CordUnidle - Hide idle status and reset the timeout

đŸŒ± Contributing

This project is in beta. Feel free to open an issue or pull request for missing icons or features. You can also contact me on Discord (vyfor) if you have any questions.

Comments
  • feat: use image from user client id when specified

    feat: use image from user client id when specified

    This PR allows user to fetch image from their custom Discord client's id instead of fetching only from this repo's asset folder.

    How has this been tested:

    Tested with my own client id

    require('cord').setup({
      editor = {
        image = "neovim",
        client = "914799712794705961",
      },
    })
    

    Presence showcase:

    Screenshot 2024-04-21 at 21 25 29 Screenshot 2024-04-21 at 21 26 00
    opened by cpea2506 6
  • Build error (and was also erroring during runtime)

    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',
      },
    })
    
    bug 
    opened by ravibrock 2
  • Add missing language icons

    Add missing language icons

    • [x] AHK
    • [x] Clojure
    • [x] Crystal
    • [x] D
    • [x] Elixir
    • [x] Erlang
    • [x] F#
    • [x] Git
    • [x] GML
    • [x] Gradle (Groovy & Kotlin)
    • [x] Groovy
    • [x] LaTeX
    • [x] LICENSE (Text)
    • [x] Lisp
    • [x] Nim
    • [x] Nix
    • [x] Pascal
    • [x] PostCSS
    • [x] R
    • [x] Sass
    • [x] Svelte
    • [x] V
    • [x] Vue
    • [x] Zig
    opened by vyfor 2
  • Add 'hide presence on idle'

    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

    enhancement 
    opened by sahilyeole 1
  • Support for ssh git repos

    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

    enhancement 
    opened by netfri25 1
  • feat!: Provide a configuration option to disable rich presence on idle

    feat!: Provide a configuration option to disable rich presence on idle

    Includes breaking changes to the configuration:

      idle = {
    -   show_idle = true,    -- Enable idle status
    +   enable = true,       -- Enable idle status
    +   show_status = true,  -- Display idle status, disable to hide the rich presence on idle
      },
    

    Closes #36

    enhancement 
    opened by vyfor 0
  • feat: Add support for custom icons

    feat: Add support for custom icons

    Supported assets:

    • [x] Languages
    • [x] File Browsers
    • [x] Plugin Managers
    • [x] Fallback file icon

    To do:

    • [x] Add documentation, perhaps, a wiki page to describe it in detail
    enhancement 
    opened by vyfor 0
  • Manually fetch GitHub repository

    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.

    enhancement priority: high 
    opened by vyfor 0
  • Add missing language icons

    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
    enhancement 
    opened by vyfor 0
Owner
vyfor
vyfor
Rich terminals. follows Python's rich conventions

richterm use richterm::print; use richterm::text; use richterm::track; use richterm::progress; use std::{thread, time}; fn main() { let vec = ve

Abdur-Rahmaan Janhangeer 14 Aug 5, 2023
Neovim plugin for moving lines up and down, written in Rust

Moveline.nvim Moveline is a simple plugin for moving lines up and down. It's written in Rust using my library nvim-utils. Installation Moveline can be

Will Hopkins 34 Mar 18, 2023
Envful is a CLI tool that verifies the presence of environment variables

Envful is a CLI tool that verifies the presence of environment variables. It looks inside your .env file and the host system. You can use it to run any process while ensuring all the variables are set.

Alex Vilchis 65 Sep 8, 2022
A CLI to easily switch between multiple Neovim configuration environments, written in Rust

Neovim Configuration Switcher Neovim Configuration Switcher (short nvims) is a CLI to easily switch between multiple Neovim configuration environments

Nhan Pham 3 Mar 30, 2024
A dark and light Neovim theme written in fennel, inspired by IBM Carbon.

oxocarbon.nvim Note: The old rust version can be found on the rust branch of this repository Oxocarbon is looking for ports! If you're a user of anoth

Nyoom Engineering 690 Jun 29, 2023
Fast, minimal, feature-rich, extended formatting syntax for Rust!

Formatting Tools Fast, minimal, feature-rich, extended formatting syntax for Rust! Features include: Arbitrary expressions inside the formatting brace

Casper 58 Dec 26, 2022
Estratto is a powerful and user-friendly Rust library designed for extracting rich audio features from digital audio signals.

estratto 〜 An Audio Feature Extraction Library estratto is a powerful and user-friendly Rust library designed for extracting rich audio features from

Amber J Blue 5 Aug 25, 2023
🔭 Search Dash.app from Neovim with Telescope. Built with Rust 🩀 and Lua

Dash.nvim Query Dash.app within Neovim with a Telescope picker! The theme used in the recording is lighthaus.nvim. Note: Dash is a Mac-only app, so yo

Mat Jones 193 Dec 28, 2022
Neovide - No Nonsense Neovim Client in Rust

Neovide This is a simple graphical user interface for Neovim (an aggressively refactored and updated Vim editor). Where possible there are some graphi

Neovide 9.3k Jan 5, 2023
đŸ–„ A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3

?? A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3

Christian Visintin 574 Jan 5, 2023
A lightweight but incredibly powerful and feature-rich BitTorrent tracker. Supports UDP + HTTP(S) and a private tracker mode.

Torrust Tracker Project Description Torrust Tracker is a lightweight but incredibly powerful and feature-rich BitTorrent tracker made using Rust. Feat

Torrust 162 Dec 31, 2022
Terminal based, feature rich, interactive SQL tool

datafusion-tui (dft) DataFusion-tui provides a feature rich terminal application, built with tui-rs, for using DataFusion (and eventually Ballista). I

null 49 Dec 24, 2022
An async autocompletion framework for Neovim

⚡ nvim-compleet This plugin is still in early development. ?? Table of Contents Installation Features Configuration Sources Commands Mappings Colors R

Riccardo Mazzarini 520 Dec 25, 2022
Xcode Neovim Replacement-ish.

An XCode replacement-ish development environment that aims to be your reliable XCode alternative to develop exciting new [apple] software products ??

null 272 Dec 30, 2022
Failed experiment in downloading random cat image, turning it into ascii and displaying it in Neovim.

cat.nvim Failed experiment in downloading random cat image, turning it into ascii and displaying it in Neovim. Failed as I realized far too late, that

James Vero 4 Aug 5, 2022
Neovim Configuration Manager (Swap/Backup/Try Configurations Easily)

ncm-rs Neovim Configuration Manager (Swap/Backup/Try Configurations Easily) I created this package because I wanted to try out Lazyvim (which is why i

instance.id 4 Mar 5, 2023
WIP. Goals: Treesitter highlighting, snippets, and a smooth intergration with neovim.

typst.nvim WIP. Goals: Tree-sitter highlighting, snippets, and a smooth integration with neovim. For the past week, I've been thinking what I want for

SeniorMars 66 Apr 9, 2023
this-week-in-neovim.org official webapp repository

This Week In Neovim This repository holds the source code of https://this-week-in-neovim.org. Architecture How does it run in production Automatic upd

Dimitri Sabadie 189 Jun 23, 2023
A discord bot to view & monitor OpenSea collections, written in Rust

Titan What is this This is a discord bot to monitor OpenSea collections and get info about them, including: Floor Price Activity Sales per Hour And mo

theldb 3 Oct 11, 2022