diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | plugins/lastproject.lua | 26 |
2 files changed, 27 insertions, 0 deletions
@@ -60,6 +60,7 @@ Plugin | Description [`language_sh`](plugins/language_sh.lua?raw=1) | Syntax for shell scripting language [`language_tex`](plugins/language_tex.lua?raw=1) | Syntax for the [LaTeX](https://www.latex-project.org/) typesetting language [`language_wren`](plugins/language_wren.lua?raw=1) | Syntax for the [Wren](http://wren.io/) programming language +[`lastproject`](plugins/lastproject.lua?raw=1) | Loads the last loaded project if lite is launched without any arguments [`lfautoinsert`](plugins/lfautoinsert.lua?raw=1) | Automatically inserts indentation and closing bracket/text after newline [`linecopypaste`](plugins/linecopypaste.lua?raw=1) | Copy, cut and paste the current line when nothing is selected [`lineguide`](plugins/lineguide.lua?raw=1) | Displays a line-guide at the line limit offset *([screenshot](https://user-images.githubusercontent.com/3920290/81476159-2cf70000-9208-11ea-928b-9dae3884c477.png))* diff --git a/plugins/lastproject.lua b/plugins/lastproject.lua new file mode 100644 index 0000000..09ca507 --- /dev/null +++ b/plugins/lastproject.lua @@ -0,0 +1,26 @@ +local core = require "core" + +local last_project_filename = EXEDIR .. PATHSEP .. ".lite_last_project" + + +-- load last project path +local fp = io.open(last_project_filename) +local project_path +if fp then + project_path = fp:read("*a") + fp:close() +end + + +-- save current project path +local fp = io.open(last_project_filename, "w") +fp:write(system.absolute_path ".") +fp:close() + + +-- restart using last project path if we had no commandline arguments and could +-- find a last-project file +if #ARGS == 1 and project_path then + system.exec(string.format("%s %q", EXEFILE, project_path)) + core.quit(true) +end |