Permalink
Browse files

Add ack.vim plugin

I have long wanted an easy way to replicate TextMate's "Find in Project",
and this delivers it via a backslash shortcut and selectable results in
a "quickfix" window. If present, Ripgrep or The Silver Searcher (Ag) will
be used instead of Ack for faster search results.

https://github.com/mileszs/ack.vim#keyboard-shortcuts
https://github.com/BurntSushi/ripgrep#whirlwind-tour
  • Loading branch information...
1 parent e863cf9 commit 6a455cb3e27d4006fcfcb089b353751e8e3e8b84 @justinmayer committed Sep 27, 2016
Showing with 16 additions and 2 deletions.
  1. +1 −1 bin/bootstrap.sh
  2. +6 −1 vim/keys.vim
  3. +8 −0 vim/plugins.vim
  4. +1 −0 vim/vundle.vim
View
@@ -17,7 +17,7 @@ if [ "$OS" = "darwin" ]; then
[ ! -f /usr/local/bin/brew ] && /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install basic packages
- for pkg in git grc pixz ssh-copy-id vcprompt wget
+ for pkg in git grc pixz ssh-copy-id vcprompt wget ripgrep
do
[ ! -f /usr/local/bin/$pkg ] && brew install $pkg
done
View
@@ -1,4 +1,4 @@
-" Directional keys -------------------------------------------------------------
+" Directional keys ------------------------------------------------------------
" When wrapping is on, move cursor by displayed lines instead of file lines
noremap j gj
@@ -10,3 +10,8 @@ noremap gk k
noremap H ^
noremap L $
vnoremap L g_
+
+" Plugin key bindings ---------------------------------------------------------
+
+" Backslash invokes ack.vim
+nnoremap \ :Ack<SPACE>
View
@@ -4,3 +4,11 @@ python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
set laststatus=2 " Always show the statusline
+
+" ack.vim: use ripgrep/ag if available ----------------------------------------
+
+if executable('rg')
+ let g:ackprg = 'rg -S --no-heading --vimgrep'
+elseif executable('ag')
+ let g:ackprg = 'ag --vimgrep'
+endif
View
@@ -12,6 +12,7 @@ Plugin 'VundleVim/Vundle.vim'
Plugin 'twerth/ir_black'
" Behaviors
+Plugin 'mileszs/ack.vim'
Plugin 'matchit.zip'
Plugin 'tpope/vim-commentary'
Plugin 'bronson/vim-trailing-whitespace'

0 comments on commit 6a455cb

Please sign in to comment.