screen.Init()
- action.InitBindings()
- action.InitCommands()
-
- err = config.InitColorscheme()
- if err != nil {
- screen.TermMessage(err)
- }
-
- err = config.LoadAllPlugins()
- if err != nil {
- screen.TermMessage(err)
- }
- err = config.RunPluginFn("init")
- if err != nil {
- screen.TermMessage(err)
- }
-
// If we have an error, we can exit cleanly and not completely
// mess up the terminal being worked in
// In other words we need to shut down tcell before the program crashes
}
}()
+ action.InitBindings()
+ action.InitCommands()
+
+ err = config.InitColorscheme()
+ if err != nil {
+ screen.TermMessage(err)
+ }
+
+ err = config.LoadAllPlugins()
+ if err != nil {
+ screen.TermMessage(err)
+ }
+ err = config.RunPluginFn("init")
+ if err != nil {
+ screen.TermMessage(err)
+ }
+
b := LoadInput()
if len(b) == 0 {
} else {
screen.Screen.EnableMouse()
}
+ // autosave option has been removed
// } else if option == "autosave" {
// if nativeValue.(float64) > 0 {
// config.SetAutoTime(int(nativeValue.(float64)))
if option == pl.Name {
if nativeValue.(bool) && !pl.Loaded {
pl.Load()
- pl.Call("init")
+ _, err := pl.Call("init")
+ if err != nil && err != config.ErrNoSuchFunction {
+ screen.TermMessage(err)
+ }
} else if !nativeValue.(bool) && pl.Loaded {
- pl.Call("deinit")
+ _, err := pl.Call("deinit")
+ if err != nil && err != config.ErrNoSuchFunction {
+ screen.TermMessage(err)
+ }
}
}
}
// Backup saves the current buffer to ConfigDir/backups
func (b *Buffer) Backup(checkTime bool) error {
- if !b.Settings["backup"].(bool) || b.Path == "" {
+ if !b.Settings["backup"].(bool) || b.Path == "" || b.Type != BTDefault {
return nil
}
// RemoveBackup removes any backup file associated with this buffer
func (b *Buffer) RemoveBackup() {
- if !b.Settings["backup"].(bool) || b.Path == "" {
+ if !b.Settings["backup"].(bool) || b.Path == "" || b.Type != BTDefault {
return
}
f := config.ConfigDir + "/backups/" + util.EscapePath(b.AbsPath)
// ApplyBackup applies the corresponding backup file to this buffer (if one exists)
// Returns true if a backup was applied
func (b *Buffer) ApplyBackup(fsize int64) bool {
- if b.Settings["backup"].(bool) && len(b.Path) > 0 {
+ if b.Settings["backup"].(bool) && len(b.Path) > 0 && b.Type == BTDefault {
backupfile := config.ConfigDir + "/backups/" + util.EscapePath(b.AbsPath)
if info, err := os.Stat(backupfile); err == nil {
backup, err := os.Open(backupfile)
if !b.Type.Syntax {
return
}
- syntaxFile := ""
ft := b.Settings["filetype"].(string)
+ if ft == "off" {
+ return
+ }
+ syntaxFile := ""
var header *highlight.Header
for _, f := range config.ListRuntimeFiles(config.RTSyntaxHeader) {
data, err := f.Data()