cecutil : Some utilities used by several of my scripts (window positioning, mark handling)
script karma |
Rating 38/20,
Downloaded by 6052 |
Comments, bugs, improvements
|
Vim wiki
|
created by |
Charles Campbell |
|
script type |
utility |
|
description |
[CECUTIL V15 OR LATER REQUIRES VIMBALL V18 OR LATER FOR UNPACKING]
These routines are used by several of my utilities. I'm loading them onto vim.sf.net to make it easier for GetLatestVimScripts to automate updates with them.
Marks:
call SaveMark(markname) let savemark= SaveMark(markname)
call RestoreMark(markname) call RestoreMark(savemark)
call DestroyMark(markname)
commands: SM RM DM
Window Position:
call SaveWinPosn() let winposn= SaveWinPosn()
call RestoreWinPosn() call RestoreWinPosn(winposn)
\swp : save current window/buffer's position
\rwp : restore current window/buffer's previous position
commands: SWP RWP
User Maps:
call SaveUserMaps(mapmode,maplead,mapchx,suffix)
This function sets up a script-variable (ie. a variable that can generally be accessed only from within cecutil's own functions; see |s:|) called s:restoremap. The selected user's maps are appended to this variable; the RestoreUserMaps() (|cecutil-restoreusermaps|) function uses the contents of this variable to restore user maps.
Some examples follow:
call SaveUserMaps("n","","webWEBjklh$0%;,nN","HiMtchBrkt")
normal mode maps for w, e, b, W, E, B, j, k, l, etc
(if any) are all saved in the variable
s:restoremaps_HiMtchBrkt >
call SaveUserMaps("n","","<up>","DrawIt")
the normal mode map (if any) for the <up> key is saved in
the variable s:restoremaps_DrawIt >
call SaveUserMaps("n","",":F(","HiMtchBrkt")
the normal mode map for F( (if any) is saved in the
variable s:restoremaps_HiMtchBrkt
call RestoreUserMaps(suffix)
The usermaps saved by SaveUserMaps() with the given suffix will be restored (ie. s:restoremaps_{suffix}). Example:
call RestoreUserMaps("HiMtchBrkt")
will restore all user maps redefined for the HiMtchBrkt plugin
(alpha/beta version available at http://www.drchip.org/astronaut/vim/index.html#CECUTIL)
|
|
install details |
1. Get vimball v18 if you don't have it already (vimscript#1502). Please remove any vestiges of an older vimball first.
(if you have vim 7.1a or later, you probably can skip this step)
2. vim cecutil.vba.gz
:so %
:q
Works well with AsNeeded, too (vimscript#915). |
|
script versions (upload new version)
Click on the package to download.
cecutil.vba.gz |
17 |
2007-09-04 |
7.0 |
Charles Campbell |
A new function, QArgSplitter(), now comes with cecutil. |
cecutil.vba.gz |
16 |
2007-04-12 |
7.0 |
Charles Campbell |
Changed com to com! so AsNeeded (vimscript#915) is happier.
Fixed a bug concerning maps which don't use the mapleader option are still saved and restored properly.
|
cecutil.vba.gz |
15 |
2006-09-19 |
7.0 |
Charles Campbell |
* (-new-) map restoration improved
* (change) b:(varname) now use b:cecutil_(varname)
* (bugfix) bypass for report option for DestroyMark() included
* (bugfix) SaveWinPosn() and RestoreWinPosn() now handle an empty buffer |
cecutil.vim.gz |
14 |
2006-01-25 |
6.0 |
Charles Campbell |
SaveUserMaps' mapmode argument, heretofore just a single letter (see |maparg()|), now accepts a leading "u". If present, SaveUserMaps() will do an unmap.
Bypasses for si, so, and siso options included.
|
ip used for rating: 142.132.191.50
|