Loading ...
Sorry, an error occurred while loading the content.

20655Re: decapitlising on the fly

Expand Messages
  • Mark Zealey
    Sep 3, 2001
      > function! Decap()
      > let l:line = getline(".")
      > " decapitalize words (e.g. THat -> That)
      > let l:line = substitute(l:line, "\\<\\(\\u\\)\\(\\u\\)\\([^A-Z
      > \\t.]\\)", "\\1\\L\\2\\e\\3", "g")
      > " turn i's into I's
      > let l:line = substitute(l:line, "\\<i\\>", "I", "g")
      > call setline(".", l:line)
      > endfunction
      > inoremap <Space> <C-O>:call Decap()<CR><Space>

      This is nice, maybe use ''s rather than "'s to avoid the need for lots of \'s...


      Mark Zealey (aka JALH on irc.openprojects.net: #zealos and many more)

      UL++++>$ G!>(GCM/GCS/GS/GM) dpu? s:-@ a16! C++++>$ P++++>+++++$ L+++>+++++$
      !E---? W+++>$ N- !o? !w--- O? !M? !V? !PS !PE--@ PGP+? r++ !t---?@ !X---?
      !R- b+ !tv b+ DI+ D+? G+++ e>+++++ !h++* r!-- y--

    • Show all 6 messages in this topic