sublime-text-plugin

Sublime Text 3 API : Get all text from a file

倾然丶 夕夏残阳落幕 提交于 2019-11-30 08:52:52
I am trying to create a plugin for sublime text 3. For now I only get possible to select all text in a window and copy it in another window. Code : import sublime, sublime_plugin class PrintCodeCommand(sublime_plugin.WindowCommand): def run(self): # for each caracter, add it to a string with the substr method s = "" for x in range(0,self.window.active_view().size()): s += self.window.active_view().substr(x) newFile = self.window.new_file() newFile.run_command("test",{"textBuffer": s}) class Test(sublime_plugin.TextCommand): def run(self, edit, textBuffer): self.view.insert(edit, 0, textBuffer)

How can I change tab name in Sublime Text?

丶灬走出姿态 提交于 2019-11-30 03:50:03
问题 Is it possible to change tab names for files with strange names? They can not be renamed on disk but it is difficult to keep up with mad file names in Sublime :D 回答1: In the ST console, enter view.set_name("My changed name") , replacing the content of the string with the name you want. You can also create a plugin to do this, again using the view#set_name api method. 来源: https://stackoverflow.com/questions/23288789/how-can-i-change-tab-name-in-sublime-text

How to integrate Sublime Text with GitHub?

夙愿已清 提交于 2019-11-30 01:29:46
I thought it would be perfect if ST would have a plugin for syncing repo with the one on GitHub account, but I can't find such a thing. There is Github Tools and sublime-github but they don't provide commit or push commands. I can always use GitHub's app for syncing but plugin is more convenient, since it can be assigned to ST's hotkeys. There are numerous git plugins available via Package Control , so all you have to do is browse through them, read the READMEs, and decide if you want to try it out. I use SideBarGit (along with SideBarEnhancements ), which allows you to right-click on a file

Sublime Text 3 API : Get all text from a file

纵然是瞬间 提交于 2019-11-29 12:18:05
问题 I am trying to create a plugin for sublime text 3. For now I only get possible to select all text in a window and copy it in another window. Code : import sublime, sublime_plugin class PrintCodeCommand(sublime_plugin.WindowCommand): def run(self): # for each caracter, add it to a string with the substr method s = "" for x in range(0,self.window.active_view().size()): s += self.window.active_view().substr(x) newFile = self.window.new_file() newFile.run_command("test",{"textBuffer": s}) class

Use 'Chrome Native Messaging' from Sublime Text plugin

不问归期 提交于 2019-11-29 05:14:15
With 'Native Messaging' it should be possible to communicate between a chrome extension and a native app. https://developer.chrome.com/extensions/nativeMessaging Google even provides an example for how to do this with a python "host"-app: https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host I wanted to use this technique to communicate between a Sublime Text plugin (python) and an Chrome extension. Does anybody have experience with this or maybe know some open source ST plugin that I can look at?

Sublime Text autocomplete plugin for C++?

别说谁变了你拦得住时间么 提交于 2019-11-29 02:16:35
I'm trying to have the autocomplete feature on Sublime Text by using c++ libraries. I use very often EIGEN for example, but there is no autocomplete for functions inside this library. How can I somehow export the library to let sublime know about all the functions and methods I could use within this library? I would appreciate any helpful answer. I use the package EasyClangComplete to auto-complete C++ code. And it works fine. You can install this package using Package Control . It is easy to set it up, a working setting is as follows: { "common_flags" : [ // some example includes "-I/usr

delete U+200B zero-width space characters using sublime text 3

折月煮酒 提交于 2019-11-29 00:15:08
How can I make U+200B character or delete them in using sublime text 3. I found http://pastebin.com/ehWxNfMe but I am not sure how to use it The following will work in Sublime Text 2 and 3. However, due to some issues discussed later, it has the potential to block the program when editing large files, and/or on slow computers. A Sublime Text 3-specific version using an asynchronous method is at the bottom. Open a new file in Sublime, and set its syntax to Python. Paste the following into it: import sublime_plugin class ShowZeroWidthSpace(sublime_plugin.EventListener): def on_modified(self,

Eslint: How to disable “unexpected console statement” in Node.js?

你说的曾经没有我的故事 提交于 2019-11-28 14:55:34
问题 I'm using eslint with Sublime Text 3 and I am writing gulpfile.js . /*eslint-env node*/ var gulp = require('gulp'); gulp.task('default', function(){ console.log('default task'); }); But eslint keeps showing error : "Error: Unexpected console statement. (no-console)" I found official document here, but I still don't know how to disable it. /*eslint-env node*/ var gulp = require('gulp'); /*eslint no-console: 2*/ gulp.task('default', function(){ console.log('default task'); }); doesn't work,

How can I import a Python module in a Sublime Text plugin?

谁说我不能喝 提交于 2019-11-28 04:44:06
问题 I'm having trouble making a Sublime Text 3 plugin. I just installed wxPython with Python 2.7 on my Macintosh. In the terminal, my Mac can find wxPython ( import wx ). But the source code of a Sublime Text plugin cannot import wxPython. You can check out the screen capture below. How can I fix this problem? 回答1: Plugins are executed using Sublime's internal Python interpreter, not any version of Python installed on your computer. Nearly all of the standard library is included, but a few