summaryrefslogtreecommitdiff
path: root/User/copy_pos.py
blob: bda36545c4ed468681c749ad77ff9be3f55f59d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import os.path
import sublime
import sublime_plugin


class CopyPosCommand(sublime_plugin.TextCommand):
    def run(self, edit):
        try:
            project_path = self.view.window().extract_variables().get("project_path", "")
            line, _ = self.view.rowcol(next(iter(self.view.sel())).begin())
            sublime.set_clipboard("{}:{}".format(os.path.relpath(self.view.file_name(), project_path), line+1))
        except StopIteration:
            pass