Documentation ¶
Index ¶
- Variables
- func Abs(n int) int
- func CharacterCount(b []byte) int
- func CharacterCountInString(str string) int
- func Clamp(val, min, max int) int
- func DecodeCharacter(b []byte) (rune, []rune, int)
- func DecodeCharacterInString(str string) (rune, []rune, int)
- func EscapePath(path string) string
- func FSize(f *os.File) int64
- func GetCharPosInLine(b []byte, visualPos int, tabsize int) int
- func GetLeadingWhitespace(b []byte) []byte
- func GetMemStats() string
- func GetModTime(path string) (time.Time, error)
- func GetPathAndCursorPosition(path string) (string, []string)
- func HttpRequest(method string, url string, headers []string) (resp *http.Response, err error)
- func IntOpt(opt interface{}) int
- func IsAutocomplete(c rune) bool
- func IsBytesWhitespace(b []byte) bool
- func IsNonAlphaNumeric(c rune) bool
- func IsSpaces(str []byte) bool
- func IsSpacesOrTabs(str []byte) bool
- func IsWhitespace(c rune) bool
- func IsWordChar(r rune) bool
- func LuaGetLeadingWhitespace(s string) string
- func LuaIsWordChar(s string) bool
- func LuaRuneAt(str string, runeidx int) string
- func MakeRelative(path, base string) (string, error)
- func Max(a, b int) int
- func Min(a, b int) int
- func ParseBool(str string) (bool, error)
- func ParseSpecial(s string) string
- func ReplaceHome(path string) (string, error)
- func RunePos(b []byte, i int) int
- func SliceEnd(slc []byte, index int) []byte
- func SliceEndStr(str string, index int) string
- func SliceStart(slc []byte, index int) []byte
- func SliceStartStr(str string, index int) string
- func SliceVisualEnd(b []byte, n, tabsize int) ([]byte, int, int)
- func Spaces(n int) string
- func String(s []byte) string
- func StringWidth(b []byte, n, tabsize int) int
- func Tic(s string) time.Time
- func Toc(start time.Time)
- func Unzip(src, dest string) error
Constants ¶
This section is empty.
Variables ¶
var ( // Version is the version number or commit hash Version = "0.0.0-unknown" // SemVersion is the Semantic version SemVersion semver.Version // CommitHash is the commit this version was built on CommitHash = "Unknown" // CompileDate is the date this binary was compiled on CompileDate = "Unknown" // Debug logging Debug = "OFF" // FakeCursor is used to disable the terminal cursor and have micro // draw its own (enabled for windows consoles where the cursor is slow) FakeCursor = false // Stdout is a buffer that is written to stdout when micro closes Stdout *bytes.Buffer )
Functions ¶
func CharacterCount ¶
CharacterCount returns the number of characters in a byte array Similar to utf8.RuneCount but for unicode characters
func CharacterCountInString ¶
CharacterCount returns the number of characters in a string Similar to utf8.RuneCountInString but for unicode characters
func DecodeCharacter ¶
DecodeCharacter returns the next character from an array of bytes A character is a rune along with any accompanying combining runes
func DecodeCharacterInString ¶
DecodeCharacterInString returns the next character from a string A character is a rune along with any accompanying combining runes
func EscapePath ¶
EscapePath replaces every path separator in a given path with a %
func GetCharPosInLine ¶
GetCharPosInLine gets the char position of a visual x y coordinate (this is necessary because tabs are 1 char but 4 visual spaces)
func GetLeadingWhitespace ¶
GetLeadingWhitespace returns the leading whitespace of the given byte array
func GetMemStats ¶
func GetMemStats() string
GetMemStats returns a string describing the memory usage and gc time used so far
func GetModTime ¶
GetModTime returns the last modification time for a given file
func GetPathAndCursorPosition ¶
GetPathAndCursorPosition returns a filename without everything following a `:` This is used for opening files like util.go:10:5 to specify a line and column Special cases like Windows Absolute path (C:\myfile.txt:10:5) are handled correctly.
func HttpRequest ¶
HttpRequest returns a new http.Client for making custom requests (for lua plugins)
func IsAutocomplete ¶
IsAutocomplete returns whether a character should begin an autocompletion.
func IsBytesWhitespace ¶
IsBytesWhitespace returns true if the given bytes are all whitespace
func IsNonAlphaNumeric ¶
IsNonAlphaNumeric returns if the rune is not a number of letter or underscore.
func IsSpacesOrTabs ¶
IsSpacesOrTabs checks if a given string contains only spaces and tabs
func IsWhitespace ¶
IsWhitespace returns true if the given rune is a space, tab, or newline
func IsWordChar ¶
IsWordChar returns whether or not the string is a 'word character' Word characters are defined as numbers, letters, or '_'
func LuaGetLeadingWhitespace ¶
LuaGetLeadingWhitespace returns the leading whitespace of a string (used by lua plugins)
func LuaIsWordChar ¶
LuaIsWordChar returns true if the first rune in a string is a word character
func LuaRuneAt ¶
LuaRuneAt is a helper function for lua plugins to return the rune at an index within a string
func MakeRelative ¶
MakeRelative will attempt to make a relative path between path and base
func ParseBool ¶
ParseBool is almost exactly like strconv.ParseBool, except it also accepts 'on' and 'off' as 'true' and 'false' respectively
func ReplaceHome ¶
ReplaceHome takes a path as input and replaces ~ at the start of the path with the user's home directory. Does nothing if the path does not start with '~'.
func RunePos ¶
RunePos returns the rune index of a given byte index Make sure the byte index is not between code points
func SliceEnd ¶
SliceEnd returns a byte slice where the index is a rune index Slices off the start of the slice
func SliceEndStr ¶
SliceEndStr is the same as SliceEnd but for strings
func SliceStart ¶
SliceStart returns a byte slice where the index is a rune index Slices off the end of the slice
func SliceStartStr ¶
SliceStartStr is the same as SliceStart but for strings
func SliceVisualEnd ¶
SliceVisualEnd will take a byte slice and slice off the start up to a given visual index. If the index is in the middle of a rune the number of visual columns into the rune will be returned It will also return the char pos of the first character of the slice
func StringWidth ¶
StringWidth returns the visual width of a byte array indexed from 0 to n (rune index) with a given tabsize
Types ¶
This section is empty.