Community
    • Login

    relative paths in search results

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    search
    5 Posts 3 Posters 21.3k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gfgtdfG Offline
      gfgtdf
      last edited by

      i wonder whether its possible to get the search-in-files list to use relertive paths instead of absolute paths, for example if i seached in file in the folder C:\folder\folder2 i want the resultlist for example for resuls in the file C:\folder\folder2\folder3\file.txt to only show .\folder3\file.txt instead of the whole C:\folder\folder2\folder3\file.txt. The follwing image shows my problem quite well:

      https://i.imgur.com/MSy5p0J.png

      i searched in ‘C:\Users\Daniel\Documents\My Games\Wesnoth1.14\data\add-ons\World_Conquest_II’ and i cannot see the actual filenames at all unless i move the searchresults list to someplace where it would block the usual codeview compltely, (the window is maximized. this is a small screen and putting the list to the bottom is also not really an option.)

      ps: is it possible to upload images directly to this post? i couldn’t figure out how.

      1 Reply Last reply Reply Quote 2
      • PeterJonesP Offline
        PeterJones
        last edited by PeterJones

        I don’t think that feature currently exists. FAQ Desk: Feature Request explains the right location to ask for new features.

        Regarding results too wide to see the actual filenames: if you click in the Results window, and use Ctrl+A to select all, you can then paste the results into a normal Notepad++ editing pane (such as after File > New). If you trim out all the lines that start with a tab (such as Find what:(?-s)^\t.*\R, Replace with:`` (blank), enable Regular expression), it will just leave (mostly) just the filename rows, but delete the result rows… After that, you can do a search/replace (this time, case insensitive, without regular expression, so the windows backslash doesn’t become meaningful), where you search for the c:\folder\folder2\ and replace with .\ … then all the files are relative. But that is only a workaround, and won’t have the nice features of the find-in-files results window, sorry.

        Embedded images: if you noticed the COMPOSE ? in the upper-right of your text-edit window, you could have clicked on it, and it would have directed you to Markdown documentation, where it says to embed an image, use the syntax ![](https://url.of/image.png)

        Also, you should look at this old post to find other good formatting hints for this forum. ( @Scott-Sumner was thinking about turning that old post into an entry on our FAQ Desk, but apparently hasn’t found the Round Tuit™ yet. I keep hoping my continued @-mentions will help him find the Tuit™ :-) )

        [edit: fix phrasing, especially incomplete sentence; reorder paragraphs]

        1 Reply Last reply Reply Quote 2
        • gfgtdfG Offline
          gfgtdf
          last edited by

          ok thx, i’ll consider filing a report on gh, i just asked here first becasue i hoped it might already exist and also becasue this place seemed more active than gh.

          Scott SumnerS 1 Reply Last reply Reply Quote 2
          • Scott SumnerS Offline
            Scott Sumner @gfgtdf
            last edited by Scott Sumner

            @gfgtdf

            I really like this idea. I’d suggest a Preferences… option to replace leading Directory: text with ... in the Find result panel.

            As an example, if the Directory: box contains the following when the Find in Files is executed:

            C:\Users\Daniel\Documents\My Games\Wesnoth1.14\data\add-ons\World_Conquest_II
            

            hits in the file :

            C:\Users\Daniel\Documents\My Games\Wesnoth1.14\data\add-ons\World_Conquest_II\lua\effects.lua
            

            would simply show up in the Find result panel as :

            ...\lua\effects.lua (2 hits)
            
            1 Reply Last reply Reply Quote 2
            • Scott SumnerS Offline
              Scott Sumner
              last edited by

              I would think (haven’t checked the Notepad++ source code) that in order to jump to hits when they are double-clicked in the Find result panel, Notepad++ actually reads the data out of the panel itself to determine file path…so it can switch to (or open) the necessary file and jump to the correct line.

              Thus, I would modify my previous suggestion from showing only this in the Find result panel:

              ...\lua\effects.lua (2 hits)
              

              to displaying something more along these lines:

              ...\lua\effects.lua (2 hits) - C:\Users\Daniel\Documents\My Games\Wesnoth1.14\data\add-ons\World_Conquest_II\...
              

              That way Notepad++ could put the complete path back together when needed.

              1 Reply Last reply Reply Quote 1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors