Atom, How to stop the new line from beeing commented? - comments

When having a line of code that is commented on Atom, I press enter and the new line starts with a comment, which I hate.
How do you stop that? I've searched but haven't found the answear...
import numpy
import pandas
# Commented line ↓ cursor here > enter
# new line has comment
Also important, If you have two lines of code and press enter, the new in between line should be commented. How do you keep that behavior.
# original line 1 ↓ cursor here > enter
# -> new line
# original line 2

Related

How to detect a blank line between filled lines in .txt file and convert it to a single tab

I an running a bash/.dat script (Mac terminal) and part of it is converting each line return into a TAB (to get it ready for nicely importing into Excel). The problem is that I also want to remove all extra blank lines except a single blank line when comes between two filled lines. So...
Line pre-A is blank
Line A has text
Line B has text
Line C is blank
Line D has text
Line E is blank
Line F is blank
Line C above would become a TAB and Line E and F (and pre-A) would be deleted. Also, sometimes there is a blank line before Line A (labelled Line pre-A above), so I'd want it removed but not replaced with a TAB.
So the result would be:
Line A text [TAB] Line B text [TAB] [TAB] Line D text
...and it'd be OK if Line D text was followed by a [TAB]. Make sense? Is this doable and, if so, how?
Thanks!
If perl is your option, would you please try:
perl -0777pe 's/^\n+//; s/\n{3,}/\t/g; s/\n/\t/g' file.txt
The -0777 option tells perl to slurp all lines at once to process
newline characters between lines.
The -pe option enables the one-liner programming.
The first substitution s/^\n+// removes the pre blank line(s).
The next s/\n{3,}/\t/g converts three or more consecutive newline
characters (meaning two or more blank lines) into a tab character.
The last s/\n/\t/g converts the newline characters into the same number
of tab characters.

Is it possible to preserve long lines in Sphinx?

My restructuredText input file to Sphinx has a long line:
This is a long line text that I want to keep as a long single line. It should not be wrapped in the text output.
Using the text builder of Sphinx, I get this output:
This is a long line text that I want to keep as a long single line. It
should not be wrapped in the text output.
Sphinx wraps the line.
I would like to keep the single long line as is. Is this possible?
Using Line Blocks was suggested in this answer. However using line blocks changes the indentation of the line. I could not find a way to keep the indentation same with Line Blocks.
For input:
Prev Line
| This is a long line text that I want to keep as a long single line. It should not be wrapped in the text output.
Next Line
I get this output:
Prev Line
This is a long line text that I want to keep as a long single line. It should not be wrapped in the text output.
Next Line
The long line is kept long but it is indented now.
I was not able to find a setting about line wrapping in Sphinx configuration page.
I am using sphinx-build version 1.7.4 and the command I use is:
sphinx-build -M text "." "_build"
Update:
The code-block directive also indents the long line.
Input:
Prev Line
.. code-block:: text
This is a long line text that I want to keep as a long single line. It should not be wrapped in the text output.
Next Line
Output:
Prev Line
This is a long line text that I want to keep as a long single line. It should not be wrapped in the text output.
Next Line
Monkey-patching the rendering of line blocks for Text writer works for me:
add this to conf.py
def my_visit_line_block(self, node):
# type: (nodes.Node) -> None
self.new_state(indent=0)
self.lineblocklevel += 1
def setup(app):
from sphinx.writers.text import TextTranslator
TextTranslator.visit_line_block = my_visit_line_block
The obvious defect is that it modifies rendering of all line blocks...
I am not familiar enough about sphinx.writers.text (and docutils) to see immediately if there is better way than the above monkey-patching.
I could re-insert indentation via this mark-up:
| \ one
| \ two
| \ three
but being forced to modify mark-up is bad.

Underlining text in vi

Is there a quick way to insert a line with the same number of hyphens or = characters as there are in the current line in vi(m)? That is, to go from:
My Heading
to:
My Heading
==========
without going to the end of the line, reading the number of characters in it from CTRL-G, opening a new line underneath, and typing <n>i= ?
I use the following mappings in my own markdown.vim:
" Level 1 Heading
nnoremap <leader>1 :co.<CR>Vr=A<CR><Esc>
inoremap <leader>1 <Esc>:co.<CR>Vr=A<CR>
The first mapping is for when already in Normal mode while the second Insert mode mapping returns to Insert mode with the cursor at the start of the line underneath the heading.
Use the Ex copy command, :co to copy the line without affecting the contents of any of the Vim registers.
Then select all of the copied line with V.
Finally, r= replaces each of those characters with an equal sign.
For the mapping keys, I use the leader key (defaults to \) followed by the numeral 1 to represent a Level 1 heading in Markdown.

How to add line break in rdoc

I have a code and comments for RDoc like this:
# first line comment
# second line comment
def foo
end
When I output document by rdoc foo.rb, then line break are ignored in HTML file.
To add line break I can write like:
# first line comment<br>
# second line comment
or
# first line comment
#
# second line comment
but I feel both way are not simple enough.
Is there other simple way to add line break in RDoc?
Just add two or more spaces to the end of the line and it will work.
#first comment
#second comment
def foo
end
The first line has 2 spaces after comment.
Add answer regarding add line break in common text:
Make heading with full white space
 "===  " # <= the quoted part
At least this works on github.

Sublime insert a symbol to the end of line to make column

I want to insert " to the end of each lines
I have the following text:
Some test\n
Also some text\n
The rest of text\n
And I want to get like this one:
Some test "\n
Also some text "\n
The rest of text "\n
Where \n - end of line
I just did a search for "sublime line padding" and found:
http://wbond.net/sublime_packages/alignment
Hope it helps.
From the website:
Features
Align multiple selections to the same column by inserting spaces (or tabs)
Align all lines in a multi-line selection to the same indent level
Align the first = on each line of a multi-line selection to the same column
See the screenshots below for examples of the plugin in action.
Installation
Download Package Control and use the Package Control: Install Package command from the command palette. Using Package Control ensures Alignment will stay up to date automatically.

Resources