Import Default Session

№ 4 edited on Saturday, March 4th 2017 at 1:56 AM by Fig Elkrowaim

By default, when you run Textadept from the command line with filename arguments, Textadept will open only those files, and not any files from the previous session (which is located in *~/.textadept/session*):

textadept file1 file2 ... fileN

If you want to Textadept to open files from the previous session in addition to files specified on the command line, you can use the `-s` switch:

textadept -s session file1 file2 ... fileN

(Note: `session` is the name of the default, previous session.)

However, if you happen to forget the `-s session` parameter, you can still have Textadept "import" the default session's files by putting the following in your *~/.textadept/init.lua* and selecting the "File > Import default session" menu item.

local function import_default_session()
for i = 1, #arg do
local filename = lfs.abspath(arg[i], arg[-1])
if lfs.attributes(filename) then -- not a switch
local file_menu =[_L['_File']]
table.insert(file_menu, #file_menu - 2,
{'Import default session', import_default_session})