Code find-xargs(less)-gvim
%http://unix.stackexchange.com/a/277889/16920
find . -name "*.tex" -exec grep -il "agent" {} + | less -s -M +Gg
Output
./InfectiousDiseases/1.4.2016.tex
./InfectiousDiseases/2.11.2015.tex
./InfectiousDiseases/21.4.2016.tex
...
In less, command !gvim
- You se the current line number at the status bar at the bottom. It locates at the top of the window.
- Expected output is the file ./InfectiousDiseases/1.4.2016.tex of the current line in a new window gvim.
- Current output is unsuccessful with empty file in vim.
Muru's proposal with Xargs in less
|X xargs gvim
which is about
|Xcommand Pipe file between current pos & mark X to shell command.
...
Muru's suggestion with find-vim-gvim
find . -name "*.tex" -exec grep -il "agent" {} + | vim -
I do successfully :tabe <cfile>
or :vs <cfile>
just by keeping cursor on the current line.
I do successfully !gvim <cfile>
but the list view goes to the another view Press ENTER or type command to continue
which I do not like.
I would like to keep the view in the list view.
It would be also great to have a binding/macro for launching many external windows fast on the current line.
:nnoremap gff :silent! exec "!gvim " shellescape('<cfile>') <bar> redraw!<cr>
which works successfully by pressing gff
on the current cursor position.
I think the sequence binding gff
is too slow.
It would be great to have a stereo binding that is pressing two buttons which activates the macro.
I can recall that CTRL-1 or CTRL-ESC or CTRL-F1 could be possible.
...
I am having some problem with stereo keybindings <C-1>
because stereo keybinding is impossible in Vim, but not in some Gvim's. I extended OS X specific part here in Apple Stackexchange, but noticed that Vim Stackexchange knows better so here.
How can you execute gvim on the current line in viewer?
|X xargs gvim
, whereX
is a mark (dunno what that is). In vim, maybe you could create a custom command::command E !gvim <cfile>
. Then you can do:E
. (Or a map with similar effects):nnoremap gff :silent! exec "!gvim " shellescape('<cfile>') <bar> redraw!<cr>
. Then you can pressgff
while on the filename.less
typeh
. You'll see|X
mentioned right below!
. It says it pipes content between current line and markX
to the command. And to convert stdin to args,xargs
it is.