@@ -513,74 +513,69 @@ func (h *BufPane) NewTabCmd(args []string) {
513513}
514514
515515func SetGlobalOptionNative (option string , nativeValue interface {}) error {
516- local := false
516+ // check for local option first...
517517 for _ , s := range config .LocalSettings {
518518 if s == option {
519- local = true
520- break
519+ MainTab (). CurPane (). Buf . SetOptionNative ( option , nativeValue )
520+ return nil
521521 }
522522 }
523523
524- if ! local {
525- config .GlobalSettings [option ] = nativeValue
526- config .ModifiedSettings [option ] = true
527- delete (config .VolatileSettings , option )
524+ // ... if it's not local continue with the globals
525+ config .GlobalSettings [option ] = nativeValue
526+ config .ModifiedSettings [option ] = true
527+ delete (config .VolatileSettings , option )
528528
529- if option == "colorscheme" {
530- // LoadSyntaxFiles()
531- config .InitColorscheme ()
532- for _ , b := range buffer .OpenBuffers {
533- b .UpdateRules ()
534- }
535- } else if option == "infobar" || option == "keymenu" {
536- Tabs .Resize ()
537- } else if option == "mouse" {
538- if ! nativeValue .(bool ) {
539- screen .Screen .DisableMouse ()
540- } else {
541- screen .Screen .EnableMouse ()
542- }
543- } else if option == "autosave" {
544- if nativeValue .(float64 ) > 0 {
545- config .SetAutoTime (int (nativeValue .(float64 )))
546- config .StartAutoSave ()
547- } else {
548- config .SetAutoTime (0 )
549- }
550- } else if option == "paste" {
551- screen .Screen .SetPaste (nativeValue .(bool ))
552- } else if option == "clipboard" {
553- m := clipboard .SetMethod (nativeValue .(string ))
554- err := clipboard .Initialize (m )
555- if err != nil {
556- return err
557- }
529+ if option == "colorscheme" {
530+ // LoadSyntaxFiles()
531+ config .InitColorscheme ()
532+ for _ , b := range buffer .OpenBuffers {
533+ b .UpdateRules ()
534+ }
535+ } else if option == "infobar" || option == "keymenu" {
536+ Tabs .Resize ()
537+ } else if option == "mouse" {
538+ if ! nativeValue .(bool ) {
539+ screen .Screen .DisableMouse ()
540+ } else {
541+ screen .Screen .EnableMouse ()
542+ }
543+ } else if option == "autosave" {
544+ if nativeValue .(float64 ) > 0 {
545+ config .SetAutoTime (int (nativeValue .(float64 )))
546+ config .StartAutoSave ()
558547 } else {
559- for _ , pl := range config .Plugins {
560- if option == pl .Name {
561- if nativeValue .(bool ) && ! pl .Loaded {
562- pl .Load ()
563- _ , err := pl .Call ("init" )
564- if err != nil && err != config .ErrNoSuchFunction {
565- screen .TermMessage (err )
566- }
567- } else if ! nativeValue .(bool ) && pl .Loaded {
568- _ , err := pl .Call ("deinit" )
569- if err != nil && err != config .ErrNoSuchFunction {
570- screen .TermMessage (err )
571- }
548+ config .SetAutoTime (0 )
549+ }
550+ } else if option == "paste" {
551+ screen .Screen .SetPaste (nativeValue .(bool ))
552+ } else if option == "clipboard" {
553+ m := clipboard .SetMethod (nativeValue .(string ))
554+ err := clipboard .Initialize (m )
555+ if err != nil {
556+ return err
557+ }
558+ } else {
559+ for _ , pl := range config .Plugins {
560+ if option == pl .Name {
561+ if nativeValue .(bool ) && ! pl .Loaded {
562+ pl .Load ()
563+ _ , err := pl .Call ("init" )
564+ if err != nil && err != config .ErrNoSuchFunction {
565+ screen .TermMessage (err )
566+ }
567+ } else if ! nativeValue .(bool ) && pl .Loaded {
568+ _ , err := pl .Call ("deinit" )
569+ if err != nil && err != config .ErrNoSuchFunction {
570+ screen .TermMessage (err )
572571 }
573572 }
574573 }
575574 }
576575 }
577576
578- if local {
579- MainTab ().CurPane ().Buf .SetOptionNative (option , nativeValue )
580- } else {
581- for _ , b := range buffer .OpenBuffers {
582- b .SetOptionNative (option , nativeValue )
583- }
577+ for _ , b := range buffer .OpenBuffers {
578+ b .SetOptionNative (option , nativeValue )
584579 }
585580
586581 return config .WriteSettings (filepath .Join (config .ConfigDir , "settings.json" ))
0 commit comments