status.lua: Move import lines to beginning of file

This commit is contained in:
niten94
2025-02-15 23:17:33 +08:00
parent 5a62a8ead4
commit d992c606c5

View File

@@ -3,7 +3,9 @@ VERSION = "1.0.0"
local micro = import("micro")
local buffer = import("micro/buffer")
local config = import("micro/config")
local shell = import("micro/shell")
local humanize = import("humanize")
local strings = import("strings")
function init()
micro.SetStatusInfoFn("status.branch")
@@ -34,9 +36,6 @@ end
function branch(b)
if b.Type.Kind ~= buffer.BTInfo then
local shell = import("micro/shell")
local strings = import("strings")
local branch, err = shell.ExecCommand("git", "rev-parse", "--abbrev-ref", "HEAD")
if err == nil then
return strings.TrimSpace(branch)
@@ -47,9 +46,6 @@ end
function hash(b)
if b.Type.Kind ~= 5 then
local shell = import("micro/shell")
local strings = import("strings")
local hash, err = shell.ExecCommand("git", "rev-parse", "--short", "HEAD")
if err == nil then
return strings.TrimSpace(hash)