diff --git a/ftplugin/python/pydocstring.vim b/ftplugin/python/pydocstring.vim index 8aaafd3..e267c4f 100644 --- a/ftplugin/python/pydocstring.vim +++ b/ftplugin/python/pydocstring.vim @@ -14,17 +14,13 @@ if !has('nvim') && (!has('channel') || !has('job')) finish endif -command! -nargs=0 -range=0 -complete=customlist,pydocstring#insert Pydocstring call pydocstring#insert(, , , ) -command! -nargs=0 -complete=customlist,pydocstring#format PydocstringFormat call pydocstring#format() +command! -buffer -nargs=0 -range=0 -complete=customlist,pydocstring#insert Pydocstring call pydocstring#insert(, , , ) +command! -buffer -nargs=0 -complete=customlist,pydocstring#format PydocstringFormat call pydocstring#format() -if !exists('g:pydocstring_enable_mapping') - let g:pydocstring_enable_mapping = 1 -endif - -if g:pydocstring_enable_mapping == 1 || hasmapto('(pydocstring)') - nnoremap (pydocstring) :call pydocstring#insert() - if !hasmapto('(pydocstring)') - nmap (pydocstring) +nnoremap (pydocstring) :call pydocstring#insert() +if get(g:, 'pydocstring_enable_mapping', 1) + if !hasmapto('(pydocstring)', 'n') + nmap (pydocstring) endif endif