Permalink
Browse files

Clean up documentation mapping option to be a user-specified key

  • Loading branch information...
1 parent c4293bd commit f732563f924a1b32b1d18ffdeb8596602fcb9c4a @pearofducks pearofducks committed Sep 2, 2015
Showing with 14 additions and 6 deletions.
  1. +11 −3 README.md
  2. +3 −3 ftplugin/ansible.vim
View
@@ -7,8 +7,8 @@ I don't have time to maintain this and haven't used Ansible in quite some time.
Adds additional syntax highlighting and fixes indentation for Ansible's dialect of YAML.
-Allows the use of the K key in normal mode to search the ansible docs for the keyword underneath the current
-cursor position. Set this option in your vimrc to enable: `let g:ansible_doc_mapping = 1`.
+Allows a user-specified mapping in normal mode to search the ansible docs for the keyword underneath the current
+cursor position. See below for configuration.
Ansible YAML files are detected based on the presence of a modeline or a
[structure following Ansible's Playbook Best Practices](http://www.ansibleworks.com/docs/playbooks_best_practices.html#directory-layout).
@@ -67,7 +67,9 @@ A file is recognized as an Ansible YAML file, and its filetype is set to `ansibl
## Configuration
-So far, there is only one option. Others may be added later.
+All configuration options will live under `g:ansible_options`.
+
+### ignore_blank_lines
If you define
@@ -86,6 +88,12 @@ tasks:
If `g:ansible_options` is not defined, or if the `ignore_blank_lines` key is not present, or the value is not `0`, then the indent function uses the default behavior.
+### documentation_mapping
+
+The documentation_mapping option enables setting a custom mapping to search the Ansible documentation for the word under the cursor.
+
+It can be enabled as such: `let g:ansible_options = {'documentation_mapping': '<C-K>'}` - which would bind Control-K to perform the search.
+
## Thanks
[Benji Fisher](https://github.com/bejifisher) helped out a great amount as a maintainer, thanks a ton!
@@ -22,9 +22,9 @@ setlocal commentstring=#\ %s
let &cpo = s:save_cpo
unlet s:save_cpo
-" Remap K to look in ansible-doc for keyword under cursor
-if exists("g:ansible_doc_mapping")
- nmap K :!ansible-doc <C-R><C-W> *<CR>
+" Remap user-specified binding to look in ansible-doc for keyword under cursor
+if exists('g:ansible_options["documentation_mapping"]')
+ exec 'nmap ' . g:ansible_options["documentation_mapping"] . ' :!ansible-doc <C-R><C-W> *<CR>'
endif
" vim:sts=2:sw=2:

0 comments on commit f732563

Please sign in to comment.