This is what I want to do using GVIM 7.3:
- open a file in new tab (first tab)
- get all lines which contain a pattern -> insert them to a register/clipboard
- open a new tab (second tab)
- paste the code from clipboard
- do some regex replace process in the second tab.
I can manually execute commands one by one successfully.
I even can do commands in sequence using this sample :
:let @b="This Value should be pasted in second tab" | :set dir=$TEMP | :tabe tabname | "bp | :%s/tab/tab and replaced in second tab/gi
but when I record them into a macro; The macro stops at step 3
Is there special technique dealing with function/macro that access multiple tabs
Thank you.
this is the commands sample
:let @b="This Value should be pasted in second tab"
:set dir=$TEMP
":tabe tabName
"bp
:%s/tab/tab and replaced in second tab/gi
You have a wrong syntax on your first line: Ex commands should not start with
:: you use:to open command line, it is not an Ex command designator. So, all what"bpdoes in this sequence is commenting the whole line starting with". If you want to execute normal command"bp, useexecute 'normal! "bp', but you can also paste withput b. Function that can do what you want (to be put in~/.vimrc):function! FindToTab(regex) let @b="" execute 'g/'.escape(a:regex, '/').'/.yank B' set dir=$TEMP tabe tabName put b %s/tab/tab and replaced in second tab/gi endfunction noremap <special> ,r :<C-u>call FindToTab(input("What to find? /", @/))<CR>