Monday, June 3, 2013

Re: insert mode mapping to move to a column

On Monday, June 3, 2013 1:31:08 AM UTC-5, sinbad wrote:
> On Thursday, May 30, 2013 10:59:52 AM UTC+5:30, sinbad wrote:
> > On Wednesday, May 29, 2013 8:31:09 PM UTC+5:30, Ben Fritz wrote:
> > > I think (if as Christian suggests you have 'virtualedit' set to "all") this will work: <Up><C-Right><Down>
> >
> > This works, thanks Ben and toothpik.
>
> set ve=all is little annoying to be set
> all the time, at least i'm not use to it.
> how can i temporarily set and unset it.
> should i do it in a function. i tried the
> following it doesn't work.
>
> inoremap ,s <C-O>:call Top_align()<CR>
>
> fun! Top_align()
> set ve=all
> exec "<Up><C-Right><Down>"
> set ve=
> endfun

One reason this won't work is because you used "exec" when you meant "normal". The :exec command executes ex commands, not commands as typed.

I was thinking an expression map might be better (:help :map-<expr>) but I couldn't quickly figure out a good way to make it work.

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

Post a Comment