Sorry to use the `e' word but does vim have similar to cperl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Sorry to use the `e' word but does vim have similar to cperl

Harry Putnam
Any one here familiar with emacs cperl mode, that can tell me how to
get something similar when using vim?

If not familiar, `cperl-mode' trys to offer a host of short cuts that insert
quite a bit of standard code for you... a simple example is; if you
type `if<spc>' `cperl-mode' inserts:

  if (_) {
  }

With the underscore indicating where the cursor is left.

I vaguely remember using something with vim, years ago, that did
something similar, but no longer remember how to load that sort of
thing.

With my current vim setup (just the basic install on debian using
`aptitude install vim'), plus a .vimrc carted around from OS to OS for
years.

If opening a perl script, I get syntax highlighting but when coding I
get no help... no tricky inserts or the like.

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Sorry to use the `e' word but does vim have similar to cperl

Shawn H Corey
On Fri, 25 Aug 2017 20:30:14 -0400
Harry Putnam <[hidden email]> wrote:

> Any one here familiar with emacs cperl mode, that can tell me how to
> get something similar when using vim?
>
> If not familiar, `cperl-mode' trys to offer a host of short cuts that
> insert quite a bit of standard code for you... a simple example is;
> if you type `if<spc>' `cperl-mode' inserts:
>
>   if (_) {
>   }
>
> With the underscore indicating where the cursor is left.
>
> I vaguely remember using something with vim, years ago, that did
> something similar, but no longer remember how to load that sort of
> thing.
>
> With my current vim setup (just the basic install on debian using
> `aptitude install vim'), plus a .vimrc carted around from OS to OS for
> years.
>
> If opening a perl script, I get syntax highlighting but when coding I
> get no help... no tricky inserts or the like.
>

Do you mean key mappings$ Type the following and press ENTER:

:help map


--
Don't stop where the ink does.

        Shawn H Corey

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Sorry to use the `e' word but does vim have similar to cperl

Shlomi Fish-2
In reply to this post by Harry Putnam
On Fri, 25 Aug 2017 20:30:14 -0400
Harry Putnam <[hidden email]> wrote:

> Any one here familiar with emacs cperl mode, that can tell me how to
> get something similar when using vim?
>
> If not familiar, `cperl-mode' trys to offer a host of short cuts that insert
> quite a bit of standard code for you... a simple example is; if you
> type `if<spc>' `cperl-mode' inserts:
>
>   if (_) {
>   }
>
> With the underscore indicating where the cursor is left.
>
> I vaguely remember using something with vim, years ago, that did
> something similar, but no longer remember how to load that sort of
> thing.
>
> With my current vim setup (just the basic install on debian using
> `aptitude install vim'), plus a .vimrc carted around from OS to OS for
> years.
>
> If opening a perl script, I get syntax highlighting but when coding I
> get no help... no tricky inserts or the like.
>

I think UltiSnips can do what you want: https://github.com/sirver/UltiSnips .
There are similar alternative to it as well.

--
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/bits/facts/Emma-Watson/

Experience is what causes a person to make new mistakes instead of old ones.
    — Source unknown, via Nadav Har’El.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Sorry to use the `e' word but does vim have similar to cperl

Lifepillar
In reply to this post by Harry Putnam
On 26/08/2017 03:30, Harry Putnam wrote:

> Any one here familiar with emacs cperl mode, that can tell me how to
> get something similar when using vim?
>
> If not familiar, `cperl-mode' trys to offer a host of short cuts that insert
> quite a bit of standard code for you... a simple example is; if you
> type `if<spc>' `cperl-mode' inserts:
>
>    if (_) {
>    }
>
> With the underscore indicating where the cursor is left.
>
> I vaguely remember using something with vim, years ago, that did
> something similar, but no longer remember how to load that sort of
> thing.

If you want to use a built-in feature, you may use abbreviations (`:help
abbreviations`). In the simplest form:

     iab <buffer> if if () {<cr>}<c-o>2gE

You may want to put this in ~/.vim/after/ftplugin/perl.vim to make it
filetype-specific.

The above also inserts the space you type after `if`. You most likely
won't wanto that. You may type if<c-]> to expand the snippet without
inserting a space, or use the `Eatchar()` function described in Vim's
help.

If the cases in which you do *not* want `if` to be expanded, you may
type if<c-v><spc> to insert a literal space. Alternatively, give the
snippet a different name, like `if…` (… is <alt>-. in my keyboard).

Enjoy,
Life.


--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Sorry to use the `e' word but does vim have similar to cperl

Grady Martin
In reply to this post by Shlomi Fish-2
>I think UltiSnips can do what you want: https://github.com/sirver/UltiSnips .
>There are similar alternative to it as well.

I recently abandoned snippet plugins for leader mappings and now wonder how I ever justified entire plugins in the first place.  In my case, after/ftplugin/c.vim, for example, has a total of eight mappings and two abbreviations.  I do not feel short-changed.

nnoremap <leader>s iswitch ()<CR>{<CR>case :<CR>break;<CR><BS>case :<CR>break;<CR><BS>case :<CR>break;<CR><BS><BS>}<ESC>8k/:<CR>02kf(a

How to Do 90% of What Plugins Do (With Just Vim)
https://www.youtube.com/watch?v=XA2WjJbmmoM&t=2300s

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.