douluan4644
douluan4644
2014-01-27 10:10

如何在VIM中包含.go以搜索Ack?

已采纳

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>)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • douming4359 douming4359 7年前

    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.

    点赞 评论 复制链接分享