diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f6f23b8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d3e38dc --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto +*.png binary +*.jpg binary diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap index 7cff673..61af07f 100644 --- a/Default (Linux).sublime-keymap +++ b/Default (Linux).sublime-keymap @@ -1,3 +1,3 @@ -[ - { "keys": ["alt+a+r"], "command": "tail_last_rpt" }, -] +[ + { "keys": ["alt+a+r"], "command": "open_last_rpt" }, +] diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap index 7cff673..61af07f 100644 --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -1,3 +1,3 @@ -[ - { "keys": ["alt+a+r"], "command": "tail_last_rpt" }, -] +[ + { "keys": ["alt+a+r"], "command": "open_last_rpt" }, +] diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap index 7cff673..28a2283 100644 --- a/Default (Windows).sublime-keymap +++ b/Default (Windows).sublime-keymap @@ -1,3 +1,4 @@ -[ - { "keys": ["alt+a+r"], "command": "tail_last_rpt" }, -] +[ + { "keys": ["alt+a+r"], "command": "open_last_rpt" }, +] + diff --git a/Default.sublime-commands b/Default.sublime-commands index ec4db00..aea8fc4 100644 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -1,6 +1,6 @@ -[ - { - "caption": "Open Last RPT", - "command": "open_last_rpt" - } -] +[ + { + "caption": "Open Last RPT", + "command": "open_last_rpt" + } +] diff --git a/Main.sublime-menu b/Main.sublime-menu index cbe9c4d..4b23e2d 100644 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -1,86 +1,86 @@ -[ - { - "caption": "Project", - "id": "project", - "children": - [ - { - "caption": "-" - }, - { - "caption": "Open Last RPT", - "command": "open_last_rpt" - }, - ] - }, - { - "caption": "Preferences", - "mnemonic": "n", - "id": "preferences", - "children": - [ - { - "caption": "Package Settings", - "mnemonic": "P", - "id": "package-settings", - "children": - [ - { - "caption": "Open Last RPT", - "children": - [ - { - "command": "open_file", - "args": { - "file": "${packages}/OpenLastRPT/Default (OSX).sublime-keymap", - "platform": "OSX" - }, - "caption": "Key Bindings – Default" - }, - { - "command": "open_file", - "args": { - "file": "${packages}/OpenLastRPT/Default (Linux).sublime-keymap", - "platform": "Linux" - }, - "caption": "Key Bindings – Default" - }, - { - "command": "open_file", - "args": { - "file": "${packages}/OpenLastRPT/Default (Windows).sublime-keymap", - "platform": "Windows" - }, - "caption": "Key Bindings – Default" - }, - { - "command": "open_file", - "args": { - "file": "${packages}/User/Default (OSX).sublime-keymap", - "platform": "OSX" - }, - "caption": "Key Bindings – User" - }, - { - "command": "open_file", - "args": { - "file": "${packages}/User/Default (Linux).sublime-keymap", - "platform": "Linux" - }, - "caption": "Key Bindings – User" - }, - { - "command": "open_file", - "args": { - "file": "${packages}/User/Default (Windows).sublime-keymap", - "platform": "Windows" - }, - "caption": "Key Bindings – User" - } - ] - } - ] - } - ] - } -] +[ + { + "caption": "Project", + "id": "project", + "children": + [ + { + "caption": "-" + }, + { + "caption": "Open Last RPT", + "command": "open_last_rpt" + }, + ] + }, + { + "caption": "Preferences", + "mnemonic": "n", + "id": "preferences", + "children": + [ + { + "caption": "Package Settings", + "mnemonic": "P", + "id": "package-settings", + "children": + [ + { + "caption": "Open Last RPT", + "children": + [ + { + "command": "open_file", + "args": { + "file": "${packages}/OpenLastRPT/Default (OSX).sublime-keymap", + "platform": "OSX" + }, + "caption": "Key Bindings – Default" + }, + { + "command": "open_file", + "args": { + "file": "${packages}/OpenLastRPT/Default (Linux).sublime-keymap", + "platform": "Linux" + }, + "caption": "Key Bindings – Default" + }, + { + "command": "open_file", + "args": { + "file": "${packages}/OpenLastRPT/Default (Windows).sublime-keymap", + "platform": "Windows" + }, + "caption": "Key Bindings – Default" + }, + { + "command": "open_file", + "args": { + "file": "${packages}/User/Default (OSX).sublime-keymap", + "platform": "OSX" + }, + "caption": "Key Bindings – User" + }, + { + "command": "open_file", + "args": { + "file": "${packages}/User/Default (Linux).sublime-keymap", + "platform": "Linux" + }, + "caption": "Key Bindings – User" + }, + { + "command": "open_file", + "args": { + "file": "${packages}/User/Default (Windows).sublime-keymap", + "platform": "Windows" + }, + "caption": "Key Bindings – User" + } + ] + } + ] + } + ] + } +] diff --git a/open_last_rpt.py b/open_last_rpt.py index 593619f..e045ed1 100644 --- a/open_last_rpt.py +++ b/open_last_rpt.py @@ -1,24 +1,24 @@ -import os -import glob -import sublime, sublime_plugin - -rpt_files = [] - -class OpenLastRptCommand(sublime_plugin.WindowCommand): - def run(self): - # Get last RPT file - base_folder = os.path.join(os.getenv("LOCALAPPDATA"), "Arma 3") - newest_rpt_file = max(glob.iglob(os.path.join(base_folder, "*.rpt")), key=os.path.getctime) - # Save file into list for EventListener - global rpt_files - rpt_files.append(newest_rpt_file) - # Open file - self.window.open_file(newest_rpt_file) - -class EventListener(sublime_plugin.EventListener): - # Called when a file is finished loading - def on_load_async(self, view): - global rpt_files - if view.file_name() in rpt_files: - rpt_files.remove(view.file_name()) - view.run_command("move_to", {"to": "eof"}) +import os +import glob +import sublime, sublime_plugin + +rpt_files = [] + +class OpenLastRptCommand(sublime_plugin.WindowCommand): + def run(self): + # Get last RPT file + base_folder = os.path.join(os.getenv("LOCALAPPDATA"), "Arma 3") + newest_rpt_file = max(glob.iglob(os.path.join(base_folder, "*.rpt")), key=os.path.getctime) + # Save file into list for EventListener + global rpt_files + rpt_files.append(newest_rpt_file) + # Open file + self.window.open_file(newest_rpt_file) + +class EventListener(sublime_plugin.EventListener): + # Called when a file is finished loading + def on_load_async(self, view): + global rpt_files + if view.file_name() in rpt_files: + rpt_files.remove(view.file_name()) + view.run_command("move_to", {"to": "eof"})