Joe's own editor - how to change the tab size - editor

I'm having trouble changing the tab size in Joe.
I have copied joerc to $HOME and have edited the -tab line to -tab 4 but this hasn't changed the option in Joe. Also the number 4 is green instead of blue when I edit joerc so I think its reading it wrong.

The real solution is:
Create a file $HOME/.joerc (NOT .joe as at least the Debian joerc suggests!)
FIRST LINE must be :include /etc/joe/joerc
Then, a line containing just a * and a newline character
Then, -tab 4 and -istep 4, each on a single line.
Add a blank line at the end.
You may also add further options with other masks.

I've wasted about 20 mins trying to set tab size too. Here is the solution:
I. Open:
/etc/joe/joerc
II. Find row containing -tab nnn and change it to:
-tab 4
(I assume that you want to change tab size to 4. If you want different value, please replace all the 4s with your value)
III. Find -istep nnn and change it to:
-istep 4
IV. Save & exit
This will set tab size 4 for files WITHOUT extension. If you want to change tab size for files with common extensions like *.java:
I. open /etc/joe/ftyperc
II. Find your extension, for example *.java. Initially it looks like:
JAVA
*.java
-autoindent
-syntax java
-smarthome
-smartbacks
-purify
-cpara >#!;*/%
III. You have to comment (insert tab before it) -autoindent and add -istep 4 bellow -cpara. It should look like:
JAVA
*.java
-autoindent
-syntax java
-smarthome
-smartbacks
-purify
-cpara >#!;*/%
-istep 4

In case anyone else runs into this, I am running an ancient version of joe on AIX and after some painful trial and error it turned out that -smartbacks was the problem for me. I commented that line out and tabs work, put it back and they go back to 2. Probably fixed in a later version, but hopefully this helps someone else with the same problem.
JAVA
*.java
-spaces
-tab 4
-istep 4
-indentc 32
-autoindent
-syntax java
-smarthome
-smartbacks
-purify

Each time the tab key is pressed (using joe 4.6) it inserts 4 spaces after having followed those steps:
Execute sudo joe /etc/joe/joerc
Find the row containing -tab nnn Tab width, change it to -tab 4 Tab width and make sure that there is no whitespace at its left side.
A few lines down, find the row containing -spaces TAB inserts spaces instead of tabs and make sure that there is no whitespace at its left side.
Save and exit
This works here for files without extension, for .cpp files, for .java files, for .c files, for .txt files, etc.

Related

Ckeditor 5 removing line-breaks from copying data

I use classic default ckeditor 5 build.
The problem is if I copy from notepad text like:
1
2
3
In editor I give result:
1 2 3
If I copy next text:
1
2
3
In editor I give:
1
2
3
Why ckeditor removing one line-break per line ?
You encountered something that can be considered a bug or a missing feature.
Single \n line characters, which are converted to <br> on paste are lost due the fact that CKEditor 5 doesn't support soft-line breaks yet.
On the other hand, not everyone need to load the soft-line break feature so, even if we'll introduce it, the problem will occur for these users. Hance, perhaps the plain text to HTML conversion should work differently. Or be configurable.
More info https://github.com/ckeditor/ckeditor5/issues/766

Copy & paste folded text in Visual Studio Code

Given the following text
Node1_L1
Node1_L2
Node2_L2
Node2_L1
Node3_L2
Node1_L3
Node2_L3
Node4_L2
Node3_L3
Node4_L3
Node3_L1
Node5_L2
Node6_L2
I can use vscode's built-in folding feature to fold it to look like so
+ Node1_L1
Node2_L1
+ Node3_L2
+ Node4_L2
Node3_L1
Node5_L2
Node6_L2
but when I now select the folded text and copy & paste it then it actually grabbed all text - also the hidden one. The result of copy & paste of the first 4 lines of the folded text above would therefore be
Node1_L1
Node1_L2
Node2_L2
Node2_L1
Node3_L2
Node1_L3
Node2_L3
Node4_L2
whereas I would like to have
Node1_L1
Node2_L1
Node3_L2
Node4_L2
Hope that makes sense and someone knows a way to do it. Thanks!
Maybe there is another way of doing it but a workaround seems to be using block selection with multiple cursors - see the GIF
If the selection doesn't include the new line and carriage return, folded content will not be copied.
The selection must go to the start of the next line to select the folded text ( hidden text )
https://github.com/Microsoft/vscode/issues/41922#issuecomment-359368290
The op actually wants to select 'unfolded' text ignoring the folded text so they need to use a multi-line select where each selection will span a single line

Copy a table from iPython notebook into Word?

I want to copy a table from iPython notebook into a Word doc. I'm using Word for Mac 2011. The table is a standard pandas output and looks like this:
If I use Apple+C to copy the table, and then paste it into a Word doc, I get this:
Surely there must be an easier way?
Creating a table with the same number of rows/columns in Word and then trying to paste the cells there doesn't work either.
I guess I could screenshot the table, but I'd like to include the raw data in the document if possible.
The problem in this case (from the Word perspective) is not the table layout - it's the paragraph layout. Each paragraph has a substantial indent on right and left, and more space before/after than you would normally want.
I don't think any of the Paste options (e.g. Paste Special) in Word is going to help, unless you paste as unformatted text, then select the text, convert to a table, then proceed from there.
But, even a simple Word VBA macro such as this one will leave you with something a bit more manageable. (Select a table you copied in, then run the macro). A little bit more work on the code would probably allow you to get most of the formatting you want, most of the time.
Sub fixupSelectedTable()
With Selection.Tables(1).Range.ParagraphFormat
.LeftIndent = 0
.RightIndent = 0
.SpaceBefore = 0
.SpaceAfter = 0
.LineSpacingRule = wdLineSpaceSingle
End With
End Sub
If you are more familiar with Applescript, the equivalent looks something like this:
-- you may need to fix up the application name
-- (I use this to ensure that the script uses the Open Word 2011 doc
-- and does not try to start Word for Mac 15 (2016))
tell application "/Applications/Microsoft Office 2011/Microsoft Word.app"
tell the paragraph format of the text object of table 1 of the text object of the selection
set paragraph format left indent to 0
set paragraph format right indent to 0
set space before to 0
set space after to 0
set line spacing rule to line space single
end tell
end tell

NotePad++ Changing Few Number Entries

Here is a simple lists where I like to change the numbers: the entries are as below and it got over 300 entries like it
tom112
smith113
harry114
linda115
cindy106
samantha147
It need to be changed to
tom212
smith213
harry214
...and so on.
Please assist using notepad++ regular expression.
Thanks.
Assuming it's just a matter of replacing a name followed by a number starting with 1 with the same number but starting with 2 instead:
Ctrl + H for search & replace.
Check Regular expression under Search Mode.
Next to Find what type or copy in ([a-zA-Z]+)1([0-9]+).
Next to Replace with type or copy in \12\2.
Click Replace All and that should do it.
Add any other characters that might appear in the name before the number inside the first set of brackets with a-zA-Z.

How to count lines of code (LOC) using IntelliJ IDEA?

title says everything plus:
- development language Lua
- code revision control system - Perforce (integrated with IntelliJ IDE)
Posting for posterity - This was the top Google entry when searching "intellij count lines of code" (without quotes)
.
If you're like me and didn't want to install anything else, you can hack it via the native, global search:
Ctrl + Shift + F (to open global search)
Use regex mode (check "regex" checkbox)
In the searchbox, enter only a caret "^" (without the quotes)
You may want to limit the search to a specific directory, via the "directory" tab
Hit the "Open in Find Window" button on the bottom-right
If it asks whether you want to continue, press "Continue"
.
Notes:
In regex, the caret (^) denotes the start of a line, except when inside square brackets, in which case it denotes negation
If you wanted to count non-empty lines, you could instead use "^.*\S" (without quotes), which signifies "The start of a line (^), followed by any number of characters (except newline) (.*), followed by a non-whitespace character (\S)"
You can either turn on the display of lines of code for a single file by right clicking in the left gutter and highlighting "display lines of code". Or you can do it for your entire project by downloading the Statistic plug-in. It's very nice indeed, because it shows LOC and other metrics for your entire project.

Resources