vimtaglist

How to change the preview result position of vim's taglist plugin (hitting 'p')


While using a preview [p] or jump-to [enter] command in the taglist window, the appropriate line is by default in the file-edit window. Because I mostly need to see more of what's right after the selected tag (functions), I'd love to change the line at which the tag is displayed from the center to let's say 1 third of the current page size (number of lines) or even to an explicit line (let's say 10th line from the top).

Is there a command/settings that would adjust the displayed position of a selected tag? (I couldn't find one in the manual).

Thanks


Solution

  • Well, regarding the Ingo Karkat's comment, I managed to locate the appropriate line in the taglist plugin (begginning at line 3357, version 4.6):

    " Jump to the tag
    if a:tagpat != ''
        " Add the current cursor position to the jump list, so that user can
        " jump back using the ' and ` marks.
        mark '
        silent call search(a:tagpat, 'w')
    
        " Bring the line to the middle of the window
        normal! z.
    
        " If the line is inside a fold, open the fold
        if foldclosed('.') != -1
            .foldopen
        endif
    endif
    

    Here the part normal! z. needs to be changed appropriately to something that would change a position of the selected line appropriately. As I'm no vim-plugin guru, I changed it in the most dumb way possible as

    " Bring the line to the middle of the window
    normal! zt
    normal! 10k
    silent call search(a:tagpat, 'w')
    

    which just walks 10times up and than searches the right position again. Hope this might help someone who 'struggles' with the same issue at the moment until a better solution is suggested or Yegappan Lakshmanan, the author, includes this (or rather something nicer) to his plugin (in case he decides to do that of course :) )