text
stringlengths
9
39.2M
dir
stringlengths
25
226
lang
stringclasses
163 values
created_date
timestamp[s]
updated_date
timestamp[s]
repo_name
stringclasses
751 values
repo_full_name
stringclasses
752 values
star
int64
1.01k
183k
len_tokens
int64
1
18.5M
```go //go:build ignore // +build ignore package main import ( "fmt" "io/ioutil" "os" "runtime" ) func check(e error) { if e != nil { panic(e) } } func main() { if runtime.GOOS != "darwin" { return } if len(os.Args) == 3 { if os.Args[1] == "darwin" && runtime.GOOS == "darwin" { rawInfoPlistString ...
/content/code_sandbox/tools/info-plist.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
364
```shell command -v fpm > /dev/null && fpm -s dir -t deb -p micro-$1-amd64.deb --name micro --license mit --version $1 --deb-recommends xclip --description "A modern and intuitive terminal-based text editor" --after-install ./assets/packaging/deb/micro.postinst --before-remove ./assets/packaging/deb/micro.prerm ./micro...
/content/code_sandbox/tools/package-deb.sh
shell
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
112
```shell # This script creates releases on Github for micro # You must have the correct Github access token to run this script # $1 is the title, $2 is the description commitID=$(git rev-parse HEAD) tag="v$1" echo "Creating tag" git tag $tag $commitID hub push --tags echo "Cross compiling binaries" ./cross-compile....
/content/code_sandbox/tools/pre-release.sh
shell
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
388
```go //+build ignore package main import ( "fmt" "os" "strconv" "time" ) func main() { var buildTime time.Time epoch := os.Getenv("SOURCE_DATE_EPOCH") if epoch != "" { i, err := strconv.Atoi(epoch) if err != nil { fmt.Errorf("SOURCE_DATE_EPOCH is not a valid integer") os.Exit(1) } buildTime = t...
/content/code_sandbox/tools/build-date.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
132
```go //+build ignore package main import ( "fmt" "io/ioutil" "log" "os" "regexp" "strings" "github.com/robertkrimen/otto/ast" "github.com/robertkrimen/otto/parser" ) type walker struct { nodes []ast.Node } func (w *walker) Enter(node ast.Node) ast.Visitor { w.nodes = append(w.nodes, node) return w } f...
/content/code_sandbox/tools/testgen.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,684
```go package highlight import ( "bytes" "errors" "fmt" "regexp" "gopkg.in/yaml.v2" ) // A Group represents a syntax group type Group uint8 // Groups contains all of the groups that are defined // You can access them in the map via their string name var Groups map[string]Group var numGroups Group // String re...
/content/code_sandbox/pkg/highlight/parser.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,070
```go package highlight import ( "unicode" "unicode/utf8" ) var minMark = rune(unicode.Mark.R16[0].Lo) func isMark(r rune) bool { // Fast path if r < minMark { return false } return unicode.In(r, unicode.Mark) } // DecodeCharacter returns the next character from an array of bytes // A character is a rune al...
/content/code_sandbox/pkg/highlight/unicode.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
485
```desktop [Desktop Entry] Name=Micro GenericName=Text Editor Comment=Edit text files in a terminal Icon=micro Type=Application Categories=Utility;TextEditor;Development; Keywords=text;editor;syntax;terminal; Exec=micro %F StartupNotify=false Terminal=true MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;te...
/content/code_sandbox/assets/packaging/micro.desktop
desktop
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
143
```groff .TH micro 1 "2020-02-10" .SH NAME micro \- A modern and intuitive terminal-based text editor .SH SYNOPSIS .B micro .RB [OPTIONS] [FILE]\&... .SH DESCRIPTION Micro is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the full capabilities of modern terminal...
/content/code_sandbox/assets/packaging/micro.1
groff
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
755
```go package highlight import ( "regexp" "strings" ) func sliceStart(slc []byte, index int) []byte { len := len(slc) i := 0 totalSize := 0 for totalSize < len { if i >= index { return slc[totalSize:] } _, _, size := DecodeCharacter(slc[totalSize:]) totalSize += size i++ } return slc[totalSize:...
/content/code_sandbox/pkg/highlight/highlighter.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,999
```unknown #!/bin/sh set -e if [ "$1" != "upgrade" ]; then update-alternatives --remove editor /usr/bin/micro fi ```
/content/code_sandbox/assets/packaging/deb/micro.prerm
unknown
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
37
```go package main import ( "bufio" "encoding/gob" "fmt" "io/ioutil" "os" "path/filepath" "sort" "strings" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" ) func shouldContinue() bool { reader := bufio.NewReader(os.Stdin) fmt.Print("Continue [Y/n]: ") text, ...
/content/code_sandbox/cmd/micro/clean.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
946
```unknown #!/bin/sh set -e if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]; then update-alternatives --install /usr/bin/editor editor /usr/bin/micro 40 \ --slave /usr/share/man/man1/editor.1 editor.1 \ /usr/share/man/man1/micro.1 fi ```
/content/code_sandbox/assets/packaging/deb/micro.postinst
unknown
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
83
```go package main import ( "log" "os" "github.com/zyedidia/micro/v2/internal/util" ) // NullWriter simply sends writes into the void type NullWriter struct{} // Write is empty func (NullWriter) Write(data []byte) (n int, err error) { return 0, nil } // InitLog sets up the debug log system for micro if it has ...
/content/code_sandbox/cmd/micro/debug.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
184
```go package main import ( "log" "time" lua "github.com/yuin/gopher-lua" luar "layeh.com/gopher-luar" "github.com/zyedidia/micro/v2/internal/action" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/display" ulua "github.com...
/content/code_sandbox/cmd/micro/initlua.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,357
```go package main import ( "fmt" "io/ioutil" "log" "os" "testing" "github.com/go-errors/errors" "github.com/stretchr/testify/assert" "github.com/zyedidia/micro/v2/internal/action" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/in...
/content/code_sandbox/cmd/micro/micro_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,148
```go package action import ( "bytes" "errors" "fmt" "strings" "github.com/zyedidia/tcell/v2" ) type Event interface { Name() string } // RawEvent is simply an escape code // We allow users to directly bind escape codes // to get around some of a limitations of terminals type RawEvent struct { esc string } ...
/content/code_sandbox/internal/action/events.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,050
```go package main import ( "flag" "fmt" "io" "io/ioutil" "log" "os" "os/signal" "regexp" "runtime" "runtime/pprof" "sort" "strconv" "syscall" "time" "github.com/go-errors/errors" isatty "github.com/mattn/go-isatty" lua "github.com/yuin/gopher-lua" "github.com/zyedidia/micro/v2/internal/action" "gi...
/content/code_sandbox/cmd/micro/micro.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,402
```go package action import ( "bytes" "github.com/zyedidia/tcell/v2" ) type PaneKeyAction func(Pane) bool type PaneMouseAction func(Pane, *tcell.EventMouse) bool type PaneKeyAnyAction func(Pane, []KeyEvent) bool // A KeyTreeNode stores a single node in the KeyTree (trie). The // children are stored as a map, and ...
/content/code_sandbox/internal/action/keytree.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,777
```go package action import "github.com/zyedidia/micro/v2/internal/buffer" // InfoBar is the global info bar. var InfoBar *InfoPane // LogBufPane is a global log buffer. var LogBufPane *BufPane // InitGlobals initializes the log buffer and the info bar func InitGlobals() { InfoBar = NewInfoBar() buffer.LogBuf = b...
/content/code_sandbox/internal/action/globals.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
231
```go package action import ( "github.com/zyedidia/micro/v2/internal/display" ) // A Pane is a general interface for a window in the editor. type Pane interface { Handler display.Window ID() uint64 SetID(i uint64) Name() string Close() SetTab(t *Tab) Tab() *Tab } ```
/content/code_sandbox/internal/action/pane.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
75
```go // +build !linux,!darwin,!freebsd,!dragonfly,!openbsd_amd64 package action import "errors" // TermEmuSupported is a constant that marks if the terminal emulator is supported const TermEmuSupported = false // RunTermEmulator returns an error for unsupported systems (non-unix systems func RunTermEmulator(input ...
/content/code_sandbox/internal/action/terminal_unsupported.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
112
```go package action var termdefaults = map[string]string{ "<Ctrl-q><Ctrl-q>": "Exit", "<Ctrl-e><Ctrl-e>": "CommandMode", "<Ctrl-w><Ctrl-w>": "NextSplit", } // DefaultBindings returns a map containing micro's default keybindings func DefaultBindings(pane string) map[string]string { switch pane { case "command": ...
/content/code_sandbox/internal/action/defaults.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
118
```go package action var bufdefaults = map[string]string{ "Up": "CursorUp", "Down": "CursorDown", "Right": "CursorRight", "Left": "CursorLeft", "ShiftUp": "SelectUp", "ShiftDown": "SelectDown", "ShiftLeft": "SelectLeft", "ShiftRight": "SelectRight",...
/content/code_sandbox/internal/action/defaults_darwin.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,846
```go package action import ( "bytes" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/info" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/tcell/v2" ) type In...
/content/code_sandbox/internal/action/infopane.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,732
```go package action import ( luar "layeh.com/gopher-luar" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/display" ulua "github.com/zyedidia/micro/v2/internal/lua" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zy...
/content/code_sandbox/internal/action/tab.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,762
```go package action import ( "bytes" "sort" "strings" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/pkg/highlight" ) // This file is meant (for now) for autocompletion in command mode, n...
/content/code_sandbox/internal/action/infocomplete.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,301
```go // +build linux darwin dragonfly solaris openbsd netbsd freebsd package action import ( "syscall" "github.com/zyedidia/micro/v2/internal/screen" ) // Suspend sends micro to the background. This is the same as pressing CtrlZ in most unix programs. // This only works on linux and has no default binding. // Th...
/content/code_sandbox/internal/action/actions_posix.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
156
```go // +build plan9 nacl windows package action func (*BufPane) Suspend() bool { InfoBar.Error("Suspend is only supported on BSD/Linux") return false } ```
/content/code_sandbox/internal/action/actions_other.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
41
```go // +build linux darwin dragonfly openbsd_amd64 freebsd package action import ( shellquote "github.com/kballard/go-shellquote" "github.com/zyedidia/micro/v2/internal/shell" ) // TermEmuSupported is a constant that marks if the terminal emulator is supported const TermEmuSupported = true // RunTermEmulator st...
/content/code_sandbox/internal/action/terminal_supported.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
347
```go package action import ( "bytes" "errors" "fmt" "os" "os/exec" "path/filepath" "reflect" "regexp" "strconv" "strings" shellquote "github.com/kballard/go-shellquote" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/clipboard" "github.com/zyedidia/micro/v2/interna...
/content/code_sandbox/internal/action/command.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
7,714
```go package action import ( "fmt" "reflect" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/tcell/v2" ) type RawPane struct { *BufPane } func NewRawPaneFromWin(b *buffer.Buffer, win display.BWindow, tab *Tab) *RawPane { rh := new(RawPane) ...
/content/code_sandbox/internal/action/rawpane.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
304
```go package action import ( "encoding/json" "errors" "fmt" "io/ioutil" "os" "path/filepath" "regexp" "strings" "unicode" "github.com/zyedidia/json5" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/tcell/v2" ) var Binder = map[string]fu...
/content/code_sandbox/internal/action/bindings.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,910
```go package action import ( "errors" "fmt" "io/fs" "os" "regexp" "runtime" "strings" "time" shellquote "github.com/kballard/go-shellquote" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/clipboard" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia...
/content/code_sandbox/internal/action/actions.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
15,256
```go package action import ( "errors" "runtime" "github.com/zyedidia/micro/v2/internal/clipboard" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/display" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/shell" "github.com/zyedidia/tc...
/content/code_sandbox/internal/action/termpane.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,553
```go //go:build !darwin // +build !darwin package action var bufdefaults = map[string]string{ "Up": "CursorUp", "Down": "CursorDown", "Right": "CursorRight", "Left": "CursorLeft", "ShiftUp": "SelectUp", "ShiftDown": "SelectDown", "ShiftLeft": "SelectLe...
/content/code_sandbox/internal/action/defaults_other.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,859
```go package action import ( "strings" "time" luar "layeh.com/gopher-luar" lua "github.com/yuin/gopher-lua" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/display" ulua "github.com/zyedidia/micro/v2/internal/lua" "github....
/content/code_sandbox/internal/action/bufpane.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
7,834
```go package config import ( "time" ) var Autosave chan bool var autotime chan float64 func init() { Autosave = make(chan bool) autotime = make(chan float64) } func SetAutoTime(a float64) { autotime <- a } func StartAutoSave() { go func() { var a float64 var t *time.Timer var elapsed <-chan time.Time ...
/content/code_sandbox/internal/config/autosave.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
240
```go package config const ( DoubleClickThreshold = 400 // How many milliseconds to wait before a second click is not a double click ) var Bindings map[string]map[string]string func init() { Bindings = map[string]map[string]string{ "command": make(map[string]string), "buffer": make(map[string]string), "te...
/content/code_sandbox/internal/config/globals.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
88
```go package config import ( "errors" "os" "path/filepath" homedir "github.com/mitchellh/go-homedir" ) var ConfigDir string // InitConfigDir finds the configuration directory for micro according to the XDG spec. // If no directory is found, it creates one. func InitConfigDir(flagConfigDir string) error { var ...
/content/code_sandbox/internal/config/config.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
391
```go package config import ( "testing" "github.com/stretchr/testify/assert" "github.com/zyedidia/tcell/v2" ) func TestSimpleStringToStyle(t *testing.T) { s := StringToStyle("lightblue,magenta") fg, bg, _ := s.Decompose() assert.Equal(t, tcell.ColorBlue, fg) assert.Equal(t, tcell.ColorPurple, bg) } func Te...
/content/code_sandbox/internal/config/colorscheme_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
586
```go package config import ( "testing" "github.com/stretchr/testify/assert" ) func init() { InitRuntimeFiles(false) } func TestAddFile(t *testing.T) { AddRuntimeFile(RTPlugin, memoryFile{"foo.lua", []byte("hello world\n")}) AddRuntimeFile(RTSyntax, memoryFile{"bar", []byte("some syntax file\n")}) f1 := Find...
/content/code_sandbox/internal/config/rtfiles_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
285
```go package config import ( "encoding/json" "errors" "fmt" "io/ioutil" "os" "path/filepath" "reflect" "runtime" "strconv" "strings" "github.com/zyedidia/glob" "github.com/zyedidia/json5" "github.com/zyedidia/micro/v2/internal/util" "golang.org/x/text/encoding/htmlindex" ) type optionValidator func(st...
/content/code_sandbox/internal/config/settings.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,829
```go package config import ( "errors" "io/ioutil" "log" "os" "path" "path/filepath" "regexp" "strings" rt "github.com/zyedidia/micro/v2/runtime" ) const ( RTColorscheme = 0 RTSyntax = 1 RTHelp = 2 RTPlugin = 3 RTSyntaxHeader = 4 ) var ( NumTypes = 5 // How many filetypes are the...
/content/code_sandbox/internal/config/rtfiles.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,424
```go package config import ( "testing" "github.com/blang/semver" "github.com/zyedidia/json5" ) func TestDependencyResolving(t *testing.T) { js := ` [{ "Name": "Foo", "Versions": [{ "Version": "1.0.0" }, { "Version": "1.5.0" },{ "Version": "2.0.0" }] }, { "Name": "Bar", "Versions": [{ "Version": "1.0.0"...
/content/code_sandbox/internal/config/plugin_installer_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
427
```go package config import ( "bytes" "encoding/json" "errors" ) var ( ErrMissingName = errors.New("Missing or empty name field") ErrMissingDesc = errors.New("Missing or empty description field") ErrMissingSite = errors.New("Missing or empty website field") ) // PluginInfo contains all the needed info about a ...
/content/code_sandbox/internal/config/plugin_manager.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
327
```go package config import ( "errors" "regexp" "strconv" "strings" "github.com/zyedidia/tcell/v2" ) // DefStyle is Micro's default style var DefStyle tcell.Style = tcell.StyleDefault // Colorscheme is the current colorscheme var Colorscheme map[string]tcell.Style // GetColor takes in a syntax group and retur...
/content/code_sandbox/internal/config/colorscheme.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,879
```go package config import ( "errors" "log" lua "github.com/yuin/gopher-lua" ulua "github.com/zyedidia/micro/v2/internal/lua" ) // ErrNoSuchFunction is returned when Call is executed on a function that does not exist var ErrNoSuchFunction = errors.New("No such function exists") // LoadAllPlugins loads all dete...
/content/code_sandbox/internal/config/plugin.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,048
```go package config import ( "archive/zip" "bytes" "fmt" "io" "io/ioutil" "net/http" "os" "path/filepath" "sort" "strings" "sync" "github.com/blang/semver" lua "github.com/yuin/gopher-lua" "github.com/zyedidia/json5" ulua "github.com/zyedidia/micro/v2/internal/lua" "github.com/zyedidia/micro/v2/inter...
/content/code_sandbox/internal/config/plugin_installer.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
4,662
```go package shell import ( "bytes" "errors" "fmt" "io" "os" "os/exec" "os/signal" shellquote "github.com/kballard/go-shellquote" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" ) // ExecCommand executes a command using exec // It returns any output/errors func ...
/content/code_sandbox/internal/shell/shell.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
860
```go package shell import ( "bytes" "os/exec" "strconv" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/terminal" ) type TermType int type CallbackFunc func(string) const ( TTClose = iota // Should be closed TTRunning // Currently ...
/content/code_sandbox/internal/shell/terminal.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
852
```go package info // A GutterMessage is a message displayed on the side of the editor type GutterMessage struct { lineNum int msg string kind int } // These are the different types of messages const ( // GutterInfo represents a simple info message GutterInfo = iota // GutterWarning represents a compiler...
/content/code_sandbox/internal/info/gutter.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
97
```go package shell import ( "bytes" "io" "os/exec" ) var Jobs chan JobFunction func init() { Jobs = make(chan JobFunction, 100) } // Jobs are the way plugins can run processes in the background // A job is simply a process that gets executed asynchronously // There are callbacks for when the job exits, when th...
/content/code_sandbox/internal/shell/job.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
724
```go package info import ( "encoding/gob" "os" "path/filepath" "strings" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/util" ) // LoadHistory attempts to load user history from configDir/buffers/history // into the history map // The savehistory option must be on func (...
/content/code_sandbox/internal/info/history.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,163
```go package info import ( "fmt" "github.com/zyedidia/micro/v2/internal/buffer" ) // The InfoBuf displays messages and other info at the bottom of the screen. // It is represented as a buffer and a message with a style. type InfoBuf struct { *buffer.Buffer HasPrompt bool HasMessage bool HasError bool Has...
/content/code_sandbox/internal/info/infobuffer.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,333
```go package screen import ( "bufio" "fmt" "os" "strconv" "strings" ) // TermMessage sends a message to the user in the terminal. This usually occurs before // micro has been fully initialized -- ie if there is an error in the syntax highlighting // regular expressions // The function must be called when the Sc...
/content/code_sandbox/internal/screen/message.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
422
```go package screen import ( "errors" "log" "os" "sync" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/tcell/v2" ) // Screen is the tcell screen we use to draw to the terminal // Synchronization is used because we poll the screen on a separate...
/content/code_sandbox/internal/screen/screen.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,402
```go package buffer import ( "regexp" "github.com/zyedidia/micro/v2/internal/util" ) func (b *Buffer) findDown(r *regexp.Regexp, start, end Loc) ([2]Loc, bool) { lastcn := util.CharacterCount(b.LineBytes(b.LinesNum() - 1)) if start.Y > b.LinesNum()-1 { start.X = lastcn - 1 } if end.Y > b.LinesNum()-1 { en...
/content/code_sandbox/internal/buffer/search.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,603
```go package buffer import ( "bufio" "bytes" "io" "sync" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/pkg/highlight" ) // Finds the byte index of the nth rune in a byte slice func runeToByteIndex(n int, txt []byte) int { if n == 0 { return 0 } count := 0 i := 0 for len(tx...
/content/code_sandbox/internal/buffer/line_array.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,589
```go package buffer import ( "fmt" "io" "os" "path/filepath" "sync/atomic" "time" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" "golang.org/x/text/encoding" ) const backupMsg = `A backup was detected for this file...
/content/code_sandbox/internal/buffer/backup.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,069
```go package buffer import ( "bytes" "time" dmp "github.com/sergi/go-diff/diffmatchpatch" "github.com/zyedidia/micro/v2/internal/config" ulua "github.com/zyedidia/micro/v2/internal/lua" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" luar "layeh.com/gopher-luar" ) ...
/content/code_sandbox/internal/buffer/eventhandler.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,075
```go package buffer import ( "crypto/md5" "reflect" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" ) func (b *Buffer) ReloadSettings(reloadFiletype bool) { settings := config.ParsedSettings() if _, ok := b.LocalSettings["filetype"]; !ok && reloadFiletype { // ...
/content/code_sandbox/internal/buffer/settings.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
980
```go package buffer import ( "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/tcell/v2" ) type MsgType int const ( MTInfo = iota MTWarning MTError ) // Message represents the information for a gutter message type Message struct { // The Msg iteslf Msg string // Start and End locations fo...
/content/code_sandbox/internal/buffer/message.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
537
```go package buffer import ( "testing" "time" "github.com/stretchr/testify/assert" ) func TestStack(t *testing.T) { s := new(TEStack) e1 := &TextEvent{ EventType: TextEventReplace, Time: time.Now(), } e2 := &TextEvent{ EventType: TextEventInsert, Time: time.Now(), } s.Push(e1) s.Push(e2)...
/content/code_sandbox/internal/buffer/stack_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
181
```go package buffer import ( "bytes" "io/ioutil" "os" "sort" "strings" "github.com/zyedidia/micro/v2/internal/util" ) // A Completer is a function that takes a buffer and returns info // describing what autocompletions should be inserted at the current // cursor location // It returns a list of string suggest...
/content/code_sandbox/internal/buffer/autocomplete.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,433
```go package buffer import ( "encoding/gob" "errors" "io" "os" "path/filepath" "time" "golang.org/x/text/encoding" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/util" ) // The SerializedBuffer holds the types that get serialized when a buffer is saved // These are u...
/content/code_sandbox/internal/buffer/serialize.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
577
```go package buffer import ( "math/rand" "strings" "testing" "github.com/stretchr/testify/assert" lua "github.com/yuin/gopher-lua" "github.com/zyedidia/micro/v2/internal/config" ulua "github.com/zyedidia/micro/v2/internal/lua" "github.com/zyedidia/micro/v2/internal/util" ) type operation struct { start Loc...
/content/code_sandbox/internal/buffer/buffer_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,002
```go package buffer import ( "strings" "testing" "github.com/stretchr/testify/assert" ) var unicode_txt = `An preost wes on leoden, Laamon was ihoten He wes Leovenaes sone -- lie him be Drihten. He wonede at Ernlee at elen are chirechen, Uppen Sevarne stae, sel ar him uhte, Onfest Radestone, er he bock radde.` ...
/content/code_sandbox/internal/buffer/line_array_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
560
```go package buffer import ( "github.com/zyedidia/micro/v2/internal/util" ) // Loc stores a location type Loc struct { X, Y int } // LessThan returns true if b is smaller func (l Loc) LessThan(b Loc) bool { if l.Y < b.Y { return true } return l.Y == b.Y && l.X < b.X } // GreaterThan returns true if b is big...
/content/code_sandbox/internal/buffer/loc.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
978
```go package buffer // TEStack is a simple implementation of a LIFO stack for text events type TEStack struct { Top *Element Size int } // An Element which is stored in the Stack type Element struct { Value *TextEvent Next *Element } // Len returns the stack's length func (s *TEStack) Len() int { return s.Si...
/content/code_sandbox/internal/buffer/stack.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
242
```go package buffer import ( "github.com/zyedidia/micro/v2/internal/clipboard" "github.com/zyedidia/micro/v2/internal/util" ) // InBounds returns whether the given location is a valid character position in the given buffer func InBounds(pos Loc, buf *Buffer) bool { if pos.Y < 0 || pos.Y >= len(buf.lines) || pos.X...
/content/code_sandbox/internal/buffer/cursor.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
4,416
```go package buffer import ( "bufio" "bytes" "errors" "io" "os" "os/exec" "os/signal" "path/filepath" "runtime" "unicode" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" "golang.org/x/text/encoding" "golang.org/...
/content/code_sandbox/internal/buffer/save.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,692
```go // This file is generated from VSCode model tests by the testgen tool. // DO NOT EDIT THIS FILE BY HAND; your changes will be overwritten! package buffer import "testing" func TestAuto1(t *testing.T) { check( t, []string{ "ioe", "", "yjct", "", "", }, []operation{ { start: Loc{1,...
/content/code_sandbox/internal/buffer/buffer_generated_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
9,174
```go package views import ( "fmt" "strings" ) type SplitType uint8 const ( STVert = 0 STHoriz = 1 STUndef = 2 ) var idcounter uint64 // NewID returns a new unique id func NewID() uint64 { idcounter++ return idcounter } // A View is a size and location of a split type View struct { X, Y int W, H int } ...
/content/code_sandbox/internal/views/splits.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,530
```go package views import ( "fmt" "testing" ) func TestHSplit(t *testing.T) { root := NewRoot(0, 0, 80, 80) n1 := root.VSplit(true) root.GetNode(n1).VSplit(true) root.GetNode(root.id).ResizeSplit(7) root.Resize(120, 120) fmt.Println(root.String()) } ```
/content/code_sandbox/internal/views/splits_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
82
```go package util import ( "testing" "github.com/stretchr/testify/assert" ) func TestStringWidth(t *testing.T) { bytes := []byte("\tPot s \tmnnc sticl i ea nu m rnete.") n := StringWidth(bytes, 23, 4) assert.Equal(t, 26, n) } func TestSliceVisualEnd(t *testing.T) { s := []byte("\thello") slc, n, _ := Slice...
/content/code_sandbox/internal/util/util_test.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
248
```go package buffer import ( "bufio" "bytes" "crypto/md5" "errors" "fmt" "io" "io/ioutil" "os" "path" "path/filepath" "strconv" "strings" "sync" "sync/atomic" "time" luar "layeh.com/gopher-luar" dmp "github.com/sergi/go-diff/diffmatchpatch" "github.com/zyedidia/micro/v2/internal/config" ulua "git...
/content/code_sandbox/internal/buffer/buffer.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
10,078
```go package util import ( "archive/zip" "bytes" "errors" "fmt" "io" "net/http" "os" "os/user" "path/filepath" "regexp" "runtime" "strconv" "strings" "time" "unicode" "unicode/utf8" "github.com/blang/semver" runewidth "github.com/mattn/go-runewidth" ) var ( // These variables should be set by the...
/content/code_sandbox/internal/util/util.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
3,872
```go package util import ( "fmt" "log" "runtime" "time" humanize "github.com/dustin/go-humanize" ) // GetMemStats returns a string describing the memory usage and gc time used so far func GetMemStats() string { var memstats runtime.MemStats runtime.ReadMemStats(&memstats) return fmt.Sprintf("Alloc: %s, Sys:...
/content/code_sandbox/internal/util/profile.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
177
```go package util // LuaRuneAt is a helper function for lua plugins to return the rune // at an index within a string func LuaRuneAt(str string, runeidx int) string { i := 0 for len(str) > 0 { r, _, size := DecodeCharacterInString(str) str = str[size:] if i == runeidx { return string(r) } i++ } re...
/content/code_sandbox/internal/util/lua.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
245
```go package util import ( "unicode" "unicode/utf8" ) // Unicode is annoying. A "code point" (rune in Go-speak) may need up to // 4 bytes to represent it. In general, a code point will represent a // complete character, but this is not always the case. A character with // accents may be made up of multiple code po...
/content/code_sandbox/internal/util/unicode.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
645
```go package display import ( "github.com/zyedidia/micro/v2/internal/buffer" ) type View struct { X, Y int // X,Y location of the view Width, Height int // Width and height of the view // Start line of the view (for vertical scroll) StartLine SLoc // Start column of the view (for horizontal scroll) ...
/content/code_sandbox/internal/display/window.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
209
```go package display import ( "bytes" "fmt" "regexp" "strconv" "strings" luar "layeh.com/gopher-luar" runewidth "github.com/mattn/go-runewidth" lua "github.com/yuin/gopher-lua" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" ulua "github.com/zyedidia/micro/v2...
/content/code_sandbox/internal/display/statusline.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,603
```go package display import ( "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/micro/v2/internal/views" ) type UIWindow struct { root *views.Node } func...
/content/code_sandbox/internal/display/uiwindow.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
603
```go package display import ( "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/shell" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/tcell/v2" "github.com/zyedid...
/content/code_sandbox/internal/display/termwindow.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
878
```go package display import ( runewidth "github.com/mattn/go-runewidth" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/info" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" "github....
/content/code_sandbox/internal/display/infowindow.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,290
```go package display import ( runewidth "github.com/mattn/go-runewidth" "github.com/zyedidia/tcell/v2" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" ) type TabWindow struc...
/content/code_sandbox/internal/display/tabwindow.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,180
```go package display import ( "strconv" runewidth "github.com/mattn/go-runewidth" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/config" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/micro/v2/internal/util" "github.com/zyedidia/tcell/v2" ) // The B...
/content/code_sandbox/internal/display/bufwindow.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
6,357
```go package display import ( runewidth "github.com/mattn/go-runewidth" "github.com/zyedidia/micro/v2/internal/buffer" "github.com/zyedidia/micro/v2/internal/util" ) // SLoc represents a vertical scrolling location, i.e. a location of a visual line // in the buffer. When softwrap is enabled, a buffer line may be ...
/content/code_sandbox/internal/display/softwrap.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
2,488
```go package clipboard type internalClipboard map[Register]string var internal internalClipboard func init() { internal = make(internalClipboard) } func (c internalClipboard) read(r Register) string { return c[r] } func (c internalClipboard) write(text string, r Register) { c[r] = text } ```
/content/code_sandbox/internal/clipboard/internal.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
66
```go package clipboard import ( "errors" "time" "github.com/zyedidia/micro/v2/internal/screen" "github.com/zyedidia/tcell/v2" ) type terminalClipboard struct{} var terminal terminalClipboard func (t terminalClipboard) read(reg string) (string, error) { screen.Screen.GetClipboard(reg) // wait at most 200ms f...
/content/code_sandbox/internal/clipboard/terminal.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
174
```go package clipboard import ( "bytes" ) // For storing multi cursor clipboard contents type multiClipboard map[Register][]string var multi multiClipboard func (c multiClipboard) getAllText(r Register) string { content := c[r] if content == nil { return "" } buf := &bytes.Buffer{} for _, s := range conte...
/content/code_sandbox/internal/clipboard/multi.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
325
```go package clipboard import ( "errors" "github.com/zyedidia/clipper" ) type Method int const ( // External relies on external tools for accessing the clipboard // These include xclip, xsel, wl-clipboard for linux, pbcopy/pbpaste on Mac, // and Syscalls on Windows. External Method = iota // Terminal uses t...
/content/code_sandbox/internal/clipboard/clipboard.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
1,046
```go package lua import ( "archive/zip" "bytes" "errors" "fmt" "io" "io/ioutil" "math" "math/rand" "net" "net/http" "os" "path" "path/filepath" "regexp" "runtime" "strings" "time" "unicode/utf8" humanize "github.com/dustin/go-humanize" lua "github.com/yuin/gopher-lua" luar "layeh.com/gopher-luar...
/content/code_sandbox/internal/lua/lua.go
go
2016-03-11T02:06:28
2024-08-16T15:15:57
micro
zyedidia/micro
24,604
7,952
```smalltalk using System; using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class RentalsConfiguration : IEntityTypeConfiguration<Rentals> { public void Configure(EntityTypeBuilder<R...
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/RentalsConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
654
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class MoviesConfiguration : IEntityTypeConfiguration<Movies> { public void Configure(EntityTypeBuilder<Movies> builder) ...
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/MoviesConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
429
```smalltalk using CodeFirst.DataAccess.Models; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace CodeFirst.DataAccess.Configurations; public class EmployeesConfiguration : IEntityTypeConfiguration<Employees> { public void Configure(EntityTypeBuilder<Employees> ...
/content/code_sandbox/src-examples/CodeFirst.DataAccess/Configurations/EmployeesConfiguration.cs
smalltalk
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
348
```xml <Project> <PropertyGroup> <MsBuildAllProjects>$(MsBuildAllProjects);$(MsBuildThisFileFullPath)</MsBuildAllProjects> </PropertyGroup> <Choose> <!-- The environment variable `Prerelease` is set in the azure-pipelines.yml file. --> <When Condition=" '$(Prerelease)' != '' "> ...
/content/code_sandbox/Directory.Build.props
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
155
```unknown [config] project = doc\System.Linq.Dynamic.Core.SandCastle ```
/content/code_sandbox/.deployment
unknown
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
14
```xml <Project> <PropertyGroup> <PatchVersion>5</PatchVersion> </PropertyGroup> </Project> ```
/content/code_sandbox/version.xml
xml
2016-04-08T16:41:51
2024-08-16T05:55:59
System.Linq.Dynamic.Core
zzzprojects/System.Linq.Dynamic.Core
1,537
26