Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

69 lines (57 sloc) 4.387 kB
" CommentFrame! "
" "
" Copyright (c) 2012 Benjamin Leopold "
" All rights reserved. "
" "
" Public Domain, same license as Vim. "
" see: "
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~ by cometsong <benjamin at cometsong dot net> ~~~~~
" "
" This is a simple plugin to generate fancy-looking comments/section dividers "
" with centered titles and append them at the current cursor position. "
" "
" Also CommentRight => line of comment (customizable for diff langs) with "
" string arg put on right end of line. "
" "
" To customize further, unmapping of default keysets can be done, plus "
" creating any new combinations of frame types by using the CommentFrame "
" Custom and CustomRight function in your vimrc. See below for details. "
" "
" For latest developments, any mods, pull requests, etc, see: "
" "
" "
" inspired by: makesd/makecsd by Chase Venters script: "
" "
Basic Usage:
The default keymappings are setup for a custom function to create a CommentFrame
and also a CommentRight line. All keymapping start with <Leader>, all default
frames and right lines are 80 characters.
Key Command Name Result
--- -------------------------- ----------------------------------------
fcs CommentFrameSlashes border: //****************************//
fcS CommentFrameSlashStar border: /******************************/
fch CommentFrameHashDash border: #------------------------------#
fcH CommentFrameHashEqual border: #==============================#
fcq CommentFrameQuoteDash border: "------------------------------"
fcQ CommentFrameQuoteTilde border: "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
frh CommentRightHash line: #~~~~~~~~~~~~~~~~~~~~~ title ~~~~~
frs CommentRightSlashes line: //~~~~~~~~~~~~~~~~~~~~ title ~~~~~
frS CommentRightSlashStar line: /*~~~~~~~~~~~~~~~~~~ title ~~~~~*/
frq CommentRightQuote line: "~~~~~~~~~~~~~~~~~~~~~ title ~~~~~
These defaults can be unmapped, remapped or preserved, as you see fit.
New styles and keymappings can be added using the following lines in your vimrc:
command! -nargs=+ CommentFrameSlashMeDown :call CommentFrame#Custom('//', '//', 80, '*', '_', 0, <args>)
call CommentFrame#MapKeys('ni', 'cfs', ':CommentFrameSlashMeDown ""<Left>')
This will create a new command and a new key mapped in modes normal (n) and
insert (i) modes, as designeted in the first MapKeys arg, then 'cfC' as the keys
to map, and the command to be run with that keypress, or by using the command
from the ':' command line.
Below is the MapKeys call for direct access to the CommentFrameCustom
command, if only a keymapping is desired, not another usable command.
call CommentFrame#MapKeys("n", "mykeys", ":CommentFrameCustom '!','...',80,':','>',3,''<Left>")
Have fun stormin the castle!
Jump to Line
Something went wrong with that request. Please try again.