[vlc-devel] hacking VLC using vim

Sam Hocevar sam at zoy.org
Fri Dec 6 17:44:11 CET 2002


   I'm using vim and I thought people might be interested in this
vlc.vim file I'm using to extend the syntax highlighting using VLC
types. It's also handy to detect tabs (which are forbidden in our
coding style) or trailing spaces. Put it anywhere you want and add
a line like this to your ~/.vimrc:

      exe "source ~/.vim/vlc.vim"

   Any enhancements welcome!

-- 
Sam.
-------------- next part --------------
" vlc specific stuff
au Syntax c call VlcSyntax()
au Syntax cpp call VlcSyntax()

function VlcSyntax()
  " Look for a VideoLAN copyright in the first 10 lines
  let line=1
  let vlc=0
  while(line<=10)
    if matchend(getline(line), "Copyright.*VideoLAN") > -1
      let vlc=1
      break
    endif
    let line=line+1
  endwhile
  if vlc==0
    return
  endif
  " true/false
  syn keyword cConstant VLC_TRUE VLC_FALSE
  " return values
  syn keyword cConstant VLC_SUCCESS VLC_EGENERIC VLC_ENOMEM VLC_ETHREAD
  syn keyword cConstant VLC_ESTATUS VLC_EEXIT VLC_EMODULE VLC_EOBJECT
  syn keyword cConstant VLC_ENOOBJ VLC_ENOMOD
  " custom types
  syn keyword cType vlc_fixed_t mtime_t byte_t dctelem_t count_t ssize_t off_t
  " custom structures
  syn keyword cType vlc_t libvlc_t
  syn keyword cType vlc_object_t vlc_error_t vlc_status_t vlc_thread_t
  syn keyword cType vlc_cond_t vlc_mutex_t vlc_bool_t vlc_fourcc_t vlc_list_t
  syn keyword cType msg_bank_t msg_subscription_t playlist_t playlist_item_t
  syn keyword cType module_bank_t module_t module_config_t module_symbols_t
  syn keyword cType intf_thread_t intf_sys_t intf_console_t intf_msg_t
  syn keyword cType intf_channel_t input_thread_t input_channel_t input_area_t
  syn keyword cType input_buffers_t input_socket_t input_info_t
  syn keyword cType input_info_category_t access_sys_t demux_sys_t
  syn keyword cType es_descriptor_t es_sys_t pgrm_descriptor_t pgrm_sys_t
  syn keyword cType stream_descriptor_t stream_sys_t aout_instance_t aout_sys_t
  syn keyword cType aout_fifo_t aout_input_t aout_buffer_t audio_sample_format_t
  syn keyword cType audio_date_t vout_thread_t vout_font_t vout_sys_t
  syn keyword cType chroma_sys_t picture_t picture_sys_t picture_heap_t
  syn keyword cType subpicture_t subpicture_sys_t sout_instance_t sout_fifo_t
  syn keyword cType decoder_fifo_t data_packet_t data_buffer_t stream_position_t
  syn keyword cType stream_ctrl_t pes_packet_t bit_stream_t network_socket_t
  syn keyword cType iso639_lang_t aout_filter_t video_format_t aout_alloc_t
  syn keyword cType aout_mixer_sys_t aout_filter_sys_t audio_volume_t
  syn keyword cType aout_mixer_t aout_output_t _input_socket_t
  " misc macros
  syn keyword cOperator VLC_OBJECT VLC_EXPORT VLC_COMMON_MEMBERS
  " don't use these any more, please
  syn keyword cError u8 s8 u16 s16 u32 s32 u64 s64
  " don't put trailing spaces! DON'T USE TABS!!!
  syn match cSpaceError display excludenl "\s\+$"
  syn match cSpaceError display "\t"
endfun



More information about the vlc-devel mailing list