Tuesday, November 7, 2017

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

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 vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: