For simple random cases, you can write a function that opens a specific file based on the word under the cursor. You can then map this function to a double-click event.
For example:
function! CustomLoad() let word = expand("<cword>") let path = "/path/to/file/to/be/opened" if ( word == "special_keyword" && filereadable(path) ) sil exe "split " . path endif endfunction
And map it using:
nnoremap <2-LeftMouse> :call CustomLoad()<CR>
Thus, double-clicking (in normal mode) the word special_keyword will open the file /path/to/file/to/be/opened , if it is available for reading. You can add several cases for different keywords or do some text processing of the keyword to generate a file name, if necessary. (Note that the filereadable condition filereadable not necessary, but probably a good idea.)
Hope this helps.
Prince goulash
source share