mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-16 05:47:06 +09:00
Add shell command support
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/zyedidia/micro/cmd/micro/buffer"
|
||||
"github.com/zyedidia/micro/cmd/micro/config"
|
||||
"github.com/zyedidia/micro/cmd/micro/screen"
|
||||
"github.com/zyedidia/micro/cmd/micro/shell"
|
||||
"github.com/zyedidia/micro/cmd/micro/util"
|
||||
"github.com/zyedidia/tcell"
|
||||
)
|
||||
@@ -370,16 +371,6 @@ func (h *BufHandler) SelectToEnd() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// InsertSpace inserts a space
|
||||
func (h *BufHandler) InsertSpace() bool {
|
||||
if h.Cursor.HasSelection() {
|
||||
h.Cursor.DeleteSelection()
|
||||
h.Cursor.ResetSelection()
|
||||
}
|
||||
h.Buf.Insert(h.Cursor.Loc, " ")
|
||||
return true
|
||||
}
|
||||
|
||||
// InsertNewline inserts a newline plus possible some whitespace if autoindent is on
|
||||
func (h *BufHandler) InsertNewline() bool {
|
||||
if h.Buf.Type == buffer.BTInfo {
|
||||
@@ -984,6 +975,13 @@ func (h *BufHandler) ToggleKeyMenu() bool {
|
||||
|
||||
// ShellMode opens a terminal to run a shell command
|
||||
func (h *BufHandler) ShellMode() bool {
|
||||
InfoBar.Prompt("$ ", "", "Shell", nil, func(resp string, canceled bool) {
|
||||
if !canceled {
|
||||
// The true here is for openTerm to make the command interactive
|
||||
shell.RunInteractiveShell(resp, true, false)
|
||||
}
|
||||
})
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user