Plugin for opening files from clicking text in a file?



  • I need a plugin that will detect string " function " with white spaces, and then read "FolderName:FileName " (Ending to a white space) and make that text region clickable.
    When clicked the plugin will look for the specified file by going 2 folders backwards from the file I was clicking the text from, then open “FolderName” and then “functions” and then open “FileName” into a new tab in Notepad++…
    If there is “FolderName:OtherFolderName/FileName” (“OtherFolderName” is in the directory where “FileName” would have been) It would be nice to detect that too.
    These files are in appdata most of the time so that might effect the code aswell for it to have permissions to go around those files.
    Would make life a lot easier for a handful of .mcfunction “scripters”.



  • I doubt there’s any plugin for that specific task. There might be one that allows generic cross-linking of some sort, but I don’t know it.

    Really, that sounds like a job for one of the scripting plugins, like PythonScript or LuaScript. I don’t know if it could handle every requirement, but it might be able to make a close approximation. (it’s the making the specially-highlighted strings clickable that I think would cause the most difficulty).

    But either as a new plugin, or a script in a scripting plugin, it would take significant coding, and you probably aren’t going to get anyone to code it for you for free. Since you mentioned “scripters”, that might mean you have enough coding skill to do it yourself, but I don’t know.



  • I need clickable text too, since I’m used to it from Notetab Pro (I had to move because it doesn’t support Unicode).

    I need two commands (bound to separate keystrokes):

    • Click pathname to open that file for editing (if detecting pathnames is too hard, requiring surrounding square brackets [] is sufficient)

    • Click URL to open in default browser (again, using surrounding square brackets is sufficient).



  • @David-Spector said in Plugin for opening files from clicking text in a file?:

    Click URL to open in default browser

    You can accomplish this from “Settings” menu => “Preferences” item => “MISC” section and “Clickable Link Settings” check “Enable” box.

    The former - open file can be done with a scripting plugin. I highlight text that is a filename in N++ and then I have Ctrl-Alt-O shortcut mapped to “Open Include File” which is an NppExec command:

    NPP_CONSOLE keep
    NPE_CONSOLE -- v+
    "$(NPP_DIRECTORY)\plugins\nppExtTasks.bat" openinc "$(FULL_CURRENT_PATH)" $(CURRENT_WORD)
    NPP_OPEN $(OUTPUT)
    NPE_CONSOLE -- v-
    

    and the “nppExtTasks.bat” script mentioned above does some logic about directory back tracing and looking in certain include directories if the file extension of the original file is “.c” or “.pl” or other such stuff. If it’s in the same directory:

    NPP_OPEN $(CURRENT_WORD)
    

    would be sufficient.

    Cheers.



  • @David-Spector

    Instead using a scripting plugin it is also possible to use the Open Selection plugin, which is especially made for opening files whose file names are currently selected in a document’s text. You can even configure it to use standard paths (e.g. for include files in the C programming language).

    The plugin can be installed via PluginsAdmin and is available in 32 bit and 64 bit versions.



  • @David-Spector said in Plugin for opening files from clicking text in a file?:

    Click pathname to open that file for editing

    How about simply go to the Edit menu, choose On Selection, then choose Open File?

    It’s annoying to open a series of menus, but can be bound to a keycombo as well for quick access. Of course, you have to have some selected text first…



  • If your core requirement is “open file from text” then a tag lookup plugin can help.
    When generating “tags” file you can indicate to treat each file as a tag and probably (I never tried) to treat ONLY files as tags.
    That way looking up a file name will open it.
    I use it constantly for #include <somefile.h> statements.

    I didn’t follow your exact requirement, they looked extremely specific to your use case so your only hope is to write your own plugin or script.



  • @GreatMCGamer said in Plugin for opening files from clicking text in a file?:

    When clicked the plugin will look for the specified file by going 2 folders backwards from the file

    find_and_open_file_x86.zip

    find_and_open_file_x64.zip

    wacth at youtube


Log in to reply