|
@@ -22,16 +22,46 @@ local function getProperties(fullpath) |
|
|
return properties |
|
|
return properties |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
local function setIndentation(properties, view) |
|
|
|
|
|
local indent_size_str = properties["indent_size"] |
|
|
|
|
|
local tab_width_str = properties["tab_width"] |
|
|
|
|
|
local indent_style = properties["indent_style"] |
|
|
|
|
|
|
|
|
|
|
|
local indent_size = tonumber(indent_size, 10) |
|
|
|
|
|
if indent_size ~= nil then |
|
|
|
|
|
SetLocalOption("tabsize", indent_size, view) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
if indent_style == "space" then |
|
|
|
|
|
messenger:Message("indent_style to space") |
|
|
|
|
|
SetLocalOption("indentchar", " ", view) |
|
|
|
|
|
elseif indent_style == "tab" then |
|
|
|
|
|
messenger:Message("indent_style to tab") |
|
|
|
|
|
SetLocalOption("indentchar", "\t", view) |
|
|
|
|
|
else |
|
|
|
|
|
messenger:Message("unknown indent_style") |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
function onViewOpen(view) |
|
|
function onViewOpen(view) |
|
|
-- Is this portable? (work on windows?) |
|
|
-- Is this portable? (work on windows?) |
|
|
local pwd = os.getenv("PWD") |
|
|
local pwd = os.getenv("PWD") |
|
|
local filename = view.Buf.Path |
|
|
local filename = view.Buf.Path |
|
|
-- prop, names = ec.parse(filepath) |
|
|
-- prop, names = ec.parse(filepath) |
|
|
local fullpath = JoinPaths(pwd, filename) |
|
|
local fullpath = JoinPaths(pwd, filename) |
|
|
local out = getProperties(fullpath) |
|
|
|
|
|
messenger:Message("edconf: " .. out["indent_style"]) |
|
|
|
|
|
|
|
|
local properties = getProperties(fullpath) |
|
|
|
|
|
if properties["indent_style"] == nil then |
|
|
|
|
|
messenger:Message("edconf: nil") |
|
|
|
|
|
else |
|
|
|
|
|
messenger:Message("edconf: " .. properties["indent_style"]) |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
setIndentation(properties, view) |
|
|
|
|
|
-- setCodingSystem(propertieps, view) |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function onSave(view) |
|
|
function onSave(view) |
|
|
messenger:Message("Saved!") |
|
|
messenger:Message("Saved!") |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
-- function getindentstyle() |