-
Notifications
You must be signed in to change notification settings - Fork 5
/
README
77 lines (64 loc) · 4.72 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
" 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!