]> git.lizzy.rs Git - micro.git/commitdiff
Add "paste" option to enable aggressive pasting
authorZachary Yedidia <zyedidia@gmail.com>
Thu, 2 Jan 2020 17:42:39 +0000 (12:42 -0500)
committerZachary Yedidia <zyedidia@gmail.com>
Thu, 2 Jan 2020 17:42:39 +0000 (12:42 -0500)
Ref #1043

go.mod
go.sum
internal/action/command.go
internal/action/termpane.go
internal/config/runtime.go
internal/config/settings.go
runtime/plugins/status/status.lua [new file with mode: 0644]

diff --git a/go.mod b/go.mod
index 0e55ea095891ead0b4192536def628ae398f4b1a..3d47659592f36448ad8b0cb182790589238e53d8 100644 (file)
--- a/go.mod
+++ b/go.mod
@@ -15,7 +15,7 @@ require (
        github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5
        github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d
        github.com/zyedidia/pty v2.0.0+incompatible // indirect
-       github.com/zyedidia/tcell v1.4.0
+       github.com/zyedidia/tcell v1.4.1
        github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415
        golang.org/x/text v0.3.2
        gopkg.in/yaml.v2 v2.2.7
diff --git a/go.sum b/go.sum
index 5a4e2366271c6dddce64ddc20a594e010c9d11d6..420ee6b9bd10df0f323362ac6570d27e38a2c7a2 100644 (file)
--- a/go.sum
+++ b/go.sum
@@ -50,6 +50,8 @@ github.com/zyedidia/pty v2.0.0+incompatible h1:Ou5vXL6tvjst+RV8sUFISbuKDnUJPhnpy
 github.com/zyedidia/pty v2.0.0+incompatible/go.mod h1:4y9l9yJZNxRa7GB/fB+mmDmGkG3CqmzLf4vUxGGotEA=
 github.com/zyedidia/tcell v1.4.0 h1:uhAz+bdB3HHlVP2hff3WURkI+pERNwgVfy27oi1Gb2A=
 github.com/zyedidia/tcell v1.4.0/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA=
+github.com/zyedidia/tcell v1.4.1 h1:zLci8cg1SLINjwSePZ1yUWnYOnZXMyr4h+zaOvhu5K8=
+github.com/zyedidia/tcell v1.4.1/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA=
 github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415 h1:752dTQ5OatJ9M5ULK2+9lor+nzyZz+LYDo3WGngg3Rc=
 github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415/go.mod h1:8leT8G0Cm8NoJHdrrKHyR9MirWoF4YW7pZh06B6H+1E=
 golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
index 31fc9f9cb77ff1a33b3ac39149c03445bfa50200..4c40cb99fa4527d8b3db7485771a590bd1a41d0b 100644 (file)
@@ -546,6 +546,8 @@ func SetGlobalOptionNative(option string, nativeValue interface{}) error {
                //      } else {
                //              config.SetAutoTime(0)
                //      }
+       } else if option == "paste" {
+               screen.Screen.SetPaste(nativeValue.(bool))
        } else {
                for _, pl := range config.Plugins {
                        if option == pl.Name {
index b5a2da527f22ca4c3671312ef337688f10e1043f..1f9b57970afc21800e93a9206dfa394afecbb1ff 100644 (file)
@@ -81,7 +81,7 @@ func (t *TermPane) HandleEvent(event tcell.Event) {
                        t.WriteString(event.EscSeq())
                }
        } else if e, ok := event.(*tcell.EventMouse); e != nil && (!ok || t.State.Mode(terminal.ModeMouseMask)) {
-               t.WriteString(event.EscSeq())
+               // t.WriteString(event.EscSeq())
        } else if e != nil {
                x, y := e.Position()
                v := t.GetView()
index b833dd996decd04c91643472ad34a1c87f4830d2..be825a77e8ad995e18c1331e29a1c63f6e84cad9 100644 (file)
@@ -52,6 +52,7 @@
 // runtime/plugins/literate/README.md
 // runtime/plugins/literate/info.json
 // runtime/plugins/literate/literate.lua
+// runtime/plugins/status/status.lua
 // runtime/syntax/LICENSE
 // runtime/syntax/PowerShell.hdr
 // runtime/syntax/PowerShell.yaml
@@ -1422,6 +1423,26 @@ func runtimePluginsLiterateLiterateLua() (*asset, error) {
        return a, nil
 }
 
+var _runtimePluginsStatusStatusLua = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x93\xc1\x4e\xc3\x30\x0c\x86\xef\x7d\x0a\xcb\xa7\x56\xda\xc2\x89\xe3\x0e\x03\xc6\x40\x1c\x40\x6a\x5f\x20\xed\x9c\x35\x52\xeb\x54\x49\x8a\xe0\xc2\xb3\xa3\x24\x9d\x68\x99\x90\x86\x84\xc8\xa5\xb2\xfd\xcb\xfe\xfd\x35\xe9\x75\x63\x0d\x6c\x40\xf7\x83\xb1\x3e\xc7\x18\x63\x91\xd5\xa3\x52\x64\xbf\x17\xae\x52\x1a\x8b\xac\x31\xac\xf4\xf1\xac\x9e\xd2\x58\x64\x99\x1a\xb9\xf1\xda\x30\x68\xd6\x3e\x2f\x32\x00\x80\xa8\x11\x25\xf9\xd2\x4b\x3f\xba\x47\x56\xe6\x9e\x73\x74\x31\x12\xb5\x95\xdc\xb4\x78\x89\xb4\x95\xee\x32\xe1\x20\x9d\x27\x2c\x32\xe2\xc3\xcc\x52\x9a\x94\xd7\xa9\x83\x56\x50\x8b\xea\x7d\x20\xf1\xa4\xf9\x00\x1f\x1b\x48\x5b\x8a\x9b\x2a\x74\x03\xdf\x12\x47\x61\x38\x9d\x69\x64\x07\xae\xa5\xae\x3b\x5b\x3e\x66\x27\x5b\x33\xad\xb7\x9a\x8f\x6e\xa6\x9e\x32\x81\xd2\x52\x9a\x7c\xad\x80\x6c\x20\x1f\xdb\x89\xdd\x1b\x35\xb7\xa6\xef\x25\x1f\x72\x3c\x6a\x8f\x2b\x40\x4b\xaf\xeb\x41\x5a\x47\x21\x58\xaf\x65\x5d\x87\x8c\x25\x15\xe2\x87\xdd\xf6\x6e\x66\x42\xab\xd4\x6e\x03\xac\xbb\xe5\x2e\xe1\x58\xf2\xa3\xe5\x93\x49\x51\x59\xdd\x97\x83\x6c\x28\x4f\x5e\xbe\xfa\x04\x82\xa7\xef\x92\x66\xf8\x19\x3f\xb3\xbc\xfe\x47\x7e\xc1\xc9\xaf\xe9\xb9\xd6\x58\xff\x87\xe0\x82\x89\x4b\xb0\xc5\xab\x39\xe3\x96\x9e\x8e\xd8\x93\xdf\x77\xa6\x96\xdd\xf3\x10\x64\x39\x4e\x57\x78\xe9\x60\x9a\x8e\x2f\xdb\xb2\xda\x01\x66\xf3\x51\xa7\x1a\xc6\x81\x9f\x01\x00\x00\xff\xff\xcf\xbd\xdb\xff\xe1\x03\x00\x00"
+
+func runtimePluginsStatusStatusLuaBytes() ([]byte, error) {
+       return bindataRead(
+               _runtimePluginsStatusStatusLua,
+               "runtime/plugins/status/status.lua",
+       )
+}
+
+func runtimePluginsStatusStatusLua() (*asset, error) {
+       bytes, err := runtimePluginsStatusStatusLuaBytes()
+       if err != nil {
+               return nil, err
+       }
+
+       info := bindataFileInfo{name: "runtime/plugins/status/status.lua", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
+       a := &asset{bytes: bytes, info: info}
+       return a, nil
+}
+
 var _runtimeSyntaxLicense = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x91\x4f\xaf\xe2\x36\x14\xc5\xf7\xfe\x14\x47\x6c\x3a\x23\x45\xaf\x7f\x16\x5d\xbc\x9d\x5f\x62\xc0\x6a\xb0\x91\x63\x86\xd2\x9d\x49\x0c\x71\x15\x6c\x14\x9b\xbe\xe1\xdb\x57\x36\xcc\xbc\x69\x57\x91\xe2\x7b\xcf\x39\xbf\x73\x37\xae\x9f\xc3\x4f\x11\xf1\xee\x93\xf9\x8a\x93\x9b\x6c\x84\x99\x2d\x26\xd7\x5b\x1f\xed\x80\x9b\x1f\xec\x8c\x34\x5a\x6c\xb8\xc6\x82\x7d\xbd\x9a\xb4\x40\xfb\x78\x7e\x25\xa4\x0e\xd7\xfb\xec\xce\x63\xc2\xa7\xfe\x33\x7e\xfb\xe5\xd7\xdf\x5f\xf1\x97\xe9\x47\x33\xdf\x71\xb0\x83\x1b\x9c\xa9\x50\x87\x69\x72\x1e\x7b\x33\xcf\xd6\x57\xb0\x09\x66\x7a\x21\x64\x6b\xe7\x8b\x8b\xd1\x05\x0f\x17\x31\xda\xd9\x1e\xef\x38\xcf\xc6\x27\x3b\x54\x38\xcd\xd6\x22\x9c\x90\xb5\xce\xb6\x42\x0a\x30\xfe\x8e\xab\x9d\x63\xf0\x08\xc7\x64\x9c\x77\xfe\x4c\x0c\xfa\x70\xbd\xe7\xc9\x34\xba\x88\x18\x4e\xe9\x3d\x23\x18\x3f\xc0\xc4\x18\x7a\x67\x92\x1d\x30\x84\xfe\x76\xb1\x3e\x99\x94\xfd\x1e\xa4\x9f\xd2\x68\xc9\xa2\x7b\x6e\x2c\x3e\x17\x93\xc1\x9a\x09\xce\x17\xe6\x6f\x4f\x78\x77\x69\x0c\xb7\x84\xd9\xc6\x34\xbb\x3e\x6b\x54\x70\xbe\x9f\x6e\x43\xce\xf0\xed\x79\x72\x17\xf7\x74\xc8\xeb\xa5\x98\x98\x45\x6f\xd1\x56\x25\x67\x85\x4b\x18\xdc\x29\x7f\x6d\xc1\xba\xde\x8e\x93\x8b\x63\x45\x06\x97\xa5\x8f\xb7\x64\x2b\xc4\xfc\xb3\x54\x5c\x65\x8e\x9f\xc3\x8c\x68\xa7\x29\x2b\x38\x1b\x1f\xac\x1f\xe9\xca\x0c\x52\x20\xd7\x5c\x68\x7a\x56\x54\x7c\xdf\xc7\x70\xf9\x2f\x89\x8b\x38\xdd\x66\xef\xe2\x68\x87\x82\x1b\x10\x43\x71\xfc\xdb\xf6\x29\xab\xe4\xf1\x53\x98\xa6\xf0\xee\xfc\x19\x7d\xf0\x83\xcb\x44\xf1\x95\x10\x3d\x5a\x98\x63\xf8\xc7\x16\x96\xc7\xdd\x7d\x48\xae\x7f\xd4\x5d\x0e\x70\xfd\xb8\xea\xf3\x29\x8e\x66\x9a\x70\xb4\xe4\x51\x98\x1d\x72\xbd\xe6\x07\x9c\x39\xdb\xc7\x64\x7c\x72\x66\xc2\x35\xcc\xc5\xef\xff\x98\x2f\x84\xe8\x35\x43\x27\x97\x7a\x4f\x15\x03\xef\xb0\x55\xf2\x0b\x6f\x58\x83\x05\xed\xc0\xbb\x45\x85\x3d\xd7\x6b\xb9\xd3\xd8\x53\xa5\xa8\xd0\x07\xc8\x25\xa8\x38\xe0\x0f\x2e\x9a\x8a\xb0\x3f\xb7\x8a\x75\x1d\xa4\x02\xdf\x6c\x5b\xce\x9a\x0a\x5c\xd4\xed\xae\xe1\x62\x85\xb7\x9d\x86\x90\x1a\x2d\xdf\x70\xcd\x1a\x68\x89\x6c\xf8\x94\xe2\xac\x83\x5c\x92\x0d\x53\xf5\x9a\x0a\x4d\xdf\x78\xcb\xf5\xa1\xc2\x92\x6b\x91\x35\x97\x52\x81\x62\x4b\x95\xe6\xf5\xae\xa5\x0a\xdb\x9d\xda\xca\x8e\x81\x8a\x06\x42\x0a\x2e\x96\x8a\x8b\x15\xdb\x30\xa1\x5f\x08\x17\x10\x12\xec\x0b\x13\x1a\xdd\x9a\xb6\x6d\xb1\xa2\x3b\xbd\x96\xaa\xe4\xab\xe5\xf6\xa0\xf8\x6a\xad\xb1\x96\x6d\xc3\x54\x87\x37\x86\x96\xd3\xb7\x96\x3d\xac\xc4\x81\xd4\x2d\xe5\x9b\x0a\x0d\xdd\xd0\x15\x2b\x5b\x52\xaf\x99\x2a\x63\xcf\x74\xfb\x35\x2b\xbf\xb8\x00\x15\xa0\xb5\xe6\x52\xe4\x4e\x6a\x29\xb4\xa2\xb5\xae\x88\x96\x4a\x7f\x5f\xdd\xf3\x8e\x55\xa0\x8a\x77\xb9\x90\xa5\x92\x9b\x0a\xb9\x4e\xb9\x2c\x9d\x89\xbc\x27\xd8\x43\x25\x57\x9d\x53\x93\xef\x17\x91\xaa\x50\xec\x3a\xf6\x91\xa5\x61\xb4\xe5\x62\xd5\xe5\xe5\x1f\xcf\xf7\x42\xfe\x0d\x00\x00\xff\xff\x67\x82\x89\x6c\x7d\x04\x00\x00"
 
 func runtimeSyntaxLicenseBytes() ([]byte, error) {
@@ -5922,7 +5943,7 @@ func runtimeSyntaxSwiftYaml() (*asset, error) {
        return a, nil
 }
 
-var _runtimeSyntaxSyntax_checkerGo = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x91\x4f\x6b\xdc\x30\x10\xc5\xcf\xd2\xa7\x98\x15\x04\x64\x70\x65\xf6\x1a\xd8\x5e\x92\x96\x9e\x42\x68\xaf\x85\x45\xb5\x35\xf6\x10\xfd\x59\xf4\x07\x9a\x96\xfd\xee\x45\xf2\xd6\x64\xdb\x3d\x14\x0a\xc6\xd8\xe3\x37\xef\xfd\x9e\x75\xd2\xe3\x8b\x9e\x0d\x38\x4d\x9e\x73\x72\xa7\x10\x33\x48\xce\x04\xba\x2c\x38\x13\x14\x06\x0a\x25\x93\xad\x2f\x29\x47\xf2\x73\x12\x9c\x33\x31\x53\x5e\xca\x37\x35\x06\x37\xfc\x78\x35\x13\x4d\xa4\x07\x47\x63\x0c\xc3\xe8\xa6\xcb\xd3\x42\xf3\x62\x69\x5e\xb2\xe0\x1d\xe7\x58\xfc\xd8\x72\x64\x07\x3f\x39\x43\xb2\x26\xf5\x70\x84\xfb\x03\xac\x11\xea\xb3\xd1\xd3\x23\x45\x29\x94\xe8\x38\x67\x8b\x9e\x3e\xc4\x58\xbf\xa3\xb6\xc9\x70\x86\x21\xc2\xb1\x07\xac\xa3\xa8\xfd\x6c\xa0\x99\x54\x37\x46\x08\x17\x3c\xf5\x49\xa7\x2f\x05\x91\xbe\x4b\x54\x4f\xda\x19\xd9\xf5\x20\xd4\xab\x76\x56\xb4\x64\xc6\xc8\x9f\x4a\xfe\x3b\xfb\x23\x59\xb3\xed\x74\x55\x38\x0c\xe8\xb2\x7a\x8e\xe4\xb3\xf5\x52\x3c\x2c\x66\x7c\x21\x3f\xb7\x5c\x78\xf7\x1e\x44\x0f\x57\xfa\x3a\xef\xc1\xac\xd4\x5b\x7d\xf5\xac\x63\x32\xcd\xbd\x25\x37\x29\x61\xd3\xed\x0e\xe0\xc9\xae\x58\xbf\x1b\x1f\x20\xc7\x62\xda\x64\x8b\x47\x29\x1e\x42\xb1\x13\xf8\x90\xe1\x54\xfd\x36\x88\xbb\x74\xff\xd5\xff\x49\xc2\xde\x82\x9b\x18\xd7\xe1\x18\x7c\x26\xbf\x7a\x9f\xeb\xed\xd8\x68\xf7\x37\x70\x1f\x0d\xca\xb5\x8e\x27\xfb\x86\x78\xff\x3f\xc8\xad\xfe\x0a\x5e\x52\xfd\x91\x37\x42\xef\x52\xf7\x0f\x7d\xf6\xb7\x0b\x9d\x79\xbd\x08\x61\x77\x01\xab\x94\x57\x67\xf8\x14\x80\x52\x2a\x26\x01\x86\xe2\xa7\x9d\xe8\xea\xca\x99\xff\x0a\x00\x00\xff\xff\x81\x30\x89\xf2\x0a\x03\x00\x00"
+var _runtimeSyntaxSyntax_checkerGo = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x91\x4f\x8b\xdb\x30\x14\xc4\xcf\xd2\xa7\x78\x11\x2c\xc8\xe0\xca\xe4\xba\x90\x5e\x76\x5b\x7a\x5a\x96\xf6\x5a\x08\xaa\xad\x67\x3f\x56\x96\x8c\xfe\x40\xd3\x92\xef\x5e\x24\xa7\x26\x69\x73\x28\x14\x8c\xc1\xe3\xd1\xcc\x6f\xec\x45\xf7\x6f\x7a\x34\x30\x6b\x72\x9c\xd3\xbc\xf8\x90\x40\x72\x26\x70\x4e\x82\x33\x41\xbe\x23\x9f\x13\xd9\xf2\x10\x53\x20\x37\x46\xc1\x39\x13\x23\xa5\x29\x7f\x53\xbd\x9f\xbb\x1f\x27\x33\xd0\x40\xba\x9b\x68\x9c\x2c\x8d\x53\x12\xbc\xe1\x1c\xb3\xeb\x6b\xae\x6c\xe0\x27\x67\x48\xd6\xc4\x16\x8e\xf0\x78\x80\x35\x52\x7d\x36\x7a\x78\xa6\x20\x85\x12\x0d\xe7\x6c\xd2\xc3\x87\x10\xca\x7b\xd4\x36\x1a\xce\xd0\x07\x38\xb6\x80\x45\x0a\xda\x8d\x06\x6a\x48\x49\x63\x84\x70\xc1\x51\x9f\x74\xfc\x92\x11\xe9\xbb\x44\xf5\xa2\x67\x23\x9b\x16\x84\x3a\xe9\xd9\x8a\xda\xcc\x18\xb9\x25\xa7\xbf\xbb\x3f\x92\x35\xdb\x99\xa6\x18\xbb\x0e\xe7\xa4\x5e\x03\xb9\x64\x9d\x14\x4f\x93\xe9\xdf\xc8\x8d\xb5\x17\xde\xbd\x07\xd1\xc2\x8d\xbf\xe8\x2d\x98\x95\x7a\x9b\xaf\x5e\x75\x88\xa6\xa6\xd7\xe6\x6a\x25\xac\xbe\xdd\x01\x1c\xd9\x15\xeb\xf7\xe2\x03\xa4\x90\x4d\x55\xb6\x7a\x94\xe2\xc9\x67\x3b\x80\xf3\x09\x96\x92\xb7\x41\x3c\xc4\xc7\xaf\xee\x4f\x12\x76\x0d\x6e\x42\x58\xc5\xde\xbb\x44\x6e\xcd\x3e\x97\xdb\xb1\xd2\xee\xef\xe0\x3e\x1b\x94\xeb\x1c\x47\xf6\x8a\x78\xff\x3f\xc8\x75\xfe\x0a\x9e\x63\xf9\x90\x77\x4a\x1f\x62\xf3\x0f\x7b\xf6\xf7\x07\x9d\x79\xb9\x08\x61\x77\x01\x2b\x94\x37\xff\xf0\xc5\x03\xc5\x98\x4d\x04\xf4\xd9\x0d\x3b\xd1\x94\x23\x67\xfe\x2b\x00\x00\xff\xff\xb6\x23\x71\x5f\xfa\x02\x00\x00"
 
 func runtimeSyntaxSyntax_checkerGoBytes() ([]byte, error) {
        return bindataRead(
@@ -6786,6 +6807,7 @@ var _bindata = map[string]func() (*asset, error){
        "runtime/plugins/literate/README.md":                      runtimePluginsLiterateReadmeMd,
        "runtime/plugins/literate/info.json":                      runtimePluginsLiterateInfoJson,
        "runtime/plugins/literate/literate.lua":                   runtimePluginsLiterateLiterateLua,
+       "runtime/plugins/status/status.lua":                       runtimePluginsStatusStatusLua,
        "runtime/syntax/LICENSE":                                  runtimeSyntaxLicense,
        "runtime/syntax/PowerShell.hdr":                           runtimeSyntaxPowershellHdr,
        "runtime/syntax/PowerShell.yaml":                          runtimeSyntaxPowershellYaml,
@@ -7162,6 +7184,9 @@ var _bintree = &bintree{nil, map[string]*bintree{
                                "info.json":    &bintree{runtimePluginsLiterateInfoJson, map[string]*bintree{}},
                                "literate.lua": &bintree{runtimePluginsLiterateLiterateLua, map[string]*bintree{}},
                        }},
+                       "status": &bintree{nil, map[string]*bintree{
+                               "status.lua": &bintree{runtimePluginsStatusStatusLua, map[string]*bintree{}},
+                       }},
                }},
                "syntax": &bintree{nil, map[string]*bintree{
                        "LICENSE":                 &bintree{runtimeSyntaxLicense, map[string]*bintree{}},
index f73d87517f73b5d6c6e142fa90fe8ac8b1ef106a..c85340de6123e57a6e80f36d2258c54b8ef21668 100644 (file)
@@ -218,9 +218,9 @@ var defaultGlobalSettings = map[string]interface{}{
        "infobar":     true,
        "keymenu":     false,
        "mouse":       true,
+       "paste":       false,
        "savehistory": true,
        "sucmd":       "sudo",
-       "termtitle":   false,
 }
 
 // DefaultGlobalSettings returns the default global settings for micro
diff --git a/runtime/plugins/status/status.lua b/runtime/plugins/status/status.lua
new file mode 100644 (file)
index 0000000..b1092ce
--- /dev/null
@@ -0,0 +1,40 @@
+micro = import("micro")
+buffer = import("micro/buffer")
+config = import("micro/config")
+
+function init()
+    micro.SetStatusInfoFn("status.branch")
+    micro.SetStatusInfoFn("status.hash")
+    micro.SetStatusInfoFn("status.paste")
+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)
+        end
+    end
+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)
+        end
+    end
+end
+
+function paste(b)
+    if config.GetGlobalOption("paste") then
+        return "PASTE "
+    end
+    return ""
+end