diff options
author | Guldoman <giulio.lettieri@gmail.com> | 2022-11-02 08:10:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-02 08:10:57 +0100 |
commit | 9bf5649c7df6bbd746956e9a96b616f61a59fa9b (patch) | |
tree | 725e2d12dc826f8ebe73807a705371cb4c5af4d9 /plugins/autoinsert.lua | |
parent | 49139e03398c9d0ecb347267a4882a4eb3f7ee23 (diff) | |
download | lite-xl-plugins-9bf5649c7df6bbd746956e9a96b616f61a59fa9b.tar.gz lite-xl-plugins-9bf5649c7df6bbd746956e9a96b616f61a59fa9b.zip |
Use new `command.add` syntax (#136)
Diffstat (limited to 'plugins/autoinsert.lua')
-rw-r--r-- | plugins/autoinsert.lua | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/plugins/autoinsert.lua b/plugins/autoinsert.lua index c49887a..a02b6a5 100644 --- a/plugins/autoinsert.lua +++ b/plugins/autoinsert.lua @@ -81,13 +81,12 @@ end local function predicate() - return getmetatable(core.active_view) == DocView - and not core.active_view.doc:has_selection() + return core.active_view:is(DocView) + and not core.active_view.doc:has_selection(), core.active_view.doc end command.add(predicate, { - ["autoinsert:backspace"] = function() - local doc = core.active_view.doc + ["autoinsert:backspace"] = function(doc) local l, c = doc:get_selection() if c > 1 then local chr = doc:get_char(l, c) @@ -99,8 +98,7 @@ command.add(predicate, { command.perform "doc:backspace" end, - ["autoinsert:delete-to-previous-word-start"] = function() - local doc = core.active_view.doc + ["autoinsert:delete-to-previous-word-start"] = function(doc) local le, ce = translate.previous_word_start(doc, doc:get_selection()) while true do local l, c = doc:get_selection() |