Last active
August 29, 2015 14:25
-
-
Save dahu/18b48c70444d8078f7d7 to your computer and use it in GitHub Desktop.
emulating comments in vim's dict literals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Barry Arthur, July 2015 | |
" Kludge emulating comments in dict literals | |
" :-0 surprised?! | |
function! StripComments(comment_leader, dict) | |
return filter(a:dict, 'v:key !~ "^" . escape(a:comment_leader, "\"")') | |
endfunction | |
let x = StripComments('REM', { | |
\ 'a' : 1 | |
\, 'REM This is a nasty workaround mimicking comments in dict literals' :-0 | |
\, 'b' : 2 | |
\, 'REM Duplicate keys are not tolerated within dict literals, hence the numbered comment keys' :-0 | |
\, 'c' : 3 | |
\, 'REM For the younger audience members, REM stands for "remark" and was the comment leader in BASIC' :-0 | |
\, 'd' : 4 | |
\}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment