Hi,

What about using :mksession file with option 
    set sessionoptions=localoptions,options
and after a while restoring the session by sourcing it.

Best,
Marcin

On 00:31 Wed 04 May     , Mathew Brown wrote:
> Thanks ZyX.  I'll have a look.
> 
> 
> On Wed, 04 May 2011 01:09 +0400, "ZyX" <[email protected]> wrote:
> > Reply to message ĢRe: Temporarily Disabling All imaps and inoremapsģ, 
> > sent 00:40:33 04 May 2011, Wednesday
> > by Mathew Brown:
> > 
> > > Thanks ZyX.  Unfortunately, it appears that :set paste also resets the
> > > language.  In fact, when :set paste is enabled, you can't even manually
> > > set the keymap.  What I'm currently doing but isn't very effective
> > > (because some plugins may add their own imaps and inoremaps) is that I
> > > run I mapped a macro to run :imapclear.  When I want my imaps +
> > > inoremaps back, I source my $MYVIMRC file which contains them.  It's not
> > > elegant at all.  I'm looking for a cleaner solution.  Is there some way
> > > for example to copy them into a reg, run imapclear, and then restore
> > > them?  Thanks.
> > You can construct something using `:redir', output of `:imap' without
> > arguments 
> > and `maparg({lhs}, "i", 0, 1)' (note the last argument, it was added in 
> > vim-7.3.32. Without it you can't restore <expr> (not restoring it will
> > render 
> > mapping useless) and <silent> mapping flags). Also see my savemap[1,2]
> > and 
> > map[3,4] functions: first saves mapping into dictionary, second restores
> > it 
> > (first link points to function definition inside a source file, second to
> > its 
> > description in the documentation). Note that you can't distinguish
> > between 
> > lhs/rhs=<LT>Space> and lhs/rhs=<Space> inside a :*map output (though it
> > is 
> > unlikely that some mapping contains escaped special characters notation
> > in lhs 
> > and rhs returned by :map can be ignored in fawor of `maparg(lhs, mode,
> > abbr, 1)' 
> > where it is always normal) and in `lhs' key of a dictionary returned by 
> > `maparg(lhs, mode, abbr, 1)' (though this does not matter as `rhs' is
> > normal and 
> > lhs is obtained from already corrupted :imap output).
> > 
> > [1]https://bitbucket.org/ZyX_I/frawor/src/e9387e3271f2/plugin/frawor/mappings.vim#cl-175
> > [2]https://bitbucket.org/ZyX_I/frawor/src/e9387e3271f2/doc/frawor.txt#cl-568
> > [3]https://bitbucket.org/ZyX_I/frawor/src/e9387e3271f2/plugin/frawor/mappings.vim#cl-256
> > [4]https://bitbucket.org/ZyX_I/frawor/src/e9387e3271f2/doc/frawor.txt#cl-585
> > 
> > Original message:
> > > Thanks ZyX.  Unfortunately, it appears that :set paste also resets the
> > > language.  In fact, when :set paste is enabled, you can't even manually
> > > set the keymap.  What I'm currently doing but isn't very effective
> > > (because some plugins may add their own imaps and inoremaps) is that I
> > > run I mapped a macro to run :imapclear.  When I want my imaps +
> > > inoremaps back, I source my $MYVIMRC file which contains them.  It's not
> > > elegant at all.  I'm looking for a cleaner solution.  Is there some way
> > > for example to copy them into a reg, run imapclear, and then restore
> > > them?  Thanks.
> > > 
> > > On Wed, 04 May 2011 00:12 +0400, "ZyX" <[email protected]> wrote:
> > > > Reply to message ĢTemporarily Disabling All imaps and inoremapsģ,
> > > > sent 23:56:30 04 May 2011, Wednesday
> > > > by Mathew Brown:
> > > > 
> > > > I do not know, how your default imaps and inoremaps can prevent you from
> > > > editing
> > > > a file using a different character set, but to disable them completely
> > > > you can
> > > > use 'paste' option: do `:set paste' when you want them disabled and `set
> > > > nopaste' when you don't. Note that it will disable automatic 
> > > > indentation,
> > > > tabs
> > > > expansion, automatic wrap as well. The only exception is 'pastetoggle'
> > > > key: you
> > > > will still be able to unset paste using it without leaving insert mode 
> > > > if
> > > > you
> > > > set this option somewhere.
> > > > 
> > > > Original message:
> > > > > Hi,
> > > > > 
> > > > >   I was wondering if there is any way to temporarily disable all imaps
> > > > >   and inoremaps.  I sometimes need to edit a file using a different
> > > > >   character set and my default imaps and inoremaps can get in the way.
> > > > >   So is some way to disable them until I finish this and then enable
> > > > >   them again?  Thanks.
> > > > 
> > > > Email had 1 attachment:
> > > > + signature.asc
> > > > 
> > > >   1k (application/pgp-signature)
> > 
> > Email had 1 attachment:
> > + signature.asc
> >   1k (application/pgp-signature)
> -- 
>   Mathew Brown
>   [email protected]
> 
> -- 
> http://www.fastmail.fm - A fast, anti-spam email service.
> 
> -- 
> 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 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

Reply via email to