My dotfiles. Period.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. "=============================================================================
  2. " $Id$
  3. " File: autoload/lh/visual.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: 08th Sep 2008
  10. " Last Update: $Date$
  11. "------------------------------------------------------------------------
  12. " Helpers functions releated to the visual mode
  13. "
  14. "------------------------------------------------------------------------
  15. " Drop it into {rtp}/autoload/lh/
  16. " Vim 7+ required.
  17. " History:
  18. " v3.0.0: GPLv3
  19. " v2.2.5: lh#visual#cut()
  20. " v2.0.6: First appearance
  21. " TODO: «missing features»
  22. " }}}1
  23. "=============================================================================
  24. let s:cpo_save=&cpo
  25. set cpo&vim
  26. "------------------------------------------------------------------------
  27. " Functions {{{1
  28. " Function: lh#visual#selection() {{{3
  29. " @return the text currently selected
  30. function! lh#visual#selection()
  31. try
  32. let a_save = @a
  33. normal! gv"ay
  34. return @a
  35. finally
  36. let @a = a_save
  37. endtry
  38. endfunction
  39. " Function: lh#visual#cut() {{{3
  40. " @return and delete the text currently selected
  41. function! lh#visual#cut()
  42. try
  43. let a_save = @a
  44. normal! gv"ad
  45. return @a
  46. finally
  47. let @a = a_save
  48. endtry
  49. endfunction
  50. " Functions }}}1
  51. "------------------------------------------------------------------------
  52. let &cpo=s:cpo_save
  53. "=============================================================================
  54. " vim600: set fdm=marker: