Differences
This shows you the differences between the selected revisions of the page.
task_edit 2005-03-02 | task_edit 2023-03-08 (current) | ||
Line 1: | Line 1: | ||
====== Editing/Opening Files ====== | ====== Editing/Opening Files ====== | ||
- | WinSCP allows you to edit/open remote file using editor or associated application on local machine. To do so it needs to download the remote file to [[temp_folder|temporary directory]] first. Then it opens the file in your preferred editor or associated application. Once you change the file it uploads it back. With [[ui_commander|Norton Commander interface]] you can even edit/open local files, but most of this chapter covers editing remote files only. | + | WinSCP allows you to edit/open remote file using editor or associated application on local machine. To do so it needs to download the remote file to [[temp_folders|temporary directory]] first. Then it opens the file in your preferred editor or associated application. Once you change the file, WinSCP uploads it back. With [[ui_commander|Commander interface]] you can even edit/open local files, but most of this chapter covers editing remote files only. |
- | To edit file selected in panel go to //File(s) > Edit//. The command by default opens the file is an internal editor. Command //File(s) > Edit (alternative)// by default opens the file as external editor (Notepad). You can swap the meaning of the commands or change the external editor in [[ui_pref_editor|preferences]]. | + | To edit file selected in panel go to //Files > Edit//. The command by default opens the file in an [[ui_editor|internal editor]]. You can make the command open the file in any external editor in [[ui_pref_editor|preferences]]. From submenu //Files > Edit (alternative)// you can open the file in any of configured editors, or even ad hoc editor (//Edit With//). By default the file is also opened in editor when double-clicked((If resolving of symbolic links is disabled or not possible, double-clicking file is always interpreted as attempt to enter it, just in case it is unresolved symbolic link to a directory.)) (this can be changed in [[ui_pref_panels#double-click|preferences]]). |
- | You can create new empty file using command //File(s) > Edit New File//. The command asks for name of the new file and then opens your default editor. | + | You can create new empty file using command //Files > New > File//. The command asks for name of the new file and then opens your default editor. Note that you can use the command also to open an existing file by typing in its path to avoid need to navigate first to its location. You can also open an existing file this way, or even multiple files by separating their paths with semicolon ('';''). |
- | To open file in an associated application use //File(s) > Open//. You can also double-click the file or press ''Enter'' (unless //[[ui_pref_environment#confirmations|Copy files using double-click]]// option is enabled). | + | To open selected file in an associated application use //Files > Open//. This way you do not need to configure external editor for each file type. However you will not be able to set an additional options. |
- | ===== Editing Modes ===== | + | Editing and opening of files can be [[administration|restricted by system administrator]]. |
- | WinSCP has two modes to manage the edited/opened remote files. The mode can be selected in [[ui_pref_editor|preferences]]. | + | |
- | ==== Mulptiple Files Mode ==== | + | Especially when the files are opened in an external editor, user can easily change two files at once. For this reason WinSCP must upload the files back using [[transfer_queue|background transfer/queue]] to allow several uploads at once. |
- | With //Multiple files// mode (the default), WinSCP can handle several edited/opened remote files at once.· | + | |
- | Especially when the files are opened in an external editor, user can easily change two files at once. For the reason WinSCP must upload the files using [[transfer_queue|background transfer/queue]] to allow several downloads at once. | + | ===== [[external_editors]] External Editors ===== |
+ | For basic editing WinSCP offers a simple [[ui_editor|integrated text editor]]. For advanced editing you will probably want to [[ui_pref_editor|configure your favorite editor]]. | ||
- | ==== One File Mode ==== | + | ==== [[mdi]] Opening More Files in a Single Editor Instance ==== |
- | With //One file// mode, WinSCP can handle only one edited/opened remote file at once.· | + | Some external editors can open multiple files in one process. Usually such editors have some kind of tabbed interface, but it is also the case of Microsoft Word. |
- | With this mode the WinSCP window is locked as long as the file (or rather the editor/associated application) is opened. Modified files are upload back using the main connection. Only once the upload is finished you can continue using the main windows for other tasks. | + | If such an editor is already running and WinSCP runs a second instance to open a new file, then the second instance just notifies the first to open the new file and exits immediately. |
- | ===== External Editors ===== | + | To allow using this kind of editor, WinSCP does not treat the file as closed when the editor launched to open it is closed. |
- | For basic editing WinSCP offers simple integrated text editor. For advanced editing you will probably want to [[ui_pref_editor|configure your favourite editor]]. | + | |
- | ==== Problems with Some External Editors ==== | + | If you choose to edit the same file again during the same session, WinSCP will download it to the same temporary directory as before, allowing the external editor to reload the file content in case it still has it opened (assuming the editor can detect the change). |
- | Some external editors can open multiple file in one process. Usually such editors have some kind of tabbed interface, but it is also case of new versions of Microsoft Word (2000 and XP). | + | |
- | If such editor is already running and the WinSCP runs second instance to open new file, the second instance just notifies the first to open the new file and exits immediately. Hence WinSCP expects that the file was closed as well and tries to delete the temporary file.· | + | One drawback of this approach is that all of the files ever edited by the current instance of WinSCP are kept in a [[temp_folders|temporary directory]] (until WinSCP is closed). WinSCP watches for changes to them all. |
- | To allow WinSCP use this kind of editors, you need to select //Multiple files// mode and enable preference option //[[ui_pref_editor|External editor opens multiple files in one window (process)]]//. Then WinSCP will not treat the file as closed when the editor launched to open it is closed. Drawback is that all the files ever edited by current instance of WinSCP will be kept in [[temp_folder|temporary directory]] and WinSCP will need to watch for changes of them all. | + | If you want to avoid that, you need to make sure that your editor opens each file in a separate window (process). Some editors do that by default while some offer a configuration option for that (see below). If either is the case, then configure your editor as an external editor for WinSCP and enable preference option //[[ui_editor_preferences#external|External editor opens each file in separate window (process)]]//. WinSCP will then treat the file as closed when the editor launched to open it is closed. Note that this setting only affects the "edit" operation. So you may want to make sure that editing is the [[ui_pref_panels#double-click|default operation for double-click]]. |
- | Note that WinSCP can heuristically detect that you need to enable the option //External editor opens multiple files in one window (process)// and offers you to do so. | + | Learn how to select between opening files in a separate or the same window for some [[integration_editor|popular editors]]. |
- | If you want to both keep the standard WinSCP bahaviour and use your preferred editor, you may check if your editor offers you option to open separate instance for each edited file. Some editors have such option: | + | ===== [[binary]] Editing Binary Files ===== |
- | * UltraEdit: //Advanced > Configuration > General > General Application Items > Allow multiple instances// | + | The [[ui_editor|internal editor]] supports only Windows-format text files. Thus the [[transfer_mode|text transfer mode]] is forced when transferring remote file to/from the internal editor. |
- | * PSPad: //Settings > Program Settings > System Integration > Only One Program Instance// | + | |
- | * Crimson Editor: //Tools > Preferences > General > Allow Multiple Instances// | + | If you want to edit binary files you need to use [[#external_editors|external editor]] that supports binary files (and make sure preference option //[[ui_editor_preferences#external|Force text transfer mode for files edited in external editor]]// is unchecked). The configured [[transfer_mode|transfer mode]] will then be used even for transfers to/from external editor. Note that if you have configured [[transfer_mode|binary transfer]] mode, your external editor must support [[transfer_mode#eol|server-side format of text files]] (Unix format usually), if you still want to edit them. |
- | * TextPad: //Configure > Preferences > Allow Multiple Instances to Run// | + | |
+ | ===== Transfer Settings when Editing Files ===== | ||
+ | When remote file is downloaded to editor or uploaded from editor, default [[transfer_settings|transfer settings]] or settings of active [[transfer_settings#presets|preset]] are used, with some exceptions: | ||
+ | * //Filename modification// option is forced to "No change". | ||
+ | * Replacement of characters not valid on Windows is enabled (original filename is restored on upload). | ||
+ | * File masks are ignored. | ||
+ | * Text [[transfer_mode|transfer mode]] may be forced (see [[#binary|Editing Binary Files]]). | ||
+ | * [[resume|Transfer resume support]] is disabled. | ||
+ | |||
+ | ===== [[commandline]] Editing from Command-line ===== | ||
+ | You can use command line parameter ''[[commandline#operations|/edit]]'' to make WinSCP open a remote file in [[ui_editor|internal editor]]. This way, you can for example create a desktop shortcut that opens a remote file as easily as a local one. | ||
- | ===== Editing Binary Files ===== | ||
- | The internal editor supports only Windows-format text files. Thus the test/ascii transfer mode is forced when transferring remote file to/from the internal editor. | ||
- | If you want to edit binary files you need to use [[task_edit#external_editors|external editor]] that supports binary files and uncheck preference option //[[ui_pref_storage|Force text transfer mode for files edited in external editor]]//. The configured transfer mode will then be used even for transfers to/from external editor. Note that if you have configured binary transfer mode, your external editor must suport server-side format of text files (Unix format usually), if you still want to edit them. |