Is it possible to type different value for multiple cursors? - visual-studio-code

When doing multi cursor selection, often you need to type a different value for each, you've to cancel selection even though all cursors are where you want them to be.
Is it possible to activate some sort of mode and press tab to automatically iterate through each one by one on every tab and type your value. Esc to cancel the mode.
Note: how in end I had to type 1, 2, 3, 4 manually. Those could have been food categories, clothing size, select options etc.

For the special case of when you want to insert values that follow a sequence at your multiple cursor locations, then the powerful Insert Nums package for Sublime Text can help.
Insert Nums can fill in numbered blanks (1,2,3,4, ... 10), and much more. Just about anything you could write as a for loop can be generated and inserted at the multiple cursors. This includes integer/float/string, count up/down, arbitrary start/stop/step values, and formatting to hex, binary, etc., representation. You can also evaluate an expression at each index, so for example you can create a geometric or power series or a pattern of bit shifts.
The default case for Insert Nums is integers, starting at 1, incrementing by 1, and ending when all selections are filled. For the example problem in the question of numbering Items, all you'd have to do is Ctrl+Alt+N, then Return. The numbers 1 through 5 would be filled in.

In case you don't want to install extension, you can copy sample data (which is generated by your favorite scripts or tools, for example) then paste it to the current cursors.
For example, I generate numbers by a cent JavaScript:
Array(10).fill(0).map((a, i) => i + 1).join('\n')
Then,

I can only answer for Sublime, and there core Sublime can't do this out of the box, but you can add the capability to do it to via a third party package.
The PowerCursors package is one way to go with this. With it installed it's as simple as Alt+[ and Alt+] to cycle between existing cursors (the binds use Ctrl instead if you're on MacOS) and type what you like, amongst other capabilities.
There may well be other packages that incorporate something similar as well, so it may be worth casting around a little bit on packagecontrol.io to see what you can dig up.

For CudaText editor, plugin "Carets Numbering" exists, which does this job. You enter starting number, etc, and it inserts increasing numbers at multi-carets positions.

Text Pastry is a vscode extension which does exactly these type of things.

Related

Why does "continue numbering" behave unexpectedly?

I have an example document that uses nested numbered lists that are continued (the sample document is much simplified, but it shows the same problem).
When I want the last list item to continue the numbering at the same (very first) level, the indentation changes and the number is not what it should be.
Maybe I just don't understand the concepts as the online documentation is very poor.
It could be a bug in list management, also.
So here is how the numbering looks like before trying to fix the last number (item marked red):
And here is how it looks after I tried to continue the numbering for the last list item (item marked red).
I expected the item to be "2.":
Unfortunately I have no idea how to provide the test document.
Alternate explanation of the problem
If I have two concurrent numbered lists (outlines), how would I format such avoiding direct formatting as much as possible?
Example:
1) First Step of some procedure A (A1), possibly with sub-steps
2) Step A2
1) First step of procedure B (B1), possibly with sub-steps
3) Next step of procedure A (A3), ...
...
(the list may change between procedure A and procedure B multiple times)
I suspect that LibreOffice has a bug where the actual numbering format, and not the levels of the outlines determine which counters are incremented.
Even after reading the long manual, I didn't understand the concepts behind.
Can't really explain the strange numbering you encountered, as I was unable to reproduce the effect. However, the "Alternate explanation of the problem" concerning how to provide interleaved lists with proper numbering for each list can be addressed using List Styles.
In the example shown below, I created two new custom List Styles, entitled "Numbering α" and "Numbering β" (with intentionally distinctive notation after each number). To start, I double-clicked Numbering α in the "Styles and Formatting" pane to start an α list.
To start a β list, I got the insertion point to a blank line and double-clicked Numbering β.
Then, whenever I wanted to continue a list or switch from one list to the other, I would double-click the appropriate List Style as needed.
Also, if the insertion point is on an item from, say, list α, double-clicking Numbering β switches the item to the other list, with any subsequent items in each of the lists renumbered as needed. (Note: if a document has a very large quantity of list items, you may need to hit F9 or select Tools > Update > Fields for renumbering to be properly displayed.)
Creating and customizing new lists is pretty straightforward; you can right-clicked in the empty area of the "Styles and Formatting" pane, select "New...", and tweak stuff for a new list as needed. For specific info, see the "Creating custom (new) styles" and "Working with list styles" sections of Writer 6.0 Guide : Chapter 9 - Working with Styles.

how to add different number at end of multi line edit?

Having trouble finding a way to do this, maybe it is not even possible?
In my case, for testing flow of if-statements/user-interaction, am temporarily adding 40 lines of console.log('trigger-fired-1'); throughout our code.
However, to tell them apart would like each to end with a different number, so in this case, numbers one to forty like so:
In the screen recorded gif, to replicate what I am going for, all I did was copy/paste the numbers one to nine. What I really would like is a shortcut key to generate those numbers at the end for me to eliminate that step of typing out each unique number.
Am primarily coding in Visual Studio Code or Sublime Text, and in some cases shortcuts are similar, or at least have same support but for different shortcut keys.
There are a few extensions that allow you to do this:
Text Pastry
Increment Selection
NumberMonger
For Sublime Text, the solution to this problem is the internal Arithmetic command. Something similar may or may not be available in VS Code (possibly with an extension of some sort) but I'm not familiar enough with it to say for sure.
This command allows you to provide an expression of some sort to apply to all of the cursor locations and/or selected text.
By way of demonstration, here's the example you outlined above:
The expression you provide is evaluated once for every selection/caret in the buffer at the time, and the result of the expression is inserted into the buffer (or in the case of selected text, it replaces the selection). Note also that when you invoke this command from the input panel (as in the screen recording) the panel shows you a preview of what the expression output is going to be.
The special variable i references the selection number; selections are numbered starting at 0, so the expression i + 1 has the effect of inserting the selection numbers starting at 1 instead of 0.
The special variable x refers to the text in a particular selection instead. That allows you to select some text and then transform it based on your expression. An example would be to use x * 2 immediately after the above example (make sure all of the selections are still present and wrapping the numbers) to double everything.
You can use both variables at once if you like, as well as anything in the Python math library, for example math.sqrt(i) if you want some really esoteric logs.
The example above shows the command being selected from the command palette interactively, where the expression automatically defaults to the one that you want for your example (i + 1).
If you want to have this as a key binding, you can bind a key to the arithmetic command and provide the expression directly. For example:
{
"keys": ["super+a"],
"command": "arithmetic",
"args": {
"expr": "i+1"
},
},
Try this one ...
its not like sublime
but works g
https://github.com/kuone314/VSCodeExtensionInsertSequence

Select one word, then have all matching words automatically select?

I have been working in Notepad++ recently, and last night, spent at least an hour manually selecting many of the same phrase with Ctrl+Select. I needed to select all occurrences of 'yyty' (Just a phrase so I could easily find it), but could not see or find a quick way to do that. I ended up just using the Ctr+Select method, but when doing this 80 times, it gets quite annoying. I need something that will allow me to select a word, then have all matching words become selected (NOT highlighted or marked, as I need to be able to run the column editor tool on the selection to auto-number all of the selections) automatically (by automatically, I mean after clicking something to run the auto-selector). I am willing to install a plugin for NP++ if needed.

How can I export a comma-separated list of values from a column of an org-mode table

I have a table in org-mode with emails in one column. I want to collect all the emails as a comma-separated list, but I don't know an easy way to do it. It seems like something fairly simple, but I can't find a solution anywhere on the web.
What would be the simplest way to do it?
Dipping my toes slightly into org mode, a very simple formula of #1.. will do the trick of making a list from the values in the current column from rows 1 onwards, as it simply joins the values by commas by default. e.g.:
#+TBLFM: #5$2=#1..
(followed by C-cC-c to evaluate), would create a list in row 5, column 2, of all the values in column 2.
It does wrap the list in square brackets, but that's obviously no problem for a manual approach.
One manual approach would be to use rectangle editing commands to extract the content of that column (which should be nicely aligned by org-mode), and then just search and replace to convert to CSV format:
C-SPC at first corner
C-xrk at opposite corner
C-/ to undo the kill (there's no default copy-rectangle command)
Then in the buffer where you want the list of addresses:
C-xry to yank the rectangle
C-xC-x to exchange point and mark, marking the region
C-M-% to regex search and replace within the region, like so:
C-M-%SPC*C-qC-jRET,RET!
Does M-x org-table-export do what you want?

Length of current selection in Eclipse

Do you know any easy way to find out what is the length of the current selection in Eclipse?
i.e. I select a line fragment and would like to know how many characters are there?
Usually, I count them manually, but that's stupid. When being desperate, I move to the start, check the column number, move to the end, check the column number, subtract, think a minute if I should add 1 or not... and my selection is lost.
On Windows, Notepad++ is a good solution. Open a new tab, copy and paste in there and the length of the document listed at the bottom of the window is the number of characters you have.
Easy way? Copy the text and paste it to a counting script, like this site:
http://charcount.com/
(Warning: the site's background may hurt your eyes.)
Eclipse does support a Selection object, if you're into its API:
http://www.eclipse.org/articles/Article-WorkbenchSelections/article.html#example