Skip to content

config.buffer_editor "The system cannot find the file specified." #8714

Closed

Description

@JABirchall

Question

How do I get nushell to use sublime text 3 for editing files with a space in the path?
It stops parsing on the first space and tries executing c:/program

Additional context and details

~> config nu                                                                                      04/02/2023 06:37:50 pm
Error: nu::shell::external_command

  × External command failed
   ╭─[entry #1:1:1]
 1 │ config nu
   · ────┬────
   ·     ╰── executable 'c:/program' was not found
   ╰────
  help: The system cannot find the file specified. (os error 2)

~> $env.config.buffer_editor                                                                      04/02/2023 06:37:53 pm
C:/Program Files/Sublime Text 3/subl.exe

Activity

  1. added
    deprecated:question
    on Apr 2, 2023
  2. added
    category:bug
    and removed
    deprecated:question
    on Apr 2, 2023
  3. sholderbach commented on Apr 2, 2023

    @sholderbach
    Member

    How does your config.buffer_editor config line look like?

    Since #8105 we support the addition of flags in the EDITOR/VISUAL environment variable which includes splitting by space. Apparently the same is true for $config.buffer_editor

  4. added
    A:configuration
    on Apr 2, 2023
  5. JABirchall commented on Apr 2, 2023

    @JABirchall
    Author

    How does your config.buffer_editor config line look like?

    buffer_editor: 'C:/Program Files/Sublime Text 3/subl.exe'

    The rest of the config is default.

  6. fdncred commented on Apr 2, 2023

    @fdncred
    Contributor

    I thought you had to use backtick quotes for spaces in folder name like this:

    buffer_editor: `C:\Program Files\Sublime Text3\subl.exe`
    

    Does that work for you?

  7. JABirchall commented on Apr 2, 2023

    @JABirchall
    Author

    I thought you had to use backtick quotes for spaces in folder name like this:

    buffer_editor: `C:\Program Files\Sublime Text3\subl.exe`
    

    Does that work for you?

    That still results in the same error. I've tried double quotes, single quotes, backtick and backtick inside double quotes.

    The only one which gives different error, is backticks inside double quotes

      buffer_editor: "`C:/Program Files/Sublime Text 3/subl.exe`" 
    

    gives

    ~> config nu                                                                                      04/02/2023 08:11:54 pm
    Error: nu::shell::external_command
    
      × External command failed
       ╭─[entry #1:1:1]
     1 │ config nu
       · ────┬────
       ·     ╰── can't run executable
       ╰────
      help: The filename, directory name, or volume label syntax is incorrect. (os error 123)
    
    
  8. sholderbach commented on Apr 2, 2023

    @sholderbach
    Member

    Yeah I think we need to rethink the solution to #8051 from #8105

  9. JABirchall commented on Apr 2, 2023

    @JABirchall
    Author

    Also traditional methods dont work such as escaping the space

      buffer_editor: "C:/Program\ Files/Sublime\ Text\ 3/subl.exe"
    

    this just results in a config error

    Error:
      × Invalid literal
         ╭─[C:\Users\owner\AppData\Roaming\nushell\config.nu:282:1]
     282 │   float_precision: 2 # the precision for displaying floats in tables
     283 │   buffer_editor: "C:/Program\ Files/Sublime\ Text\ 3/subl.exe" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
         ·                              ────────────────┬────────────────
         ·                                              ╰── unrecognized escape after '\' in string
         ╰────
    

    Backticks with escaped spaces gives different error

      buffer_editor: `C:/Program\ Files/Sublime\ Text\ 3/subl.exe`
    
    ~> config nu                                                                                      04/02/2023 08:20:20 pm
    Error: nu::shell::external_command
    
      × External command failed
       ╭─[entry #1:1:1]
     1 │ config nu
       · ────┬────
       ·     ╰── can't run executable
       ╰────
      help: program path has no file name
    
  10. fdncred commented on Apr 2, 2023

    @fdncred
    Contributor

    @JABirchall, I agree with @sholderbach, that our accepted solution probably needs a rethink.

    However, even though this is a total hack, it may get you going. You could try to use Windows' short filenames like 'c:\progra~1\blah. You just need to do a dir /x from cmd.exe to see what they are for your path https://manjusullad.wordpress.com/2016/01/06/how-can-i-find-create-short-path-for-windows-folders-directories/

  11. added
    category:regression
    on Apr 2, 2023
  12. JABirchall commented on Apr 2, 2023

    @JABirchall
    Author

    @JABirchall, I agree with @sholderbach, that our accepted solution probably needs a rethink.

    However, even though this is a total hack, it may get you going. You could try to use Windows' short filenames like 'c:\progra~1\blah. You just need to do a dir /x from cmd.exe to see what they are for your path https://manjusullad.wordpress.com/2016/01/06/how-can-i-find-create-short-path-for-windows-folders-directories/

    Thanks, I didnt know windows did this.

    This works

    ~> config nu                                                                                      04/02/2023 08:27:19 pm
    ~> ls C:/PROGRA~1/SUBLIM~1/subl.exe                                                               04/02/2023 08:27:21 pm
    ╭───┬──────────────────────────────────────────┬──────┬────────┬─────────────╮
    │ # │                   name                   │ type │  size  │  modified   │
    ├───┼──────────────────────────────────────────┼──────┼────────┼─────────────┤
    │ 0 │ C:\Program Files\Sublime Text 3\subl.exe │ file │ 2.7 MB │ a month ago │
    ╰───┴──────────────────────────────────────────┴──────┴────────┴─────────────╯
    
  13. added a commit that references this issue on Sep 29, 2023
    80a183d
  14. added this to the v0.86.0 milestone on Sep 29, 2023
  15. added a commit that references this issue on Dec 14, 2023
    71e7d1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:configurationcategory:bugcategory:regressiongood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions