ctrl+shift+p filters: :st2 :st3 :win :osx :linux


by nchauhan890 ST3

Sublime Text 3 plugin which allows for a selection to be instantly added to an open file



  • Total 3K
  • Win 2K
  • Mac 263
  • Linux 264
Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6 Mar 5 Mar 4 Mar 3 Mar 2 Mar 1 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5
Windows 0 0 0 1 1 0 0 1 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 2 0 0 0
Mac 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0
Linux 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0




Sublime Text 3 plugin which allows for a selection to be instantly added to an open file


When run, a panel appears containing a list of currently open files (excluding the current file). The content inside the selection will be copied to the end of the file selected from the panel. Note that the command will not be invoked if the selection is empty.


demo-1 Demonstration with standard settings

demo-2 Demonstration with file previews set to true and file paths set to true

demo-3 Demonstration with popup setting set to true


Edit the AddToFile.sublime-settings to configure this plugin. Open through Preferences --> Package Settings --> AddToFile --> Settings - User or the command palette

Setting Description
suggest_new_file Add an option to create a new file inside the file selection panel. Defaults to true.
add_to_single_view Automatically select the view in the file selection panel if there is only one view in the list. Defaults to false. [1]
show_status_message Show a message in the status bar when text is copied. Defaults to true
show_file_path Show the full file path instead of the file name in the file selection panel to help distinguish files with the same name in different directories. Defaults to false. [2]
status_message Set the message to appear in the status bar. Defaults to Copied to {name}. [3]
keep_focus Keep the focus on the source file when copying rather than switching to the destination file's view. Defaults to true.
show_preview Show a 3-line file preview in the file selection panel. Defaults to false.
scroll_view Scroll the view to where the text was copied. Defaults to true. [4]
show_popup Show a popup at the cursor instead of a selection panel. Defaults to false. [5]
auto_smart Show a smart preview of files open in the file selection panel. Defaults to false. [6]

1: This will not work if add_to_suggest_new_file is set to true as this adds another element to the file list. Even if there is no other view open and New File is the only item in the list, the panel will still open to ensure that a new file isn't accidentally created.

2: If there are two files called AddToFile.py in different directories, the file selection panel will display AddToFile.py twice if this setting is set to false. However, the order that appears in the selection panel is the order of the view tabs from left to right which means the files could be distinguished by looking at which one's view tab is furthest left/right.

3: Can include {name}, {path}, {dir}, {sourcename}, {sourcepath} and {sourcedir} which will be replaced with their corresponding values:

Segment Description
name file name
path the path to the file including the file
dir the path to the file excluding the file
sourcename source file name
sourcepath the path to the source file including the file
sourcedir the path to the source file excluding the file

4: keep_focus must be set to false to allow the view to switch.

5: File previews will not be shown and show_preview setting will be ignored

6: Usually, file names are shown on their own, however, if there are multiple files with the same name, a folder will be shown in brackets: the folder name is the first folder in the 2 conflicting file paths whose name is different. E.g. (GitHub) AddToFile.py and (Documents) AddToFile.py would be shown for 2 files in directories GitHub/AddToFile/AddToFile.py and Documents/AddToFile/AddToFile.py

Command Palette

Open the command palette and type AddToFile to show available commands:

Command Description
AddToFile: Add to... Run AddToFile command
Preferences: AddToFile Settings Edit AddToFile user settings
Preferences: AddToFile Key Bindings Edit AddToFile key binding
AddToFile: Add to New File Run AddToFile command, but explicitly specifying to create a new file
AddToFile: Change preview lines Set the lines to preview to the 3 lines starting from the first cursor point (Limited to the view's individual settings so will reset on the closing of the view)
AddToFile: Get preview lines Scroll the view to to show the lines which will be previewed
AddToFile: Add to... (smart) Run AddToFile command, but the version that would be run if auto_smart in settings was enabled

Context Menu

The following commands are available via the view's context menu

Command Description
Add to... Run add_to command
Add to New File Run add_to_new_file command

Key Bindings

The following describe the default key bindings associated with AddToFile

Key Binding Command
f8 Run add_to command
ctrl+f8 (OSX cmd+f8) Run add_to_new_file command
shift+f8 Run smart_add_to command


AddToFile can be installed manually: 1. Download the .zip file or browse to the latest release 2. Unzip the .zip file 3. Rename to AddToFile 4. Move to the Packages directory which can be opened through Preferences --> Browse Packages...

Using package control: 1. Open Package Control 2. Type AddToFile