Skip to content

Commit 6a455cb

Browse files
committed
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
1 parent e863cf9 commit 6a455cb

File tree

4 files changed

+16
-2
lines changed

4 files changed

+16
-2
lines changed

bin/bootstrap.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if [ "$OS" = "darwin" ]; then
1717
[ ! -f /usr/local/bin/brew ] && /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
1818

1919
# Install basic packages
20-
for pkg in git grc pixz ssh-copy-id vcprompt wget
20+
for pkg in git grc pixz ssh-copy-id vcprompt wget ripgrep
2121
do
2222
[ ! -f /usr/local/bin/$pkg ] && brew install $pkg
2323
done

vim/keys.vim

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
" Directional keys -------------------------------------------------------------
1+
" Directional keys ------------------------------------------------------------
22

33
" When wrapping is on, move cursor by displayed lines instead of file lines
44
noremap j gj
@@ -10,3 +10,8 @@ noremap gk k
1010
noremap H ^
1111
noremap L $
1212
vnoremap L g_
13+
14+
" Plugin key bindings ---------------------------------------------------------
15+
16+
" Backslash invokes ack.vim
17+
nnoremap \ :Ack<SPACE>

vim/plugins.vim

+8
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ python from powerline.vim import setup as powerline_setup
44
python powerline_setup()
55
python del powerline_setup
66
set laststatus=2 " Always show the statusline
7+
8+
" ack.vim: use ripgrep/ag if available ----------------------------------------
9+
10+
if executable('rg')
11+
let g:ackprg = 'rg -S --no-heading --vimgrep'
12+
elseif executable('ag')
13+
let g:ackprg = 'ag --vimgrep'
14+
endif

vim/vundle.vim

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Plugin 'VundleVim/Vundle.vim'
1212
Plugin 'twerth/ir_black'
1313

1414
" Behaviors
15+
Plugin 'mileszs/ack.vim'
1516
Plugin 'matchit.zip'
1617
Plugin 'tpope/vim-commentary'
1718
Plugin 'bronson/vim-trailing-whitespace'

0 commit comments

Comments
 (0)