Question

Here is my .vimrc for Ack, But it can't search .go files, I'd like add .go support.

let g:ackprg="ack-grep -H --nocolor --nogroup --column"

function! Ack(args)

let grepprg_bak=&grepprg
exec "set grepprg=" . g:ackprg
execute "silent! grep " . a:args
botright copen
let &grepprg=grepprg_bak
exec "redraw!"

endfunction

command! -nargs=* -complete=file Ack call Ack(<q-args>)
Était-ce utile?

La solution

Since version 1.94, ack has support for the Go language built-in.

$ ack --help type
...
    --[no]go           .go

You can explicitly enable it by passing --go, but it should be included in the search by default.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top