I can execute the following command and then enter "@:" to repeat the command.
This works fine.

:windo silent/foo/|wincmd w
@:

However, when I execute the same command within a function, "@:" displays an
error message saying there is no  previous command.
How can I get the command within the function to be registered as a command for 
"@:"?

function! Find_In_Multiple_Windows(pattern)
  if !empty(a:pattern)
    execute ":windo silent /" . a:pattern . "/|wincmd w"
  endif
endfunction
nnoremap <silent>fw :call Find_In_Multiple_Windows(input("Search for: "))<CR>

fw
Search for: foo
@:
E30: No previous command line

Note: Also posted on stackoverflow, but no responses so far.

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/MN2PR03MB49123F9974FC7E34E2FEE8F0DC5BA%40MN2PR03MB4912.namprd03.prod.outlook.com.

Reply via email to