sponsor Vim development Vim logo Vim Book Ad

genutils : General utility functions

 script karma  Rating 231/88, Downloaded by 46526  Comments, bugs, improvements  Vim wiki

created by
Hari Krishna Dara
 
script type
utility
 
description
The new version requires Vim 7.0 and it employs the new autoload mechanism. If you have plugins that use both the new version and previous non-autoloaded version, then see the installation instructions for both to coexist.

This script provides functions that are mostly useful to script developers, but some of the functions can be easily converted to good utilities.

See script header for documented public functions with help and usage information along with the function prototypes.

This script provides many useful utility functions for buffers, windows and other misc things. I needed a place to share all the misc. utility functions so I renamed bufNwinUtils.vim and started adding these additional functions. I intend to create/collect many more useful functions and add to this script.

- Read the "Documentation With Function Prototypes" section below.
- Misc. window/buffer related functions, genutils#NumberOfWindows(),
  genutils#FindBufferForName(), genutils#MoveCursorToWindow(),
  genutils#MoveCurLineToWinLine(), genutils#SetupScratchBuffer(),
  genutils#MapAppendCascaded()
- Save/Restore all the window height/width settings to be restored later.
- Save/Restore position in the buffer to be restored later. Works like the
  built-in marks feature, but has more to it.
- genutils#AddNotifyWindowClose() to get notifications *after* a window
  with the specified buffer has been closed or the buffer is unloaded. The
  built-in autocommands can only notify you *before* the window is closed.
  You can use this with the Save/Restore window settings feature to
  restore the dimensions of existing windows, after your window is closed
  (just like how Vim does while closing help windows). See selectbuf.vim
  or perforce.vim for examples.
  There is also a test function called RunNotifyWindowCloseTest() that
  demos the usage (you need to uncomment RunNotifyWindowCloseTest and
  NotifyWindowCloseF functions).
- genutils#ShowLinesWithSyntax() function to echo lines with syntax coloring.
- genutils#ShiftWordInSpace(), genutils#CenterWordInSpace() and
  genutils#AlignWordWithWordInPreviousLine() utility functions to move
  words in the space without changing the width of the field. A
  genutils#GetSpacer() function to return a spacer of specified width.
- Binary search function genutils#BinSearchList() for sorted lists, to
  find the index after which a given item can be inserted to keep the list
  in sorted order. You can also use these functions to just search for
  boundaries.
  There are also a couple of functions genutils#BinSearchForInsert() and
  genutils#BinSearchForInsert2() to find the location for a newline to be
  inserted in an already sorted buffer or arbitrary data.
  There are also a few comparison functions that can be used with sort() or
  the above functions.
- ExecMap function has now been separated as a plugin called execmap.vim.
- New genutils#CommonPath() function to extract the common part of two
  paths, and genutils#RelPathFromFile() and genutils#RelPathFromDir() to
  find relative paths (useful HTML href's). A side effect is the
  genutils#CommonString() function to find the common string of two
  strings.
- genutils#UnEscape() and genutils#DeEscape() functions to reverse and
  genutils#Escape() to compliment what built-in escape() does. There is
  also an genutils#EscapeCommand() function to escape external command
  strings.
- Utility functions genutils#CurLineHasSign() and genutils#ClearAllSigns()
  to fill in the gaps left by Vim.
- genutils#GetVimCmdOutput() function to capture the output of Vim built-in
  commands, in a safe manner.
- genutils#OptClearBuffer() function to clear the contents and undo
  history of the current buffer in an optimal manner. Ideal to be used
  when plugins need to refresh their windows and don't care about
  preserving the current contents (which is the most usual case).
- genutils#GetPreviewWinnr() function.
- Functions to have persistent data, genutils#PutPersistentVar() and
  genutils#GetPersistentVar(). You don't need to worry about saving in
  files and reading them back. To disable, set g:genutilsNoPersist in your
  vimrc.
- A function to emulate the default Vim behavior for |timestamp| changes.
  It also provides hooks to get call backs before and after handling the
  default FileChangedShell autocommand (effectively splitting it into a
  Pre and a Post event). Suggested usage is to use
  genutils#AddToFCShellPre() and either install a default event handling
  mechanism for all files by calling genutils#DefFCShellInstall() or
  create your own autocommand on a matching pattern to call
  genutils#DefFileChangedShell() function. Most useful for the source
  control plugins to conditionally reload a file, while being able to
  default to the Vim's standard behavior of asking the user. See
  perforce.vim for usage examples.
- Utility function genutils#ExtractFuncListing() that is useful to to
  create snippets (see breakpts.vim, ntservices.vim and ntprocesses.vim
  for interesting ideas on how to use this function).
                                                                                  
Function Prototypes:
    The types in prototypes of the functions mimic Java.
    This is just a full list for a quick reference, see
      "Documentation With Function Prototypes" for more information on the
      functions.
                                                                                  
void    genutils#DebugShowArgs(...)
String  genutils#ExtractFuncListing(String funcName, String hLines, String tLines)
int     genutils#NumberOfWindows()
int     genutils#FindBufferForName(String fileName)
String  genutils#GetBufNameForAu(String bufName)
void    genutils#MoveCursorToWindow(int winno)
void    genutils#MoveCurLineToWinLine(int winLine)
void    genutils#CloseWindow(int winnr, boolean force)
void    genutils#MarkActiveWindow()
void    genutils#RestoreActiveWindow()
void    genutils#IsOnlyVerticalWindow()
void    genutils#IsOnlyHorizontalWindow()
int     genutils#GetNextWinnrInStack(char dir)
int     genutils#GetLastWinnrInStack(char dir)
void    genutils#MoveCursorToNextInWinStack(char dir)
void    genutils#MoveCursorToLastInWinStack(char dir)
void    genutils#OpenWinNoEa(String openWinCmd)
void    genutils#CloseWinNoEa(int winnr, boolean force)
void    genutils#SetupScratchBuffer()
void    genutils#CleanDiffOptions()
boolean genutils#ArrayVarExists(String varName, int index)
void    genutils#MapAppendCascaded(String lhs, String rhs, String mapMode)
void    genutils#SaveWindowSettings()
void    genutils#RestoreWindowSettings()
void    genutils#ResetWindowSettings()
void    genutils#SaveWindowSettings2(String id, boolean overwrite)
void    genutils#RestoreWindowSettings2(String id)
void    genutils#ResetWindowSettings2(String id)
void    genutils#SaveVisualSelection(String id)
void    genutils#RestoreVisualSelection(String id)
void    genutils#SaveSoftPosition(String id)
void    genutils#RestoreSoftPosition(String id)
void    genutils#ResetSoftPosition(String id)
void    genutils#SaveHardPosition(String id)
void    genutils#RestoreHardPosition(String id)
void    genutils#ResetHardPosition(String id)
int     genutils#GetLinePosition(String id)
int     genutils#GetColPosition(String id)
boolean genutils#IsPositionSet(String id)
String  genutils#CleanupFileName(String fileName)
String  genutils#CleanupFileName2(String fileName, String win32ProtectedChars)
boolean genutils#OnMS()
boolean genutils#PathIsAbsolute(String path)
boolean genutils#PathIsFileNameOnly(String path)
void    genutils#AddNotifyWindowClose(String windowTitle, String functionName)
void    genutils#RemoveNotifyWindowClose(String windowTitle)
void    genutils#CheckWindowClose()
void    genutils#ShowLinesWithSyntax() range
void    genutils#ShiftWordInSpace(int direction)
void    genutils#CenterWordInSpace()
int     genutils#BinSearchList(List list, int start, int end, Object item,
                           [Funcref|String] cmp, int direction)
int     genutils#BinSearchForInsert(int start, int end, String line,
                           String cmp, int direction)
int     genutils#BinSearchForInsert2(int start, int end, line, String cmp,
                            int direction, String accessor, String context)
String  genutils#CommonPath(String path1, String path2)
String  genutils#CommonString(String str1, String str2)
String  genutils#RelPathFromFile(String srcFile, String tgtFile)
String  genutils#RelPathFromDir(String srcDir, String tgtFile)
String  genutils#Roman2Decimal(String str)
String  genutils#Escape(String str, String chars)
String  genutils#UnEscape(String str, String chars)
String  genutils#DeEscape(String str)
String  genutils#CrUnProtectedCharsPattern(String chars)
String  genutils#EscapeCommand(String cmd, List/String args, List/String pipe)
int     genutils#GetShellEnvType()
String  genutils#ExpandStr(String str)
String  genutils#QuoteStr(String str)
boolean genutils#CurLineHasSign()
void    genutils#ClearAllSigns()
String  genutils#UserFileComplete(String ArgLead, String CmdLine,
               String CursorPos, String smartSlash, String searchPath)
String  genutils#UserFileComplete2(String ArgLead, String CmdLine,
               String CursorPos, [Map params])
String  genutils#UserDirComplete2(String ArgLead, String CmdLine,
               String CursorPos, [Map params])
String  genutils#UserFileExpand(String fileArgs)
String  genutils#GetVimCmdOutput(String cmd)
void    genutils#OptClearBuffer()
int     genutils#GetPreviewWinnr()
void    genutils#PutPersistentVar(String pluginName, String persistentVar,
               String value)
void    genutils#GetPersistentVar(String pluginName, String persistentVar,
               String default)
void    genutils#AddToFCShellPre(String funcName)
void    genutils#RemoveFromFCShellPre(String funcName)
void    genutils#DefFCShellInstall()
void    genutils#DefFCShellUninstall()
boolean genutils#DefFileChangedShell()
void    genutils#SilentSubstitute(String pat, String cmd)
void    genutils#SilentDelete(String pat)
void    genutils#SilentDelete(String range, String pat)
String  genutils#GetSpacer(int width)
String  genutils#PromptForElement(List array,
        [String defaultValue | int defaultIndex], String msg,
        String skip, boolean useDialog, int nCols)
int     genutils#GetSelectedIndex()

Deprecations:
  - UserFileComplete() is now deprecated, use UserFileComplete2().
  - CleanDiffOptions() is deprecated as Vim now has the :diffoff command.
  - MakeArgumentString, MakeArgumentList and CreateArgString are deprecated.
    Vim7 now includes call() function to receive and pass argument lists
    around.
  - The g:makeArgumentString and g:makeArgumentList are obsolete and are
    deprecated, please use MakeArgumentString() and MakeArgumentList()
    instead.
  - FindWindowForBuffer() function is now deprecated, as the corresponding
    Vim bugs are fixed. Use the below expr instead:
      bufwinnr(genutils#FindBufferForName(fileName))
  - QSort(), QSort2(), BinInsertSort() and BinInsertSort2() functions are
    now deprecated in favor of sort() function.




Search_key_words: genutils variable arguments window buffer windows buffers preview save restore cursor position notify close echo syntax shift sort library typing error errors scriptid clean reset diff eatchar align word words space file filename binary search multvals Hari Krishna Dara
 
install details
Expand in your runtime (vimfiles/.vim directory).

Place the following in your vimrc if you find them useful:

- Add the following commands to create simple sort commands.
    command! -nargs=0 -range=% SortByLength <line1>,<line2>call QSort(
        \ 'CmpByLineLengthNname', 1)
    command! -nargs=0 -range=% RSortByLength <line1>,<line2>call QSort(
        \ 'CmpByLineLengthNname', -1)
    command! -nargs=0 -range=% SortJavaImports <line1>,<line2>call QSort(
        \ 'CmpJavaImports', 1)
                                                                          
- You might like the following mappings to adjust spacing:
    nnoremap <silent> <C-Space> :call ShiftWordInSpace(1)<CR>
    nnoremap <silent> <C-BS> :call ShiftWordInSpace(-1)<CR>
    nnoremap <silent> \cw :call CenterWordInSpace()<CR>
    nnoremap <silent> \va :call AlignWordWithWordInPreviousLine()<CR>
                                                                          
- The :find command is very useful to search for a file in path, but it
  doesn't support file completion. Add the following command in your vimrc
  to add this functionality:
      command! -nargs=1 -bang -complete=customlist,genutils#UserFileComplete2
            \ FindInPath :find<bang> <args>
                                                                          
- If you are running commands that generate multiple pages of output, you
  might find it useful to redirect the output to a new buffer. Put the
  following command in your vimrc:
    command! -nargs=* -complete=command Redir
          \ :new | put! =GetVimCmdOutput('<args>') | setl bufhidden=wipe |
          \ setl nomodified


For version prior to 2.0:
Drop it in the plugin directory or source it from vimrc.
Also install multvals.vim: vimscript #171

Special instructions for the coexistence of autoload (version since 2.0) and non-autoload (prior to 2.0) versions of genutils:
- Install the latest version of genutils first. Overwriting all existing
  files.
- Open the plugin/genutils.vim file and note the value set to
  loaded_genutils variable.
- Install the older version of genutils (non autoload version) in to
  plugin directory, overwriting the existing file.
- Open the plugin/genutils.vim again and change the value of
  loaded_genutils variable to the value you noted before and save it.

 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
genutils-2.5.zip 2.5 2009-09-17 7.0 Hari Krishna Dara Re-uploading the zip file with the correct name.
- Improved genutils#CleanupFileName() to expand "~" and environment
  variables. It also works more reliably now.
- More user friendly version of genutils#UserFileComplete() function
  added as genutils#UserFileComplete2(). It can now be used directly as
  the custom or customlist function in commands (so saves trouble for
  users, as no wrapper needs be written), and also offer various
  customizations via passing params.
- New function genutils#UserDirComplete2(), which is a customization on
  top of genutils#UserFileComplete2() for the sake of restricting the
  completions to directories only.
- Minor improvements in genutils#PathIsAbsolute() and
  genutils#GetVimCmdOutput()
genutils-2.4.zip 2.4 2007-06-12 7.0 Hari Krishna Dara - Fixed some corner cases in RelPathFromDir()/RelPathFromFile().
- Made the default comparators sort() function friendly.
genutils-2.3.zip 2.3 2006-09-03 7.0 Hari Krishna Dara - SilentSubstitute() and SilentDelete() should preserve cursor position.
- CleanupFileName() should also remove any leading or trailing
  whitespace.
genutils-2.2.zip 2.2 2006-08-31 7.0 Hari Krishna Dara - EscapeCommand() now supports Lists as arguments.
- CrUnProtectedCharsPattern() now accepts an optional "capture"
  argument.
- Renamed PromptForElement2 to PromptForElement. It was a typo.
genutils-2.1.zip 2.1 2006-08-09 7.0 Hari Krishna Dara - Fixed a typo in AddNotifyWindowClose() in the previous release.
- Added BinSearchList() function.
(uploading again to correct the Vim compatibility information, sorry to bump up)
genutils-2.0.zip 2.0 2006-06-23 7.0 Hari Krishna Dara genutils 2.0 release for Vim7.0.
This release is not backwards compatible with previous genutils or Vim
versions, so download this version only when a plugin explicitly
depends on this version. If you want to use plugins that use both the
old and new version of genutils, then you need to follow the below
procedure so that both can co-exist:
- Install the latest version of genutils first. Overwriting all existing
  files.
- Open the plugin/genutils.vim file and note the value set to
  loaded_genutils variable.
- Install the older version of genutils (non autoload version) in to
  plugin directory, overwriting the existing file.
- Open the plugin/genutils.vim again and change the value of
  loaded_genutils variable to the value you noted before and save it.

This version has the following changes:
- No longer depends on multvals plugin. Inherits some useful functions
  from multvals to make way for it to be retired (in favor of Vim7
  arrays). New functions are:
  CrUnProtectedCharsPattern
  PromptForElement/GetSelectedIndex
- Fix for Save/RestoreHardPosition() not working right when there are
  wrapped lines in the window.
- Dropped the AddToFCShell and RemoveFromFCShell functions as these
  can't be implemented in Vim7 because of new restrictions on
  FileChangedShell autocommand. Use AddToFcShellPre and
  RemoveFromFCShellPre functions instead.
genutils.vim 1.20 2006-05-09 6.0 Hari Krishna Dara Release 1.20 for fixing an issue with my previous release. Thanks to
Niels, Delphin and Craig for reporting the problem. If you downloaded the latest selectbuf, please download this version of genutils.
genutils.vim 1.19 2006-05-08 6.0 Hari Krishna Dara Now Vim7 compatible, no functionality change.
genutils.vim 1.18 2005-03-16 6.0 Hari Krishna Dara - New functions OpenWinNoEa() and CloseWinNoEa() which open and close
  windows with minimal side effects (such as minimizing the impact on
  the current window sizes, restoring the cursor to the original window
  and even restoring the current-previous-window). This is a good
  alternative to using the existing Save/RestoreWindowSettings()
  method.
- GetShellEnvType() is now public. Useful in conjunction with the
  EscapeCommand() function.
genutils.vim 1.17 2004-10-28 6.0 Hari Krishna Dara - Minor corrections to the FindBufferForName() function to work well
  with filenames containing backslashes (see doc).
genutils.vim 1.16 2004-10-20 6.0 Hari Krishna Dara - Fast BinInsertSort() based on the BISort() by Peit Delport's.
- Slightly improved QSort().
genutils.vim 1.15 2004-10-18 6.0 Hari Krishna Dara New functions:
- CloseWindow()
- MarkActiveWindow()
- RestoreActiveWindow()
New overloaded function for:
- SilentDelete()

- Fixed IsOnlyVerticalWindow() and IsOnlyHorizontalWindow() to use
  MarkActiveWindow() and RestoreActiveWindow() to avoid corrupting the
  "previous-window".
genutils.vim 1.14 2004-08-11 6.0 Hari Krishna Dara - New functions: GetNextWinnrInStack, GetLastWinnrInStack, MoveCursorToNextInWinStack, MoveCursorToLastInWinStack based on Dr. Chip's WinStackMv() function.
- New functions: SaveVisualSelection, RestoreVisualSelection.
- FIxed a possible issue with my earlier change. You can't add to 'eventignore'  if its current value is "all".
- Some improvement to RestoreWindowSettings(). It is still not working perfectly. Actually, there are no commands available in Vim to accurately resize windows in all circumstances.
- Save/Restore functions for cursor positions now create marks in the buffer context. This means, you can use the same name to create marks in different buffers, without overwriting each other. This is how Vim works for lowercase marks anyway.
- Misc. other improvements/bugfixes.
genutils.vim 1.13 2004-07-07 6.0 Hari Krishna Dara Now requires Vim 6.3

- More documentation. I now added a section with all the supported functions at one place so it is easy to lookup.
- New function GetBufNameForAU().
- New functions to help write custom completion functions, UserFileComplete() and UserFileExpand()
- Some clarifications on EscapeCommand().
- Improved CleanFileName() to work with Windows UNC paths.
genutils.vim 1.12 2004-06-18 6.0 Hari Krishna Dara - New function EscapeCommand() extracted from my perforce.vim plugin. This
  makes it simpler for plugins to execute external commands passing
  arguments literally.
- New functions IsOnlyHorizontalWindow(), IsOnlyVerticalWindow(),
  QuoteStr(), SilentSubstitute(), SilentDelete()
- More documentation on GetPreviewWinnr(), DefFileChangedShell(),
  MakeArgumentString(), MakeArgumentList(), UnEscape(), GetSpacer()
genutils.vim 1.11 2004-03-29 6.0 Hari Krishna Dara - Most important change is a lot of documentation with function prototypes. Now it is not necessary to look into the code to see the help and usage information. I also documented a lot of functions that lacked documentation earlier.
- A few minor fixes to bugs/inconsistencies and other improvements in Escape(), RestoreSoftPosition, Notify window close related functionality. Also added a patch from Bram for persistence related funcationality.
genutils.vim 1.10 2003-12-17 6.0 Hari Krishna Dara - Fixed bugs in the RelPathFromFile and RelPathFromDir functions.
- The g:loaded_genutils variable now contains the version number for dependency checking (see ":help v:version" for format). If your plugin depends on genutils.vim, it is now easy and safe to check if the user has at least the minimum base version.
genutils.vim 1.9 2003-10-30 6.0 Hari Krishna Dara Misc. functions added: GetSpacer, GetPreviewWinnr, ExtractFuncListing, UnEscape, GetLine/ColPosition. Removed undocumented IsPreviewWindowOpen function. See description for more details.
genutils.vim 1.8 2003-08-28 6.0 Hari Krishna Dara When disabling persistence feature using g:genutilsNoPersist, it is possible for the plugins that depend on it to fail. Fixed it.
genutils.vim 1.7 2003-08-25 6.0 Hari Krishna Dara Misc. changes, see script for more details.
- The scriptlets g:makeArgumentString g:makeArgumentList have been replaced with new function MakeArgumentString() and MakeArgumentList() and the usage now is more concise. The old usage is now deprecated.
- New functions Escape(), GetVimCmdOutput() and OptClearBuffer()
- New utility functions for signs, CurLineHasSign() and ClearAllSigns().
- Fixed bugs in FindWindowForName().
- The FindWindowForBuffer() function is now redundant and is deprecated, use bufwinnr(FindBufferForName(fileName)) for the same purpose.
- Some improvements for Vim6.2, but it should still work with Vim6.0.
- Fixed a few bugs.
genutils.vim 1.6 2003-05-02 6.0 Hari Krishna Dara Minor fixes/updates. Fixed a bug in restoring line position with respect to window. Users of FileChangedShell functionality provided by the plugin (and thus the perforce plugin), should download this version only if the 6.1.220 patch is installed.
genutils.vim 1.5 2003-03-30 6.0 Hari Krishna Dara My earlier version was using :normal instead of :normal! command, so user's mapping will interfere with it. If you have downloaded 1.4 earlier, please download it again. Thanks to David Rennalls for reporting the problem.
genutils.vim 1.4 2003-03-23 6.0 Hari Krishna Dara Some bugfixes and improvements.
- New UnEscape() which is more close to escape() than the old DeEscape().
- ExecMap() is separated as a new plugin. That is the better place for it as it is not really useful as a library function.
- The sort compare methods were made public as they are very useful in writing new compares.
- Some update on doc.
- Now CreateArgString() can be used with an arbitrary pattern.
- Fixed some bugs in MoveCurLineToWinLine(). It works better now.
- Added a functions to handle FileChangedShell autocommand and emulate the default vim behavior.
genutils.vim 1.3 2002-12-05 6.0 Hari Krishna Dara GPLed it for the use by Cream project. See http://cream.sf.net for information on Cream for Vim.
genutils.vim 1.2 2002-11-26 6.0 Hari Krishna Dara - Generalized Quick sort function. The sort routine is no longer tied to the
  buffer contents (multvals.vim uses this function to sort arrays).
- A binary search function that can be used to incrementally update sorted
  buffer contents (like buffer lists, tag lists etc), and a generalized variant
  of this function which is no tied to the buffer contents.
- A new comparator to sort Java imports first by name and then by their length.
  This groups the imports from the same package pretty well together.
- Minor fixes in FindWindowForBuffer() and FindBufferForWindow()
genutils.vim 1.1 2002-08-13 6.0 Hari Krishna Dara New functions
  - CenterWordInSpace(), useful if you use Align.vim and want to center the text horizontally in the boxes.
  - Improved ShiftWordInSpace().
  - New collection from list, CommonPath() with minor improvements. Added RelPathFromFile() and RelPathFromDir() functions.
  - New persistence functions, PutPersistenceVar() and GetPersistenceVar() functions to save and retrieve your script variables across vim sessions without stepping on another script's name space.
  -- Minor fixes in CleanupFileName() function.
genutils.vim 1.0.24 2002-04-12 6.0 Hari Krishna Dara New function, AlignWordWithWordInPreviousLine(). Improved ExecMap(), it is now much more useful. Added new scriptlet, g:makeArgumentList and its companion function, CreateArgString().
genutils.vim 1.0.20 2002-03-29 6.0 Hari Krishna Dara Fixed a typo in ResetWindowSettings(). Update the previous version to fix an error while quitting selectbuf or perforce help window.
genutils.vim 1.0.19 2002-03-26 6.0 Hari Krishna Dara Minor changes. Fixed FindWindowForBuffer and other functions to take care of the extra backslashes in the filenames protecting the spaces etc. Save/RestoreWindowSettings functions now have a variant that takes in a key. This key can be used to call these function from multiple scripts at the same time without overwriting each other's settings. Some new functions.
genutils.vim 1.0.15 2002-03-08 6.0 Hari Krishna Dara - Fixed minor issues with makeArgumentString.
- New functions to do quick sort on the current window contents. A command to sort lines by their length.
- A Basic help/description is added at the start of the script.
genutils.vim 1.0.11 2002-02-25 6.0 Hari Krishna Dara New utility to pass variable number of arugments to other functions. Ex usage:
   fu! s:IF(...)
     exec g:makeArgumentString
     exec "call Impl(" . argumentString . ")"
   endfu

New OnMS() function to check for any windoze OS. New utility ShiftWordInSpace() and SetupScratchBuffer() functions. Add the following mappings to move words in the white space:

noremap <silent> <C-Space> :call ShiftWordInSpace(1)<CR>
noremap <silent> <C-BS> :call ShiftWordInSpace(-1)<CR>
genutils.vim 1.0.8 2002-02-04 6.0 Hari Krishna Dara Improved the save/restore position to even save/restore the line position in the window. Take a look at the set of Save/Restore/ResetSoft/HardPosition() functions.
genutils.vim 1.0.7 2002-02-01 6.0 Hari Krishna Dara Initial upload
ip used for rating: 3.129.45.92

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github