Add a separator to existing menu in Atom - atom-editor

I added a package to sort lines, but the most used command Sort closely follows the existing command Join Lines. For usability, I'd like to put in a separator to split them. I don't own the sort lines package. I'm just asking to change on my local copy of Atom.

Found it, opened the code for the sort-lines package, went to menus, opened sort-lines.cson, and added { 'type': 'separator' } under submenu.
Closed Atom and reopened, and the separator was there!

Related

How to customize the look of currently selected(highlighted) completion in zsh?

Main question
I would like to add powerline characters at the start and at the end of the selected completion, like this:
Started the completion menu by inserting c and pressing the TAB key.
Moved right in the completion menu by pressing the right arrow key.
Moved down in the completion menu by pressing the down arrow key.
Is there any way to make zsh look/behave like in the pictures?
Note
Added powerline triangle + blank character at the beginning and blank character + powerline triangle at the end should somehow be accounted when columns are created to keep the alignment correct.
Bonus
Add 2 blanks at the beginning of every completion in the list, so that when the completion is selected it doesn't look like the text was moved to the right.
( This issue can be seen by comparing the completion with and without the selection. )
Alternative question
In case that previously explained behavior is impossible to get without changing the zsh source code, is it at least possible to add powerline triangle only at the end of the selected completion?
My unsuccessful attempts
I have tried using the lc, rc, and ec variables in the list-colors style but that didn't help:
Completion list was badly aligned and it created all kinds of visual problems.
Symbols were inserted in all elements of the completion list, not just the selected one.
I have also tried using the ma variable, but I couldn't properly insert a character at the beginning:
The variable expects only a number that represents a color and it is probably wrapped in some escape sequences, so the output did not look as expected.
This works for me.
zstyle ":completion:*:default" list-colors ${(s.:.)LS_COLORS} "ma=48;5;153;1"
Uses my LS_COLORS and then ma sets the background of my selection to bold and color 153 from https://jonasjacek.github.io/colors/.
Found from https://www.zsh.org/mla/users/2010/msg00811.html

How to represent markdown properly with escaping and line breaks?

I'm currently trying to build a chat app, using the official markdown package as well as underscore's escape function, and my template contains something like this:
<span class="message-content">
{{#markdown}}{{text}}{{/markdown}}
</span>
When I grab the text from the chat input box, I try to escape any HTML and then add in line breaks. safeText is then inserted into the database and displayed in the above template.
rawText = $("#chat-input-textbox").val();
safeText = _.escape(rawText).replace(/(?:\r\n|\r|\n)/g, '\n');
The normal stuff like headings, italics, and bold looks okay. However, there are two major problems:
Code escape issue - With the following input:
<script>alert("test")</script>
```
alert('hello');
```
This is _italics_!
Everything looks fine, except the alert('hello'); has become alert('hello'); instead. The <pre> blocks aren't rendering the escaped characters, which makes sense. But the problem is, the underscore JS escape function escapes everything.
SOLVED: Line break Issue - With the following input:
first
second
third
I get first second third being displayed with no line breaks. I understand this could be a markdown thing. Since I believe you need an empty line between paragraphs to get linebreaks in markdown. But having the above behaviour would be the most ideal, anyone know how to do this?
UPDATE Line break issue has been solved by adding an extra \n to my regex. So now I'm making sure that any line break will be represented with at least two \n characters (i.e. \n\n).
You should check the showdown docs and the wiki article they have on the topic.
The marked npm package, which is used by Telescope removes disallowed-tags. These include <script> of course. As the article I linked to above explains, there's still another problem with this:
<a href='javascript:alert("kidding! Im more the world domination kinda guy. Muhahahah")'>
click me for world peace!
</a>
Which isn't prevented by marked. I'd follow the advice of the author and use a HTML sanitation library. Like OWASP's ESAPI or Caja's html-sanitizer. Both of these project's seem outdated dough. I also found a showdown extension for it called showdown-xss-filter. So my advice is to write your own helper, and use showdown-xss-filter.

Aptana: find and replace tabs (with spaces)

I am belatedly setting up Aptana to use four spaces instead of tabs. I've made the necessary changes to the preferences so every new tab inserts four spaces.
All the existing tabs remain, however, and so I get Mixed spaces and tab errors. How can you do a Replace all to fix this? I've tried ^t, <TAB> etc but it just searches for these as normal strings. What are the correct ways to specify a space and a tab?
I've found myself in similar situation and copying whole source code and repasting it helped me out. Just do as follow on your source code Ctrl+A, Ctrl+C, then Del whole code and Ctrl+V it again. You will get only spaces if have set it in options like you mentioned above.
There's an option in the refactor source menu to convert between tabs and space-tabs.
This worked for me: Edit > Find/Replace... (CTRL+F), check Regular Expressions, type \t and type 4 spaces (I use 4 spaces for tab).

Text editing macros in Xcode 4?

I'm trying to figure out how to define a new text editing keystroke in Xcode 4.
To pick one example, Xcode does not appear to have the incredibly useful Emacs join-line function: delete the newline between the current line and the previous line AND ALSO delete any excess indentation whitespace at the beginning of the current line. ie, go in one keystroke from this:
_measurement =
[DPLMeasurement newWithDate:measureDate inManagedObjectContext:[datastore managedObjectContext]];
to this:
_measurement = [DPLMeasurement newWithDate:measureDate inManagedObjectContext:[datastore managedObjectContext]];
and NOT this:
_measurement = [DPLMeasurement newWithDate:measureDate inManagedObjectContext:[datastore managedObjectContext]];
I've seen instructions for user scripts that were apparently for Xcode 3. Does Xcode 4 no longer have anything like this?
Halley's answer to this question does ALMOST what I want:
Xcode duplicate line
Add the following to the plist file, /Developer/Library/PrivateFrameworks/IDEKit.framework/Resources/IDETextKeyBindingSet.plist:
Join Previous Line
String
moveToBeginningOfLine:, moveWordRight:, moveWordLeft:, deleteToBeginningOfLine:, deleteBackward:
I say "almost" because it joins the two lines, and deletes whitespace at the beginning of the second line, but if the first line doesn't end with a space it just rams them together and I have to type in the required space. It also deletes punctuation (like open brackets) if they happen to fall at the beginning of the line. So I'm not quite there.

Teach Notepad++ to fold new multiline comment (R)

Can I teach Notepad++ that it should apply a fold whenever it sees a multi-line comment, where comments start with the hash mark and multi-line comments are hash marks on consecutive lines?
# This is a comment
# It continues on the next line
# and the next
# I want to fold this block
Edit
I submitted a fix to the R lexer to support multi-line comments. It includes the fix to source as well as a compiled SciLexer.dll for those who are eager to use this feature. Simply replace SciLexer.dll in the NPP folder with the one attached to the bug:
https://sourceforge.net/tracker/?func=detail&aid=3485870&group_id=95717&atid=612385
I've tested your multi-line comment with notepad++ 5.9.8 and it correctly fold as a single entity as long as there is a non-comment line between the comment groups and that the language selected has comments starting with '#' (eg: sh).
EDIT:
This seem to be language specific.
I've looked at the xml files that configure the behavior of notepad++ and it seem that this mechanic is hardcoded inside the program.
EDIT2:
The author of the question has just added comment folding support for the R languange!

Resources