Skip to content

Instantly share code, notes, and snippets.

View OdatNurd's full-sized avatar

Terence Martin OdatNurd

View GitHub Profile
@OdatNurd
OdatNurd / Mariana.sublime-color-scheme
Last active September 14, 2023 20:58
OdatNurd's customizations on the Mariana color scheme
{
"globals":
{
"background": "color(var(blue3) l(- 3%))",
"line_diff_added": "var(green)",
"line_diff_modified": "var(blue)",
"line_diff_deleted": "var(red)",
"line_diff_width": "5",
"brackets_options": "glow",
"bracket_contents_options": "glow",
@OdatNurd
OdatNurd / always_rainbows.py
Created October 5, 2021 04:41
Cause the RainbowBrackets package to always enable itself for all files
import sublime
import sublime_plugin
# This requires that the RainbowBrackets package be installed:
# https://packagecontrol.io/packages/RainbowBrackets
class RainbowEventListener(sublime_plugin.EventListener):
# Triggers whenever a new file is finished loading
def on_load_async(self, view):
view.window().run_command( "rainbow_brackets", { "action": "make rainbow" })
@OdatNurd
OdatNurd / BuildExample.sublime-build
Created August 26, 2021 04:50 — forked from VICTORVICKIE/BuildExample.sublime-build
Sublime Per Tab Panel Execution
{
"target":"special_build",
"cancel": "special_cancel_build",
// "shell_cmd":"gcc \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\"",
// selector: "source.c"
"selector": "source.python",
}
[
// Toggle the most recently accessed terminus panel open and closed; will
// create a new default panel if there is none currently.
{
"keys": ["alt+`"],
"command": "toggle_terminus_panel"
},
// You can have multiple bindings to toggle multiple panels, but you must
// specify a panel_name for all of them.
@OdatNurd
OdatNurd / highlight_large_files.py
Created July 5, 2021 05:38
Enable syntax highlighting on large files in Sublime Text 4
import sublime
import sublime_plugin
class LargeFileLoadListener(sublime_plugin.EventListener):
def on_load(self, view):
if len(view) >= 4194304 and 'Plain text' in view.settings().get('syntax'):
first_line = view.substr(view.line(0))
syntax = sublime.find_syntax_for_file(view.file_name(), first_line)
view.assign_syntax(syntax.path)
@OdatNurd
OdatNurd / YourThemeNameHere.sublime-theme
Created June 21, 2021 18:36
Augment your Sublime Text theme to
{
"rules": [
// Make the tab image for unselected unhovered tabs have the same
// opacity as they do on hover.
{
"class": "tab_control",
"attributes": ["!selected", "!hover"],
"layer1.opacity": 0.7,
},
]
@OdatNurd
OdatNurd / tab_color.py
Created June 21, 2021 18:21
A simple plugin for changing Sublime Text file tab colors based on the filename and paths of files
import sublime
import sublime_plugin
import re
def plugin_loaded():
"""
When the plugin loads, set up to monitor the user preferences changing so
that we can change tab colors on settings change.
@OdatNurd
OdatNurd / close_other_files.py
Created June 16, 2021 04:50
A simple Sublime Text plugin that allows you to close all files except the one currently being edited.
import sublime
import sublime_plugin
# Sample key binding:
#
# { "keys": ["ctrl+alt+shift+w"], "command": "close_others_shim" },
#
class CloseOtherTabsCommand(sublime_plugin.WindowCommand):
"""
@OdatNurd
OdatNurd / Sample.sublime-build
Created May 26, 2021 04:51
Sample Sublime plugin for adding custom variables
{
"target": "my_custom_build",
"cancel": {"kill": true},
"shell_cmd": "echo \\${docs}"
}
@OdatNurd
OdatNurd / region_sample.py
Created May 19, 2021 05:55
Sample of using regions in Sublime Text plugins
import sublime
import sublime_plugin
_types = {
"IDII": 7,
"SEDOL": 7,
"DATE": 7,
"TYPE": 1
}