Column Mode Indent?
-
This is something that is supported by almost all editors that support block selection (what NP++ calls Column Mode). Usually you select the block and then Tab or Shift-Tab move the contents of the selected block left or right.
This seems to be missing in NP++ (or it’s well hidden). The above sequence just deletes the selected text block, and combinations of Alt, Shift and Ctrl with Tab or Left/Right don’t do anything.
Is there a way to do this?
-
To achieve this, you need a zero-width column block.
-
@Alan-Kilborn ,
Now wait for the follow-up question… “What is a zero-width column?”
:-) -
@Lycan-Thrope said in Column Mode Indent?:
“What is a zero-width column?”
Well, for the benefit of those that might not understand…
If this is a column-block with a width of 4:
Then is it really that hard to grasp the concept that this is a column-block of width zero?:
-
@Alan-Kilborn ,
:-)
Best to head these questions off at the pass. If they won’t read the manual, it’s a good bet, they won’t understand the vernacular of terms used in the application. -
Column mode indent is a feature that allows users to select and edit text in a columnar manner. This is useful for working with code, tables, or other types of text that require precise formatting. To use column mode indent in a text editor, the user typically needs to activate the feature by selecting a specific key combination or by accessing it through the editor’s menu or toolbar Once activated, the user can then select text in a columnar fashion by holding down the mouse button and dragging the cursor vertically or horizontally. This can save time and make it easier to work with text that requires a consistent layout.
-
All,
Please do not post content generated by ChatGPT or other such systems. It is harmful, not helpful, to the Community.
In this specific case, the content was just completely unhelpful – presumably, it was generated by just typing in the title, rather than the content of the actual question, so it completely missed the point.
But because such AI systems have no fact-checking involved – all they do is, based on all their historical text training input, they guess what text is likely to come next. Based on that, they could easily give advice that is plain wrong or even dangerous to follow.
-
Old post, but this was the first I found when looking for this information myself. Since the commenters here were wholly unhelpful (and event downright derisive), I thought I should share a solution that actually worked.
In order to get Notepad++ to do tab manipulation similar to Visual Studio with block selection, all you need to do is bind the Tab key to Edit > Indent > Increase Line Indent. That’s it, with that change <Tab> and <Shift+Tab> works very similar to Visual Studio.
Instructions (in case you are unfamiliar with key binds in Notepad++)
- Open Settings > Shortcut Mapper
- In the Main Menu tab, scroll to “Increase Line Indent” (Was line 39 for me).
- Double click the Shortcut column.
- Select “Tab” from the drop down. (Fancy!) Hit OK.
- If the line turns red, it means you have a conflict. For me there was a conflict with one of my plugins under the “Plugin Commands” tab. I just removed the plugin’s shortcut.
-
Since the commenters here were wholly unhelpful (and event downright derisive)
I personally thought that @Alan-Kilborn and @Lycan-Thrope were both very helpful 2 years ago: one explained how to do it as tersely as possible, and the other prodded him to expand, trying to avoid assumptions about the understood terminology – and answering the question and prodding to make it easier to understand are not derisive in any way, shape, or form.
The closest to derision was my claim that a post that something as generic and unhelpful as “the user typically needs to activate the feature by selecting a specific key combination or by accessing it through the editor’s menu or toolbar” – that’s literally how you use a Windows program, yes, but it says nothing sepecific about the specific keystrokes or menu commands to use to accomplish the specific goal (whereas Alan did provide specifics) – was just calling out a reply that appeared to be LLM-created. I am sorry if you are offended that I call out unhelpful LLM posts as such (and nowadays, I’m less diplomatic, since LLM nonsense is expressly forbidden in this forum), but that’s one of my jobs as a moderator.
But on to the actual content:
In order to get Notepad++ to do tab manipulation similar to Visual Studio with block selection, all you need to do is bind the Tab key to Edit > Indent > Increase Line Indent.
Interesting. I cannot get that to do the same thing as VS:
First, to confirm what VS does:
- Column/Rectangle/Block selection:
- TAB:
So VS does add indent at the start of the Column/Rectangle/Block.
Now let’s look at what N++ does “out of the box” with a Column/Rectangle/Block selection in the middle of a line:
-
Column/Rectangle/Block selection:
-
Normal, unchanged TAB:
This is the undesired behavior.
Now, instead, do what @Alan-Kilborn suggested in 2023:
-
do a zero-width column-mode selection instead of a multi-character column-mode selection:
-
Then hit TAB, and it will indent from that location, without deleting any characters:
Now, to look at your suggestion
-
Change the Increase Line Indent to use the TAB key (and remove any conflicts elsewhere):
-
Do the Column/Rectangle/Block selection in N++:
-
And then hit the newly-mapped TAB:
… noticing that the results are the same as in step 4: it overwrites the characters.
So @Alan-Kilborn’s suggestion is able to mimic the results of VS, though the selection has to be a little different to get it to overwrite nothing.
Whereas Notepad++'s original behavior is identical to the behavior when I follow your instructions: it overwrites the selected text with the tab (or spaces, if you have space-indentation enabled in N++)
So did I miss something from your instructions? Or are you seeing different behavior with Notepad++ v8.8.5 than I am?
- Column/Rectangle/Block selection:
-
@PeterJones Thanks for expanding on this! In my post I was frustrated that @Lycan-Thrope essentially said “RTFM” when the manual doesn’t seem to cover inserting tabs in column mode at all.
Based on your response, I think there may be a defect that lies somewhere between Notepad++ and interactions with plugins. I agree “Increase Line Indent” is not the same as Visual Studio and is not ideal, however the alternative I was seeing was much worse.
Prior to adding a shortcut to “Increase Line Indent”, the tab key would do absolutely nothing. I would press alt + shift and up or down arrows to make a selection (just like in VS), then press tab. Nothing happens at all. No change to the text. Caret doesn’t move. Just nothing happens. It definitely does not behave as you outlined in your very detailed post. (Thanks again!)
Web searches on this topic were frustrating. They mostly pull up posts or articles about Notepad++ tabs (or documents), rather than the tab key. The lack of writing about this particular topic may be additional data indicating some form of defect. Who is going to ask about this problem if they are not encountering it? Who is going to document how to press the tab key in this context? Just do it.
Should someone reading this be in a position to investigate a potential defect, here are details on my Notepad++ configuration. The plugin with the conflict for Tab was QuickText. Here is a screenshot of my Notepad++ version and installed plugins. I run Notepad++ on multiple machines, but am pretty quick to “copy paste” my plugin setup because it addresses other needs. I’ve observed this “unresponsive tab” issue on each of the other computers.
-
I was frustrated that @Lycan-Thrope essentially said “RTFM” when the manual doesn’t seem to cover inserting tabs in column mode at all.
I guess I can see how it was read that way. Based on what I know of his usual style, I think he was just lamenting the fact that most don’t read the manual, so would need additional pointers beyond the bare mention of “zero-width column block” to understand what was said.
Based on your response, I think there may be a defect that lies somewhere between Notepad++ and interactions with plugins.
In that Notepad++ allows plugins to set a default keyboard shortcut, and that
Tab
is an available option… But plugins shouldn’t use something as fundamental asTab
as one of their shortcuts. (more on that below.)Web searches on this topic were frustrating. They mostly pull up posts or articles about Notepad++ tabs (or documents), rather than the tab key.
Unfortunately, the word “tab” has multiple meanings in modern computer usage, and one cannot narrow a search down.
The plugin with the conflict for Tab was QuickText. Here is a screenshot of my Notepad++ version and installed plugins.
…
… And that explains the difficulty . Older versions of the QuickText plugin defaulted to
TAB
being the default keystroke for the Plugins > Quick Text > Replace Tags (now called Replace Snips, instead) action. As you have seen, that was a confusing default for the plugin to have, as it breaks expectations for how the main app should behave.We were able to convince the current maintainer to not use such an integral key as the default keystroke – so now there is no default keystroke at all for that plugin (verified in a fresh 0.2.5.1 install); so if the user wants a shortcut, they can set their own shortcut, because no matter what was picked for the default, it was likely to conflict with the user’s current setup. (I don’t remember if 0.2.4.1 was old enough to still use
TAB
by default, but if you started with that, or started with an older version and upgraded at some point, the keyboard shortcut would have stayed bound to that plugin action.)Given that you are on Plugin List version 1.7.2 in N++ v8.6.8, if you look on the Updates tab of Plugins Admin, you should see that QuickText should be able to be upgraded to v0.2.5.1 (the newest QuickText version was added in Plugin List 1.5.2 around N++ v8.4.5)
Regarding the mapping of the
Tab
key: I don’t think Increase Line Indent is the best choice for you. The normal mapping forTab
is actually the scintilla commandSCI_TAB
, and I highly recommend that you put it back to that default:
That will allowTab
to have all the magic users normally associate with that key, rather than just being able to do the Increase Line Indent that you currently have.