a few [crazy?] questions to make editing like an IDE experience

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

a few [crazy?] questions to make editing like an IDE experience

Jose Caballero
Hi,


I didn't really know how to express it better, so I picked that
meaningless subject. Sorry about that.

Let's say, as a mental experiment, we want to write plugins -or
whatever is needed- to enhance the experience of editing a given kind
of configuration file, with a well defined extension.
That is a fake example, but simple enough to explain the case.

I would love to know if it is possible to:

(1) when creating a new one, start with a template.
Well, I actually know how to do that. So not really a question. Just
adding it here for completeness.
For example

# config file
enable =
# set here the day of the week
day =
# set here if notification is needed
notify =

(2) it would be nice if moving between lines (j k), the cursor
actually goes after the = directly. Is that possible, easily?

(3) nice feature would be to have completion popup menus, based on the line.
For example, <C-P> would offer "True | False" options if cursor is in
"enable= " line.
But the menu would be "Mon | Tue | Wed...." if cursor is in "day = " line.
Is it possible?

(4) The bonus feature. If picking from the popup menu "Yes" in "notify
= " line, that makes automagically a new line "phone = " to appear.
Is autocompletion one of the "Events" that VIM allows to catch in
order to trigger actions?


Thanks for your attention.
Jose

--
--
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: a few [crazy?] questions to make editing like an IDE experience

Ben Fritz
On Tuesday, November 7, 2017 at 4:08:36 PM UTC-6, Jose Caballero wrote:

>
> I would love to know if it is possible to:
>
> (1) when creating a new one, start with a template.
> Well, I actually know how to do that. So not really a question. Just
> adding it here for completeness.
> For example
>
> # config file
> enable =
> # set here the day of the week
> day =
> # set here if notification is needed
> notify =
>
Yes, possible in a variety of ways. The simplest probably being an autocmd to read a template file when creating a new buffer.

> (2) it would be nice if moving between lines (j k), the cursor
> actually goes after the = directly. Is that possible, easily?
>

Go to the end of the line with $. Now moving up/down with k/j will automatically keep the cursor at the end of the line.

Or, map a key sequence to the j/k keys.

Or, why do you want this? If just to be in a convenient place to append text, you don't need it. Rather than using a/i to start insert mode, use "A" instead to append to the end of the entire line no matter where your cursor is.

> (3) nice feature would be to have completion popup menus, based on the line.
> For example, <C-P> would offer "True | False" options if cursor is in
> "enable= " line.
> But the menu would be "Mon | Tue | Wed...." if cursor is in "day = " line.
> Is it possible?
>

This is possible but not trivial. See the omni completion and user completion sections of the help.

> (4) The bonus feature. If picking from the popup menu "Yes" in "notify
> = " line, that makes automagically a new line "phone = " to appear.
> Is autocompletion one of the "Events" that VIM allows to catch in
> order to trigger actions?
>

Yes, it is. See :help CompleteDone.

--
--
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: a few [crazy?] questions to make editing like an IDE experience

Jose Caballero



Or, why do you want this? 


Just trying to learn new things that could eventually improve performance, while I have some fun during the process.

Thanks a lot for your comments and pointers.

Cheers,
Jose

--
--
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.