Skip to content

Commit 50ced6b

Browse files
authored
Merge pull request #1147 from fpob/add-syntax
Add syntax highlight for walrus
2 parents 34e2c24 + 0beb5f8 commit 50ced6b

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

doc/pymode.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,10 @@ Highlight '=' operator *'g:pymode_syntax_highlight_equal_operator'
674674
>
675675
let g:pymode_syntax_highlight_equal_operator = g:pymode_syntax_all
676676
677+
Highlight ':=' operator *'g:pymode_syntax_highlight_walrus_operator'*
678+
>
679+
let g:pymode_syntax_highlight_walrus_operator = g:pymode_syntax_all
680+
677681
Highlight '*' operator *'g:pymode_syntax_highlight_stars_operator'*
678682
>
679683
let g:pymode_syntax_highlight_stars_operator = g:pymode_syntax_all

syntax/python.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ call pymode#default("g:pymode_syntax_highlight_async_await", g:pymode_syntax_all
2323
" Highlight '=' operator
2424
call pymode#default('g:pymode_syntax_highlight_equal_operator', g:pymode_syntax_all)
2525

26+
" Highlight ':=' operator
27+
call pymode#default('g:pymode_syntax_highlight_walrus_operator', g:pymode_syntax_all)
28+
2629
" Highlight '*' operator
2730
call pymode#default('g:pymode_syntax_highlight_stars_operator', g:pymode_syntax_all)
2831

@@ -114,6 +117,10 @@ endif
114117
syn match pythonExtraOperator "\%(=\)"
115118
endif
116119

120+
if g:pymode_syntax_highlight_walrus_operator
121+
syn match pythonExtraOperator "\%(:=\)"
122+
endif
123+
117124
if g:pymode_syntax_highlight_stars_operator
118125
syn match pythonExtraOperator "\%(\*\|\*\*\)"
119126
endif

0 commit comments

Comments
 (0)