Skip to content

Commit c909e31

Browse files
committed
Allow default mapping to be overridden.
1 parent cf6f4d4 commit c909e31

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

doc/indent_guides.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ Default: 0. Values: 0 or 1.
156156
The default mapping for toggling indent guides is <Leader>ig. You can easily
157157
map it to other keys. For example:
158158
>
159-
:nmap <Leader>ig :IndentGuidesToggle<CR>
159+
:nmap <silent> <Leader>ig <Plug>IndentGuidesToggle
160160
<
161161

162162
You can also map some other commands that are not mapped by default. For
163163
example:
164164
>
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
167167
<
168168

169169
==============================================================================
@@ -226,6 +226,9 @@ Bug reports, feedback, suggestions etc are welcomed.
226226
==============================================================================
227227
7. CHANGELOG *indent-guides-changelog*
228228

229+
1.7 (pending release)~
230+
* Added way to override the default mapping (thanks xuhdev).
231+
229232
1.6~
230233
* Added option g:|indent_guides_space_guides| to control whether spaces are
231234
considered as indention (thanks scoz).

plugin/indent_guides.vim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ call s:InitVariable('g:indent_guides_debug', 0 )
5555
call s:InitVariable('g:indent_guides_space_guides', 1 )
5656

5757
" 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>
5966
6067
" Auto commands
6168
augroup indent_guides

0 commit comments

Comments
 (0)