Go to Line Number

Joseph J's Avatar

Joseph J

31 Jul, 2021 04:21 AM

Is there a shortcut or feature that allows to Go to Line number ?

Am using marked2 with silversearcher (ag) from CLI. Silver searcher lists the found search strings with a line number.
So the workflow is like this
1. From CLI Use silversearcher to search multiple markdown files
2. From CLI Open the specific *.md file in MarkedApp
3. Go To Line with a shortcut like CMD+G and enter the line number
* Better yet pass an argument from the terminal to open a file in marked app and go to the specific line 

  1. Support Staff 1 Posted by Brett on 31 Jul, 2021 07:58 PM

    Brett's Avatar

    Once Markdown is rendered to HTML, the line numbers from the original
    document have no direct correlation with the represented version
    anymore. So, short answer, there's not currently a way to jump to a
    point that represents a given line number from the original document.

    I've considered injecting a bunch of hidden HTML tags representing line
    numbers before the Markdown conversion happens, which I could then use
    to correlate screen position and line number, but all that extra markup
    is too messy. Plus it would likely interfere with custom processors,
    meaning I could only make it work for people using the built-in
    processors, which is then more support tickets. I've definitely thought
    about it, though, it would be a useful trick. I just haven't found a
    reasonable way to make it work.

    -Brett

  2. 2 Posted by Joseph J on 01 Aug, 2021 03:33 PM

    Joseph J's Avatar

    Thanks for the Reply.

    I wasn't thinking that Marked 2 was rendering Markdown to HTML. :(
    Guess I got too comfortable with the Vim shortcuts on Marked to like 'gg' "G", "/' for find, then I started pressing 22gg and it didn't work. :)

  3. Support Staff 3 Posted by Brett on 01 Aug, 2021 06:57 PM

    Brett's Avatar

    Yeah, some things can't be replicated as easily :). I, too, use the vim
    shortcuts all the time, glad to hear someone else is finding them
    useful!

    -Brett

  4. 4 Posted by Joseph J on 02 Aug, 2021 04:20 AM

    Joseph J's Avatar

    Sorta' got it working from the terminal using Keyboard Maestro (KM) using these steps.

    1. Search using silver-searcher in the Terminal
    2. Copy the filename&search-string as URLEncoded String to clipboard using a script
    3. Trigger a Macro on KM using its Macro URL scheme (KM-URL)
    4. The KM Macro
      1. Opens the filename in Marked2.app
      2. Press Key "/" & paste the search-string
    5. Press CMD+G or CMD+SHIFT+G to navigate the matches in Marked2.app

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac