What are the supported editing commands for the GNU APL line editor (∇-editor)? - command

The GNU APL documentation on the line editor seems to assume one already knows how to use it. I only see mention of what commands/syntax '... are not fully supported in GNU APL'.
Compare with the documentation of Dyalog's APL ∇-editor, or MicroAPL.
I'd be willing to prepare a patch to submit for the documentation if anyone has a reference.

The main developer of GNU APL, Jürgen Sauermann, has told me that GNU APL's editor is a clone of APL2's line editor, and thus should support the same commands:
command
action
[⎕]
display the current whole definition
[⎕2 7 1 …]
display specific lines
[⎕2-7]
display a range of lines
[⎕-7]
display all lines until a specific line
[⎕7-]
display all lines beginning with a specific line
[7] code
replace a specific line
[2.1] code
insert a line between two lines
[∆2 7 1]
delete specific lines
[∆2-7]
delete a range of lines
[∆-7]
delete all lines until a specific line
[∆7-]
delete all lines beginning with a specific line
[→]
quit without saving
[2⎕7]
display line 2 for editing, placing the cursor at position 7
[2⎕0]
display line 2 for editing, placing the cursor at the end of the line
Source: IBM's APL2 Language Reference

See:
APL: The Language and Its Usage;
Polivka & Pakin;
1975

Related

Line wrapping TeX from Visual Studio Code

I'm seeking a command that when I highlight a paragraph of text in Visual Studio Code will let me remove all line breaks, and correspondingly a command that if I highlight a paragraph without line breaks will insert them at the end of the display width.
It wont be enough to just use Alt-Z because that just makes the display show the line wrapping but doesn't actually insert the line breaks.
For context: I'm using a VS Code latex plugin which is a compiled text editor format. Errors in this system trace back to line numbers so if you don't have line breaks you have to hunt down the error somewhere in a large paragraph. But of course this being a text document there you often have to edit paragraphs and end-of-lines become jagged and hard to read/update.
You can set this behavior searching for "Word Wrap" in the settings. Set to "on" to wrap the words.
Found a solution, maybe it will help someone in the future.: install "rewrap" extension. Select portion of text, and use Alt-q. Seems to work like Emacs' M-q command. (Thx Grant)

Single line break in Github flavoured markdown without any extension

I am writing README.md for my project that I have created on GitHub. I am having issues with the line breaks. I have gone through the official documentation, but I am not sure how to make a single line break, as single Enter is not recognized as a line break and two Enters make it a new paragraph.
From documentation:
"My basic recommendation for learning how line breaks work is to experiment and discover -- hit once (i.e., insert one newline), then hit it twice (i.e., insert two new lines), see what happens. You'll soon learn to get what you want. "Markdown Toggle" is your friend."
It mentions about "Markdown Toggle", I googled it but it shows me "Markdown Here" (Markdown Toggle is renamed maybe). But I want to do it without any extension.
Is it possible?
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#lines
Ending a line with two or more spaces should work.
Use two or more spaces <-- 2 or more spaces
to create a line break.

How can I remove duplicate lines in Visual Studio Code?

Say you have the following text:
abc
123
abc
456
789
abc
abc
I want to remove all "abc" lines and just keep one. I don't mind sorting. The result should be like this:
abc
123
456
789
If the order of lines is not important
Sort lines alphabetically, if they aren't already, and perform these steps:
(based on this related question: How do I find and remove duplicate lines from a file using Regular Expressions?)
Control+F
Toggle "Replace mode"
Toggle "Use Regular Expression" (the icon with the .* symbol)
In the search field, type ^(.*)(\n\1)+$
In the "replace with" field, type $1
Click ("Replace All").
If the order of lines is important so you can't sort
In this case, either resort to a solution outside VS Code (see here), or - if your document is not very large and you don't mind spamming the Replace All button - follow the previous steps, but in steps 4 and 5, enter these:
(based on Remove specific duplicate lines without sorting)
Caution: Blocks for files with too many lines (1000+); may cause VS Code to crash; may introduce blank lines in some cases.
search: ((^[^\S$]*?(?=\S)(?:.*)+$)[\S\s]*?)^\2$(?:\n)?
replace with: $1
and then click the "Replace All" button as many times as there are duplicate occurrences.
You'll know it's enough when the line count stops decreasing when you click the button. Navigate to the last line of the document to keep an eye on that.
Coming in vscode v1.62 is a command to eliminate duplicate lines from a selection:
Delete Duplicate Lines in the Command Palette
or
editor.action.removeDuplicateLines as a command in a keybinding
(there is no default keybinding for this command)
Here is a very interesting extension: Transformer
Features:
Unique Lines As New Document
Unique Lines
Align CSV
Align To Cursor
Compact CSV
Copy To New Document
Count Duplicate Lines As New Document
Encode / Decode
Filter Lines As New Document
Filter Lines
Join Lines
JSON String As Text
Lines As JSON String Array
Normalize Diacritical Marks
Randomize Lines
Randomize Selections
Reverse Lines
Reverse Selections
Rotate Backward Selections
Rotate Forward Selections
Select Highlights
Select Lines
Selection As JSON String
Sort Lines By Length
Sort Lines
Sort Selections
Split Lines After
Split Lines Before
Split Lines
Trim Lines
Trim Selections
Unique Lines
Removes duplicate lines from the document Operates on selection or
current block if no selection
Unique Lines As New Document
Unique lines are opened in a new document Operates on selection or
current block if no selection
I haven't played with it much besides the "Unique Lines" command but it seems quite nicely done (including attempting a macro recorder!).
To add to #Marc.2377 's reply.
If the order is important and you don't care that you just keep the last of the duplicate lines, simply search for the following regexp if you want to only remove duplicte non-empty lines
^(.+)\n(?=(?:.*\n)*?\1$)
If you also want to remove duplicate empty lines, use * instead of +
^(.*)\n(?=(?:.*\n)*?\1$)
and replace with nothing.
This will take a line and try to find ahead some more (maybe 0) lines followed by the exact same line taken. It will remove the taken line.
This is just a one-shot regex. No need to spam the replace button.
This now also takes the comment of #awk into account, in where the last line has to have a linefeed in order to be identified as a duplicate. This is no longer the case now by excluding the \n from the line to search and adding a $ to the line found.
I just had the same issue and found the Visual Studio Code package "Sort lines". See the Visual Studio Code market place for details (e.g. Sort lines).
This package has the option "Sorting lines (unique)", which did it for me. Take care of any white spaces at the beginning/end of lines. They influence whether lines are considered unique or not.
Install the DupChecker extension, hit F1, and type "Check Duplicates".
It will check for duplicates and ask if you want to remove them.
Try find and replace with a regular expression.
Find:
^(.+)((?:\r?\n.*)*)(?:\r?\n\1)$
Replace:
$1$2
It is possible to introduce some variance in the first group.
If you don't mind some Vim in your VS Code. You can install Vim emulation plugin.
Then you can use vim commands
:sort u
It will sort lines and it will remove duplicates
Sublime Text 3
It has blisteringly fast native permutation functions.
Edit > Permute Lines > Unique or ⇧⌘U, and
Edit > Permute Selections > Unique
Visual Studio Code is my daily driver. But, I keep Sublime Text on standby for these situations.
Not actually in Visual Studio Code, but if it works, it works.
Open a new Excel spreadsheet
Paste the data into a column
Go to the Data tab
Select the column of data (if you haven't already)
Click Remove Duplicates (somewhat in the middle of the bar)
Click OK to remove duplicates.
It is not the best answer, as you specified Visual Studio Code, but as I said: If it works, it works :)

How do I get a cursor on every line in vscode

I'm trying to use the multi cursor functionality of vscode on a large(ish) file.
the file is too large to select every line individually with ctrl-alt-up or down. In sublime-text I would select everything and push ctrl-shift-l. Is there a similar thing in vscode. I've tried using a regex search for ^, but that gives me an error stating "Expression matches everything".
The command Selection / Add Cursors to Line Ends altshifti will put a cursor on every line in the current selection. (For mac use optshifti)
Tip: You can pull up the keyboard shortcut reference sheet with ctrlk,ctrls (as in, those two keyboard combos in sequence).
(For mac use cmdk,cmds)
Hold Alt+Shift and select the block. Then press End or Right button.
You get selected individual lines.
I use version VSCode 1.5.3 in Windows.
Hold Alt+Shift+i
Hold Home (fn+-> Mac) for right-most or End for left most(fn+<- Mac)
This feature is actually called split selection into lines in many editors.
Sublime Text uses the default keybinding, CTRLSHIFT L
VSCode uses ALTSHIFTI
For Atom you actually need to edit your keymap to something like this
'.platform-win32 .editor, .platform-linux .editor':
'ctrl-shift-L': 'editor:split-selections-into-lines'
Real Lines vs Display Lines
First we have to understand the difference between Real Lines and Display Lines to completely understand the answer of the question.
When Word Wrap is enabled, each line of text that exceeds the width of the window will display as wrapped. As a result, a single line in the file may be represented by multiple lines on the display.
The easiest way to tell the difference between Real Lines and Display Lines is by looking at the line number in the left margin of the text editor. Lines that begin with a number correspond to the real lines, which may span one or more display lines. Each time a line is wrapped to fit inside the window, it begins without a line number.
Cursor At the Beginning of each Display Lines:
Cursor At the Beginning of each Real Lines:
Answer to the Question
Now that we know the difference between Display Lines and Real Lines, we can now properly answer the actual question.
Hold AltShift and select the text block.
Press Home to put cursor on the beginning of every Display Line.
Press End to put cursor on the end of every Display Line.
Press HomeHome (Home twice) to put cursor on the beginning of every Real Line.
Press EndEnd (End twice) to put cursor on the end of every Real Line.
Please understand that AltShiftI put cursor on the end of every Real Line.
Install the extension Sublime Commands.
[Sublime Commands] Adds commands from Sublime Text to VS Code: Transpose, Expand Selection to Line, Split into Lines, Join Lines.
(Don't forget to add the keybinding(s) from the extensions details page to your keybindings.json)
Doesn't VS Code already have a "split into lines" command?
Yes, yes it does. However it differs from the one in Sublime.
In VS Code, when you split into lines your selection gets deselected and a cursor appears at the end of each line that was selected (except for the last line where the cursor appears at the end of the selection).
In Sublime, when you split into lines a cursor appears at the end of each line (with the same exception as in VS Code) and the selection is divided on each line and "given" to the same line.
I have the same problem, i'm used to Alt + drag to do 'box selections' in visual studio but it does'n work in code.
It seems to be impossible for now to do it differently than by selecting every single line.
However plugins should be supported soon so we will likely see a plugin for this if not implemented directly by microsoft.
From visual studio uservoice forums:
We plan to offer plugin support for Visual Studio Code. Thank you for your interests and look for more details in our blog in the coming weeks. http://blogs.msdn.com/b/vscode.
For the preview we are looking for exactly this type of feedback. Keep it coming.
Sean McBreen – VS Code Team Member

Sublime Text Macro Command Move to Specific Column Number

I'm trying to move to a specific column number in a Sublime Text macro command, so that I can delete everything after that point, but I can't get the move command to work.
I've compared the old and new versions of the unofficial documentation, and it looks like the move command used to have an "amount" parameter, but it hasn't been working for me. So the reason I'm writing is because I feel like there's something the docs are leaving out, but I don't know what it is, or how to even debug it in Sublime Text.
Here's an example of what I'm trying to do:
/*//////////////////////////////////////////////////////////
// Comment Block ///////////////////////////////////////////////
//////////////////////////////////////////////////////////*/
When the caret is at the end of the phrase "Comment Block", I need to run a command that advances the caret to a specific column number. After that, I can expand the selection to the end of the line and delete, trimming the line to be equal with its counterparts.