Home Download Buy Blog Forum Support

Bookmarks

Re: Bookmarks

Postby jbrooksuk on Mon Jan 07, 2013 11:23 am

Edit: Jons version works I've got something to work from now :)

This works well for me.

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Comment Markers</string>
    <key>scope</key>
    <string>source comment</string>
    <key>settings</key>
    <dict>
        <key>showInSymbolList</key>
        <integer>1</integer>
        <key>symbolTransformation</key>
        <string>
          s/^[^!]*!([^\n]*).*/$1/g
          s/\W*$//g
        </string>
    </dict>
</dict>
</plist>
jbrooksuk
 
Posts: 839
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Bookmarks

Postby kamranayyub on Fri Jan 11, 2013 9:51 am

If I want drop down menu then?
kamranayyub
 
Posts: 1
Joined: Fri Jan 11, 2013 9:30 am

Re: Bookmarks

Postby jbrooksuk on Fri Jan 11, 2013 9:58 am

CMD+R on OSX. Not sure about Windows.
jbrooksuk
 
Posts: 839
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Bookmarks

Postby kosibar on Sat May 02, 2015 6:05 pm

This is an old thread but I found it useful and wanted to submit my bug fixes and updates.

First I used http://en.wikipedia.org/wiki/Comment_%28computer_programming%29#In_context to learn about various comment formats.

quodlibet wrote:+ Re-write so that you don't need to space before the bang (while still ignoring HTML punctuation)

quodlibet wrote:# !this works
#!this doesn't


Changed the "\S+" in the first regex to "\S[^!]*" which replaces everything except "!". The "\S+" matched the exclamation mark and removed it. I included the "\S" at the start because Fortran 90 uses "!" to denote a comment. I also added an HTML-specific string so it isn't thrown off by the "!" in "<!--".

Of course this won't work with languages like Haskell which place no text before the comment. You could probably fix this by including a space before the "!".

quodlibet wrote:+ Doesn't work in CSS, although it works for other syntaxes with C-style comments (/* xxx */). Need to investigate.


Can't figure this one out.

I found a package called "Scope Hunter" that tells you the scope of the text under your cursor. In a CSS comment it shows "source.css" and "comment.block.css" just like my PHP example which shows "source.php.embedded.block.html" and "comment.block.php" (both have "source" and "comment" scopes).

HTML didn't work for me either but Sublime doesn't include "source" in the scope for HTML files. I assume that Sublime knows what a comment is regardless of its context so I took "source" out and now HTML works.

ScopeHunter: https://packagecontrol.io/packages/ScopeHunter

quodlibet wrote:+ Strip common punctuation from end of single comments (such as, -->)


The second line in the symbolTransformations below was added.

Here is my modified version of the code:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Comment Bang</string>
    <key>scope</key>
    <string>comment</string>
    <key>settings</key>
    <dict>
        <key>showInSymbolList</key>
        <integer>1</integer>
        <key>symbolTransformation</key>
        <string>
            s/^(&lt;!--|\S)[^!]*\s*//g                # strip opening punctuation + spacing
            s/\s*(\*\/|--&gt;|-\}|#&gt;)$//g          # strip closing text on block comments
            s/^[^!].*//g                              # remove all comments that DON'T begin with a bang
            s/^!\s*//g                                # strip the leading exclamation and spacing
            s/^(.*?)\n.*/$1/g                         # keep only 1st line (in case of multiline comment)
        </string>
    </dict>
    <key>uuid</key>
    <string>7fdae8f0-c6c7-11e1-9b21-0800200c9a66</string>
</dict>
</plist>
kosibar
 
Posts: 1
Joined: Sat May 02, 2015 4:12 pm

Re: Bookmarks

Postby quodlibet on Sun May 03, 2015 7:54 pm

Hey,

I haven't used it in a while but I had put together a slightly improved version here:
https://github.com/alehandrof/BetterGoT ... references

The readme explains more things: https://github.com/alehandrof/BetterGoTo

Hope this helps,
Alex
quodlibet
 
Posts: 574
Joined: Sat Jun 18, 2011 5:53 pm

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 20 guests