Sunday, October 23, 2016

Re: Load one key- map

On Mon, Oct 24, 2016 at 12:15 AM, Guido Milanese
<guido.milanese@gmail.com> wrote:
> Dear all,
> I'm probably making a mountain out of a molehill, but I'm lost in a (probably) very simple problem.
>
> I have written a simple bash script that performs some transformations in a file, calls (g)vim, waits for the user to edit the file, and exits. The problem is:
>
> * I have defined one simple key map of the kind
>
> map <F11> do-this-and-this
>
> * I would like to save this mapping to a file, in order to add this particular key-map to other mapping(s) defined by users; I would like to load the mapping from an external file, in order for this mapping to be unloaded after the current session. Such as:
>
> (g)vim FILE-WITH-MAPPING FILE-TO-WORK
>
> I tried to use *mkexrc* but I did not obtain what I want, i.e. to save in a file *only* the particular mapping I need for this particular script.
>
> Could you please help me?
>
> Thank you!
> guido (Italy)

Well, you could write your mapping to a file, and source that file
when needed; but unless it is a rather complex "do this and that" it
might be simpler to simply type the :map command at the command line,
or as argument to the -c command-line switch.

For a complex mappinf (written to ./mymapping.vim)

(g)vim -c "source ./mymapping.vim"

would, I suppose, do the trick. (Vim accepts forward slashes as path
separators on all platforms including Windows, or backslashes on
Windows only.)

see
:help :source
:help -c

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.

No comments: