Add SaveAll command and display + for modified tabs

Closes #651
This commit is contained in:
Zachary Yedidia 2017-05-05 11:05:23 -04:00
parent 8d1618692e
commit a6ee75a9cf
5 changed files with 27 additions and 3 deletions

View file

@ -705,6 +705,24 @@ func (v *View) InsertTab(usePlugin bool) bool {
return true
}
// SaveAll saves all open buffers
func (v *View) SaveAll(usePlugin bool) bool {
if usePlugin && !PreActionCall("SaveAll", v) {
return false
}
for _, t := range tabs {
for _, v := range t.views {
v.Save(false)
}
}
if usePlugin {
return PostActionCall("SaveAll", v)
}
return false
}
// Save the buffer to disk
func (v *View) Save(usePlugin bool) bool {
if usePlugin && !PreActionCall("Save", v) {

View file

@ -41,6 +41,7 @@ var bindingActions = map[string]func(*View, bool) bool{
"Delete": (*View).Delete,
"InsertTab": (*View).InsertTab,
"Save": (*View).Save,
"SaveAll": (*View).SaveAll,
"SaveAs": (*View).SaveAs,
"Find": (*View).Find,
"FindNext": (*View).FindNext,

File diff suppressed because one or more lines are too long

View file

@ -89,13 +89,17 @@ func TabbarString() (string, map[int]int) {
} else {
str += " "
}
str += t.views[t.CurView].Buf.GetName()
buf := t.views[t.CurView].Buf
str += buf.GetName()
if buf.IsModified {
str += " +"
}
if i == curTab {
str += "]"
} else {
str += " "
}
indicies[len(str)-1] = i + 1
indicies[Count(str)-1] = i + 1
str += " "
}
return str, indicies

View file

@ -88,6 +88,7 @@ Delete
Center
InsertTab
Save
SaveAll
SaveAs
Find
FindNext