When I use CTRL+] to jump to a tag, the cursor will be placed at the center of the window. How can I make it stop at the top of the window? Now I do this by pressing CTRL+D after each jump. I was wondering whether vim can do this for me automatically.
Asked
Active
Viewed 412 times
1
Michael Ma
- 730
- 1
- 5
- 13
:nnoremap <C-]> <C-]><C-d>. But Vim should already put the cursor at the top of the screen with just<C-]>. it does for me, anyway. Which filetype are you using? Make use a custom implementation. Also see: How do I debug my vimrc file?. – Martin Tournoij May 25 '17 at 01:57vim does place the cursor at the topbut your question saysthe cursor will be placed at the center? – Martin Tournoij May 25 '17 at 02:15<C-d>will leave the cursor where it is in the window, but scroll the buffer, so the cursor will no longer be on the tag.zt(and related commandszzandzb) will move the cursor and buffer together, so both will be at the top (or middle or bottom) of the window. – 8bittree May 25 '17 at 18:28