Skip to content
Vim script
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
plugin Add plugin config var to set width of comment lines Feb 12, 2020
.gitignore Initial commit Apr 18, 2012
README Update README with default comment width option Feb 13, 2020

README

"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"                                 CommentFrame!                                "
"                                                                              "
"                      Copyright (c) 2012 Benjamin Leopold                     "
"                              All rights reserved.                            "
"                                                                              "
"                      Public Domain, same license as Vim.                     "
"        see: http://vimdoc.sourceforge.net/htmldoc/uganda.html#license        "
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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 custom             "
" CommentFrameCustom and CommentRightCustom functions in your vimrc.           "
" See below for details.                                                       "
"                                                                              "
" For latest developments, any mods, pull requests, etc, see:                  "
"   https://github.com/cometsong/CommentFrame.vim                              "
"                                                                              "
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
"             inspired by: makesd/makecsd by Chase Venters script:             "
"             http://www.vim.org/scripts/script.php?script_id=3253             "
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Plugin Configuration:
  `g:CommentFrame_SkipDefaultMappings`   let =1 to not use default keymaps

  `g:CommentFrame_TextWidth`             set global default width of comment
                                         frames and lines; always modifiable
					 using the `...Custom` functions

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 or can be
not mapped at all using the config variable mentioned above.

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!

You can’t perform that action at this time.