mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Add reopen cmd and other encodings support
This commit is contained in:
@@ -48,6 +48,7 @@ func InitCommands() {
|
||||
"togglelog": Command{(*BufPane).ToggleLogCmd, nil},
|
||||
"plugin": Command{(*BufPane).PluginCmd, nil},
|
||||
"reload": Command{(*BufPane).ReloadCmd, nil},
|
||||
"reopen": Command{(*BufPane).ReopenCmd, nil},
|
||||
"cd": Command{(*BufPane).CdCmd, buffer.FileComplete},
|
||||
"pwd": Command{(*BufPane).PwdCmd, nil},
|
||||
"open": Command{(*BufPane).OpenCmd, buffer.FileComplete},
|
||||
@@ -234,6 +235,22 @@ func (h *BufPane) ToggleLogCmd(args []string) {
|
||||
func (h *BufPane) ReloadCmd(args []string) {
|
||||
}
|
||||
|
||||
// ReopenCmd reopens the buffer (reload from disk)
|
||||
func (h *BufPane) ReopenCmd(args []string) {
|
||||
if h.Buf.Modified() {
|
||||
InfoBar.YNPrompt("Save file before reopen?", func(yes, canceled bool) {
|
||||
if !canceled && yes {
|
||||
h.Save()
|
||||
h.Buf.ReOpen()
|
||||
} else if !canceled {
|
||||
h.Buf.ReOpen()
|
||||
}
|
||||
})
|
||||
} else {
|
||||
h.Buf.ReOpen()
|
||||
}
|
||||
}
|
||||
|
||||
func (h *BufPane) openHelp(page string) error {
|
||||
if data, err := config.FindRuntimeFile(config.RTHelp, page).Data(); err != nil {
|
||||
return errors.New(fmt.Sprint("Unable to load help text", page, "\n", err))
|
||||
|
||||
@@ -2,7 +2,6 @@ package action
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"log"
|
||||
|
||||
"github.com/zyedidia/micro/cmd/micro/display"
|
||||
"github.com/zyedidia/micro/cmd/micro/info"
|
||||
@@ -184,7 +183,6 @@ func (h *InfoPane) InsertTab() {
|
||||
}
|
||||
}
|
||||
}
|
||||
log.Println(ins, suggestions)
|
||||
|
||||
if len(suggestions) == 1 {
|
||||
b.Insert(c.Loc, ins)
|
||||
|
||||
Reference in New Issue
Block a user