I like to know how I can connect/map a specific string to a desired buffer.

Let's say I have the following text files:

  • file1: Dog Cat
  • file2: Milk

Now, the 2 files are located at different dirs, and my goal is as follows:

  1. Mouse left click while cursor on "Cat" pops up file2 content.
  2. Mouse right click will bring the user back to file1 content.



Let me introduce a more detailed view containing the association process:

  1. Each user has 2 files in his directory. These files are actually reports that created throughout some user analysis.
  2. The files look as follows:
  • Section 1:
    • <group_name1>
    • group_name1 additional details (some detail about this specific group)
  • Section 2:
    • <group_name2>
    • group_name2 additional details . . Now, pre-proccesing (via TCL/Python/awk) over these files I've:
  • <group_name1>
  • <group_name2> . .

Once user click on <group_name1> - a new window will popup with the additional info of <group_name1>. Once he uses the mouse right-click, he goes back to the main window.

  • 4
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 7, 2021 at 8:36
  • 3
    How is the association determined? Can it be done programmatically or must it be specified manually?
    – D. Ben Knoble
    Sep 7, 2021 at 12:48
  • The association is determined dynamically - it depends on pre-proccessing bunch of text files. Different users will experiene different associations..
    – user37804
    Sep 8, 2021 at 9:19
  • 1
    Without more detail about the association, it will be hard to provide anything beyond a high-level sketch. If it must be mouse-behavior, you would want to look in to (conditionally? <expr>?) re-mapping mouse-clicks.
    – D. Ben Knoble
    Sep 8, 2021 at 15:01
  • Please see original massage edit. Thx..
    – user37804
    Sep 9, 2021 at 16:41

1 Answer 1


Something along the lines of

nmap <RightMouse> :new <cWORD><CR> 

Now you might need to process <cWORD> or do something else. Learn about if,expand and maybe you will need to select,copy and paste the content.

I tried in neovim. Not sure if matters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.