diff --git a/src/cmd_line.rs b/src/cmd_line.rs index c350d79..6b94c39 100644 --- a/src/cmd_line.rs +++ b/src/cmd_line.rs @@ -170,12 +170,17 @@ pub fn handle_command_line_arguments(args: Vec) -> Result<(), String> { neovim_args.push("-p".to_owned()); } - neovim_args.extend::>( - files_to_open - .iter() - .map(|file| file.replace(" ", "\\ ")) - .collect(), - ); + if cfg!(target_os = "macos") { + // escape filepath which contain spaces + neovim_args.extend::>( + files_to_open + .iter() + .map(|file| file.replace(" ", "\\ ")) + .collect(), + ); + } else { + neovim_args.extend::>(files_to_open); + } /* * Integrate Environment Variables as Defaults to the command-line ones.