Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a tidbit about useful mapping function to README.md FAQ #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,30 @@ the convention of Vim's built-in `:grep` and `:make` commands.
[The Silver Searcher]: https://github.com/ggreer/the_silver_searcher
[sadface]: https://github.com/mileszs/ack.vim/commit/d97090fb502d40229e6976dfec0e06636ba227d5#commitcomment-5771145

#### How do I use this in a mapping? ####

Call one of Ack.vim's defined functions from a map:

```vim
map <D-F> :Ack!
```

Or use

```vim
function! Search ()
if empty(@/)
call feedkeys(':Ack! ')
else
:AckFromSearch!
endif
endfunction

map <silent> <D-F> :call Search()<CR>
```

to automatically search for the highlighted text (the `@/` register contains highlighted text) or start a prompt for the text to search for.

## Changelog

Please see [the GitHub releases page][releases].
Expand Down