Skip to content

Commit 84d1a41

Browse files
committed
Highlight python docstrings as pythonDocstrings.
1 parent 5e05fbf commit 84d1a41

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Contributors:
77

88
* Alvin Francis (alvinfrancis);
99
* Anler Hp (ikame);
10+
* Anton Parkhomenko
1011
* Benjamin Ruston (bruston);
1112
* Boris Filippov (frenzykryger);
1213
* David Vogt (winged);

autoload/pymode/rope.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fun! pymode#rope#complete_on_dot() "{{{
2424
return ""
2525
end
2626
for group in map(synstack(line('.'), col('.') - 1), 'synIDattr(v:val, "name")')
27-
for name in ['pythonString', 'pythonComment', 'pythonNumber']
27+
for name in ['pythonString', 'pythonComment', 'pythonNumber', 'pythonDocstring']
2828
if group == name
2929
return ""
3030
endif

doc/pymode.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,11 @@ Highlight exceptions (TypeError, ValueError, ...)
579579
>
580580
let g:pymode_syntax_highlight_exceptions = g:pymode_syntax_all
581581
582+
Highlight docstrings as pythonDocstring (otherwise as pythonString)
583+
*'g:pymode_syntax_docstrings'*
584+
>
585+
let g:pymode_syntax_docstrings = g:pymode_syntax_all
586+
582587
583588
==============================================================================
584589
6. FAQ ~

syntax/python.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ call pymode#default('g:pymode_syntax_string_format', g:pymode_syntax_all)
3838
call pymode#default('g:pymode_syntax_string_templates', g:pymode_syntax_all)
3939
call pymode#default('g:pymode_syntax_doctests', g:pymode_syntax_all)
4040

41+
" Support docstrings in syntax highlighting
42+
call pymode#default('g:pymode_syntax_docstrings', 1)
43+
4144
" Highlight builtin objects (True, False, ...)
4245
call pymode#default('g:pymode_syntax_builtin_objs', g:pymode_syntax_all)
4346

@@ -225,7 +228,7 @@ endif
225228
endif
226229

227230
" DocStrings
228-
if !pymode#Default('g:pymode_syntax_docstrings', g:pymode_syntax_all) || g:pymode_syntax_docstrings
231+
if g:pymode_syntax_docstrings
229232
syn region pythonDocstring start=+^\s*[uU]\?[rR]\?"""+ end=+"""+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
230233
syn region pythonDocstring start=+^\s*[uU]\?[rR]\?'''+ end=+'''+ keepend excludenl contains=pythonEscape,@Spell,pythonDoctest,pythonDocTest2,pythonSpaceError
231234
endif
@@ -352,6 +355,7 @@ endif
352355
hi def link pythonSpaceError Error
353356

354357
hi def link pythonString String
358+
hi def link pythonDocstring String
355359
hi def link pythonUniString String
356360
hi def link pythonRawString String
357361
hi def link pythonUniRawString String

0 commit comments

Comments
 (0)