سؤال

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>)
هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top