Skip to content

Commit 1d0abf8

Browse files
committed
Merge branch 'nfischer-add-disable-mapping-option'
2 parents ae9b634 + 2b1af68 commit 1d0abf8

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Version 0.0.6
2+
-------------
3+
Released on January 17th 2016
4+
5+
- add ``pydocstring_enable_mapping`` option.
6+
Thx @nfischer
7+
18
Version 0.0.5
29
-------------
310
Released on September 28th 2015

autoload/pydocstring.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" Insert Docstring.
22
" Author: Shinya Ohyanagi <sohyanagi@gmail.com>
3-
" Version: 0.0.5
3+
" Version: 0.0.6
44
" License: This file is placed in the public domain.
55
" WebPage: http://github.com/heavenshell/vim-pydocstriong/
66
" Description: Generate Python docstring to your Python script file.

doc/pydocstring.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*pydocstring.txt* Generate Python docstring to your Python code.
22

3-
Version: 0.0.5
3+
Version: 0.0.6
44
Author: Shinya Ohynagi <sohyanagi@gmail.com>
55
Repository: http://github.com/heavenshell/vim-pydocstring/
66
License: BSD, see LICENSE for more details.
@@ -161,6 +161,16 @@ g:pydocstring_enable_comment *g:pydocstring_enable_comment*
161161

162162
Default value is '1'
163163

164+
g:pydocstring_enable_mapping *g:pydocstring_enable_mapping*
165+
Disable this option to prevent pydocstring from creating any
166+
key mapping to the `:Pydocstring` command.
167+
Note: this value is overridden if you explicitly create a
168+
mapping in your vimrc, such as if you do:
169+
170+
nmap <silent> <C-m> <Plug>(pydocstring)
171+
172+
Default value is '1'
173+
164174
==============================================================================
165175
EXAMPLE *pydocstring-vim-example*
166176

@@ -196,6 +206,10 @@ Override default mapping.
196206

197207
nmap <silent> <C-m> <Plug>(pydocstring)
198208

209+
To disable mappings entirely, add the following to your .vimrc or _vimrc.
210+
211+
let g:pydocstring_enable_mapping = 0
212+
199213

200214
==============================================================================
201215
vim:tw=78:ts=8:ft=help:norl:noet:fen:fdl=0:

ftplugin/python/pydocstring.vim

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
" File: pydocstring.vim
22
" Author: Shinya Ohyanagi <sohyanagi@gmail.com>
3-
" Version: 0.0.5
3+
" Version: 0.0.6
44
" WebPage: http://github.com/heavenshell/vim-pydocstriong/
55
" Description: Generate Python docstring to your Python script file.
66
" License: BSD, see LICENSE for more details.
@@ -10,9 +10,15 @@ set cpo&vim
1010

1111
command! -nargs=0 -buffer -complete=customlist,pydocstring#insert Pydocstring call pydocstring#insert()
1212

13-
nnoremap <silent> <buffer> <Plug>(pydocstring) :call pydocstring#insert()<CR>
14-
if !hasmapto('<Plug>(pydocstring)')
15-
nmap <silent> <C-l> <Plug>(pydocstring)
13+
if !exists('g:pydocstring_enable_mapping')
14+
let g:pydocstring_enable_mapping = 1
15+
endif
16+
17+
if g:pydocstring_enable_mapping == 1 || hasmapto('<Plug>(pydocstring)')
18+
nnoremap <silent> <buffer> <Plug>(pydocstring) :call pydocstring#insert()<CR>
19+
if !hasmapto('<Plug>(pydocstring)')
20+
nmap <silent> <C-l> <Plug>(pydocstring)
21+
endif
1622
endif
1723

1824
let &cpo = s:save_cpo

0 commit comments

Comments
 (0)