Skip to content

Instantly share code, notes, and snippets.

@jbenner-radham
Created March 20, 2014 20:22
Show Gist options
  • Save jbenner-radham/9673001 to your computer and use it in GitHub Desktop.
Save jbenner-radham/9673001 to your computer and use it in GitHub Desktop.
import sublime, sublime_plugin
from pprint import pprint
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
#print(vars(self.view.window()))
# This gets all the text on the page, but it seems a bit excessive...
reg = sublime.Region(0, self.view.size())
print(self.view.substr(reg))
# Current loaded file.
print(self.view.file_name())
# Returns 'Windows' for win style line breaks, etc.
print(self.view.line_endings())
# Returns the number of characters in a file.
print (self.view.size())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment