Thanks a lot! Your solution works great! I suppose I just
misunderstood some mapping features. Could you please explain why you
use "i" command? AFAIK, "i" stands for "insert" - I don't understand
how can you issue yank command, then go to insert mode and select a
word there. Also I'm confused on how do you go back to normal mode to
move to another split file... Honestly, I understood only a bit of
what your solutions does and how, could you please describe it step-by-
step?..

On Nov 15, 11:55 am, "Christian Brabandt" <[email protected]> wrote:
> On Tue, November 15, 2011 8:30 am, Sapfeer wrote:
> > Hi!
>
> > Say I have a file A with line numbers as text and another file B. Both
> > split in the same window. I want to map a command sequence or create a
> > new command for the following:
>
> >  -- yank line number in file A
> >  -- move to file B
> >  -- go to line number, yanked in file A
>
> > I seemed to me somehow like this
>
> > :map <F8> vey^w^w<Insert>G
>
> > <Insert>G part doesn't work I don't know why. Probably I missed up
> > with command to put yanked line number from register to command line
>
> > Any advice or comment is greatly appreciated
>
> First you should always use the :noremap version for mapping keys. Just in
> case any of the keys on the right side have been mapped to a different
> functionality. Second, use explicit :nmap command.
> Third, ^w, if written as 2 characters is different from <Ctrl-W>. In
> mappings you can always use <C-W> if you need Ctrl-W (provided that your
> 'cpoptions' does not include the '<' flag (which should be the default).
>
> So for your purpose, I would use the following sequence to map:
> nnoremap <f8> yiw<C-W><C-W>@0G
>
> (which copies the word under the cursor (into register 0 implicitly),
> moves to the other window and uses register 0 as a count to the G command.
>
> regards,
> Christian

-- 
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

Reply via email to