Vim, Ag and Quickfix window, limit output width and height -
is there way limit :ag
output takes 1 line , doesn't blow quickfix window?
at moment looks , it's awful. can't see filenames, super slow , sucks:
update record, scrolled quickfix window bit illustrate point better. , while usable via :cn
:cp
, able glance on results j
k
.
looking on man page, there not seem way limit output built ag itself.
is there way of limiting line length? actually, have built in "cut" command in linux, e.g. using on shell:
ag --column foo | cutting -c 1-80
limit lines 80.
now have create ag.vim
execute our specially crafted command, g:agprg
exists. first thing thought of this:
let g:agprg='ag --column \| cutting -c 1-80' " doesn't work
the problem ag.vim
plugin appends arguments end, , end executing ag --column | cutting -c 1-80 something-i-searched-for
. there way straight "insert" arguments before |?
one trick utilize temporary shell function, this:
f() { ag --column "$@" | cutting -c 1-80 }; f something-i-search-for
unfortunately, still can't utilize this. ag.vim
checks whether or not first word actual command. complains no executable name of "f()" exists. final solution:
let g:agprg='true ; f(){ ag --column "$@" \| cutting -c 1-80 }; f'
as true
exists , doesn't except homecoming true, works!
to actual screenwidth instead of 80
, use:
let g:agprg='true ; f(){ ag --column "$@" \| cutting -c 1-'.(&columns - 6).' }; f'
i added magic - 6
here business relationship characters vim adds.
vim ag
No comments:
Post a Comment