in src/pathpicker/output.py [0:0]
def join_files_into_command(files_and_line_numbers: List[Tuple[str, int]]) -> str:
editor, editor_path = get_editor_and_path()
cmd = editor_path + " "
if editor == "vim -p":
first_file_path, first_line_num = files_and_line_numbers[0]
cmd += f" +{first_line_num} {first_file_path}"
for (file_path, line_num) in files_and_line_numbers[1:]:
cmd += f' +"tabnew +{line_num} {file_path}"'
elif editor in ["vim", "mvim", "nvim"] and not os.environ.get("FPP_DISABLE_SPLIT"):
first_file_path, first_line_num = files_and_line_numbers[0]
cmd += f" +{first_line_num} {first_file_path}"
for (file_path, line_num) in files_and_line_numbers[1:]:
cmd += f' +"vsp +{line_num} {file_path}"'
else:
for (file_path, line_num) in files_and_line_numbers:
editor_without_args = editor.split()[0]
if (
editor_without_args
in ["vi", "nvim", "nano", "joe", "emacs", "emacsclient", "micro"]
and line_num != 0
):
cmd += f" +{line_num} '{file_path}'"
elif editor_without_args in ["subl", "sublime", "atom"] and line_num != 0:
cmd += f" '{file_path}:{line_num}'"
elif line_num != 0 and os.environ.get("FPP_LINENUM_SEP"):
cmd += f" '{file_path}{os.environ.get('FPP_LINENUM_SEP')}{line_num}'"
else:
cmd += f" '{file_path}'"
return cmd