Sunday, February 1, 2015

Re:Re: How to set cursor position after jump to a tag?

At 2015-02-02 02:46:17, "Gary Johnson" <garyjohn@spocom.com> wrote:  >On 2015-01-31, Jiaxing Wang wrote:  >> By default, the cursor is placed in the middle of the window after jump to a  >> tag definition,   >> but more often than not, a function's code is longer than half the window's  >> height, so I have to  >> press 'z<CR>' after every '<C-]>' to see more code.  >>   >> Is there a way to set cursor position after jump to a tag?  >>   >> I use ':tjump'  so there will be a window when there are more than one match,  >> so a simply  >> ':nnoremap  <C-]>  <C-]>z<CR>' don't work.  >  >It seems that there should be an easier way to do this, but the  >following works.  >  >    function MyTjump(word)  >        exe "tjump" a:word  >        normal zt  >    endfunction  >  >    nmap <silent> <C-]> :call MyTjump(expand("<cword>"))<CR>  >  >You might also be interested in g<C-]>.  See  >  >    :help g_CTRL-]  
>
This works , thanks very much!

>Regards, >Gary > >-- >-- >You received this message from the "vim_use" maillist. >Do not top-post! Type your reply below the text you are replying to. >For more information, visit http://www.vim.org/maillist.php > >--- >You received this message because you are subscribed to the Google Groups "vim_use" group. >To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com. >For more options, visit https://groups.google.com/d/optout.


--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: