Skip to content

Instantly share code, notes, and snippets.

View UltraInstinct05's full-sized avatar
:octocat:
Going even further beyond !

Ashwin Shenoy UltraInstinct05

:octocat:
Going even further beyond !
View GitHub Profile
@UltraInstinct05
UltraInstinct05 / Default (Windows).sublime-mousemap
Last active July 5, 2022 08:53
Running tests using mouse bindings.
[
{ "button": "button3", "command": "execute_test_under_cursor" },
]
import sublime
import sublime_plugin
class SelectDictionaryCommand(sublime_plugin.WindowCommand):
def run(self):
available_dictionaries = [x for x in sublime.find_resources("*") if x.endswith("dic")]
current_dictionaries = self.window.active_view().settings().get("dictionary")
items = [
@UltraInstinct05
UltraInstinct05 / Side Bar.sublime-menu
Created October 19, 2021 12:25
To open any folder in a new window.
[
{
"caption": "Open in New Window",
"command": "open_folder_in_new_window",
"args": {
"paths": []
},
},
]
@UltraInstinct05
UltraInstinct05 / Cottle.sublime-syntax
Last active April 11, 2021 13:21
A syntax for Cottle.
%YAML 1.2
---
file_extensions:
- cottle
scope: source.cottle
contexts:
main:
- include: cottle_code_block
- include: expressions
@UltraInstinct05
UltraInstinct05 / Context.sublime-menu
Last active January 16, 2021 07:49
A ST plugin that colorizes selected code blocks.
[
{
"caption": "Code Block Colorer",
"children": [
{ "caption": "Redish", "command": "code_block_colorer", "args": { "color": "region.redish" }, },
{ "caption": "Pinkish", "command": "code_block_colorer", "args": { "color": "region.pinkish" }, },
{ "caption": "Orangish", "command": "code_block_colorer", "args": { "color": "region.orangish" }, },
{ "caption": "Yellowish", "command": "code_block_colorer", "args": { "color": "region.yellowish" }, },
{ "caption": "Greenish", "command": "code_block_colorer", "args": { "color": "region.greenish" }, },
{ "caption": "Cyanish", "command": "code_block_colorer", "args": { "color": "region.cyanish" }, },
@UltraInstinct05
UltraInstinct05 / mousemap.md
Last active April 19, 2023 16:57
All you need to know about Sublime mousemap files.

In case of Sublime Text, the mouse actions are configured by what are known as mousemap files (that have a file extension of .sublime-mousemap). You can have generally 2 variants of these files :-

  • Default.sublime-mousemap: This will define mouse actions for any platform.
  • Default ($platform).sublime-mousemap: This will define mouse actions for a specific platform, where $platform is any one of Windows, Linux or OSX depending on your operating system.

You can view the default shipped mousemap files by using View Package File from the command palette and searching for mousemap.

In order to define your own mouse actions (or override any existing actions), you have to create a file by the name of Default.sublime-mousemap in the User directory (to get to this directory, select Preferences -> Browse Packages ... from the main menu) for platform independent override (or Default ($platform).sublime-mousemap for platform dependent overrides depending on your OS).

Once that's done, here i

import os
import sublime
import sublime_plugin
def get_npm_scripts(chosen_directory):
""" Gets the list of npm scripts defined in the package.json
Args:
chosen_directory (str) : The absolute path of the chosen directory.