Shawn & Vim friends, On Mar 21, 2007, at 6:21 PM, shawn bright wrote:
cool, thanks, i knew there had to be something.
And it keeps getting better. Due to Vim's extensive programmability (and keystroke mapping and the endless creativity of its developer and user communities), you can extend its behavior to your needs. When you use the n and N keystrokes to step forward and backwards through the list of matches for a pattern, the focus inevitably moves down the screen from match to match until it reaches the last match on the screen, then the screen scrolls up or down to bring the next of-screen match into view... I tire of having to follow the cursor up and down the screen following the cursor, so I came up with a solution that works for me. Now, I happen to use a Mac, so the keystrokes I've mapped make sense to me, but might be different for someone else... This is a chunk out of my .vimrc file: " Command-[ and Command-] put the prev/next match at top of screen map <D-[> kNz<CR> " put prev match at top of screen map <D-]> jnz<CR> " put next match at top of screen Thus, after having typed something like: /foo with my mappings, I can type command-] to go to the next match AND scroll it to the top of my screen. That way, my tired old eyes can sit in one place and watch the matches come to them. This is especially handy when I'm editing a data file that has a lot of lines that are formatted quite similarly: as the matched lines replace each other as the "first" line on the screen, I clearly see the parts that stay the same and the parts that change -- I make a lot fewer mistakes that way. Dave