Hi Teemu, thank you very much for the suggestion,

> > :r ! find . -name *.css
>
> > Is there any way to combine the two? I.e. use the output of a find
> > command in a :tabnew? This would make it so easy to find and open
> > files at the same time. :)
>
> Perhaps this idea can be modified to match your needs:
>
>    http://vim.wikia.com/wiki/Display_shell_commands%27_output_on_Vim_window
>
> In the function change the "botright new" line to "tabnew" and create
> new Vim commands like this:
>
>     command! -nargs=+ Find call s:RunShellCommand('find '.<q-args>)
>
> Then just ":Find -what -ever -arguments" will do.

This is an awesome function. :)

Maybe I misunderstood what were getting at though. Here is what I put
in my .vimrc:

command! -complete=file -nargs=+ ShellTab call s:RunTabShellCommand(<q-
args>)
function! s:RunTabShellCommand(cmdline)
  tabnew
  setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
  call setline(1,a:cmdline)
  call setline(2,substitute(a:cmdline,'.','=','g'))
  execute 'silent $read !'.escape(a:cmdline,'%#')
  setlocal nomodifiable
  1
endfunction

command! -nargs=+ Find call s:RunTabShellCommand('find . -iregex '.<q-
args>)

But this opens a new [Scratch] buffer with the search results in a new
tab.

I want a new tab opened containing not the search results, but the
files I was searching for. :)  I.e. I want to say
:Find myF.*.txt
and have myFile.txt opened in a new tab.

Rob
:)
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to