Skip to content

Instantly share code, notes, and snippets.

@yt-siden
Last active February 7, 2020 02:54

Revisions

  1. yt-siden renamed this gist Jul 28, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. yt-siden revised this gist May 18, 2015. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -4,9 +4,10 @@ function! s:insert_include_guard()
    let s:uuid=system('uuidgen')
    let s:uuid=strpart(s:uuid, 0, strlen(s:uuid)-1)
    let s:uuid=substitute(s:uuid, '[a-f]', '\u\0', 'g')
    let s:uuid='UUID-'.s:uuid
    let s:uuid=substitute(s:uuid, '\-', '_', 'g')
    let s:uuid='UUID_'.s:uuid
    call append(0, '#ifndef '.s:uuid)
    call append(1, '#define '.s:uuid)
    call append('$', '#endif //'.s:uuid)
    endfunction
    command! -nargs=0 InsertIncludeGuard call s:insert_include_guard()
    command! -nargs=0 InsertIncludeGuard call s:insert_include_guard()
  3. yt-siden created this gist May 14, 2015.
    12 changes: 12 additions & 0 deletions .vimrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    " C/C++ insert UUID based include guard

    function! s:insert_include_guard()
    let s:uuid=system('uuidgen')
    let s:uuid=strpart(s:uuid, 0, strlen(s:uuid)-1)
    let s:uuid=substitute(s:uuid, '[a-f]', '\u\0', 'g')
    let s:uuid='UUID-'.s:uuid
    call append(0, '#ifndef '.s:uuid)
    call append(1, '#define '.s:uuid)
    call append('$', '#endif //'.s:uuid)
    endfunction
    command! -nargs=0 InsertIncludeGuard call s:insert_include_guard()