aboutsummaryrefslogtreecommitdiff
path: root/core/init.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-03-23 06:12:30 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-03-23 06:12:30 -0400
commit2e042c305207e52831c1d5eb0706e2ebbf94ab1b (patch)
treeea0aadbac77f25bfb3eb6847992336785380d745 /core/init.lua
parent16a3aaf2125c05234355f8f322e22680a0b79f0b (diff)
downloadtextadept-2e042c305207e52831c1d5eb0706e2ebbf94ab1b.tar.gz
textadept-2e042c305207e52831c1d5eb0706e2ebbf94ab1b.zip
Added textadept.user_dofile to load user files like key commands and snippets.
Diffstat (limited to 'core/init.lua')
-rw-r--r--core/init.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/init.lua b/core/init.lua
index b55a3f04..7576e660 100644
--- a/core/init.lua
+++ b/core/init.lua
@@ -99,3 +99,11 @@ function textadept.switch_buffer()
local i = tonumber(out:match('%-?%d+$'))
if i and i >= 0 then view:goto_buffer(i + 1, true) end
end
+
+-- LuaDoc is in core/.textadept.lua.
+function textadept.user_dofile(filename)
+ if lfs.attributes(_USERHOME..'/'..filename) then
+ local ret, errmsg = pcall(dofile, _USERHOME..'/'..filename)
+ if not ret then textadept.print(errmsg) end
+ end
+end