aboutsummaryrefslogtreecommitdiff
path: root/plugins/indent_convert.lua
diff options
context:
space:
mode:
authorGuldoman <giulio.lettieri@gmail.com>2022-11-02 08:10:57 +0100
committerGitHub <noreply@github.com>2022-11-02 08:10:57 +0100
commit9bf5649c7df6bbd746956e9a96b616f61a59fa9b (patch)
tree725e2d12dc826f8ebe73807a705371cb4c5af4d9 /plugins/indent_convert.lua
parent49139e03398c9d0ecb347267a4882a4eb3f7ee23 (diff)
downloadlite-xl-plugins-9bf5649c7df6bbd746956e9a96b616f61a59fa9b.tar.gz
lite-xl-plugins-9bf5649c7df6bbd746956e9a96b616f61a59fa9b.zip
Use new `command.add` syntax (#136)
Diffstat (limited to 'plugins/indent_convert.lua')
-rw-r--r--plugins/indent_convert.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/indent_convert.lua b/plugins/indent_convert.lua
index 3a950f5..45d8640 100644
--- a/plugins/indent_convert.lua
+++ b/plugins/indent_convert.lua
@@ -102,8 +102,8 @@ local function get_indent_size(doc)
return indent_size
end
-local function tabs_to_spaces()
- local doc = core.active_view.doc
+local function tabs_to_spaces(dv)
+ local doc = dv.doc
local indent_size = get_indent_size(doc)
local selections = doc.selections
doc:replace(replacer(doc, tabs_replacer, indent_size))
@@ -118,8 +118,8 @@ local function tabs_to_spaces()
end
end
-local function spaces_to_tabs()
- local doc = core.active_view.doc
+local function spaces_to_tabs(dv)
+ local doc = dv.doc
local indent_size = get_indent_size(doc)
local selections = doc.selections
doc:replace(replacer(doc, spaces_replacer, indent_size))
@@ -134,7 +134,7 @@ local function spaces_to_tabs()
end
end
-command.add("core.docview", {
+command.add("core.docview!", {
["indent-convert:tabs-to-spaces"] = tabs_to_spaces,
["indent-convert:spaces-to-tabs"] = spaces_to_tabs
}