sublime外掛程式開發教程4

2022-03-04 06:48:37 字數 653 閱讀 3336

寫幾個簡單的例子詳解下

import sublime

import sublime_plugin

class

examplecommand(sublime_plugin.textcommand):

def run(self, edit):

sels =self.view.sel();

for sel in

sels:

print(sel);

然後選中文字 輸出看到如下

從第8個字元到第3個字元  為什麼不是(3,8)呢 因為我是從後面往前面選的

import sublime

import sublime_plugin

class

examplecommand(sublime_plugin.textcommand):

def run(self, edit):

sels =self.view.sel();

for sel in

sels:

print(sel.end());

那麼輸出的就是8 了

sublime外掛程式開發教程2

直接進入正題 先新建個chajian.py python寫起 import sublime import sublime plugin class examplecommand sublime plugin.textcommand defrun self,edit self.view.insert ...

sublime外掛程式開發教程1

sublime外掛程式是用python開發的 所以學習sublime之前 先學習python語法 不然 看不懂 1 編碼統一要用utf8 這樣輸出中文才不會亂碼 usr bin python coding utf 8 print 你好,世界 2 變數跟js比較像 這個地方 要注意 型別要一致 usr...

sublime 外掛程式安裝

import urllib2,os pf package control.sublime package ipp sublime.installed packages path os.makedirs ipp if not os.path.exists ipp else none urllib2.i...