On Sat, Nov 22, at 08:59 Fredrik wrote: > > I am making notes of my spendings in a cashbook. I am inputting a line > like this: > > -10 Beer > > So I was thinking that it would be nice if I could in a second buffer > see all my previous entries regarding beer (to give me an idea of just > how much money I am actually spending on beer). The matching part of > the problem I know how to do, but I am a bit unsure of how to make two > buffers work together like this. I guess it just boils down to map the > Enter key like this: > <CR> ---> <Esc><C-w>j !!MyFilterScript<C-w>k o > > But how do I tell the second buffer which line I was at in the first > buffer then..? Well, I'm on loose ground generally. I'm not proficient > in Vim. :) >
Using the internal grep and the quickfix window? Here is function to get an idea: (Assuming in the following sample, that the last word in the current line is the entry in your cashbook or else you can (possible) use: expand('<cword>')) function! UpdateRecords() let pat = get(split(getline('.')), -1, '') if !empty(pat) execute 'vimgrep /'.pat.'/j %' copen if &buftype == 'quickfix' wincmd k endif endif endfunction imap <buffer> <Char-0x0d> <C-o>:call UpdateRecords()<CR><Esc>o > Best regards, > Fredrik Regards, Ag. --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---