#twitch #neovim #send-message #chat #cargo #plugin

app neovim-twitch-chat

一款用于向 Twitch 发送消息的 Neovim 插件

3 个稳定版本

1.0.3 2021年2月18日
1.0.0 2021年2月15日

#398 in Cargo 插件

MIT/ApacheLGPL-3.0

21KB
503

Neovim Twitch Chat

此插件允许您从 Neovim 内发送文本到 Twitch 聊天室!

先决条件

  • cargo

设置 Twitch 身份验证

您需要设置以下环境变量

  • NVIM_TWITCH_TOKEN 可以在 twitchapps.com/tmi 上生成。
  • NVIM_TWITCH_NAME 是您的 Twitch 名称
  • NVIM_TWITCH_CHANNEL 要加入的 Twitch 频道

安装二进制文件

cargo install --force neovim-twitch-chat

使用 plug 安装插件

" If you have cargo installed, you can use the install script
" to automatically update the binary
Plug 'hardliner66/neovim-twitch-chat', { 'do': ':!./install.sh' }

" If you manually installed the backend, you can just do
Plug 'hardliner66/neovim-twitch-chat'

默认绑定

vnoremap <silent> <C-s>v :<C-U>TwitchChatSendSelected<CR>
nnoremap <silent> <C-s>n :TwitchChatSendLine<CR>
nnoremap <silent> <C-s>k :TwitchChatScratch<CR>

设置

" scratch window height in percent
let g:twitch_scratch_height = 0.2

" if the scratch window shows on top or at the bottom
let g:twitch_scratch_top = 1

" if set to 1, automatically closes the scratch window on ESC
" and sends the whole buffer to twitch
"
" you can use <C-c> to enter normal mode even if twitch_scratch_autosend is set to 1
let g:twitch_scratch_autosend = 0

" list of usernames which get excluded for autocomplete
let g:twitch_chat_name_filter = ["username"]

开发设置

  1. 安装 Rustup: https://www.rustup.rs/

  2. 使用稳定的 Rust 编译器。

rustup install stable
rustup default stable

  1. 获取插件。
$ git clone https://github.com/hardliner66/neovim-twitch-chat
  1. 构建插件的二进制部分。
$ cd neovim-twitch-chat
$ cargo build --release
  1. 在 Neovim 的新实例中测试。
nvim -u ./init.vim --noplugin -c ":TwitchChatConnect"

TwitchChatConnect 命令在单独的进程中启动 Rust 插件并建立通道。

依赖关系

~5–15MB
~176K SLoC