Ⅰ. 插件描述
Post from vim directly to slackⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'prashantjois/vim-slack-may-fear-less'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'prashantjois/vim-slack-may-fear-less'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'prashantjois/vim-slack-may-fear-less'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/prashantjois/vim-slack
Ⅳ. 文档说明
# Vim Slack
Introduction
I want to share code without having to copy, switch to Slack, create a new snippet, possibly have to choose my language, paste, etc.
What am I, an animal? It shouldn't be this hard.
I want to share code (or text) with my teammates on slack without leaving vim!
Demo

Pre-reqs
You're going to need curl, most sane systems should have it already.
Installation
Pathogen (https://github.com/tpope/vim-pathogen)
git clone https://github.com/prashantjois/vim-slack ~/.vim/bundle/vim-slackVundle (https://github.com/gmarik/vundle)
Plugin 'prashantjois/vim-slack'Configuration
You need at least to specify your API token (get it here, or set up OAuth and generate it that way):
let g:slack_vim_token="xoxp-1234567890-283747610183-320837472577-5687c77204a63ef6496834749a3788ab"Slack can't search users by username, so if you want to post to users in your org by their handles, we have to assume it will be in the format of username@domain.tld.
let g:slack_email_domain="mydomain.com"Usage
Currently this plugin only works on line-wise visual selections (that is, no full file sharing or mid-column visual selections will work)
It will upload your text as a snippet to the desired destination (user or channel).
If not specified, the language of the snippet will be inferred from the file type.
That being said, grab a visual selection and ...
Post a message to one or more channels
To a single channel:
:'<,'>Slack -channels my-teamTo multiple channels (note: don't put spaces in your comma delimited list!)
:'<,'>Slack -channels my-team,some-other-teamPost directly to one or more users
To a specific user:
:'<,'>Slack -users prashantTo multiple users (note: don't put spaces in your comma delimited list!)
:'<,'>Slack -users prashant,johnsmithGive your snippet a title and comment
:'<,'>Slack -users prashant -title "Proof that P = NP" -comment "Can I get a second set of eyes on this?"Specify the language of your selection
:'<,'>Slack -users prashant -language python