Created
January 24, 2012 05:47
-
-
Save emanon001/1668225 to your computer and use it in GitHub Desktop.
Vim script: Syntax highlight of user-defined commands.
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
augroup syntax-highlight-extension | |
autocmd! | |
autocmd Syntax vim call s:set_syntax_of_user_defined_commands() | |
augroup END | |
function! s:set_syntax_of_user_defined_commands() | |
redir => _ | |
silent! command | |
redir END | |
let command_names = map(split(_, '\n')[1:], | |
\ 'matchstr(v:val, ''^[!"b]*\s\+\zs\u\w*\ze'')') | |
if empty(command_names) | return | endif | |
execute 'syntax keyword vimCommand contained' join(command_names) | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment