Hello, * On Thu, Sep 21, 2006 at 10:43:54PM +0200, Kim Schulz <[EMAIL PROTECTED]> wrote: > I want to add placeholders to some templates I have like > <+TITLE+> <+DATE+> etc. > I then want to map a keyboard shortcut to do the following > 1. find next placeholder > 2. remove placeholder > 3. place cursor where placehoder where > 4. go into insert mode. > > I started out on the command, but got kinda stuck. > :map <C-j> /<+.\++><CR>:s/<+.\++>//<CR>'.i > > it almost works, except that it places the cursor at the beginning of > the line instead of at the place of the placeholder. > > any ideas?
Why don't you use already existing solutions ? I'm maintaining a placeholder/bracketing system -> <http://hermitte.free.fr/vim/ressources/lh-map-tools.tar.gz> This is the latest UTF-8 friendly version. <Advertisement comment="someday I will have to release v1.0.0 and make an announcement"> This package offers several things: - a documentation - a markers/placeholders system that: - selects (as in "select-mode") the marker/placeholder - works well in UTF-8 (at last!) - is compatible with a few vim options that change everything in visual-selection management (like 'selection', 'magic', folders, ...) - provides forward and backward jumps - provides mappings for plugin-writers - can be customized in various ways - does not mess with neither @/, nor search history, nor any other register - several functions that can be used to implement plugins and ftplugins: - surround selection (unless the selection is a marker (workaround for vim <7 versions)) - expand text according to the context - ... - smart-bracketing mappings: - the expansion respect the context (string, comment, ...) - takes advantage of the placeholders system - can be tuned for different filetypes. - it is maintained -- I heavily use this package everyday at work (solaris/linux) and at home (xp). </> It is integrated in an advanced templating system (actually a fork of mu-template that I'm maintaining) -> <http://hermitte.free.fr/vim/ressources/mu-template.tar.gz> (I still have a few bugs to fix -- they mostly occur in a few "wizards") And also my set of ftplugins like the C&C++ one: -> <http://hermitte.free.fr/vim/ressources/lh-cpp.tar.gz> (A few files are missing from the archive for the class and doxygen wizards). Otherwise there exist a few other similar placeholders systems (either forks of my work, or even complete and (simplified) rewrites). HTH, -- Luc Hermitte http://hermitte.free.fr/vim/