AddToFile
Sublime Text 3 plugin which allows for a selection to be instantly added to an open file
Details
Installs
- Total 3K
- Win 2K
- Mac 311
- Linux 305
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 | Feb 4 | Feb 3 | Feb 2 | Feb 1 | Jan 31 | Jan 30 | Jan 29 | Jan 28 | Jan 27 | Jan 26 | Jan 25 | Jan 24 | Jan 23 | Jan 22 | Jan 21 | Jan 20 | Jan 19 | Jan 18 | Jan 17 | Jan 16 | Jan 15 | Jan 14 | Jan 13 | Jan 12 | Jan 11 | Jan 10 | Jan 9 | Jan 8 | Jan 7 | Jan 6 | Jan 5 | Jan 4 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 2 | 0 | 1 | 0 | 2 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 3 | 1 | 0 | 1 |
Mac | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 0 | 0 |
Linux | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
AddToFile
Sublime Text 3 plugin which allows for a selection to be instantly added to an open file
Usage
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.
Demonstration
Demonstration with standard settings
Demonstration with file previews set to true and file paths set to true
Demonstration with popup setting set to true
Configuration
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 |
Installation
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