ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Mattermost Post

by rubberneck ST3

Posts selected text from Sublime Text to Mattermost

Details

Installs

  • Total 7
  • Win 3
  • OS X 0
  • Linux 4
Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0

Readme

Source
raw.​githubusercontent.​com

Sublime Mattermost Post

Posts selected text from Sublime Text 3 to Mattermost

Install

Use Package Control

Usage

Select some text (multi select works as well) then right click “Mattermost Post”, ctrl+shift+p “Mattermost Post” or setup a keybinding and use that.

Settings

All settings execpt for syntax_map are required.

You can use ctrl+shift+p then “Preferences: Mattermost Post”

Example

{
    "url": "mm.example.com",
    "team": "example",
    "channel": "mmpost",
    "pat": "",
    "post_fileinfo": true,
    "max_lines": 25,
    "syntax_map": {
        "Packages/C#/C#.sublime-syntax": "cs",
        "Packages/C++/C++.sublime-syntax": "cpp",
        "Packages/Objective-C/Objective-C.sublime-syntax": "objectivec",
    }
}

Settings - team

This is the team part of the url NOT the team name.

For example the team name “Example Team” would have a team url of “example-team”.

Settings - channel

This is the channel part of the url NOT the channel name.

For example the channel name “Town Square” would have a channel url of “town-square”.

Settings - pat

This is a Personal Access Token

Settings - post_fileinfo

This will send the relative_path+filename and the line numbers.

Filename: test-data/test.py
Linenumbers: 12 - 13

Settings - syntax_map

Since sublime returns a file for view.settings().get('syntax') the syntax is based on that file name.

self.view.settings().get('syntax').split("/")[-1].rsplit(".")[0].split(" ")[0].lower()

However this is not always correct for example. Packages/PackageDev/Package/Sublime Text Settings/Sublime Text Settings.sublime-syntax returns sublime since it is the first word of the filename part.

To create your own syntax_map

Get current sublime text syntax of view bring up the console “ctrl-”

view.settings().get('syntax')

Then use one of the “Supported languages” from the Mattermost Code Block for syntax highliting.

Keybindings

I don't set a default key binding.

You can use ctrl+shift+p then “Preferences: Key Bindings”

Example

[
    { "keys": [""], "command": "mattermost_post",
        "context": [
            { "key": "selection_empty", "operator": "equal", "operand": false }
        ],
    },
]