My dotfiles. Period.

let.vim 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "=============================================================================
  2. " $Id: let.vim 520 2012-03-19 18:09:15Z luc.hermitte $
  3. " File: plugin/let.vim {{{1
  4. " Author: Luc Hermitte <EMAIL:hermitte {at} free {dot} fr>
  5. " <URL:http://code.google.com/p/lh-vim/>
  6. " License: GPLv3 with exceptions
  7. " <URL:http://code.google.com/p/lh-vim/wiki/License>
  8. " Version: 3.0.0
  9. " Created: 31st May 2010
  10. " Last Update: $Date: 2012-03-19 19:09:15 +0100 (Mon, 19 Mar 2012) $
  11. "------------------------------------------------------------------------
  12. " Description:
  13. " Defines a command :LetIfUndef that sets a variable if undefined
  14. "
  15. "------------------------------------------------------------------------
  16. " Installation:
  17. " Drop this file into {rtp}/plugin
  18. " Requires Vim7+
  19. " History:
  20. " v2.2.1: first version of this command into lh-vim-lib
  21. " v3.0.0: GPLv3
  22. " TODO:
  23. " }}}1
  24. "=============================================================================
  25. " Avoid global reinclusion {{{1
  26. let s:k_version = 300
  27. if &cp || (exists("g:loaded_let")
  28. \ && (g:loaded_let >= s:k_version)
  29. \ && !exists('g:force_reload_let'))
  30. finish
  31. endif
  32. let g:loaded_let = s:k_version
  33. let s:cpo_save=&cpo
  34. set cpo&vim
  35. " Avoid global reinclusion }}}1
  36. "------------------------------------------------------------------------
  37. " Commands and Mappings {{{1
  38. command! -nargs=+ LetIfUndef call s:LetIfUndef(<f-args>)
  39. " Commands and Mappings }}}1
  40. "------------------------------------------------------------------------
  41. " Functions {{{1
  42. " Note: most functions are best placed into
  43. " autoload/«your-initials»/«let».vim
  44. " Keep here only the functions are are required when the plugin is loaded,
  45. " like functions that help building a vim-menu for this plugin.
  46. function! s:LetIfUndef(var, value)
  47. if !exists(a:var)
  48. let {a:var} = eval(a:value)
  49. endif
  50. endfunction
  51. " Functions }}}1
  52. "------------------------------------------------------------------------
  53. let &cpo=s:cpo_save
  54. "=============================================================================
  55. " vim600: set fdm=marker: