Saturday, December 26, 2015

Re: New in VIM

I have got it :-)

Thanks a lot for your nice help.

This is how this function works in Debian 8 with:
:version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:36:03)

" -------------------------------------------
function Comment()
let currentLine = getline(".")
let result = match(currentLine, '^#\~ ')
if result == 0
exe 's/^#\~ //'
else
exe 's/^/#\~ /'
endif
endfunction

nmap <F7> :call Comment()<cr>
imap <F7> <Esc>:call Comment()<cr>
" -------------------------------------------

Here is a new VIM fan, now only using VIM.

Thanks again. Cheers.

--
Jose Angel Navarro Cortes
email: janc@telefonica.net
web: http://janc.es/
Usuario Linux: #49178

El 15.12.26 15:21:19 > Tony Mechelynck dijo:
> On Sat, Dec 26, 2015 at 1:07 PM, janc@telefonica.net
> <janc@telefonica.net> wrote:
> > Thanks Paolo and Tony for your help.
> > I can't find the way to match ~ without errors.
>
> See
> :help /\
> (which was already mentioned in my previous response)
> :help 'magic'
>
> Actually (with 'magic' set, which is the default and the recommended
> setting, as the opposite might break some of the plugins included with
> Vim), ~ matches the latest subsitute string and \~ matches a tilde.
> With 'nomagic', it's the opposite. The same applies to several other
> characters which have a special meaning in a pattern when either
> preceded or not preceded by a backslash. Now read my previous post
> again, including the example functions, which assume that 'magic' is
> set.
>
> Also try a plain search — either /~ or /\~ — on (for instance) a helpfile.
>
>
> Best regards,
> Tony.
>
> --
> --
> 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/d/optout.

--
--
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/d/optout.

No comments: