Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Vertical Highlighting with Modified Selection Tool

· 6 min read · Home Tech

In this article
  1. What Is Vertical Selection?
  2. How to Use the Modified Selection Tool
  3. Why Use Vertical Highlighting?
  4. Common Problems and Solutions
  5. Vertical Selection in Different Applications
  6. Alternatives to Vertical Selection
  7. Frequently Asked Questions

Vertical highlighting using the modified selection tool lets you select and highlight a rectangular block of text in a document or code editor, rather than a continuous line-by-line flow. This is typically done by holding the Alt key (on Windows) or Option key (on Mac) while dragging the mouse, and it is useful for editing columns of data, aligning code, or copying text from tables.

What Is Vertical Selection?

Vertical selection, also known as column selection, block selection, or rectangular selection, is a feature in many text editors and word processors that allows you to select a rectangular area of text. Unlike normal selection, which flows from the start point to the end point across lines, vertical selection is constrained to a rectangular block, ignoring the natural line breaks. This means you can select the first five characters of ten consecutive lines without selecting anything else on those lines.

The feature is especially common in code editors like Visual Studio Code, Sublime Text, Notepad++, and IntelliJ IDEA, as well as in word processors like Microsoft Word (with some limitations). It is also present in many spreadsheet programs, though there it is often the default behavior.

How to Use the Modified Selection Tool

The exact method varies slightly by application, but the general principle is the same:

  • Windows/Linux: Hold down the Alt key and drag the mouse over the text you want to select.
  • Mac: Hold down the Option key and drag the mouse.
  • Some editors also support keyboard-based column selection: place the cursor at one corner, then hold Alt+Shift (or Option+Shift on Mac) and use the arrow keys to extend the selection.

Once the vertical block is selected, you can perform the same operations as with a normal selection: copy, cut, delete, type to replace, or apply formatting. In code editors, you can also use multi-cursor editing in conjunction with column selection to edit multiple lines simultaneously.

Why Use Vertical Highlighting?

Vertical highlighting saves time in several common scenarios:

  • Editing tabular data: When you have a list of values separated by spaces or tabs, you can select just one column to copy or delete it without disturbing the rest.
  • Aligning code: In programming, you often want to align assignments or comments. With column selection, you can insert or delete spaces at the same position on multiple lines at once.
  • Copying from a table: If you copy a table from a web page or PDF, vertical selection lets you grab just one column instead of the whole table.
  • Adding prefixes or suffixes: You can select the beginning of multiple lines and type a common prefix (e.g., a bullet point or a comment marker) for all of them at once.

Common Problems and Solutions

If vertical selection is not working, check the following:

  • Wrong modifier key: Some applications use a different key, such as Ctrl (e.g., in some Linux terminals) or Shift (in some editors). Check the documentation or settings.
  • Mouse vs. keyboard: In some editors, the mouse modifier is different from the keyboard modifier. For example, in Visual Studio Code, mouse column selection uses Alt, but keyboard column selection uses Shift+Alt.
  • Selection mode: Some editors have a separate “column mode” that must be enabled. For instance, in Notepad++, you can toggle column mode via Edit > Column Mode or by pressing Alt+C.
  • Word wrap: If word wrap is enabled, column selection may behave unexpectedly because lines are visually wrapped. Disable word wrap for predictable column selection.
  • Non-monospace fonts: In word processors, column selection works best with monospaced fonts. With proportional fonts, the columns may not align visually, making the selection appear jagged.

Vertical Selection in Different Applications

The feature is implemented differently across popular tools:

  • Visual Studio Code: Hold Alt and drag to select a column. You can also use Shift+Alt with arrow keys. This works in both the editor and the integrated terminal.
  • Sublime Text: Use Ctrl (Windows/Linux) or Option (Mac) and drag. Sublime also supports multiple cursors, which can be combined with column selection.
  • Notepad++: Hold Alt and drag, or toggle column mode with Alt+C. This is especially useful for editing CSV files.
  • Microsoft Word: Hold Alt and drag to select a rectangular block. This works in most versions, but it is less commonly known because it is not advertised.
  • Terminals (e.g., Windows Terminal, iTerm2): Many terminals use Alt or Option for rectangular selection, but some require enabling it in settings. In Windows Terminal, the default is Shift+Alt.

Alternatives to Vertical Selection

If your editor does not support vertical selection, or you prefer a different approach, consider these alternatives:

  • Multi-cursor editing: Place a cursor at each location you want to edit (e.g., using Ctrl+Click or Alt+Click), then type once to affect all cursors. This is more flexible than column selection for non-rectangular edits.
  • Find and replace with regular expressions: Use regex to match a pattern at the start or end of lines and replace it with something else. This works in almost any editor.
  • External tools: For complex column manipulation, you can use command-line tools like cut, awk, or paste in Unix-like environments, or the “Text to Columns” feature in spreadsheet software.
  • Text editor plugins: Some editors have plugins that enhance column selection, such as “Column Select” for Sublime Text or “Rectangular Selection” for Atom.

Frequently Asked Questions

Does vertical selection work in Google Docs?

Google Docs does not have a built-in vertical selection feature as of now. However, you can simulate it by copying the text into a spreadsheet, using the “Split text to columns” feature, or by using a browser extension that adds column selection. Alternatively, you can use the “Find and replace” with regex to achieve similar results.

Why is my Alt+drag not working in Visual Studio Code?

First, ensure you are not in a terminal panel, as the terminal uses a different shortcut. In the editor, check if the “editor.columnSelection” setting is enabled (it is by default). If it is disabled, you can enable it by going to Settings and searching for “column selection”. Also, make sure the mouse is not in a widget or a hover tooltip, as those may capture the drag.

Can I use vertical selection to copy a column from a PDF?

Yes, in most PDF readers, you can hold Alt (or Option on Mac) and drag to select a rectangular area. However, the result depends on the PDF’s text layer. If the PDF is a scanned image, you will need OCR (optical character recognition) software first.

Is vertical selection the same as multi-cursor editing?

No. Vertical selection selects a rectangular block of text, while multi-cursor editing places multiple independent cursors that can be placed anywhere, not necessarily in a rectangular pattern. Multi-cursor is more flexible for non-contiguous edits, but column selection is quicker for rectangular blocks.

Does vertical selection work with proportional fonts?

It works, but the result may look uneven because characters have different widths. For precise column alignment, use a monospaced font (like Courier, Consolas, or Source Code Pro). In word processors, you can still use column selection, but the selected area may not align with the visual grid.

How do I select a vertical block in Notepad++?

Hold the Alt key and drag the mouse. Alternatively, press Alt+C to toggle column mode, then use the arrow keys to extend the selection. This is particularly useful for editing CSV files or log files with fixed-width fields.