sublime-text-plugin

Can I create my own command in sublime and how to associate python implementation to that command?

那年仲夏 提交于 2019-12-13 00:38:18
问题 One more depth into my former question Why doesn’t this hotkey configuration for Sublime Text work?. Now I come to the implementation of sublime command, it is really a confusing way to hack what commands sublime has, as the exploration in former thread in order to find the command which is used to open a browser, finally I found it with help of @MattDMo. Then I find there is one file named open_in_browser.py in the Packages/Default folder, I guess the commands is just the file name of .py

Correct add site-packages folder to Sublime Text 3 sys.path

为君一笑 提交于 2019-12-12 17:08:48
问题 1. Summary I don't understand, how I can make, that global site-packages path will add to Sublime Text 3 sys.path in each Sublime Text 3 start. 2. Reason I want, that in Sublime Text plugins would be possible use globally installed packages. See more in Global Python packages in Sublime Text plugin development question. 3. Example Example part of my plugin: import os import sublime_plugin import sys from duckduckgo import query # noqa from pygoogling.googling import GoogleSearch # noqa # Any

How to edit built in command behavior

丶灬走出姿态 提交于 2019-12-12 09:58:00
问题 I want to edit find_under_expand ( ctrl+d ) to consider hyphenated words, as single words. So when I try to replace all instance of var a , it shouldn't match substrings of "a" in words like a-b , which it currently does. I'm assuming find_under_expand wraps your current selection in regex boundaries like this: \ba\b I need it to wrap in something like this: \b(?<!-)a(?!-)\b Is the find_under_expand command's source available to edit? Or do I have to rewrite the whole thing? I'm not sure

Sublime Text 3 edit color scheme values

徘徊边缘 提交于 2019-12-12 05:27:16
问题 I have the following javascript code in my Sublime Text 3 Editor: function get(db, segment_name, callback) { var query = { segment_name: segment_name }; } Image: I am using colorSchemeEditor to edit my theme's xml, since I want to change the color of the "segment_name" key in the query object above. I have some trouble changing this particular value, it does find a scope, (see answer here), but when I change the foreground color in the xml file, it does not change the color, I have changed

sublime 3 tabs and spaces do not match

徘徊边缘 提交于 2019-12-12 03:48:22
问题 I have browsed the web 3 times over but still no solution. I have a simple js file, and I want my tabs to be 4 spaces instead of 2. I changed the preferences settings to tab size to be 4, chaged syntax specific settings, everything, but still same issue. any ideas? 回答1: Click On the indentation information on the status bar, that's where it says either Tab Size: num or Spaces: num , and a context menu will be displayed. Assuming the starting position of a file using indentation with spaces

SublimeText: Run the exec with current file as arg (Tab context menu)

青春壹個敷衍的年華 提交于 2019-12-11 16:01:40
问题 I have created a tab context menu to decode some data. Now, I need to take current file(Tab context menu) as 1st argument to decode this file using exec . Currently I'm using hardcoded path. How can I pass the name of the current file instead? [ { "command": "exec", "args": {"cmd": "P:\\decoder.exe P:\\in.txt"}, "caption": "DecodeJ" }, ] 回答1: Generally speaking there's no way to execute a command and provide to it the name of the currently active file without using some sort of plugin code to

Sublime Text: how to correct SQL Server syntax

不打扰是莪最后的温柔 提交于 2019-12-11 10:56:42
问题 I am new to Sublime Text (version 3) and I am experiencing difficulties to get a proper SQL syntax highlighting. Whenever I am looking at SQL queries, ST considers "#" as comment. For example, here everything beyond # gets greyed out: INSERT INTO #TEST (A,B,C,D) VALUES ('a','b','c','d') I would like to correct this, so I looked around for answers for weeks but none of them works... I started by looking in C:\Program Files\Sublime Text 3\Packages to find the file SQL.sublime-package. I found

Detecting editor exit events in Sublime

 ̄綄美尐妖づ 提交于 2019-12-11 07:47:15
问题 Is there a way to detect editor exit event in Sublime 2? It is not listed in the API reference and I've tried using EventListener.on_close , but that works only for detecting view closing, which is not what I need. I just want to execute something before the editor exits, is that possible? 回答1: There is no way to do this in ST2. In ST3, you could try to capture the exit command by using sublime_plugin.EventListener.on_window_command(), or possibly on_text_command() (not sure what kind of

Sublime Text 3 Creating Plugin adding external python libraries

允我心安 提交于 2019-12-11 06:41:49
问题 So I'm trying to create a plugin and execute it with the context menu. In my plugin, I want to make use of the mechanical soup module. I have configured the Context.sublime-menu file as follows to create the Context menu option: [ { "id": "SlackSnippets", "caption": "SlackSnippets", "children": [ {"id": "wrap"}, { "command": "slacksnippet" } ] } ] Now, with this, the extreme basic functionality of the context menu works, it shows up when you right-click, and it's child command is clickable: .

Unknown CSS Tab Completion in Sublime Text

↘锁芯ラ 提交于 2019-12-11 04:58:21
问题 I've seen "Tuts+. PSD to WordPress – Minimal Portfolio Theme" and the author uses the tab completion "sep" and then presses tab and voila he gets multiple line comment separator for CSS something like: /****************************************************************************/ /* Name Here */ /****************************************************************************/ I want to know how can I achieve this in sublime text? Using what package? 回答1: The tab completion you saw was most