Thursday, February 7, 2013

Re: Function to put full stop at the end of my sentences

On Tue, 5 Feb 2013, Eric Smith wrote:

> Hi
>
> Do you have a suggestion for an (efficient) function to put a dot
> after every combination of an alphanumeric char and a newline?
>
> I just got tired of doing it manually the last days.

(Initial suggestion: don't do it... but, that's because I suspect it
would annoy me after a while.)


What you requested:

fun! LazyFullStop()
if getline('.') =~ '\w$'
return ".\<CR>"
end
return "\<CR>"
endf
ino <expr> <CR> LazyFullStop()

Or, more compact:

ino <expr> <CR> getline('.') =~ '\w$' ? ".\<CR>" : "\<CR>"

--
Best,
Ben

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: