DEV Community

Cover image for I have updated edit-slack.vim
yamasita taisuke
yamasita taisuke

Posted on

I have updated edit-slack.vim

https://github.com/yaasita/edit-slack.vim

I have updated my slack plugin because it was not working.

What is this

This is a plugin to post to slack from vim.
You can send a message using only vim.
demo

This is a post from vim to slack via a binary written in golang
How it works
(c) gopher stickers

The display will invoke the command if the buffer name starts with "slack://".

autocmd BufReadCmd slack://* call edit_slack#Open(expand("<amatch>"))
Enter fullscreen mode Exit fullscreen mode

The post gets the part written below "=== Message ===" in vimscript.
vim passes it in the standard input of the command.

post data

Run the following script when you write

autocmd BufWriteCmd slack://* call edit_slack#Write(expand("<amatch>"))
Enter fullscreen mode Exit fullscreen mode

Call system() in the function

call system(command, postdata)
Enter fullscreen mode Exit fullscreen mode

Update details are as follows.

Upgrade golang

Updated golang version to 1.15.
I've also added the use of Module and slack-go.

Support for slack's new API

All channels can be opened with the following rules

# list
slack://ch

# channel
slack://ch/<channel name>
Enter fullscreen mode Exit fullscreen mode

Threaded support

# Threaded uri
slack://ch/<channel name>/<timestamp>
Enter fullscreen mode Exit fullscreen mode

Added the command :EditSlackOpenReplies to open threads.
open thread

You need to get the timestamp for each statement to open the thread. I used to show it in the message list, but it got too cluttered and hard to read, so I hid it with the conceal function.
If you set syntax on, it will be hidden.

syntax on

If you change [] to [x], you can also post to the channel.
However, there is a bug in slack that causes the name and icon to belong to the application.

broadcast

Joining and leaving the channel

:EditSlackJoin / :EditSlackLeave

join and leave

Uploading and downloading files

Added support for downloading and uploading files.

:EditSlackDownloadFile /path/to/savefile
:EditSlackUploadFile /path/to/uploadfile
Enter fullscreen mode Exit fullscreen mode

upload1
download1

Search command

Added a search function.

:EditSlackSearch search_word
Enter fullscreen mode Exit fullscreen mode

search

Other functions

It may support reaction functions in the future.

Top comments (0)