On Tue, August 11, 2009 12:09 am, drlatex wrote: > I am not sure how to run this script. > > The first thing I tried was copying and pasting that into vim and > applying it like a command (just like :de1,$ for example). > > I got the message: E81: Using <SID> not in a script context > > I also saved that scirpt as a .txt file in the same directory as the > file I want to split, and opened the file I wanted to split and > applied the command:
No. You save the script to a file, say splitfile.vim below your vim runtime path (e.g. ~/.vim/plugin in an Unix/Linux environment. Create the directory plugin, if it does not exist). Then whenever you start vim, this script is automatically loaded. You can confirm this by issuing the :scriptnames command, which outputs all loaded files by vim. See :h add-global-plugin and :h scriptnames for the use of plugins. I am sure, the help has some more sections on using plugins, but this should get you started. If you've confirmed, that the script was loaded, you are ready to use the plugin. The script defines one function (which does the writing and splitting) and defines a simple command, which calls the function. So you open your file you'd like to get split and then you can use the command :SplitFile to split your file. You have to provide a directory where to save your files. So if you want to have all parts saved in your /tmp directory, use :SplitFile /tmp. For ease of convenience, the command can use directory completion, so you'll have only have to type :Sp<Tab> /tm<Tab> and vim will complete for you the command name and directory name. The command will abort, if it finds that one name has already been used, e.g. there are duplicate asdf....|name1|....asdf sections in your file. You can however force it to overwrite previously written sections by using :SplitFile! /tmp. Does this make things clear? regards, Christian --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
