Skip to content

Instantly share code, notes, and snippets.

@mattst
mattst / OpenSelectedTextInNewBufferCommand.py
Created March 19, 2019 19:07
ST Plugin OpenSelectedTextInNewBufferCommand
# Command: open_selected_text_in_new_buffer
import sublime
import sublime_plugin
class OpenSelectedTextInNewBufferCommand(sublime_plugin.TextCommand):
"""
A Sublime Text plugin to create a new buffer, possibly in a new window,
which contains the selected text from the current buffer (if any). The
@mattst
mattst / MultipleSelectionClearerTopOrBottom.py
Last active August 11, 2019 04:03
An ST plugin to clear multiple selections to the top or bottom selection.
#
# Name: MultipleSelectionClearerTopOrBottom
# Requirements: Plugin for Sublime Text v2 and v3
# Written by: mattst - https://github.com/mattst
# ST Command: multiple_selection_clearer_top_or_bottom
# Arg: pos: "top" or "bottom"
# Context Key: multiple_selection_clearer_top_or_bottom_key
#
# This plugin has been designed to be used with specific keys, those being the
# same ones as the Move Tab In Group plugin. The context key ensures that this
@mattst
mattst / JavaC.sublime-build
Created April 26, 2020 09:29
JavaC.sublime-build alternatives
// ~/.config/sublime-text-3/Packages/Java/JavaC.sublime-build
// -----------------------------------------------------------------------------
// ST default JavaC.sublime-build:
{
"shell_cmd": "javac \"$file\"",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
@mattst
mattst / AlterIgnoredPackages.py
Last active May 11, 2020 14:45
Sublime Text plugin to add, remove, or toggle packages in the ignored_packages setting
#
# Save as AlterIgnoredPackages.py in your user packages directory.
# e.g. ~/.config/sublime-text-3/Packages/User/AlterIgnoredPackages.py
#
# Here are some key binding examples:
#
# {
# "keys": ["ctrl+k", "ctrl+z"],
# "command": "alter_ignored_packages",
# "args": {"add_list": ["PackageName1"],
@mattst
mattst / Bound Keys Example Output
Last active May 14, 2020 09:43
BoundKeys plugin example output heavily edited
________________________________________________________________________________________________________________________________
| User key bindings - /home/ms/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap |
________________________________________________________________________________________________________________________________
|ctrl+k, ctrl+q |exit | | |
|ctrl+shift+pageup |move_tab_in_group |direction: left | |
|ctrl+shift+pagedown |move_tab_in_group |direction: right | |
|ctrl+shift+v |paste_ahead | |Default |
|ctrl+7 |focus_group |group: 0 |Default
@mattst
mattst / Default (Windows).sublime-mousemap
Created April 30, 2020 11:20
The default "Default (Windows).sublime-mousemap" file from ST build 3211
[
// Basic drag select
{
"button": "button1", "count": 1,
"press_command": "drag_select"
},
{
"button": "button1", "count": 1, "modifiers": ["ctrl"],
"press_command": "drag_select",
"press_args": {"additive": true}
@mattst
mattst / DeleteToWhitespace.py
Last active March 30, 2021 17:16
A Sublime Text plugin to delete the text ahead or behind of the cursor breaking at whitespace characters
#
# Name: Delete To Whitespace
# Requires: Plugin for Sublime Text v3
# Author: mattst - https://github.com/mattst
# Command: delete_to_whitespace
# Args: forwards: bool (delete backwards if false)
# License: MIT License
# See Also: https://stackoverflow.com/a/66870369/2102457
#
@mattst
mattst / Git Commit Guidelines.md
Last active November 1, 2021 20:10
Git Commit Guidelines - From AngularJS
@mattst
mattst / SublimeTextSettingsExample.py
Last active October 3, 2022 18:37
Settings handing code template / example for Sublime Text plugins.
import sublime
import sublime_plugin
# The global scope ensures that the settings can
# be easily accessed from within all the classes.
global settings
def plugin_loaded():
"""
This module level function is called on ST startup when the API is ready.
@mattst
mattst / Test_CRF_Presets_For_Libx264_Encodes
Created November 9, 2018 17:18
Script to test encode speeds and file sizes for libx264 encodes with a range of CRF values and presets
#!/bin/bash
infile="TestClipTwoMin.mp4"
datafile="TestClipTwoMinData.csv"
crfs=("18" "19" "20" "21" "22" "23" "24" "25" "26" "27")
presets=("ultrafast" "superfast" "veryfast" "faster" "fast" "medium" "slow" "slower" "veryslow")
echo 'CRF,Preset,Time (Secs),Size (MB)' >> "$datafile"