Quellcode durchsuchen

Update micro init.lua

pull/15/head
10sr vor 8 Jahren
Ursprung
Commit
8e6fdd5010
1 geänderte Dateien mit 32 neuen und 2 gelöschten Zeilen
  1. +32
    -2
      micro/init.lua

+ 32
- 2
micro/init.lua Datei anzeigen

@@ -22,16 +22,46 @@ local function getProperties(fullpath)
return properties
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)
-- Is this portable? (work on windows?)
local pwd = os.getenv("PWD")
local filename = view.Buf.Path
-- prop, names = ec.parse(filepath)
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

function onSave(view)
messenger:Message("Saved!")
end

-- function getindentstyle()

Laden…
Abbrechen
Speichern