Commit 2808d8e4ea

2808d8e4eadb2b2dfe69dd2c3cc2f4138c786000

parent: 197c59703c

Unsigned

Wraient <wraient.911@gmail.com> · 2024-12-18 16:23 UTC

fix: Edit config for windows

Layout: unified · split

internal/curd.go +11 −2
@@ -34,8 +34,17 @@ func EditConfig(configFilePath string) {
34 // Get the user's preferred editor from the EDITOR environment variable 34 // Get the user's preferred editor from the EDITOR environment variable
35 editor := os.Getenv("EDITOR") 35 editor := os.Getenv("EDITOR")
36 if editor == "" { 36 if editor == "" {
37 // If EDITOR is not set, default to "vim" 37 // If EDITOR is not set, use system-specific defaults
38 editor = "vim" 38 if runtime.GOOS == "windows" {
39 // Try Notepad++ first
40 if _, err := exec.LookPath("notepad++"); err == nil {
41 editor = "notepad++"
42 } else {
43 editor = "notepad.exe"
44 }
45 } else {
46 editor = "vim"
47 }
39 } 48 }
40 49
41 // Construct the command to open the config file 50 // Construct the command to open the config file