Sublime Forum

Virtual Space Plugin

#1

Virtual Space plugin

This plugin enables you to work with full-column selections, even after normal EOL boundaries.

Essentially, it works by appending whitespace to each line, up to the view wrap settings, longest line in file, or a custom value.

It can be enabled either via keyboard or mouse (just start dragging with middle mouse button).

https://i.imgur.com/k6nfk2S.gif

Installation

Clone in your Packages folder.


Usage

Typical usage would be:

  • enable with keyboard or directly with middle mouse button
  • exit by keybinding, by mouse button, or after copying/cutting something(enabled in settings by default)

After copying/cutting something in virtual space mode, whitespaces will still be part of the clipboard content. Normally, you would like to keep them, so that pasting the selection would respect the column shape. In cases that you don’t want this, though, you can run the command virtual_space_strip, to convert the clipboard content.


Commands:

virtual_space:                  enters/exit virtual space
virtual_space_strip:            strips copied/cut content of trailing whitespaces
virtual_space_column_paste:     paste the clipboard as a block

Last command is the same as Paste as Column plugin by Clams, included here for conveniency.


Settings:

"default_width": 80                         // If neither view nor global warp_width are set, this will be used.

"use_longest_row": false                    // Always expand to longest row in file.

"safe_size": 10000                          // Within safe size, virtual space is applied on the whole file.

"tolerance": 100                            // Beyond that, x rows before and x after are expanded.

"exit_on_copy": true                        // Exit virtual space automatically after copy/cut.

"strip_empty_lines": true                   // Strips empty lines from selections

"column_paste_if_trailing_spaces": false    // Paste as column block if clipboard contains trailing whitespaces, eg because selection has been copied in virtual space mode

"auto_strip": false                         // Strip spaces from copied/cut selection automatically. Disables coulmn paste option (can still be used with keybinding).

Keyboard:

{"keys": ["alt+v", "alt+v"],    "command": "virtual_space"},
{"keys": ["alt+v", "alt+s"],    "command": "virtual_space_strip"},
{"keys": ["alt+v", "alt+c"],    "command": "virtual_space_column_paste"}

Mouse:

middle mouse button:        drag to make selection box, click again to exit
ctrl + button:              additive (must be already enabled)
ctrl + alt + button:        subtractive (must be already enabled)

With mouse, you just have to start dragging. If you press the button a second time while virtual space is enabled, it will exit virtual space. On the other hand, to use the modifiers (ctr, ctrl+alt), virtual space must be already enabled.


Issues

If you use a plugin that overwrites the default copy/cut commands (Clipboard Manager comes in mind), exit_on_copy function won’t work, you’ll need to exit virtual space manually.


Credits

Clams for the Paste as Column plugin.

3 Likes

Virtual space
Why Sublime doesn't support BLOCKS operations
#2

Thanks for the virtual space plugin

0 Likes

#3

Thanks, if you have suggestions/find issues, you can post them here.

0 Likes

#4

Thanks a lot for it. As someone who works with a variety of fixed width text files, this is a life saver.

0 Likes

#5

Hello,
Can someone please explain how to install this plug in?

Also, does it work the same way as in Visual Studio?

Thanks

0 Likes

#6

Hello,

Is this plugin still available?
Can anyone check it or upload again?

Thanks in advance,

1 Like

#7

Can’t find it. New to sublime and searching exactly for this funcionality

0 Likes