Skip to content
This repository
Browse code

Allow default mapping to be overridden.

  • Loading branch information...
commit c909e3193ac23dc55f6f2af5761e030f9e1dbac2 1 parent cf6f4d4
Nate Kane authored

Showing 2 changed files with 14 additions and 4 deletions. Show diff stats Hide diff stats

  1. +6 3 doc/indent_guides.txt
  2. +8 1 plugin/indent_guides.vim
9 doc/indent_guides.txt
@@ -156,14 +156,14 @@ Default: 0. Values: 0 or 1.
156 156 The default mapping for toggling indent guides is <Leader>ig. You can easily
157 157 map it to other keys. For example:
158 158 >
159   - :nmap <Leader>ig :IndentGuidesToggle<CR>
  159 + :nmap <silent> <Leader>ig <Plug>IndentGuidesToggle
160 160 <
161 161
162 162 You can also map some other commands that are not mapped by default. For
163 163 example:
164 164 >
165   - :nmap <Leader>ie :IndentGuidesEnable<CR>
166   - :nmap <Leader>id :IndentGuidesDisable<CR>
  165 + :nmap <silent> <Leader>ie <Plug>IndentGuidesEnable
  166 + :nmap <silent> <Leader>id <Plug>IndentGuidesDisable
167 167 <
168 168
169 169 ==============================================================================
@@ -226,6 +226,9 @@ Bug reports, feedback, suggestions etc are welcomed.
226 226 ==============================================================================
227 227 7. CHANGELOG *indent-guides-changelog*
228 228
  229 +1.7 (pending release)~
  230 + * Added way to override the default mapping (thanks xuhdev).
  231 +
229 232 1.6~
230 233 * Added option g:|indent_guides_space_guides| to control whether spaces are
231 234 considered as indention (thanks scoz).
9 plugin/indent_guides.vim
@@ -55,7 +55,14 @@ call s:InitVariable('g:indent_guides_debug', 0 )
55 55 call s:InitVariable('g:indent_guides_space_guides', 1 )
56 56
57 57 " Default mapping
58   -nmap <Leader>ig :IndentGuidesToggle<CR>
  58 +if !hasmapto('<Plug>IndentGuidesToggle')
  59 + nmap <silent><unique> <Leader>ig <Plug>IndentGuidesToggle
  60 +endif
  61 +
  62 +" Plug mappings
  63 +nnoremap <unique><script> <Plug>IndentGuidesToggle :IndentGuidesToggle<CR>
  64 +nnoremap <unique><script> <Plug>IndentGuidesEnable :IndentGuidesEnable<CR>
  65 +nnoremap <unique><script> <Plug>IndentGuidesDisable :IndentGuidesDisable<CR>
59 66
60 67 " Auto commands
61 68 augroup indent_guides

0 comments on commit c909e31

Please sign in to comment.
Something went wrong with that request. Please try again.