Add reset command and statusline format string options

This commit is contained in:
Zachary Yedidia
2019-06-16 17:35:00 -04:00
parent 8d85cae4c0
commit 809b95d290
8 changed files with 88 additions and 81 deletions

View File

@@ -108,9 +108,6 @@ type Buffer struct {
CurSuggestion int
Messages []*Message
StatusFormatLeft string
StatusFormatRight string
}
// NewBufferFromFile opens a new buffer using the given path
@@ -244,25 +241,11 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
screen.TermMessage(err)
}
b.SetStatusFormat()
OpenBuffers = append(OpenBuffers, b)
return b
}
// SetStatusFormat will correctly set the format string for the
// status line
func (b *Buffer) SetStatusFormat() {
if b.Settings["hidehelp"].(bool) {
b.StatusFormatLeft = "$(filename) $(modified)($(line),$(col)) $(opt:filetype) $(opt:fileformat) $(opt:encoding)"
b.StatusFormatRight = ""
} else {
b.StatusFormatLeft = "$(filename) $(modified)($(line),$(col)) $(opt:filetype) $(opt:fileformat) $(opt:encoding)"
b.StatusFormatRight = "$(bind:ToggleKeyMenu): show bindings, $(bind:ToggleHelp): toggle help"
}
}
// Close removes this buffer from the list of open buffers
func (b *Buffer) Close() {
for i, buf := range OpenBuffers {