Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lazy.nvim plugin setup? #116

Open
Lamby777 opened this issue Jun 27, 2023 · 18 comments
Open

lazy.nvim plugin setup? #116

Lamby777 opened this issue Jun 27, 2023 · 18 comments
Labels
enhancement New feature or request

Comments

@Lamby777
Copy link

Is your feature request related to a problem? Please describe.
Readme only lists Packer and vim-plug

Describe the solution you'd like
Not sure if this is kinda a dumb request or how easy it would be to make this into a lazy.nvim plugin, cuz I'm kinda new to it, but it would be nice if there was a way to install it through that.

@Lamby777 Lamby777 added the enhancement New feature or request label Jun 27, 2023
@badumbatish
Copy link

Hey Lamby, an easy way to do this is just add "andweeb/presence.nvim" following the installation direction in https://github.com/folke/lazy.nvim#-installation

Another long way (more sustainable) is create a directory called lua, then under lua, create a directory called plugins, then in your init.lua, you can type in require("lazy").setup("plugins")

Then in lua/plugins/ create a presence_nvim.lua and add return { 'andweeb/presence.nvim' }

My init.lua regarding lazy.nvim

Screenshot 2023-06-27 at 7 11 02 PM

My presence_nvim.lua

Screenshot 2023-06-27 at 7 11 50 PM

My tree folder structure
Screenshot 2023-06-27 at 7 12 15 PM

@Lamby777
Copy link
Author

Lamby777 commented Jun 28, 2023

Thanks. I'm using NvChad, so I put the config in lua/core/custom/plugins.lua

  {
    "andweeb/presence.nvim",
    lazy = false,
  },

and it seems to be loading (has the Start icon next to it when you pull up :Lazy, listed under "Loaded") but the presence doesn't seem to show up on my account...

@MiraiMindz
Copy link

Well, me and you are facing the same problem with presence.nvim and NvChad. Yesterday this plugin was working normally, but today It stoped for no reason.

here is how I added it to my custom.plugins:

{
    "andweeb/presence.nvim",
    event = "VeryLazy",
    config = function()
      require("presence").setup(overrides.presence)
    end
},

and here is my overrides.presence table:

M.presence = {
  auto_update         = true,
  neovim_image_text   = "How do I exit it?",
  main_image          = "file",
  log_level           = "debug",
  debounce_timeout    = 10,
  enable_line_number  = false,
  buttons             = true,
  show_time           = true,
  -- Rich Presence text options
  editing_text        = "Editing %s",
  file_explorer_text  = "Browsing %s",
  git_commit_text     = "Committing changes",
  plugin_manager_text = "Managing plugins",
  reading_text        = "Reading %s",
  workspace_text      = "Working on %s",
  line_number_text    = "Line %s out of %s"
}

and here is a full stack-trace and my system specs:

System Specs:

  • OS: Arch Linux
  • Kernel Version: 6.3.9-arch1-1
  • NeoVim Version: v0.10.0-dev-585+g2e055e49a
  • NeoVim Build type: Nightly

Stack-Trace:

[presence.nvim] Setting up plugin for linux                                                                                                   
[presence.nvim] Duplicate options: `g:presence_auto_update` and setup option `auto_update`
[presence.nvim] Using runtime path: /run/user/1000
[presence.nvim] Using Discord IPC socket path: /run/user/1000/discord-ipc-0
[presence.nvim] Checking Discord IPC socket at /run/user/1000/discord-ipc-0...
[presence.nvim] Using id <ID>
[presence.nvim] Completed plugin setup
[presence.nvim] Getting nvim socket paths...
[presence.nvim] Executing command: `ss -lx|grep "nvim.*/0"`
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Handling TextChanged event...
[presence.nvim] Connecting to Discord...
[presence.nvim] Connected to Discord
[presence.nvim] Authorizing with Discord...
[presence.nvim] Wrote message to pipe
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Failed to decode payload: '{^A
[presence.nvim] Parsed filename nil with no extension
[presence.nvim] No status text for the given buffer, skipping...
[presence.nvim] Handling WinLeave event...
[presence.nvim] Handling WinEnter event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Authorizing with Discord...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Currently authorizing with Discord, scheduling callback for later...
[presence.nvim] Not canceling presence due to switching to a window within the same instance...
[presence.nvim] Currently authorizing with Discord, scheduling callback for later...
[presence.nvim] Wrote message to pipe
[presence.nvim] Parsed filename NvimTree_1 with no extension
[presence.nvim] Getting project name for /home/mirai/.dotfiles...
[presence.nvim] Pipe was closed
[presence.nvim] Setting activity for /home/mirai/.dotfiles/NvimTree_1...
[presence.nvim] Adding button with repository URL: https://github.com/MiraiMindz/.dotfiles.git
[presence.nvim] Attaching buttons to activity: { {^@    label = "View Repository",^@    url = "https://github.com/MiraiMindz/.dotfiles.git"^@  } }
[presence.nvim] Detected project: .dotfiles
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/NvimTree_1, skipping...
[presence.nvim] Already authorized with Discord
[presence.nvim] Failed to set activity in Discord: Pipe write error - EPIPE
[presence.nvim] Pipe was closed
[presence.nvim] Activity already set for /home/mirai/.dotfiles/NvimTree_1, skipping...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Last activity sent was within 10 seconds ago, skipping...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Last activity sent was within 10 seconds ago, skipping...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Last activity sent was within 10 seconds ago, skipping...
[presence.nvim] Handling WinLeave event...
[presence.nvim] Handling WinEnter event...
[presence.nvim] Handling BufAdd event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Not canceling presence due to switching to a window within the same instance...
[presence.nvim] Parsed filename plugins.lua with lua extension
[presence.nvim] Getting project name for /home/mirai/.dotfiles/apps/editors/neovim...
[presence.nvim] Setting activity for /home/mirai/.dotfiles/apps/editors/neovim/plugins.lua...
[presence.nvim] Using file asset: { "Lua", "lua" }
[presence.nvim] Adding button with repository URL: https://github.com/MiraiMindz/.dotfiles.git
[presence.nvim] Attaching buttons to activity: { {^@    label = "View Repository",^@    url = "https://github.com/MiraiMindz/.dotfiles.git"^@  } }
[presence.nvim] Detected project: .dotfiles
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/plugins.lua, skipping...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/plugins.lua, skipping...
[presence.nvim] Failed to set activity in Discord: Pipe write error - EPIPE
[presence.nvim] Pipe was closed

I think this Failed to decode payload: '{^A is the origin of the problem, but I'm not sure.

Any help would be appreciated.

@Lamby777
Copy link
Author

Well, me and you are facing the same problem with presence.nvim and NvChad. Yesterday this plugin was working normally, but today It stoped for no reason.

How did you get that stack trace?

@MiraiMindz
Copy link

you'll need to set the log_level config variable of presence.nvim to "debug", them, relauch NeoVim, open a file and check it with :messages

@Lamby777
Copy link
Author

Lamby777 commented Jun 28, 2023

you'll need to set the log_level config variable of presence.nvim to "debug", them, relauch NeoVim, open a file and check it with :messages

Thanks. Mine seems to be a different (probably simpler) error...
Screenshot_20230628_092248

The discord-ipc-0 symlink points to /run/user/1000/app/com.discordapp.Discord/discord-ipc-0, but there is no com.discordapp.Discord folder in app. Installed Discord via pacman (or maybe yay, but I don't think so) btw. Is it just my install being set up incorrectly?

Edit: I tried to locate any file called discord-ipc-0 and none were found...?

@Lamby777
Copy link
Author

Well, me and you are facing the same problem with presence.nvim and NvChad. Yesterday this plugin was working normally, but today It stoped for no reason.

here is how I added it to my custom.plugins:

{
    "andweeb/presence.nvim",
    event = "VeryLazy",
    config = function()
      require("presence").setup(overrides.presence)
    end
},

and here is my overrides.presence table:

M.presence = {
  auto_update         = true,
  neovim_image_text   = "How do I exit it?",
  main_image          = "file",
  log_level           = "debug",
  debounce_timeout    = 10,
  enable_line_number  = false,
  buttons             = true,
  show_time           = true,
  -- Rich Presence text options
  editing_text        = "Editing %s",
  file_explorer_text  = "Browsing %s",
  git_commit_text     = "Committing changes",
  plugin_manager_text = "Managing plugins",
  reading_text        = "Reading %s",
  workspace_text      = "Working on %s",
  line_number_text    = "Line %s out of %s"
}

and here is a full stack-trace and my system specs:

System Specs:

  • OS: Arch Linux
  • Kernel Version: 6.3.9-arch1-1
  • NeoVim Version: v0.10.0-dev-585+g2e055e49a
  • NeoVim Build type: Nightly

Stack-Trace:

[presence.nvim] Setting up plugin for linux                                                                                                   
[presence.nvim] Duplicate options: `g:presence_auto_update` and setup option `auto_update`
[presence.nvim] Using runtime path: /run/user/1000
[presence.nvim] Using Discord IPC socket path: /run/user/1000/discord-ipc-0
[presence.nvim] Checking Discord IPC socket at /run/user/1000/discord-ipc-0...
[presence.nvim] Using id <ID>
[presence.nvim] Completed plugin setup
[presence.nvim] Getting nvim socket paths...
[presence.nvim] Executing command: `ss -lx|grep "nvim.*/0"`
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Handling TextChanged event...
[presence.nvim] Connecting to Discord...
[presence.nvim] Connected to Discord
[presence.nvim] Authorizing with Discord...
[presence.nvim] Wrote message to pipe
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Failed to decode payload: '{^A
[presence.nvim] Parsed filename nil with no extension
[presence.nvim] No status text for the given buffer, skipping...
[presence.nvim] Handling WinLeave event...
[presence.nvim] Handling WinEnter event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Authorizing with Discord...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Currently authorizing with Discord, scheduling callback for later...
[presence.nvim] Not canceling presence due to switching to a window within the same instance...
[presence.nvim] Currently authorizing with Discord, scheduling callback for later...
[presence.nvim] Wrote message to pipe
[presence.nvim] Parsed filename NvimTree_1 with no extension
[presence.nvim] Getting project name for /home/mirai/.dotfiles...
[presence.nvim] Pipe was closed
[presence.nvim] Setting activity for /home/mirai/.dotfiles/NvimTree_1...
[presence.nvim] Adding button with repository URL: https://github.com/MiraiMindz/.dotfiles.git
[presence.nvim] Attaching buttons to activity: { {^@    label = "View Repository",^@    url = "https://github.com/MiraiMindz/.dotfiles.git"^@  } }
[presence.nvim] Detected project: .dotfiles
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/NvimTree_1, skipping...
[presence.nvim] Already authorized with Discord
[presence.nvim] Failed to set activity in Discord: Pipe write error - EPIPE
[presence.nvim] Pipe was closed
[presence.nvim] Activity already set for /home/mirai/.dotfiles/NvimTree_1, skipping...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Last activity sent was within 10 seconds ago, skipping...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Last activity sent was within 10 seconds ago, skipping...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Last activity sent was within 10 seconds ago, skipping...
[presence.nvim] Handling WinLeave event...
[presence.nvim] Handling WinEnter event...
[presence.nvim] Handling BufAdd event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Not canceling presence due to switching to a window within the same instance...
[presence.nvim] Parsed filename plugins.lua with lua extension
[presence.nvim] Getting project name for /home/mirai/.dotfiles/apps/editors/neovim...
[presence.nvim] Setting activity for /home/mirai/.dotfiles/apps/editors/neovim/plugins.lua...
[presence.nvim] Using file asset: { "Lua", "lua" }
[presence.nvim] Adding button with repository URL: https://github.com/MiraiMindz/.dotfiles.git
[presence.nvim] Attaching buttons to activity: { {^@    label = "View Repository",^@    url = "https://github.com/MiraiMindz/.dotfiles.git"^@  } }
[presence.nvim] Detected project: .dotfiles
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/plugins.lua, skipping...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/plugins.lua, skipping...
[presence.nvim] Failed to set activity in Discord: Pipe write error - EPIPE
[presence.nvim] Pipe was closed

I think this Failed to decode payload: '{^A is the origin of the problem, but I'm not sure.

Any help would be appreciated.

WAIT WHAT
image

@MiraiMindz
Copy link

Sometimes it works but sometimes it doesn't, maybe it's a problem with NvChad itself, can you please provide our new configuration? if you made any changes.

@Lamby777
Copy link
Author

Lamby777 commented Jul 2, 2023

Sometimes it works but sometimes it doesn't, maybe it's a problem with NvChad itself, can you please provide our new configuration? if you made any changes.

Oh, I forgot to write it here, but I changed nothing in my configs... 😭

The one thing that POSSIBLY may have fixed it was running yay by accident and it started doing updates (wasn't installed from the AUR btw, but yay still updates all packages I think), but I cancelled that in like 4 seconds so I'm not sure if that was it... Plus, I only set up this laptop recently (about 1-2 months ago) so it already had a decently up-to-date version of Discord.

@AaronHo-0716
Copy link

@MiraiMindz I had the same issue, I was using the flathub version until i noticed that flathub requires some magic to do because of the unique sandbox environment, so I just uninstalled the flathub version and instead installed discord from the RPM repo with sudo dnf install discord , and it worked. Hope this helps.

@MiraiMindz
Copy link

I think it might be this, I've done a full NvChad reinstall and couldn't get it to work, I can't test rn, but probably a reinstall on Discord might work. I'm using the package from the Arch Extra repo: discord

@MiraiMindz
Copy link

Ok, I've ditched NvChad and started working on my own NeoVim Config, and the problem seems to persist, here is the Stack-Trace:

[presence.nvim] Completed plugin setup
[presence.nvim] Getting nvim socket paths...
[presence.nvim] Executing command: `ss -lx|grep "nvim.*/0"`
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Checked Discord IPC socket, looks good!
[presence.nvim] Handling BufEnter event...
[presence.nvim] Connecting to Discord...
[presence.nvim] Connected to Discord
[presence.nvim] Authorizing with Discord...
[presence.nvim] Wrote message to pipe
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Got nvim socket paths: {}
[presence.nvim] No other remote nvim instances
[presence.nvim] Handling FocusGained event...
[presence.nvim] Skipping presence update for FocusGained event triggered by tmux...
[presence.nvim] Failed to decode payload: '{^A
[presence.nvim] Parsed filename nil with no extension
[presence.nvim] No status text for the given buffer, skipping...
[presence.nvim] Handling WinLeave event...
[presence.nvim] Handling WinEnter event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Authorizing with Discord...
[presence.nvim] Handling TextChanged event...
[presence.nvim] Currently authorizing with Discord, scheduling callback for later...
[presence.nvim] Not canceling presence due to switching to a window within the same instance...
[presence.nvim] Currently authorizing with Discord, scheduling callback for later...
[presence.nvim] Wrote message to pipe
[presence.nvim] Parsed filename nil with no extension
[presence.nvim] Getting project name for nil...
[presence.nvim] Setting activity for unnamed buffer...
[presence.nvim] No project detected
[presence.nvim] Sync activity to all peers...
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Activity already set for , skipping...
[presence.nvim] Already authorized with Discord
[presence.nvim] Failed to set activity in Discord: Pipe write error - EPIPE
[presence.nvim] Pipe was closed
[presence.nvim] Activity already set for , skipping...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Activity already set for , skipping...
[presence.nvim] Handling WinLeave event...
[presence.nvim] Handling WinEnter event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Handling BufAdd event...
[presence.nvim] Handling BufEnter event...
[presence.nvim] Not canceling presence due to switching to a window within the same instance...
[presence.nvim] Parsed filename plugins.lua with lua extension
[presence.nvim] Getting project name for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig...
[presence.nvim] Setting activity for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig/plugins.lua...
[presence.nvim] Using file asset: { "Lua", "lua" }
[presence.nvim] Adding button with repository URL: https://github.com/MiraiMindz/.dotfiles.git
[presence.nvim] Attaching buttons to activity: { {^@    label = "View Repository",^@    url = "https://github.com/MiraiMindz/.dotfiles.git"^@  } }
[presence.nvim] Detected project: .dotfiles
[presence.nvim] Sync activity to all peers...
[presence.nvim] Setting Discord activity...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig/plugins.lua, skipping...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig/plugins.lua, skipping...
[presence.nvim] Failed to set activity in Discord: Pipe write error - EPIPE
[presence.nvim] Pipe was closed
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig/plugins.lua, skipping...
[presence.nvim] Handling FocusGained event...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig/plugins.lua, skipping...
[presence.nvim] Handling FocusGained event...
[presence.nvim] Activity already set for /home/mirai/.dotfiles/apps/editors/neovim/CustomConfig/plugins.lua, skipping...
[presence.nvim] Handling FocusGained event...

The three main errors I see are: Failed to decode payload: '{^A, Pipe was closed and Failed to set activity in Discord: Pipe write error - EPIPE, how could we potentially solve this?

@AaronHo-0716
Copy link

@MiraiMindz for some reason i had to reinstall NvChad, and I basically just did the same thing @Lamby777 mentioned above, and it just works. Mind checking if the discord package you are using is up to date?

@MiraiMindz
Copy link

This is my current version: Stable 218604 (958c14c) Host 0.0.28 Linux 64-Bit (6.4.7-Arch1-1) (It's literraly this package: discord)
I don't use NvChad anymore, decided to roll my own config.
ngl, don't really need this plugin to actually work, so I've just moved own.

@jiriks74
Copy link

jiriks74 commented Sep 29, 2023

@AaronHo-0716

flathub requires some magic to do because of the unique sandbox environment,
I fixed that in my fork - there should be no magic needed anymore for Flatpak Discord to work

IDK what was it with NvChad (I never used it) but Lazy.nvim works just fine with event = UIEnter instead of lazy = false.

This looks like Discord didn't create the socket or did so at a wrong location. Updating (or restarting Discord) could be what helped.

@t101804
Copy link

t101804 commented Dec 31, 2023

Thanks. I'm using NvChad, so I put the config in lua/core/custom/plugins.lua

  {
    "andweeb/presence.nvim",
    lazy = false,
  },

and it seems to be loading (has the Start icon next to it when you pull up :Lazy, listed under "Loaded") but the presence doesn't seem to show up on my account...

How do u loaded the presence.nvim in mine is Not Loaded

@jiriks74
Copy link

jiriks74 commented Jan 9, 2024

Thanks. I'm using NvChad, so I put the config in lua/core/custom/plugins.lua

  {
    "andweeb/presence.nvim",
    lazy = false,
  },

and it seems to be loading (has the Start icon next to it when you pull up :Lazy, listed under "Loaded") but the presence doesn't seem to show up on my account...

How do u loaded the presence.nvim in mine is Not Loaded

From the README on my fork you can get a basic config that works:

{
  "jiriks74/presence.nvim",
  event = "UIEnter",
},

But yours should be working too

@EsamLasheen
Copy link

how to make it work on NVchad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants