Skip to content

Commit

Permalink
set neovide_channel_id always (#2070)
Browse files Browse the repository at this point in the history
It resolves #2069
  • Loading branch information
mopp committed Oct 8, 2023
1 parent d61127f commit b40b4e2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/bridge/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const REGISTER_CLIPBOARD_PROVIDER_LUA: &str = r"
cache_enabled = 0
}";

pub async fn setup_neovide_remote_clipboard(nvim: &Neovim<NeovimWriter>, neovide_channel: u64) {
pub async fn setup_neovide_remote_clipboard(nvim: &Neovim<NeovimWriter>) {
// Users can opt-out with
// vim: `let g:neovide_no_custom_clipboard = v:true`
// lua: `vim.g.neovide_no_custom_clipboard = true`
Expand All @@ -45,9 +45,6 @@ pub async fn setup_neovide_remote_clipboard(nvim: &Neovim<NeovimWriter>, neovide
return;
}

nvim.set_var("neovide_channel_id", Value::from(neovide_channel))
.await
.ok();
nvim.execute_lua(REGISTER_CLIPBOARD_PROVIDER_LUA, vec![])
.await
.ok();
Expand Down Expand Up @@ -104,6 +101,10 @@ pub async fn setup_neovide_specific_state(
neovide_channel
);

nvim.set_var("neovide_channel_id", Value::from(neovide_channel))
.await
.ok();

// Create a command for registering right click context hooking.
#[cfg(windows)]
nvim.command(&build_neovide_command(
Expand Down Expand Up @@ -138,7 +139,7 @@ pub async fn setup_neovide_specific_state(
.ok();

if should_handle_clipboard {
setup_neovide_remote_clipboard(nvim, neovide_channel).await;
setup_neovide_remote_clipboard(nvim).await;
}
} else {
warn!("Neovide could not find the correct channel id. Some functionality may be disabled.");
Expand Down

0 comments on commit b40b4e2

Please sign in to comment.