Sublime Text, Plugins and Custom Programming in Python

By pjain      Published April 21, 2020, 7:50 p.m. in blog Programming   

Custom Programming in Python

EX: Insert Date-time at cursor

  • Create following in packages/user/.. with .py extension
// ~/Library/Application Support/Sublime Text 3/Packages/User/
import sublime, sublime_plugin, time

class InsertDatetimeCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        sel = self.view.sel();
        for s in sel:
            self.view.replace(edit, s, time.strftime('%Y-%m-%d')) //time.ctime()
  • You can put key bindings (Prefs/keybindings/user) { "keys": ["super+d"], "command": "insert_datetime"}


There are no comments yet

Add new comment

Similar posts

Markov Models Quickstart

Monte Carlo Models, Chains and Monte Carlo Simulation

Collaboration, Sync Processing =========