diff --git a/doc/NERD_commenter.txt b/doc/NERD_commenter.txt index a30a72c..aba160e 100644 --- a/doc/NERD_commenter.txt +++ b/doc/NERD_commenter.txt @@ -8,7 +8,7 @@ ============================================================================== -CONTENTS *NERDCommenterContents* +CONTENTS *NERDCommenterContents* 1.Intro...................................|NERDCommenter| 2.Functionality provided..................|NERDComFunctionality| @@ -16,8 +16,8 @@ CONTENTS *NERDCommenterContents* 2.2 Functionality Details.............|NERDComFunctionalityDetails| 2.2.1 Comment map.................|NERDComComment| 2.2.2 Nested comment map..........|NERDComNestedComment| - 2.2.3 Toggle comment map..........|NERDComToggleComment| - 2.2.4 Minimal comment map.........|NERDComMinimalComment| + 2.2.3 Toggle comment map..........|NERDComToggleComment| + 2.2.4 Minimal comment map.........|NERDComMinimalComment| 2.2.5 Invert comment map..........|NERDComInvertComment| 2.2.6 Sexy comment map............|NERDComSexyComment| 2.2.7 Yank comment map............|NERDComYankComment| @@ -66,29 +66,29 @@ provided that contains menu items corresponding to all the below mappings): Most of the following mappings are for normal/visual mode only. The |NERDComInsertComment| mapping is for insert mode only. -[count],cc |NERDComComment| +[count],cc |NERDComComment| Comments out the current line or text selected in visual mode. -[count],cn |NERDComNestedComment| +[count],cn |NERDComNestedComment| Same as |NERDComComment| but forces nesting. -[count],c |NERDComToggleComment| +[count],c |NERDComToggleComment| Toggles the comment state of the selected line(s). If the topmost selected line is commented, all selected lines are uncommented and vice versa. -[count],cm |NERDComMinimalComment| +[count],cm |NERDComMinimalComment| Comments the given lines using only one set of multipart delimiters if -possible. +possible. -[count],ci |NERDComInvertComment| +[count],ci |NERDComInvertComment| Toggles the comment state of the selected line(s) individually. Each selected line that is commented is uncommented and vice versa. -[count],cs |NERDComSexyComment| +[count],cs |NERDComSexyComment| Comments out the selected lines ``sexily'' @@ -97,37 +97,37 @@ Same as |NERDComComment| except that the commented line(s) are yanked before commenting. -,c$ |NERDComEOLComment| +,c$ |NERDComEOLComment| Comments the current line from the cursor to the end of line. -,cA |NERDComAppendComment| +,cA |NERDComAppendComment| Adds comment delimiters to the end of line and goes into insert mode between them. -,cI |NERDComPrependComment| +,cI |NERDComPrependComment| Adds comment delimiters to the start of line and goes into insert mode between them. - |NERDComInsertComment| + |NERDComInsertComment| Adds comment delimiters at the current cursor position and inserts between. -,ca |NERDComAltDelim| +,ca |NERDComAltDelim| Switches to the alternative set of delimiters. -[count],cl -[count],cr -[count],cb |NERDComAlignedComment| +[count],cl +[count],cr +[count],cb |NERDComAlignedComment| Same as |NERDComComment| except that the delimiters are aligned down the left side (,cl), the right side (,cr) or both sides (,cb). -[count],cu |NERDComUncommentLine| +[count],cu |NERDComUncommentLine| Uncomments the selected line(s). ------------------------------------------------------------------------------ @@ -137,8 +137,8 @@ Uncomments the selected line(s). 2.2.1 Comment map *NERDComComment* Default mapping: [count],cc -Change the mapping with: NERDComLineMap. -Applicable modes: normal visual visual-line visual-block. +Change the mapping with: NERDComLineMap. +Applicable modes: normal visual visual-line visual-block. Comments out the current line. If multiple lines are selected in visual-line @@ -157,12 +157,12 @@ Change the mapping with: NERDComLineNestMap. Applicable modes: normal visual visual-line visual-block. Performs nested commenting. Works the same as ,cc except that if a -line is already commented then it will be commented again. +line is already commented then it will be commented again. If |NERDUsePlaceHolders| is set then the previous comment delimiters will be replaced by place-holder delimiters if needed. Otherwise the nested comment will only be added if the current commenting delimiters have no right -delimiter (to avoid syntax errors) +delimiter (to avoid syntax errors) If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. @@ -171,15 +171,15 @@ Related options: |NERDDefaultNesting| ------------------------------------------------------------------------------ -2.2.3 Toggle comment map *NERDComToggleComment* +2.2.3 Toggle comment map *NERDComToggleComment* -Default mapping: [count],c +Default mapping: [count],c Change the mapping with: NERDComLineToggleMap. Applicable modes: normal visual-line. Toggles commenting of the lines selected. The behaviour of this mapping depends on whether the first line selected is commented or not. If so, all -selected lines are uncommented and vice versa. +selected lines are uncommented and vice versa. With this mapping, a line is only considered to be commented if it starts with a left delimiter. @@ -188,7 +188,7 @@ If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ -2.2.4 Minimal comment map *NERDComMinimalComment* +2.2.4 Minimal comment map *NERDComMinimalComment* Default mapping: [count],cm Change the mapping with: NERDComLineMinimalMap @@ -212,13 +212,13 @@ lines were selected in visual-line mode. ------------------------------------------------------------------------------ 2.2.5 Invert comment map *NERDComInvertComment* -Default mapping: ,ci +Default mapping: ,ci Change the mapping with: NERDComLineInvertMap. Applicable modes: normal visual-line. Inverts the commented state of each selected line. If the a selected line is commented then it is uncommented and vice versa. Each line is examined and -commented/uncommented individually. +commented/uncommented individually. With this mapping, a line is only considered to be commented if it starts with a left delimiter. @@ -229,13 +229,13 @@ lines were selected in visual-line mode. ------------------------------------------------------------------------------ 2.2.6 Sexy comment map *NERDComSexyComment* -Default mapping: [count],cs +Default mapping: [count],cs Change the mapping with: NERDComLineSexyMap Applicable modes: normal, visual-line. Comments the selected line(s) ``sexily''... see |NERDComSexyComments| for a description of what sexy comments are. Can only be done on filetypes for -which there is at least one set of multipart comment delimiters specified. +which there is at least one set of multipart comment delimiters specified. Sexy comments cannot be nested and lines inside a sexy comment cannot be commented again. @@ -249,31 +249,31 @@ Related options: ------------------------------------------------------------------------------ 2.2.7 Yank comment map *NERDComYankComment* -Default mapping: [count],cy +Default mapping: [count],cy Change the mapping with: NERDComLineYankMap Applicable modes: normal visual visual-line visual-block. -Same as ,cc except that it yanks the line(s) that are commented first. +Same as ,cc except that it yanks the line(s) that are commented first. ------------------------------------------------------------------------------ 2.2.8 Comment to EOL map *NERDComEOLComment* -Default mapping: ,c$ -Change the mapping with: NERDComToEOLMap +Default mapping: ,c$ +Change the mapping with: NERDComToEOLMap Applicable modes: normal. Comments the current line from the current cursor position up to the end of -the line. +the line. ------------------------------------------------------------------------------ 2.2.9 Append com to line map *NERDComAppendComment* -Default mapping: ,cA -Change the mapping with: NERDAppendComMap. +Default mapping: ,cA +Change the mapping with: NERDAppendComMap. Applicable modes: normal. Appends comment delimiters to the end of the current line and goes -to insert mode between the new delimiters. +to insert mode between the new delimiters. ------------------------------------------------------------------------------ 2.2.10 Prepend com to line map *NERDComPrependComment* @@ -283,17 +283,17 @@ Change the mapping with: NERDPrependComMap. Applicable modes: normal. Prepends comment delimiters to the start of the current line and goes to -insert mode between the new delimiters. +insert mode between the new delimiters. ------------------------------------------------------------------------------ 2.2.11 Insert comment map *NERDComInsertComment* Default mapping: -Change the mapping with: NERDComInInsertMap. +Change the mapping with: NERDComInInsertMap. Applicable modes: insert. Adds comment delimiters at the current cursor position and inserts -between them. +between them. ------------------------------------------------------------------------------ 2.2.12 Use alternate delims map *NERDComAltDelim* @@ -304,21 +304,21 @@ Applicable modes: normal. Changes to the alternative commenting style if one is available. For example, if the user is editing a c++ file using // comments and they hit ,ca -then they will be switched over to /**/ comments. +then they will be switched over to /**/ comments. See also |NERDComDefaultDelims| ------------------------------------------------------------------------------ 2.2.13 Comment aligned maps *NERDComAlignedComment* -Default mappings: [count],cl [count],cr [count],cb +Default mappings: [count],cl [count],cr [count],cb Change the mappings with: NERDComAlignLeftMap, NERDComAlignRightMap and NERDComAlignBothMap. Applicable modes: normal visual-line. Same as ,cc except that the comment delimiters are aligned on the left side, right side or both sides respectively. These comments are always nested -if the line(s) are already commented. +if the line(s) are already commented. If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. @@ -326,7 +326,7 @@ lines were selected in visual-line mode. ------------------------------------------------------------------------------ 2.2.14 Uncomment line map *NERDComUncommentLine* -Default mapping: [count],cu +Default mapping: [count],cu Change the mapping with: NERDUncomLineMap. Applicable modes: normal visual visual-line visual-block. @@ -375,7 +375,7 @@ strace svn systemverilog tads taglist tags tak tasm tcl terminfo tex text plaintex texinfo texmf tf tidy tli trasys tsalt tsscl tssgm uc uil vb verilog verilog_systemverilog vgrindefs vhdl vim viminfo virata vo_base vrml vsejcl webmacro wget winbatch wml wvdial xdefaults xf86conf xhtml xkb xmath xml -xmodmap xpm2 xpm xslt yacc yaml z8a +xmodmap xpm2 xpm xslt yacc yaml z8a If a language is not in the list of hardcoded supported filetypes then the &commentstring vim option is used. @@ -390,7 +390,7 @@ one other marker symbol. For example: > */ /* This is a c style sexy comment - * So there! + * So there! * But this one is ``compact'' style */ < Here the multipart delimiters are /* and */ and the marker is *. The NERD @@ -402,9 +402,9 @@ commenter is capable of adding and removing comments of this type. All of the NERD commenter mappings and menu items invoke a single function which delegates the commenting work to other functions. This function is public and has the prototype: > - function! NERDComment(isVisual, type) + function! NERDComment(isVisual, type) < -The arguments to this function are simple: +The arguments to this function are simple: - isVisual: if you wish to do any kind of visual comment then set this to 1 and the function will use the '< and '> marks to find the comment boundries. If set to 0 then the function will operate on the current @@ -418,7 +418,7 @@ For example, if you typed > :call NERDComment(1, 'sexy') < then the script would do a sexy comment on the last visual selection. - + ============================================================================== 3. Options *NERDComOptions* @@ -450,7 +450,7 @@ then the script would do a sexy comment on the last visual selection. |NERDRemoveExtraSpaces| Tells the script to always remove the extra spaces when uncommenting (regardless of whether NERDSpaceDelims - is set) + is set) |NERDRPlace| Specifies what to use as the right delimiter placeholder when nesting comments. @@ -466,7 +466,7 @@ then the script would do a sexy comment on the last visual selection. ------------------------------------------------------------------------------ 3.3 Options details *NERDComOptionsDetails* -To enable any of the below options you should put the given line in your +To enable any of the below options you should put the given line in your ~/.vimrc *loaded_nerd_comments* @@ -476,7 +476,7 @@ option > < ------------------------------------------------------------------------------ *NERDAllowAnyVisualDelims* -Values: 0 or 1. +Values: 0 or 1. Default: 1. If set to 1 then, when doing a visual or visual-block comment (but not a @@ -489,7 +489,7 @@ example if we are editing the following java code: > System.out.println(foo * bar); < If we are using // comments and select the "foo" and "bar" in visual-block -mode, as shown left below (where '|'s are used to represent the visual-block +mode, as shown left below (where '|'s are used to represent the visual-block boundary), and comment it then the script will use the alternative delims as shown on the right: > @@ -499,7 +499,7 @@ shown on the right: > < ------------------------------------------------------------------------------ *NERDBlockComIgnoreEmpty* -Values: 0 or 1. +Values: 0 or 1. Default: 1. This option affects visual-block mode commenting. If this option is turned @@ -516,7 +516,7 @@ For example, if you are commenting this chunk of c code in visual-block mode | | while(1){ | | fork(); | | } - |} | + |} | < If NERDBlockComIgnoreEmpty=0 then this code will become: > #include @@ -527,7 +527,7 @@ If NERDBlockComIgnoreEmpty=0 then this code will become: > /* */ while(1){ /* */ fork(); /* */ } - /*} */ + /*} */ < Otherwise, the code block would become: > #include @@ -538,7 +538,7 @@ Otherwise, the code block would become: > while(1){ fork(); } - /*} */ + /*} */ < ------------------------------------------------------------------------------ *NERDCommentWholeLinesInVMode* @@ -629,7 +629,7 @@ set NERDRemoveExtraSpaces to 0. *NERDLPlace* *NERDRPlace* Values: arbitrary string. -Default: +Default: NERDLPlace: "[>" NERDRPlace: "<]" @@ -637,8 +637,8 @@ These options are used to control the strings used as place-holder delimiters. Place holder delimiters are used when performing nested commenting when the filetype supports commenting styles with both left and right delimiters. To set these options use lines like: > - let NERDLPlace="FOO" - let NERDRPlace="BAR" + let NERDLPlace="FOO" + let NERDRPlace="BAR" < Following the above example, if we have line of c code: > /* int horse */ @@ -654,7 +654,7 @@ Values: arbitrary string. Default: \c NERDMapleader is used to specify what all the NERD commenter key mappings -begin with. +begin with. The default key mappings will look like this: > \cc @@ -688,7 +688,7 @@ This option can take 4 values: "1": Turns the 'comment' menu on with no menu shortcut. "2": Turns the 'comment 'menu on with -c as the shortcut. "3": Turns the 'Plugin -> comment' menu on with -c as the shortcut. - + ------------------------------------------------------------------------------ *NERDUsePlaceHolders* Values: 0 or 1. @@ -733,10 +733,10 @@ Some people may want their sexy comments to be like this: > * in c */ < As opposed to like this: > - /* + /* * Hi There! * This is a sexy comment - * in c + * in c */ < If this option is set to 1 then the top style will be used. @@ -769,11 +769,11 @@ See |NERDComAltDelim| for switching commenting styles at runtime. These options are used to override the default keys that are used for the commenting mappings. Their values must be set to strings. As an example: if -you wanted to use the mapping ,foo to uncomment lines of code then +you wanted to use the mapping ,foo to uncomment lines of code then you would place this line in your vimrc > let NERDUncomLineMap=",foo" < -Check out |NERDComFunctionality| for details about what the following +Check out |NERDComFunctionality| for details about what the following mappings do. Default Mapping Option to override~ @@ -793,7 +793,7 @@ Default Mapping Option to override~ ,c$ NERDComToEOLMap ,cy NERDComLineYankMap ,cu NERDUncomLineMap - + ============================================================================== 4. Issues with the script *NERDComIssues* @@ -809,7 +809,7 @@ delimiters appear in a line doesnt mean they really ARE delimiters. For example, Java uses // comments but the line > System.out.println("//"); < -clearly contains no real comment delimiters. +clearly contains no real comment delimiters. To distinguish between ``real'' comment delimiters and ``fake'' ones we use a set of heuristics. For example, one such heuristic states that any comment @@ -904,7 +904,7 @@ to get illegal syntax when uncommenting them. nicothakis for posting the issue 2.1.8 - - fixed a couple of bugs with the NERDSpaceDelims option, thx to + - fixed a couple of bugs with the NERDSpaceDelims option, thx to David Miani and Jeremy Hinegardner - added dummy support for lhaskell, thx to pipp for posting the issue - added an alternative set of delims for the plsql filetype, thx to Kuchma @@ -914,7 +914,7 @@ to get illegal syntax when uncommenting them. - added support for asymptote, thx to Vladimir Lomov - made NERDDefaultNesting enabled by default as this seems more intuitive, thx to marco for the suggestion - + 2.1.7 - added support for haml, thx to Greb Weber @@ -993,7 +993,7 @@ to get illegal syntax when uncommenting them. - Made it so that the NERDShutUp option now only controls the "Pleeease email the delimiters..." requests. It no longer affects the general output of the script. - - Simplified the names of the help tags. + - Simplified the names of the help tags. 2.0.5 - Added support for autoit, autohotkey and docbk filetypes (thanks to @@ -1034,7 +1034,7 @@ to get illegal syntax when uncommenting them. 2.0.0: - NOTE: renamed the script to NERD_commenter.vim. When you install this - version you must delete the old files: NERD_comments.vim and + version you must delete the old files: NERD_comments.vim and NERD_comments.txt. - Reworked the mappings and main entry point function for the script to avoid causing visual-bells and screen scrolling. @@ -1049,7 +1049,7 @@ to get illegal syntax when uncommenting them. ways) - Some have been removed altogether, namely: NERD_create_h_filetype (why was a commenting script creating a filetype?!), - NERD_left_align_regexp, NERD_right_align_regexp, + NERD_left_align_regexp, NERD_right_align_regexp, - Removed all the NERD_use_alt_style_XXX_coms options and replaced them with a better system. Now if a filetype has alternative delims, the @@ -1074,21 +1074,21 @@ to get illegal syntax when uncommenting them. Thanks and respect to the following people: Thanks to Nick Brettell for his many ideas and criticisms. A bloody good -bastard. +bastard. :normal :.-2s/good// Thanks to Matthew Hawkins for his awesome refactoring! -Thanks to the authors of the vimspell whose documentation +Thanks to the authors of the vimspell whose documentation installation function I stole :) Thanks to Greg Searle for the idea of using place-holders for nested comments. Thanks to Nguyen for the suggestions and pointing the h file highlighting bug! Also, thanks for the idea of doing sexy comments as well as his suggestions -relating to it :P -Thanks again to Nguyen for complaining about the NERD_comments menu mapping -(-c) interfering with another mapping of his... and thus the +relating to it :P +Thanks again to Nguyen for complaining about the NERD_comments menu mapping +(-c) interfering with another mapping of his... and thus the NERD_dont_create_menu_shortcut option was born :P (it was then replaced with NERD_menu_mode in version 1.67 :) @@ -1142,7 +1142,7 @@ sexy comments. Sexy comments dont look so sexy when they are only half removed Thanks to Alexander "boesi" Bosecke for pointing out a bug that was stopping the NERD_space_delim_filetype_regexp option from working with left aligned -toggle comments. And for pointing out a bug when initialising VB comments. +toggle comments. And for pointing out a bug when initialising VB comments. Thanks to Stefano Zacchiroli for suggesting the idea of "Minimal comments". And for suggested improvements to minimal comments. @@ -1235,7 +1235,7 @@ tinoucas gentoo-conf-d Greg Weber D, haml Bruce Sherrod velocity timberke cobol -Aaron Schaefer factor +Aaron Schaefer factor Laurent ARNOUD asterisk, mplayerconf Kuchma Michael plsql Brett Warneke spectre diff --git a/plugin/NERD_commenter.vim b/plugin/NERD_commenter.vim index 45b5915..1ab2039 100644 --- a/plugin/NERD_commenter.vim +++ b/plugin/NERD_commenter.vim @@ -92,11 +92,11 @@ if !exists("nerd_autocmds_loaded") augroup commentEnablers "if the user enters a buffer or reads a buffer then we gotta set up - "the comment delimiters for that new filetype + "the comment delimiters for that new filetype autocmd BufEnter,BufRead * :call s:SetUpForNewFiletype(&filetype, 0) "if the filetype of a buffer changes, force the script to reset the - "delims for the buffer + "delims for the buffer autocmd Filetype * :call s:SetUpForNewFiletype(&filetype, 1) augroup END @@ -104,7 +104,7 @@ endif " Function: s:SetUpForNewFiletype(filetype) function {{{2 -" This function is responsible for setting up buffer scoped variables for the +" This function is responsible for setting up buffer scoped variables for the " given filetype. " " These variables include the comment delimiters for the given filetype and calls @@ -125,224 +125,224 @@ function s:SetUpForNewFiletype(filetype, forceReset) let b:sexyComMarker = '' "check the filetype against all known filetypes to see if we have - "hardcoded the comment delimiters to use - if a:filetype == "" + "hardcoded the comment delimiters to use + if a:filetype == "" call s:MapDelimiters('', '') - elseif a:filetype == "aap" + elseif a:filetype == "aap" call s:MapDelimiters('#', '') - elseif a:filetype == "abaqus" + elseif a:filetype == "abaqus" call s:MapDelimiters('**', '') - elseif a:filetype == "abc" + elseif a:filetype == "abc" call s:MapDelimiters('%', '') - elseif a:filetype == "acedb" + elseif a:filetype == "acedb" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "ada" + elseif a:filetype == "ada" call s:MapDelimitersWithAlternative('--','', '-- ', '') - elseif a:filetype == "ahdl" + elseif a:filetype == "ahdl" call s:MapDelimiters('--', '') - elseif a:filetype == "ahk" + elseif a:filetype == "ahk" call s:MapDelimitersWithAlternative(';', '', '/*', '*/') - elseif a:filetype == "amiga" + elseif a:filetype == "amiga" call s:MapDelimiters(';', '') - elseif a:filetype == "aml" + elseif a:filetype == "aml" call s:MapDelimiters('/*', '') - elseif a:filetype == "ampl" + elseif a:filetype == "ampl" call s:MapDelimiters('#', '') - elseif a:filetype == "ant" - call s:MapDelimiters('') - elseif a:filetype == "apache" + elseif a:filetype == "ant" + call s:MapDelimiters('') + elseif a:filetype == "apache" call s:MapDelimiters('#', '') - elseif a:filetype == "apachestyle" + elseif a:filetype == "apachestyle" call s:MapDelimiters('#', '') - elseif a:filetype == "asm68k" + elseif a:filetype == "asm68k" call s:MapDelimiters(';', '') - elseif a:filetype == "asm" + elseif a:filetype == "asm" call s:MapDelimitersWithAlternative(';', '', '#', '') - elseif a:filetype == "asn" + elseif a:filetype == "asn" call s:MapDelimiters('--', '') - elseif a:filetype == "aspvbs" + elseif a:filetype == "aspvbs" call s:MapDelimiters('''', '') - elseif a:filetype == "asterisk" + elseif a:filetype == "asterisk" call s:MapDelimiters(';', '') - elseif a:filetype == "asy" + elseif a:filetype == "asy" call s:MapDelimiters('//', '') - elseif a:filetype == "atlas" - call s:MapDelimiters('C','$') - elseif a:filetype == "autohotkey" - call s:MapDelimiters(';','') - elseif a:filetype == "autoit" - call s:MapDelimiters(';','') - elseif a:filetype == "automake" - call s:MapDelimitersWithAlternative('#','', 'dnl ', '') - elseif a:filetype == "ave" - call s:MapDelimiters("'",'') - elseif a:filetype == "awk" - call s:MapDelimiters('#','') - elseif a:filetype == "basic" + elseif a:filetype == "atlas" + call s:MapDelimiters('C','$') + elseif a:filetype == "autohotkey" + call s:MapDelimiters(';','') + elseif a:filetype == "autoit" + call s:MapDelimiters(';','') + elseif a:filetype == "automake" + call s:MapDelimitersWithAlternative('#','', 'dnl ', '') + elseif a:filetype == "ave" + call s:MapDelimiters("'",'') + elseif a:filetype == "awk" + call s:MapDelimiters('#','') + elseif a:filetype == "basic" call s:MapDelimitersWithAlternative("'",'', 'REM ', '') - elseif a:filetype == "b" + elseif a:filetype == "b" call s:MapDelimiters('/*','*/') - elseif a:filetype == "bbx" + elseif a:filetype == "bbx" call s:MapDelimiters('%', '') - elseif a:filetype == "bc" + elseif a:filetype == "bc" call s:MapDelimiters('#', '') - elseif a:filetype == "bdf" + elseif a:filetype == "bdf" call s:MapDelimiters('COMMENT ', '') - elseif a:filetype == "bib" - call s:MapDelimiters('%','') - elseif a:filetype == "bindzone" + elseif a:filetype == "bib" + call s:MapDelimiters('%','') + elseif a:filetype == "bindzone" call s:MapDelimiters(';', '') - elseif a:filetype == "bst" + elseif a:filetype == "bst" call s:MapDelimiters('%', '') - elseif a:filetype == "btm" + elseif a:filetype == "btm" call s:MapDelimiters('::', '') elseif a:filetype == "bzr" call s:MapDelimiters('', '') - elseif a:filetype == "caos" + elseif a:filetype == "caos" call s:MapDelimiters('*', '') - elseif a:filetype == "catalog" - call s:MapDelimiters('--','--') - elseif a:filetype == "c" - call s:MapDelimitersWithAlternative('/*','*/', '//', '') - elseif a:filetype == "cfg" + elseif a:filetype == "catalog" + call s:MapDelimiters('--','--') + elseif a:filetype == "c" + call s:MapDelimitersWithAlternative('/*','*/', '//', '') + elseif a:filetype == "cfg" call s:MapDelimiters('#', '') - elseif a:filetype == "cg" + elseif a:filetype == "cg" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "ch" + elseif a:filetype == "ch" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "changelog" + elseif a:filetype == "changelog" call s:MapDelimiters('','') - elseif a:filetype == "cl" + elseif a:filetype == "cl" call s:MapDelimiters('#', '') - elseif a:filetype == "clean" + elseif a:filetype == "clean" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "clipper" + elseif a:filetype == "clipper" call s:MapDelimitersWithAlternative('//','', '/*','*/') elseif a:filetype == "cmake" call s:MapDelimiters('#','') - elseif a:filetype == "cobol" + elseif a:filetype == "cobol" call s:MapDelimiters('', '') - elseif a:filetype == "conf" + elseif a:filetype == "conf" call s:MapDelimiters('#', '') - elseif a:filetype == "config" + elseif a:filetype == "config" call s:MapDelimiters('dnl ', '') elseif a:filetype == "context" call s:MapDelimiters('%','') - elseif a:filetype == "cpp" + elseif a:filetype == "cpp" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "crontab" + elseif a:filetype == "crontab" call s:MapDelimiters('#', '') - elseif a:filetype == "cs" + elseif a:filetype == "cs" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "csc" + elseif a:filetype == "csc" call s:MapDelimiters('/*','*/') - elseif a:filetype == "csp" + elseif a:filetype == "csp" call s:MapDelimiters('--', '') - elseif a:filetype == "css" + elseif a:filetype == "css" call s:MapDelimiters('/*','*/') - elseif a:filetype == "cterm" + elseif a:filetype == "cterm" call s:MapDelimiters('*', '') - elseif a:filetype == "cupl" + elseif a:filetype == "cupl" call s:MapDelimiters('/*','*/') - elseif a:filetype == "csv" + elseif a:filetype == "csv" call s:MapDelimiters('','') - elseif a:filetype == "cvs" + elseif a:filetype == "cvs" call s:MapDelimiters('CVS:','') - elseif a:filetype == "CVSAnnotate" + elseif a:filetype == "CVSAnnotate" call s:MapDelimiters('','') - elseif a:filetype == "d" + elseif a:filetype == "d" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "dcl" + elseif a:filetype == "dcl" call s:MapDelimiters('$!', '') - elseif a:filetype == "dakota" + elseif a:filetype == "dakota" call s:MapDelimiters('#', '') - elseif a:filetype == "debchangelog" + elseif a:filetype == "debchangelog" call s:MapDelimiters('', '') - elseif a:filetype == "debcontrol" + elseif a:filetype == "debcontrol" call s:MapDelimiters('#', '') - elseif a:filetype == "debsources" + elseif a:filetype == "debsources" call s:MapDelimiters('#', '') - elseif a:filetype == "def" + elseif a:filetype == "def" call s:MapDelimiters(';', '') elseif a:filetype == "desktop" call s:MapDelimiters('#', '') - elseif a:filetype == "diff" + elseif a:filetype == "diff" call s:MapDelimiters('#', '') - elseif a:filetype == "django" - call s:MapDelimitersWithAlternative('', '{#', '#}') - elseif a:filetype == "docbk" + elseif a:filetype == "django" + call s:MapDelimitersWithAlternative('', '{#', '#}') + elseif a:filetype == "docbk" call s:MapDelimiters('') - elseif a:filetype == "dns" + elseif a:filetype == "dns" call s:MapDelimiters(';', '') - elseif a:filetype == "dosbatch" + elseif a:filetype == "dosbatch" call s:MapDelimitersWithAlternative('REM ','', '::', '') - elseif a:filetype == "dosini" + elseif a:filetype == "dosini" call s:MapDelimiters(';', '') - elseif a:filetype == "dot" + elseif a:filetype == "dot" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "dracula" + elseif a:filetype == "dracula" call s:MapDelimiters(';', '') - elseif a:filetype == "dsl" + elseif a:filetype == "dsl" call s:MapDelimiters(';', '') - elseif a:filetype == "dtd" - call s:MapDelimiters('') - elseif a:filetype == "dtml" - call s:MapDelimiters('','') + elseif a:filetype == "dtd" + call s:MapDelimiters('') + elseif a:filetype == "dtml" + call s:MapDelimiters('','') elseif a:filetype == "dtrace" call s:MapDelimiters('/*','*/') - elseif a:filetype == "dylan" + elseif a:filetype == "dylan" call s:MapDelimitersWithAlternative('//','', '/*','*/') elseif a:filetype == 'ebuild' call s:MapDelimiters('#', '') - elseif a:filetype == "ecd" + elseif a:filetype == "ecd" call s:MapDelimiters('#', '') elseif a:filetype == 'eclass' call s:MapDelimiters('#', '') - elseif a:filetype == "eiffel" + elseif a:filetype == "eiffel" call s:MapDelimiters('--', '') - elseif a:filetype == "elf" + elseif a:filetype == "elf" call s:MapDelimiters("'", '') - elseif a:filetype == "elmfilt" + elseif a:filetype == "elmfilt" call s:MapDelimiters('#', '') - elseif a:filetype == "erlang" + elseif a:filetype == "erlang" call s:MapDelimiters('%', '') - elseif a:filetype == "eruby" + elseif a:filetype == "eruby" call s:MapDelimitersWithAlternative('', '<%#', '%>') - elseif a:filetype == "eterm" + elseif a:filetype == "eterm" call s:MapDelimiters('#', '') - elseif a:filetype == "expect" + elseif a:filetype == "expect" call s:MapDelimiters('#', '') - elseif a:filetype == "exports" + elseif a:filetype == "exports" call s:MapDelimiters('#', '') - elseif a:filetype == "factor" + elseif a:filetype == "factor" call s:MapDelimitersWithAlternative('! ', '', '!# ', '') - elseif a:filetype == "fetchmail" + elseif a:filetype == "fetchmail" call s:MapDelimiters('#', '') - elseif a:filetype == "fgl" + elseif a:filetype == "fgl" call s:MapDelimiters('#', '') - elseif a:filetype == "focexec" + elseif a:filetype == "focexec" call s:MapDelimiters('-*', '') - elseif a:filetype == "form" + elseif a:filetype == "form" call s:MapDelimiters('*', '') - elseif a:filetype == "fortran" + elseif a:filetype == "fortran" call s:MapDelimiters('!', '') - elseif a:filetype == "foxpro" + elseif a:filetype == "foxpro" call s:MapDelimiters('*', '') - elseif a:filetype == "fstab" + elseif a:filetype == "fstab" call s:MapDelimiters('#', '') - elseif a:filetype == "fvwm" + elseif a:filetype == "fvwm" call s:MapDelimiters('#', '') - elseif a:filetype == "fx" + elseif a:filetype == "fx" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "gams" + elseif a:filetype == "gams" call s:MapDelimiters('*', '') - elseif a:filetype == "gdb" + elseif a:filetype == "gdb" call s:MapDelimiters('#', '') - elseif a:filetype == "gdmo" + elseif a:filetype == "gdmo" call s:MapDelimiters('--', '') - elseif a:filetype == "geek" + elseif a:filetype == "geek" call s:MapDelimiters('GEEK_COMMENT:', '') - elseif a:filetype == "gentoo-conf-d" + elseif a:filetype == "gentoo-conf-d" call s:MapDelimiters('#', '') elseif a:filetype == "gentoo-env-d" call s:MapDelimiters('#', '') @@ -352,9 +352,9 @@ function s:SetUpForNewFiletype(filetype, forceReset) call s:MapDelimiters('#', '') elseif a:filetype == 'gentoo-package-keywords' call s:MapDelimiters('#', '') - elseif a:filetype == 'gentoo-package-mask' + elseif a:filetype == 'gentoo-package-mask' call s:MapDelimiters('#', '') - elseif a:filetype == 'gentoo-package-use' + elseif a:filetype == 'gentoo-package-use' call s:MapDelimiters('#', '') elseif a:filetype == 'gitAnnotate' call s:MapDelimiters('', '') @@ -364,535 +364,535 @@ function s:SetUpForNewFiletype(filetype, forceReset) call s:MapDelimiters(';', '') elseif a:filetype == 'gitdiff' call s:MapDelimiters('', '') - elseif a:filetype == "gnuplot" + elseif a:filetype == "gnuplot" call s:MapDelimiters('#','') elseif a:filetype == "groovy" call s:MapDelimitersWithAlternative('//','', '/*','*/') elseif a:filetype == "grub" call s:MapDelimiters('#', '') - elseif a:filetype == "gtkrc" + elseif a:filetype == "gtkrc" call s:MapDelimiters('#', '') - elseif a:filetype == "haskell" - call s:MapDelimitersWithAlternative('--','', '{-', '-}') - elseif a:filetype == "hb" + elseif a:filetype == "haskell" + call s:MapDelimitersWithAlternative('--','', '{-', '-}') + elseif a:filetype == "hb" call s:MapDelimiters('#', '') - elseif a:filetype == "h" + elseif a:filetype == "h" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "haml" + elseif a:filetype == "haml" call s:MapDelimiters('/', '') - elseif a:filetype == "help" + elseif a:filetype == "help" call s:MapDelimiters('"','') - elseif a:filetype == "hercules" + elseif a:filetype == "hercules" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "hog" + elseif a:filetype == "hog" call s:MapDelimiters('#', '') - elseif a:filetype == "html" - call s:MapDelimitersWithAlternative('', '//', '') - elseif a:filetype == "htmldjango" - call s:MapDelimitersWithAlternative('', '{#', '#}') + elseif a:filetype == "html" + call s:MapDelimitersWithAlternative('', '//', '') + elseif a:filetype == "htmldjango" + call s:MapDelimitersWithAlternative('', '{#', '#}') elseif a:filetype == "htmlos" - call s:MapDelimiters('#','/#') - elseif a:filetype == "ia64" + call s:MapDelimiters('#','/#') + elseif a:filetype == "ia64" call s:MapDelimiters('#', '') - elseif a:filetype == "icon" + elseif a:filetype == "icon" call s:MapDelimiters('#', '') - elseif a:filetype == "idlang" + elseif a:filetype == "idlang" call s:MapDelimiters(';', '') - elseif a:filetype == "idl" + elseif a:filetype == "idl" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "indent" + elseif a:filetype == "indent" call s:MapDelimiters('/*','*/') - elseif a:filetype == "inform" + elseif a:filetype == "inform" call s:MapDelimiters('!', '') - elseif a:filetype == "inittab" + elseif a:filetype == "inittab" call s:MapDelimiters('#', '') - elseif a:filetype == "ishd" + elseif a:filetype == "ishd" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "iss" + elseif a:filetype == "iss" call s:MapDelimiters(';', '') - elseif a:filetype == "ist" + elseif a:filetype == "ist" call s:MapDelimiters('%', '') - elseif a:filetype == "jam" + elseif a:filetype == "jam" call s:MapDelimiters('/*','*/') - elseif a:filetype == "java" + elseif a:filetype == "java" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "javascript" + elseif a:filetype == "javascript" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "jess" + elseif a:filetype == "jess" call s:MapDelimiters(';', '') - elseif a:filetype == "jgraph" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "jproperties" + elseif a:filetype == "jgraph" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "jproperties" call s:MapDelimiters('#','') - elseif a:filetype == "jsp" + elseif a:filetype == "jsp" call s:MapDelimiters('<%--', '--%>') - elseif a:filetype == "kconfig" + elseif a:filetype == "kconfig" call s:MapDelimiters('#', '') - elseif a:filetype == "kix" + elseif a:filetype == "kix" call s:MapDelimiters(';', '') - elseif a:filetype == "kscript" + elseif a:filetype == "kscript" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "lace" + elseif a:filetype == "lace" call s:MapDelimiters('--', '') - elseif a:filetype == "ldif" + elseif a:filetype == "ldif" call s:MapDelimiters('#', '') - elseif a:filetype == "lex" + elseif a:filetype == "lex" call s:MapDelimiters('/*','*/') - elseif a:filetype == "lftp" + elseif a:filetype == "lftp" call s:MapDelimiters('#', '') - elseif a:filetype == "lhaskell" + elseif a:filetype == "lhaskell" call s:MapDelimiters('','') - elseif a:filetype == "lifelines" + elseif a:filetype == "lifelines" call s:MapDelimiters('/*','*/') - elseif a:filetype == "lilo" + elseif a:filetype == "lilo" call s:MapDelimiters('#', '') - elseif a:filetype == "lilypond" + elseif a:filetype == "lilypond" call s:MapDelimiters('%', '') elseif a:filetype == "liquid" call s:MapDelimiters('{%', '%}') - elseif a:filetype == "lisp" - call s:MapDelimitersWithAlternative(';','', '#|', '|#') - elseif a:filetype == "lite" + elseif a:filetype == "lisp" + call s:MapDelimitersWithAlternative(';','', '#|', '|#') + elseif a:filetype == "lite" call s:MapDelimiters('/*','*/') - elseif a:filetype == "lookupfile" - call s:MapDelimiters('', '') - elseif a:filetype == "lotos" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "lout" + elseif a:filetype == "lookupfile" + call s:MapDelimiters('', '') + elseif a:filetype == "lotos" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "lout" call s:MapDelimiters('#', '') - elseif a:filetype == "lprolog" + elseif a:filetype == "lprolog" call s:MapDelimiters('%', '') - elseif a:filetype == "lscript" + elseif a:filetype == "lscript" call s:MapDelimiters("'", '') - elseif a:filetype == "lss" + elseif a:filetype == "lss" call s:MapDelimiters('#', '') - elseif a:filetype == "lua" - call s:MapDelimitersWithAlternative('--','', '--[[', ']]') - elseif a:filetype == "lynx" + elseif a:filetype == "lua" + call s:MapDelimitersWithAlternative('--','', '--[[', ']]') + elseif a:filetype == "lynx" call s:MapDelimiters('#', '') - elseif a:filetype == "lytex" + elseif a:filetype == "lytex" call s:MapDelimiters('%', '') - elseif a:filetype == "m4" + elseif a:filetype == "m4" call s:MapDelimiters('dnl ', '') elseif a:filetype == "mail" call s:MapDelimiters('> ','') - elseif a:filetype == "make" - call s:MapDelimiters('#','') + elseif a:filetype == "make" + call s:MapDelimiters('#','') elseif a:filetype == "map" call s:MapDelimiters('%', '') - elseif a:filetype == "maple" + elseif a:filetype == "maple" call s:MapDelimiters('#', '') - elseif a:filetype == "markdown" + elseif a:filetype == "markdown" call s:MapDelimiters('') - elseif a:filetype == "masm" + elseif a:filetype == "masm" call s:MapDelimiters(';', '') elseif a:filetype == "mason" call s:MapDelimiters('<% #', '%>') - elseif a:filetype == "master" + elseif a:filetype == "master" call s:MapDelimiters('$', '') - elseif a:filetype == "matlab" + elseif a:filetype == "matlab" call s:MapDelimiters('%', '') - elseif a:filetype == "mel" + elseif a:filetype == "mel" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "mf" + elseif a:filetype == "mf" call s:MapDelimiters('%', '') - elseif a:filetype == "mib" + elseif a:filetype == "mib" call s:MapDelimiters('--', '') - elseif a:filetype == "mkd" + elseif a:filetype == "mkd" call s:MapDelimiters('>', '') - elseif a:filetype == "mma" - call s:MapDelimiters('(*','*)') + elseif a:filetype == "mma" + call s:MapDelimiters('(*','*)') elseif a:filetype == "modconf" call s:MapDelimiters('#', '') elseif a:filetype == "model" - call s:MapDelimiters('$','$') - elseif a:filetype =~ "moduala." - call s:MapDelimiters('(*','*)') - elseif a:filetype == "modula2" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "modula3" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "monk" + call s:MapDelimiters('$','$') + elseif a:filetype =~ "moduala." + call s:MapDelimiters('(*','*)') + elseif a:filetype == "modula2" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "modula3" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "monk" call s:MapDelimiters(';', '') - elseif a:filetype == "mplayerconf" + elseif a:filetype == "mplayerconf" call s:MapDelimiters('#', '') - elseif a:filetype == "mrxvtrc" + elseif a:filetype == "mrxvtrc" call s:MapDelimiters('#', '') - elseif a:filetype == "mush" + elseif a:filetype == "mush" call s:MapDelimiters('#', '') - elseif a:filetype == "muttrc" + elseif a:filetype == "muttrc" call s:MapDelimiters('#', '') - elseif a:filetype == "named" + elseif a:filetype == "named" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "nasm" + elseif a:filetype == "nasm" call s:MapDelimiters(';', '') - elseif a:filetype == "nastran" + elseif a:filetype == "nastran" call s:MapDelimiters('$', '') - elseif a:filetype == "natural" + elseif a:filetype == "natural" call s:MapDelimiters('/*', '') - elseif a:filetype == "ncf" + elseif a:filetype == "ncf" call s:MapDelimiters(';', '') elseif a:filetype == "nerdtree" call s:MapDelimiters('', '') - elseif a:filetype == "netdict" + elseif a:filetype == "netdict" call s:MapDelimiters('', '') - elseif a:filetype == "netrw" + elseif a:filetype == "netrw" call s:MapDelimiters('', '') - elseif a:filetype == "nqc" + elseif a:filetype == "nqc" call s:MapDelimiters('/*','*/') elseif a:filetype == "nroff" call s:MapDelimiters('\"', '') - elseif a:filetype == "nsis" + elseif a:filetype == "nsis" call s:MapDelimiters('#', '') elseif a:filetype == "objc" call s:MapDelimitersWithAlternative('//','', '/*','*/') elseif a:filetype == "objcpp" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "ocaml" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "occam" - call s:MapDelimiters('--','') - elseif a:filetype == "omlet" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "omnimark" + elseif a:filetype == "ocaml" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "occam" + call s:MapDelimiters('--','') + elseif a:filetype == "omlet" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "omnimark" call s:MapDelimiters(';', '') - elseif a:filetype == "openroad" + elseif a:filetype == "openroad" call s:MapDelimiters('//', '') - elseif a:filetype == "opl" + elseif a:filetype == "opl" call s:MapDelimiters("REM", "") - elseif a:filetype == "ora" + elseif a:filetype == "ora" call s:MapDelimiters('#', '') - elseif a:filetype == "otl" + elseif a:filetype == "otl" call s:MapDelimiters('', '') - elseif a:filetype == "ox" + elseif a:filetype == "ox" call s:MapDelimiters('//', '') elseif a:filetype == "pamconf" call s:MapDelimiters('#', '') - elseif a:filetype == "pascal" + elseif a:filetype == "pascal" call s:MapDelimitersWithAlternative('{','}', '(*', '*)') - elseif a:filetype == "passwd" + elseif a:filetype == "passwd" call s:MapDelimiters('','') - elseif a:filetype == "patran" + elseif a:filetype == "patran" call s:MapDelimitersWithAlternative('$','','/*', '*/') - elseif a:filetype == "pcap" + elseif a:filetype == "pcap" call s:MapDelimiters('#', '') - elseif a:filetype == "pccts" + elseif a:filetype == "pccts" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "perl" + elseif a:filetype == "perl" call s:MapDelimiters('#', '') - elseif a:filetype == "pfmain" + elseif a:filetype == "pfmain" call s:MapDelimiters('//', '') - elseif a:filetype == "php" + elseif a:filetype == "php" call s:MapDelimitersWithAlternative('//','','/*', '*/') - elseif a:filetype == "phtml" + elseif a:filetype == "phtml" call s:MapDelimiters('/*','*/') - elseif a:filetype == "pic" + elseif a:filetype == "pic" call s:MapDelimiters(';', '') - elseif a:filetype == "pike" + elseif a:filetype == "pike" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "pilrc" + elseif a:filetype == "pilrc" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "pine" + elseif a:filetype == "pine" call s:MapDelimiters('#', '') elseif a:filetype == "plaintex" call s:MapDelimiters('%','') - elseif a:filetype == "plm" + elseif a:filetype == "plm" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "plsql" + elseif a:filetype == "plsql" call s:MapDelimitersWithAlternative('--', '', '/*', '*/') - elseif a:filetype == "po" + elseif a:filetype == "po" call s:MapDelimiters('#', '') - elseif a:filetype == "postscr" + elseif a:filetype == "postscr" call s:MapDelimiters('%', '') - elseif a:filetype == "pov" + elseif a:filetype == "pov" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "povini" + elseif a:filetype == "povini" call s:MapDelimiters(';', '') - elseif a:filetype == "ppd" + elseif a:filetype == "ppd" call s:MapDelimiters('%', '') - elseif a:filetype == "ppwiz" + elseif a:filetype == "ppwiz" call s:MapDelimiters(';;', '') - elseif a:filetype == "procmail" + elseif a:filetype == "procmail" call s:MapDelimiters('#', '') - elseif a:filetype == "progress" + elseif a:filetype == "progress" call s:MapDelimiters('/*','*/') - elseif a:filetype == "prolog" - call s:MapDelimitersWithAlternative('%','','/*','*/') - elseif a:filetype == "psf" + elseif a:filetype == "prolog" + call s:MapDelimitersWithAlternative('%','','/*','*/') + elseif a:filetype == "psf" call s:MapDelimiters('#', '') - elseif a:filetype == "ptcap" + elseif a:filetype == "ptcap" call s:MapDelimiters('#', '') elseif a:filetype == "pyrex" call s:MapDelimiters('#','') - elseif a:filetype == "python" - call s:MapDelimiters('#','') - elseif a:filetype == "qf" - call s:MapDelimiters('','') - elseif a:filetype == "radiance" + elseif a:filetype == "python" + call s:MapDelimiters('#','') + elseif a:filetype == "qf" + call s:MapDelimiters('','') + elseif a:filetype == "radiance" call s:MapDelimiters('#', '') - elseif a:filetype == "Rails-log" + elseif a:filetype == "Rails-log" call s:MapDelimiters('', '') - elseif a:filetype == "ratpoison" + elseif a:filetype == "ratpoison" call s:MapDelimiters('#', '') - elseif a:filetype == "r" + elseif a:filetype == "r" call s:MapDelimiters('#', '') - elseif a:filetype == "rc" + elseif a:filetype == "rc" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "readline" + elseif a:filetype == "readline" call s:MapDelimiters('#', '') - elseif a:filetype == "rebol" + elseif a:filetype == "rebol" call s:MapDelimiters(';', '') - elseif a:filetype == "registry" + elseif a:filetype == "registry" call s:MapDelimiters(';', '') - elseif a:filetype == "remind" + elseif a:filetype == "remind" call s:MapDelimiters('#', '') - elseif a:filetype == "rexx" + elseif a:filetype == "rexx" call s:MapDelimiters('/*','*/') elseif a:filetype == "rib" call s:MapDelimiters('#','') - elseif a:filetype == "robots" + elseif a:filetype == "robots" call s:MapDelimiters('#', '') - elseif a:filetype == "rpl" + elseif a:filetype == "rpl" call s:MapDelimiters('/*','*/') - elseif a:filetype == "rst" + elseif a:filetype == "rst" call s:MapDelimiters('..', '') - elseif a:filetype == "rtf" + elseif a:filetype == "rtf" call s:MapDelimiters('', '') - elseif a:filetype == "ruby" - call s:MapDelimiters('#','') - elseif a:filetype == "sa" - call s:MapDelimiters('--','') - elseif a:filetype == "samba" - call s:MapDelimitersWithAlternative(';','', '#', '') - elseif a:filetype == "sas" + elseif a:filetype == "ruby" + call s:MapDelimiters('#','') + elseif a:filetype == "sa" + call s:MapDelimiters('--','') + elseif a:filetype == "samba" + call s:MapDelimitersWithAlternative(';','', '#', '') + elseif a:filetype == "sas" call s:MapDelimiters('/*','*/') - elseif a:filetype == "sass" + elseif a:filetype == "sass" call s:MapDelimitersWithAlternative('//','', '/*', '') - elseif a:filetype == "sather" + elseif a:filetype == "sather" call s:MapDelimiters('--', '') - elseif a:filetype == "scala" + elseif a:filetype == "scala" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "scheme" + elseif a:filetype == "scheme" call s:MapDelimiters(';', '') - elseif a:filetype == "scilab" + elseif a:filetype == "scilab" call s:MapDelimiters('//', '') - elseif a:filetype == "screen" + elseif a:filetype == "screen" call s:MapDelimiters('#', '') - elseif a:filetype == "scsh" + elseif a:filetype == "scsh" call s:MapDelimiters(';', '') - elseif a:filetype == "sdl" + elseif a:filetype == "sdl" call s:MapDelimiters('/*','*/') - elseif a:filetype == "sed" + elseif a:filetype == "sed" call s:MapDelimiters('#', '') - elseif a:filetype == "selectbuf" + elseif a:filetype == "selectbuf" call s:MapDelimiters('', '') elseif a:filetype == "services" call s:MapDelimiters('#', '') - elseif a:filetype == "sgml" - call s:MapDelimiters('') - elseif a:filetype == "sgmldecl" - call s:MapDelimiters('--','--') - elseif a:filetype == "sgmllnx" - call s:MapDelimiters('') - elseif a:filetype == "sicad" + elseif a:filetype == "sgml" + call s:MapDelimiters('') + elseif a:filetype == "sgmldecl" + call s:MapDelimiters('--','--') + elseif a:filetype == "sgmllnx" + call s:MapDelimiters('') + elseif a:filetype == "sicad" call s:MapDelimiters('*', '') - elseif a:filetype == "simula" + elseif a:filetype == "simula" call s:MapDelimitersWithAlternative('%', '', '--', '') - elseif a:filetype == "sinda" + elseif a:filetype == "sinda" call s:MapDelimiters('$', '') - elseif a:filetype == "skill" + elseif a:filetype == "skill" call s:MapDelimiters(';', '') - elseif a:filetype == "slang" + elseif a:filetype == "slang" call s:MapDelimiters('%', '') - elseif a:filetype == "sl" + elseif a:filetype == "sl" call s:MapDelimiters('/*','*/') - elseif a:filetype == "slice" + elseif a:filetype == "slice" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "slrnrc" + elseif a:filetype == "slrnrc" call s:MapDelimiters('%', '') - elseif a:filetype == "sm" + elseif a:filetype == "sm" call s:MapDelimiters('#', '') - elseif a:filetype == "smarty" + elseif a:filetype == "smarty" call s:MapDelimiters('{*', '*}') - elseif a:filetype == "smil" - call s:MapDelimiters('') - elseif a:filetype == "smith" + elseif a:filetype == "smil" + call s:MapDelimiters('') + elseif a:filetype == "smith" call s:MapDelimiters(';', '') - elseif a:filetype == "sml" - call s:MapDelimiters('(*','*)') - elseif a:filetype == "snnsnet" + elseif a:filetype == "sml" + call s:MapDelimiters('(*','*)') + elseif a:filetype == "snnsnet" call s:MapDelimiters('#', '') - elseif a:filetype == "snnspat" + elseif a:filetype == "snnspat" call s:MapDelimiters('#', '') - elseif a:filetype == "snnsres" + elseif a:filetype == "snnsres" call s:MapDelimiters('#', '') - elseif a:filetype == "snobol4" + elseif a:filetype == "snobol4" call s:MapDelimiters('*', '') - elseif a:filetype == "spec" + elseif a:filetype == "spec" call s:MapDelimiters('#', '') - elseif a:filetype == "specman" + elseif a:filetype == "specman" call s:MapDelimiters('//', '') - elseif a:filetype == "spectre" + elseif a:filetype == "spectre" call s:MapDelimitersWithAlternative('//', '', '*', '') - elseif a:filetype == "spice" + elseif a:filetype == "spice" call s:MapDelimiters('$', '') - elseif a:filetype == "sql" + elseif a:filetype == "sql" call s:MapDelimiters('--', '') - elseif a:filetype == "sqlforms" + elseif a:filetype == "sqlforms" call s:MapDelimiters('--', '') - elseif a:filetype == "sqlj" + elseif a:filetype == "sqlj" call s:MapDelimiters('--', '') - elseif a:filetype == "sqr" + elseif a:filetype == "sqr" call s:MapDelimiters('!', '') - elseif a:filetype == "squid" + elseif a:filetype == "squid" call s:MapDelimiters('#', '') - elseif a:filetype == "st" + elseif a:filetype == "st" call s:MapDelimiters('"','') - elseif a:filetype == "stp" + elseif a:filetype == "stp" call s:MapDelimiters('--', '') - elseif a:filetype == "strace" + elseif a:filetype == "strace" call s:MapDelimiters('/*','*/') elseif a:filetype == "sudoers" call s:MapDelimiters('#', '') - elseif a:filetype == "SVKAnnotate" + elseif a:filetype == "SVKAnnotate" call s:MapDelimiters('','') - elseif a:filetype == "svn" + elseif a:filetype == "svn" call s:MapDelimiters('','') - elseif a:filetype == "SVNAnnotate" + elseif a:filetype == "SVNAnnotate" call s:MapDelimiters('','') - elseif a:filetype == "SVNcommitlog" + elseif a:filetype == "SVNcommitlog" call s:MapDelimiters('','') elseif a:filetype == "SVNdiff" call s:MapDelimiters('','') - elseif a:filetype == "systemverilog" + elseif a:filetype == "systemverilog" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "tads" + elseif a:filetype == "tads" call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "taglist" + elseif a:filetype == "taglist" call s:MapDelimiters('', '') - elseif a:filetype == "tags" + elseif a:filetype == "tags" call s:MapDelimiters(';', '') - elseif a:filetype == "tak" + elseif a:filetype == "tak" call s:MapDelimiters('$', '') elseif a:filetype == "tar" call s:MapDelimiters('', '') - elseif a:filetype == "tasm" + elseif a:filetype == "tasm" call s:MapDelimiters(';', '') - elseif a:filetype == "tcl" - call s:MapDelimiters('#','') - elseif a:filetype == "terminfo" + elseif a:filetype == "tcl" + call s:MapDelimiters('#','') + elseif a:filetype == "terminfo" call s:MapDelimiters('#', '') - elseif a:filetype == "tex" - call s:MapDelimiters('%','') - elseif a:filetype == "text" - call s:MapDelimiters('','') - elseif a:filetype == "texinfo" - call s:MapDelimiters("@c ", "") - elseif a:filetype == "texmf" - call s:MapDelimiters('%', '') - elseif a:filetype == "tf" - call s:MapDelimiters(';', '') - elseif a:filetype == "tidy" - call s:MapDelimiters('#', '') - elseif a:filetype == "tli" - call s:MapDelimiters('#', '') - elseif a:filetype == "trasys" - call s:MapDelimiters("$", "") - elseif a:filetype == "tsalt" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "tsscl" - call s:MapDelimiters('#', '') - elseif a:filetype == "tssgm" - call s:MapDelimiters("comment = '","'") - elseif a:filetype == "uc" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "uil" - call s:MapDelimiters('!', '') - elseif a:filetype == "vb" - call s:MapDelimiters("'","") - elseif a:filetype == "vcscommit" + elseif a:filetype == "tex" + call s:MapDelimiters('%','') + elseif a:filetype == "text" call s:MapDelimiters('','') - elseif a:filetype == "velocity" - call s:MapDelimitersWithAlternative("##","", '#*', '*#') - elseif a:filetype == "vera" - call s:MapDelimitersWithAlternative('/*','*/','//','') - elseif a:filetype == "verilog" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "verilog_systemverilog" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "vgrindefs" + elseif a:filetype == "texinfo" + call s:MapDelimiters("@c ", "") + elseif a:filetype == "texmf" + call s:MapDelimiters('%', '') + elseif a:filetype == "tf" + call s:MapDelimiters(';', '') + elseif a:filetype == "tidy" call s:MapDelimiters('#', '') - elseif a:filetype == "vhdl" + elseif a:filetype == "tli" + call s:MapDelimiters('#', '') + elseif a:filetype == "trasys" + call s:MapDelimiters("$", "") + elseif a:filetype == "tsalt" + call s:MapDelimitersWithAlternative('//','', '/*','*/') + elseif a:filetype == "tsscl" + call s:MapDelimiters('#', '') + elseif a:filetype == "tssgm" + call s:MapDelimiters("comment = '","'") + elseif a:filetype == "uc" + call s:MapDelimitersWithAlternative('//','', '/*','*/') + elseif a:filetype == "uil" + call s:MapDelimiters('!', '') + elseif a:filetype == "vb" + call s:MapDelimiters("'","") + elseif a:filetype == "vcscommit" + call s:MapDelimiters('','') + elseif a:filetype == "velocity" + call s:MapDelimitersWithAlternative("##","", '#*', '*#') + elseif a:filetype == "vera" + call s:MapDelimitersWithAlternative('/*','*/','//','') + elseif a:filetype == "verilog" + call s:MapDelimitersWithAlternative('//','', '/*','*/') + elseif a:filetype == "verilog_systemverilog" + call s:MapDelimitersWithAlternative('//','', '/*','*/') + elseif a:filetype == "vgrindefs" + call s:MapDelimiters('#', '') + elseif a:filetype == "vhdl" call s:MapDelimiters('--', '') - elseif a:filetype == "vim" - call s:MapDelimiters('"','') - elseif a:filetype == "viminfo" - call s:MapDelimiters('','') + elseif a:filetype == "vim" + call s:MapDelimiters('"','') + elseif a:filetype == "viminfo" + call s:MapDelimiters('','') elseif a:filetype == "vimperator" call s:MapDelimiters('"','') - elseif a:filetype == "virata" + elseif a:filetype == "virata" call s:MapDelimiters('%', '') - elseif a:filetype == "vo_base" + elseif a:filetype == "vo_base" call s:MapDelimiters('', '') - elseif a:filetype == "vrml" + elseif a:filetype == "vrml" call s:MapDelimiters('#', '') - elseif a:filetype == "vsejcl" + elseif a:filetype == "vsejcl" call s:MapDelimiters('/*', '') - elseif a:filetype == "webmacro" + elseif a:filetype == "webmacro" call s:MapDelimiters('##', '') - elseif a:filetype == "wget" + elseif a:filetype == "wget" call s:MapDelimiters('#', '') - elseif a:filetype ==? "Wikipedia" - call s:MapDelimiters('') - elseif a:filetype == "winbatch" + elseif a:filetype ==? "Wikipedia" + call s:MapDelimiters('') + elseif a:filetype == "winbatch" call s:MapDelimiters(';', '') - elseif a:filetype == "wml" + elseif a:filetype == "wml" call s:MapDelimiters('#', '') - elseif a:filetype =~ "[^w]*sh" + elseif a:filetype =~ "[^w]*sh" call s:MapDelimiters('#', '') - elseif a:filetype == "wvdial" + elseif a:filetype == "wvdial" call s:MapDelimiters(';', '') - elseif a:filetype == "xdefaults" + elseif a:filetype == "xdefaults" call s:MapDelimiters('!', '') - elseif a:filetype == "xf86conf" + elseif a:filetype == "xf86conf" call s:MapDelimiters('#', '') - elseif a:filetype == "xhtml" + elseif a:filetype == "xhtml" call s:MapDelimiters('') - elseif a:filetype == "xkb" + elseif a:filetype == "xkb" call s:MapDelimiters('//', '') - elseif a:filetype == "xmath" + elseif a:filetype == "xmath" call s:MapDelimiters('#', '') - elseif a:filetype == "xml" - call s:MapDelimiters('') - elseif a:filetype == "xmodmap" + elseif a:filetype == "xml" + call s:MapDelimiters('') + elseif a:filetype == "xmodmap" call s:MapDelimiters('!', '') - elseif a:filetype == "xpm2" + elseif a:filetype == "xpm2" call s:MapDelimiters('!', '') - elseif a:filetype == "xpm" + elseif a:filetype == "xpm" call s:MapDelimiters('/*','*/') - elseif a:filetype == "xsd" - call s:MapDelimiters('') - elseif a:filetype == "xslt" - call s:MapDelimiters('') - elseif a:filetype == "yacc" + elseif a:filetype == "xsd" + call s:MapDelimiters('') + elseif a:filetype == "xslt" + call s:MapDelimiters('') + elseif a:filetype == "yacc" call s:MapDelimiters('/*','*/') - elseif a:filetype == "yaml" + elseif a:filetype == "yaml" call s:MapDelimiters('#','') - elseif a:filetype == "z8a" + elseif a:filetype == "z8a" call s:MapDelimiters(';', '') elseif a:filetype == "" - call s:MapDelimitersWithAlternative("","", "", "") + call s:MapDelimitersWithAlternative("","", "", "") "we have not hardcoded the comment delimiters to use for this filetype so "get them from &commentstring. else - "print a disclaimer to the user :) + "print a disclaimer to the user :) if !g:NERDShutUp call s:NerdEcho("Unknown filetype '".a:filetype."', setting delimiters by &commentstring.\nPleeeeease email the author of the NERD commenter with this filetype\nand its delimiters!", 0) endif - "extract the delims from &commentstring + "extract the delims from &commentstring let left= substitute(&commentstring, '\(.*\)%s.*', '\1', '') let right= substitute(&commentstring, '.*%s\(.*\)', '\1', 'g') @@ -941,30 +941,30 @@ endfunction " " Args: " -printMsgs: if this is 1 then a message is echoed to the user telling them -" if this function changed the delimiters or not +" if this function changed the delimiters or not function s:SwitchToAlternativeDelimiters(printMsgs) "if both of the alternative delimiters are empty then there is no - "alternative comment style so bail out + "alternative comment style so bail out if b:leftAlt == "" && b:rightAlt == "" - if a:printMsgs + if a:printMsgs call s:NerdEcho("Cannot use alternative delimiters, none are specified", 0) endif return 0 endif - "save the current delimiters + "save the current delimiters let tempLeft = b:left let tempRight = b:right - "swap current delimiters for alternative + "swap current delimiters for alternative let b:left = b:leftAlt let b:right = b:rightAlt - "set the previously current delimiters to be the new alternative ones + "set the previously current delimiters to be the new alternative ones let b:leftAlt = tempLeft let b:rightAlt = tempRight - "tell the user what comment delimiters they are now using + "tell the user what comment delimiters they are now using if a:printMsgs let leftNoEsc = b:left let rightNoEsc = b:right @@ -984,19 +984,19 @@ function s:AppendCommentToLine() let right = s:GetRight(0,1,0) " get the len of the right delim - let lenRight = strlen(right) + let lenRight = strlen(right) let isLineEmpty = strlen(getline(".")) == 0 let insOrApp = (isLineEmpty==1 ? 'i' : 'A') "stick the delimiters down at the end of the line. We have to format the - "comment with spaces as appropriate + "comment with spaces as appropriate execute ":normal " . insOrApp . (isLineEmpty ? '' : ' ') . left . right . " " " if there is a right delimiter then we gotta move the cursor left " by the len of the right delimiter so we insert between the delimiters - if lenRight > 0 - let leftMoveAmount = lenRight + if lenRight > 0 + let leftMoveAmount = lenRight execute ":normal " . leftMoveAmount . "h" endif startinsert @@ -1011,8 +1011,8 @@ endfunction " -bottom: the line number for the bottom line of code in the region " -lSide: the column number for the left most column in the region " -rSide: the column number for the right most column in the region -" -forceNested: a flag indicating whether comments should be nested -function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) +" -forceNested: a flag indicating whether comments should be nested +function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) " we need to create local copies of these arguments so we can modify them let top = a:top let bottom = a:bottom @@ -1020,13 +1020,13 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) let rSide = a:rSide "if the top or bottom line starts with tabs we have to adjust the left and - "right boundaries so that they are set as though the tabs were spaces + "right boundaries so that they are set as though the tabs were spaces let topline = getline(top) let bottomline = getline(bottom) if s:HasLeadingTabs(topline, bottomline) "find out how many tabs are in the top line and adjust the left - "boundary accordingly + "boundary accordingly let numTabs = s:NumberOfLeadingTabs(topline) if lSide < numTabs let lSide = &ts * lSide @@ -1035,13 +1035,13 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) endif "find out how many tabs are in the bottom line and adjust the right - "boundary accordingly + "boundary accordingly let numTabs = s:NumberOfLeadingTabs(bottomline) let rSide = (rSide - numTabs) + (&ts * numTabs) endif "we must check that bottom IS actually below top, if it is not then we - "swap top and bottom. Similarly for left and right. + "swap top and bottom. Similarly for left and right. if bottom < top let temp = top let top = bottom @@ -1055,7 +1055,7 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) "if the current delimiters arent multipart then we will switch to the "alternative delims (if THEY are) as the comment will be better and more - "accurate with multipart delims + "accurate with multipart delims let switchedDelims = 0 if !s:Multipart() && g:NERDAllowAnyVisualDelims && s:AltMultipart() let switchedDelims = 1 @@ -1067,10 +1067,10 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) let currentLine=top while currentLine <= bottom - "check if we are allowed to comment this line + "check if we are allowed to comment this line if s:CanCommentLine(a:forceNested, currentLine) - "convert the leading tabs into spaces + "convert the leading tabs into spaces let theLine = getline(currentLine) let lineHasLeadTabs = s:HasLeadingTabs(theLine) if lineHasLeadTabs @@ -1083,18 +1083,18 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) "attempt to place the cursor in on the left of the boundary box, "then check if we were successful, if not then we cant comment this - "line + "line call setline(currentLine, theLine) if s:CanPlaceCursor(currentLine, lSide) let leftSpaced = s:GetLeft(0,1,0) let rightSpaced = s:GetRight(0,1,0) - "stick the left delimiter down + "stick the left delimiter down let theLine = strpart(theLine, 0, lSide-1) . leftSpaced . strpart(theLine, lSide-1) if s:Multipart() - "stick the right delimiter down + "stick the right delimiter down let theLine = strpart(theLine, 0, rSide+strlen(leftSpaced)) . rightSpaced . strpart(theLine, rSide+strlen(leftSpaced)) let firstLeftDelim = s:FindDelimiterIndex(b:left, theLine) @@ -1105,10 +1105,10 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) let searchStr = strpart(searchStr, firstLeftDelim+strlen(b:left)) "replace the outter most delims in searchStr with - "place-holders + "place-holders let theLineWithPlaceHolders = s:ReplaceDelims(b:left, b:right, g:NERDLPlace, g:NERDRPlace, searchStr) - "add the right delimiter onto the line + "add the right delimiter onto the line let theLine = strpart(theLine, 0, firstLeftDelim+strlen(b:left)) . theLineWithPlaceHolders . strpart(theLine, lastRightDelim) endif endif @@ -1126,7 +1126,7 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) let currentLine = currentLine + 1 endwhile - "if we switched delims then we gotta go back to what they were before + "if we switched delims then we gotta go back to what they were before if switchedDelims == 1 call s:SwitchToAlternativeDelimiters(0) endif @@ -1141,7 +1141,7 @@ endfunction " -alignRight/alignLeft: 0/1 if the comments delimiters should/shouldnt be " aligned left/right " -firstLine/lastLine: the top and bottom lines to comment -function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) +function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) " we need to get the left and right indexes of the leftmost char in the " block of of lines and the right most char so that we can do alignment of " the delimiters if the user has specified @@ -1152,15 +1152,15 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) " we'll be adding a left delim to the line let rightAlignIndx = rightAlignIndx + strlen(s:GetLeft(0,1,0)) - " now we actually comment the lines. Do it line by line + " now we actually comment the lines. Do it line by line let currentLine = a:firstLine while currentLine <= a:lastLine - " get the next line, check commentability and convert spaces to tabs + " get the next line, check commentability and convert spaces to tabs let theLine = getline(currentLine) let lineHasLeadingTabs = s:HasLeadingTabs(theLine) let theLine = s:ConvertLeadingTabsToSpaces(theLine) - if s:CanCommentLine(a:forceNested, currentLine) + if s:CanCommentLine(a:forceNested, currentLine) "if the user has specified forceNesting then we check to see if we "need to switch delimiters for place-holders if a:forceNested && g:NERDUsePlaceHolders @@ -1168,10 +1168,10 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) endif " find out if the line is commented using normal delims and/or - " alternate ones + " alternate ones let isCommented = s:IsCommented(b:left, b:right, theLine) || s:IsCommented(b:leftAlt, b:rightAlt, theLine) - " check if we can comment this line + " check if we can comment this line if !isCommented || g:NERDUsePlaceHolders || s:Multipart() if a:alignLeft let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx) @@ -1186,12 +1186,12 @@ function s:CommentLines(forceNested, alignLeft, alignRight, firstLine, lastLine) endif endif - " restore leading tabs if appropriate + " restore leading tabs if appropriate if lineHasLeadingTabs let theLine = s:ConvertLeadingSpacesToTabs(theLine) endif - " we are done with this line + " we are done with this line call setline(currentLine, theLine) let currentLine = currentLine + 1 endwhile @@ -1203,24 +1203,24 @@ endfunction " " Args: " -firstLine/lastLine: the top and bottom lines to comment -function s:CommentLinesMinimal(firstLine, lastLine) - "check that minimal comments can be done on this filetype +function s:CommentLinesMinimal(firstLine, lastLine) + "check that minimal comments can be done on this filetype if !s:HasMultipartDelims() throw 'NERDCommenter.Delimiters exception: Minimal comments can only be used for filetypes that have multipart delimiters' endif "if we need to use place holders for the comment, make sure they are - "enabled for this filetype + "enabled for this filetype if !g:NERDUsePlaceHolders && s:DoesBlockHaveMultipartDelim(a:firstLine, a:lastLine) throw 'NERDCommenter.Settings exception: Placeoholders are required but disabled.' endif - "get the left and right delims to smack on + "get the left and right delims to smack on let left = s:GetSexyComLeft(g:NERDSpaceDelims,0) let right = s:GetSexyComRight(g:NERDSpaceDelims,0) "make sure all multipart delims on the lines are replaced with - "placeholders to prevent illegal syntax + "placeholders to prevent illegal syntax let currentLine = a:firstLine while(currentLine <= a:lastLine) let theLine = getline(currentLine) @@ -1229,7 +1229,7 @@ function s:CommentLinesMinimal(firstLine, lastLine) let currentLine = currentLine + 1 endwhile - "add the delim to the top line + "add the delim to the top line let theLine = getline(a:firstLine) let lineHasLeadingTabs = s:HasLeadingTabs(theLine) let theLine = s:ConvertLeadingTabsToSpaces(theLine) @@ -1239,7 +1239,7 @@ function s:CommentLinesMinimal(firstLine, lastLine) endif call setline(a:firstLine, theLine) - "add the delim to the bottom line + "add the delim to the bottom line let theLine = getline(a:lastLine) let lineHasLeadingTabs = s:HasLeadingTabs(theLine) let theLine = s:ConvertLeadingTabsToSpaces(theLine) @@ -1262,7 +1262,7 @@ function s:CommentLinesSexy(topline, bottomline) let left = s:GetSexyComLeft(0, 0) let right = s:GetSexyComRight(0, 0) - "check if we can do a sexy comment with the available delimiters + "check if we can do a sexy comment with the available delimiters if left == -1 || right == -1 throw 'NERDCommenter.Delimiters exception: cannot perform sexy comments with available delimiters.' endif @@ -1277,7 +1277,7 @@ function s:CommentLinesSexy(topline, bottomline) let sexyComMarkerSpaced = s:GetSexyComMarker(1,0) - " we jam the comment as far to the right as possible + " we jam the comment as far to the right as possible let leftAlignIndx = s:LeftMostIndx(1, 1, a:topline, a:bottomline) "check if we should use the compact style i.e that the left/right @@ -1286,7 +1286,7 @@ function s:CommentLinesSexy(topline, bottomline) if g:NERDCompactSexyComs let spaceString = (g:NERDSpaceDelims ? s:spaceStr : '') - "comment the top line + "comment the top line let theLine = getline(a:topline) let lineHasTabs = s:HasLeadingTabs(theLine) if lineHasTabs @@ -1299,7 +1299,7 @@ function s:CommentLinesSexy(topline, bottomline) endif call setline(a:topline, theLine) - "comment the bottom line + "comment the bottom line if a:bottomline != a:topline let theLine = getline(a:bottomline) let lineHasTabs = s:HasLeadingTabs(theLine) @@ -1315,14 +1315,14 @@ function s:CommentLinesSexy(topline, bottomline) call setline(a:bottomline, theLine) else - " add the left delimiter one line above the lines that are to be commented - call cursor(a:topline, 1) + " add the left delimiter one line above the lines that are to be commented + call cursor(a:topline, 1) execute 'normal! O' call setline(a:topline, strpart(s:spaces, 0, leftAlignIndx) . left ) " add the right delimiter after bottom line (we have to add 1 cos we moved " the lines down when we added the left delim - call cursor(a:bottomline+1, 1) + call cursor(a:bottomline+1, 1) execute 'normal! o' call setline(a:bottomline+2, strpart(s:spaces, 0, leftAlignIndx) . strpart(s:spaces, 0, strlen(left)-strlen(sexyComMarker)) . right ) @@ -1332,7 +1332,7 @@ function s:CommentLinesSexy(topline, bottomline) " line in the appropriate place to align them with the comment delims let currentLine = a:topline+1 while currentLine <= a:bottomline + !g:NERDCompactSexyComs - " get the line and convert the tabs to spaces + " get the line and convert the tabs to spaces let theLine = getline(currentLine) let lineHasTabs = s:HasLeadingTabs(theLine) if lineHasTabs @@ -1341,7 +1341,7 @@ function s:CommentLinesSexy(topline, bottomline) let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine) - " add the sexyComMarker + " add the sexyComMarker let theLine = strpart(s:spaces, 0, leftAlignIndx) . strpart(s:spaces, 0, strlen(left)-strlen(sexyComMarker)) . sexyComMarkerSpaced . strpart(theLine, leftAlignIndx) if lineHasTabs @@ -1349,7 +1349,7 @@ function s:CommentLinesSexy(topline, bottomline) endif - " set the line and move onto the next one + " set the line and move onto the next one call setline(currentLine, theLine) let currentLine = currentLine + 1 endwhile @@ -1363,15 +1363,15 @@ endfunction " -forceNested: a flag indicating whether the called is requesting the comment " to be nested if need be " -firstLine/lastLine: the top and bottom lines to comment -function s:CommentLinesToggle(forceNested, firstLine, lastLine) +function s:CommentLinesToggle(forceNested, firstLine, lastLine) let currentLine = a:firstLine while currentLine <= a:lastLine - " get the next line, check commentability and convert spaces to tabs + " get the next line, check commentability and convert spaces to tabs let theLine = getline(currentLine) let lineHasLeadingTabs = s:HasLeadingTabs(theLine) let theLine = s:ConvertLeadingTabsToSpaces(theLine) - if s:CanToggleCommentLine(a:forceNested, currentLine) + if s:CanToggleCommentLine(a:forceNested, currentLine) "if the user has specified forceNesting then we check to see if we "need to switch delimiters for place-holders @@ -1383,12 +1383,12 @@ function s:CommentLinesToggle(forceNested, firstLine, lastLine) let theLine = s:AddRightDelim(s:GetRight(0, 1, 0), theLine) endif - " restore leading tabs if appropriate + " restore leading tabs if appropriate if lineHasLeadingTabs let theLine = s:ConvertLeadingSpacesToTabs(theLine) endif - " we are done with this line + " we are done with this line call setline(currentLine, theLine) let currentLine = currentLine + 1 endwhile @@ -1405,7 +1405,7 @@ endfunction " -bottomCol: the bottom right col for this comment " -forceNested: whether the caller wants comments to be nested if the " line(s) are already commented -function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested) +function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested) "switch delims (if we can) if the current set isnt multipart let switchedDelims = 0 @@ -1414,23 +1414,23 @@ function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested) call s:SwitchToAlternativeDelimiters(0) endif - "if there is only one line in the comment then just do it + "if there is only one line in the comment then just do it if a:topLine == a:bottomLine call s:CommentBlock(a:topLine, a:bottomLine, a:topCol, a:bottomCol, a:forceNested) - "there are multiple lines in the comment + "there are multiple lines in the comment else "comment the top line call s:CommentBlock(a:topLine, a:topLine, a:topCol, strlen(getline(a:topLine)), a:forceNested) - "comment out all the lines in the middle of the comment + "comment out all the lines in the middle of the comment let topOfRange = a:topLine+1 let bottomOfRange = a:bottomLine-1 if topOfRange <= bottomOfRange call s:CommentLines(a:forceNested, 0, 0, topOfRange, bottomOfRange) endif - "comment the bottom line + "comment the bottom line let bottom = getline(a:bottomLine) let numLeadingSpacesTabs = strlen(substitute(bottom, '^\([ \t]*\).*$', '\1', '')) call s:CommentBlock(a:bottomLine, a:bottomLine, numLeadingSpacesTabs+1, a:bottomCol, a:forceNested) @@ -1440,7 +1440,7 @@ function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested) "stick the cursor back on the char it was on before the comment call cursor(a:topLine, a:topCol + strlen(b:left) + g:NERDSpaceDelims) - "if we switched delims then we gotta go back to what they were before + "if we switched delims then we gotta go back to what they were before if switchedDelims == 1 call s:SwitchToAlternativeDelimiters(0) endif @@ -1453,21 +1453,21 @@ endfunction " Args: " -firstLine: the top of the range of lines to be inverted " -lastLine: the bottom of the range of lines to be inverted -function s:InvertComment(firstLine, lastLine) +function s:InvertComment(firstLine, lastLine) - " go thru all lines in the given range + " go thru all lines in the given range let currentLine = a:firstLine while currentLine <= a:lastLine let theLine = getline(currentLine) - let sexyComBounds = s:FindBoundingLinesOfSexyCom(currentLine) + let sexyComBounds = s:FindBoundingLinesOfSexyCom(currentLine) - " if the line is commented normally, uncomment it + " if the line is commented normally, uncomment it if s:IsCommentedFromStartOfLine(b:left, theLine) || s:IsCommentedFromStartOfLine(b:leftAlt, theLine) call s:UncommentLines(currentLine, currentLine) let currentLine = currentLine + 1 - " check if the line is commented sexually + " check if the line is commented sexually elseif !empty(sexyComBounds) let numLinesBeforeSexyComRemoved = s:NumLinesInBuf() call s:UncommentLinesSexy(sexyComBounds[0], sexyComBounds[1]) @@ -1476,7 +1476,7 @@ function s:InvertComment(firstLine, lastLine) let numLinesAfterSexyComRemoved = s:NumLinesInBuf() let currentLine = bottomBound - (numLinesBeforeSexyComRemoved - numLinesAfterSexyComRemoved) + 1 - " the line isnt commented + " the line isnt commented else call s:CommentLinesToggle(1, currentLine, currentLine) let currentLine = currentLine + 1 @@ -1495,7 +1495,7 @@ endfunction " 'minimal', 'toggle', 'alignLeft', 'alignRight', 'alignBoth', 'norm', " 'nested', 'toEOL', 'prepend', 'append', 'insert', 'uncomment', 'yank' function! NERDComment(isVisual, type) range - " we want case sensitivity when commenting + " we want case sensitivity when commenting let oldIgnoreCase = &ignorecase set noignorecase @@ -1575,7 +1575,7 @@ function! NERDComment(isVisual, type) range call s:UncommentLines(firstLine, lastLine) elseif a:type == 'yank' - if a:isVisual + if a:isVisual normal gvy elseif countWasGiven execute firstLine .','. lastLine .'yank' @@ -1592,7 +1592,7 @@ endfunction " This is function is called to place comment delimiters down and place the " cursor between them function s:PlaceDelimitersAndInsBetween() - " get the left and right delimiters without any escape chars in them + " get the left and right delimiters without any escape chars in them let left = s:GetLeft(0, 1, 0) let right = s:GetRight(0, 1, 0) @@ -1606,21 +1606,21 @@ function s:PlaceDelimitersAndInsBetween() call cursor(line("."), untabbedCol) " get the len of the right delim - let lenRight = strlen(right) + let lenRight = strlen(right) let isDelimOnEOL = col(".") >= strlen(getline(".")) " if the cursor is in the first col then we gotta insert rather than - " append the comment delimiters here + " append the comment delimiters here let insOrApp = (col(".")==1 ? 'i' : 'a') " place the delimiters down. We do it differently depending on whether - " there is a left AND right delimiter - if lenRight > 0 - execute ":normal " . insOrApp . left . right + " there is a left AND right delimiter + if lenRight > 0 + execute ":normal " . insOrApp . left . right execute ":normal " . lenRight . "h" else - execute ":normal " . insOrApp . left + execute ":normal " . insOrApp . left " if we are tacking the delim on the EOL then we gotta add a space " after it cos when we go out of insert mode the cursor will move back @@ -1632,7 +1632,7 @@ function s:PlaceDelimitersAndInsBetween() normal l "if needed convert spaces back to tabs and adjust the cursors col - "accordingly + "accordingly if lineHasLeadTabs let tabbedCol = s:TabbedCol(getline("."), col(".")) call setline(line("."), s:ConvertLeadingSpacesToTabs(getline("."))) @@ -1646,28 +1646,28 @@ endfunction " This function prepends comment delimiters to the start of line and places " the cursor in position to start typing the comment function s:PrependCommentToLine() - " get the left and right delimiters without any escape chars in them + " get the left and right delimiters without any escape chars in them let left = s:GetLeft(0, 1, 0) let right = s:GetRight(0, 1, 0) " get the len of the right delim - let lenRight = strlen(right) + let lenRight = strlen(right) "if the line is empty then we need to know about this later on let isLineEmpty = strlen(getline(".")) == 0 "stick the delimiters down at the start of the line. We have to format the - "comment with spaces as appropriate + "comment with spaces as appropriate if lenRight > 0 - execute ":normal I" . left . right + execute ":normal I" . left . right else - execute ":normal I" . left + execute ":normal I" . left endif " if there is a right delimiter then we gotta move the cursor left " by the len of the right delimiter so we insert between the delimiters - if lenRight > 0 + if lenRight > 0 let leftMoveAmount = lenRight execute ":normal " . leftMoveAmount . "h" endif @@ -1684,7 +1684,7 @@ function s:PrependCommentToLine() endfunction " Function: s:RemoveDelimiters(left, right, line) {{{2 " this function is called to remove the first left comment delimiter and the -" last right delimiter of the given line. +" last right delimiter of the given line. " " The args left and right must be strings. If there is no right delimiter (as " is the case for e.g vim file comments) them the arg right should be "" @@ -1704,7 +1704,7 @@ function s:RemoveDelimiters(left, right, line) let line = a:line - "look for the left delimiter, if we find it, remove it. + "look for the left delimiter, if we find it, remove it. let leftIndx = s:FindDelimiterIndex(a:left, line) if leftIndx != -1 let line = strpart(line, 0, leftIndx) . strpart(line, leftIndx+lenLeft) @@ -1716,7 +1716,7 @@ function s:RemoveDelimiters(left, right, line) endif endif - "look for the right delimiter, if we find it, remove it + "look for the right delimiter, if we find it, remove it let rightIndx = s:FindDelimiterIndex(a:right, line) if rightIndx != -1 let line = strpart(line, 0, rightIndx) . strpart(line, rightIndx+lenRight) @@ -1737,7 +1737,7 @@ endfunction " Args: " topLine: the top line of the visual selection to uncomment " bottomLine: the bottom line of the visual selection to uncomment -function s:UncommentLines(topLine, bottomLine) +function s:UncommentLines(topLine, bottomLine) "make local copies of a:firstline and a:lastline and, if need be, swap "them around if the top line is below the bottom let l:firstline = a:topLine @@ -1751,7 +1751,7 @@ function s:UncommentLines(topLine, bottomLine) let currentLine = firstline while currentLine <= lastline - "check the current line to see if it is part of a sexy comment + "check the current line to see if it is part of a sexy comment let sexyComBounds = s:FindBoundingLinesOfSexyCom(currentLine) if !empty(sexyComBounds) @@ -1768,7 +1768,7 @@ function s:UncommentLines(topLine, bottomLine) let currentLine = sexyComBounds[1] - numLinesRemoved + 1 let lastline = lastline - numLinesRemoved - "no sexy com was detected so uncomment the line as normal + "no sexy com was detected so uncomment the line as normal else call s:UncommentLinesNormal(currentLine, currentLine) let currentLine = currentLine + 1 @@ -1788,7 +1788,7 @@ function s:UncommentLinesSexy(topline, bottomline) "check if it is even possible for sexy comments to exist with the - "available delimiters + "available delimiters if left == -1 || right == -1 throw 'NERDCommenter.Delimiters exception: cannot uncomment sexy comments with available delimiters.' endif @@ -1805,7 +1805,7 @@ function s:UncommentLinesSexy(topline, bottomline) " go thru the intermediate lines of the sexy comment and remove the " sexy comment markers (eg the '*'s on the start of line in a c sexy - " comment) + " comment) let currentLine = a:topline+1 while currentLine < a:bottomline let theLine = getline(currentLine) @@ -1823,25 +1823,25 @@ function s:UncommentLinesSexy(topline, bottomline) let theLine = s:ConvertLeadingWhiteSpace(theLine) - " move onto the next line + " move onto the next line call setline(currentLine, theLine) let currentLine = currentLine + 1 endwhile " gotta make a copy of a:bottomline cos we modify the position of the - " last line it if we remove the topline + " last line it if we remove the topline let bottomline = a:bottomline - " get the first line so we can remove the left delim from it + " get the first line so we can remove the left delim from it let theLine = getline(a:topline) - " if the first line contains only the left delim then just delete it + " if the first line contains only the left delim then just delete it if theLine =~ '^[ \t]*' . left . '[ \t]*$' && !g:NERDCompactSexyComs call cursor(a:topline, 1) normal dd let bottomline = bottomline - 1 - " topline contains more than just the left delim + " topline contains more than just the left delim else " remove the delim. If there is a space after it @@ -1859,12 +1859,12 @@ function s:UncommentLinesSexy(topline, bottomline) " get the last line so we can remove the right delim let theLine = getline(bottomline) - " if the bottomline contains only the right delim then just delete it + " if the bottomline contains only the right delim then just delete it if theLine =~ '^[ \t]*' . right . '[ \t]*$' call cursor(bottomline, 1) normal dd - " the last line contains more than the right delim + " the last line contains more than the right delim else " remove the right delim. If there is a space after it and " if the appropriate options are set then remove this too. @@ -1901,11 +1901,11 @@ endfunction function s:UncommentLineNormal(line) let line = a:line - "get the comment status on the line so we know how it is commented - let lineCommentStatus = s:IsCommentedOuttermost(b:left, b:right, b:leftAlt, b:rightAlt, line) + "get the comment status on the line so we know how it is commented + let lineCommentStatus = s:IsCommentedOuttermost(b:left, b:right, b:leftAlt, b:rightAlt, line) "it is commented with b:left and b:right so remove these delims - if lineCommentStatus == 1 + if lineCommentStatus == 1 let line = s:RemoveDelimiters(b:left, b:right, line) "it is commented with b:leftAlt and b:rightAlt so remove these delims @@ -1913,22 +1913,22 @@ function s:UncommentLineNormal(line) let line = s:RemoveDelimiters(b:leftAlt, b:rightAlt, line) "it is not properly commented with any delims so we check if it has - "any random left or right delims on it and remove the outtermost ones + "any random left or right delims on it and remove the outtermost ones else - "get the positions of all delim types on the line + "get the positions of all delim types on the line let indxLeft = s:FindDelimiterIndex(b:left, line) let indxLeftAlt = s:FindDelimiterIndex(b:leftAlt, line) let indxRight = s:FindDelimiterIndex(b:right, line) let indxRightAlt = s:FindDelimiterIndex(b:rightAlt, line) - "remove the outter most left comment delim + "remove the outter most left comment delim if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1) let line = s:RemoveDelimiters(b:left, '', line) elseif indxLeftAlt != -1 let line = s:RemoveDelimiters(b:leftAlt, '', line) endif - "remove the outter most right comment delim + "remove the outter most right comment delim if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1) let line = s:RemoveDelimiters('', b:right, line) elseif indxRightAlt != -1 @@ -1956,7 +1956,7 @@ function s:UncommentLineNormal(line) "if there are place-holders on the line then we check to see if they are "the outtermost delimiters on the line. If so then we replace them with "real delimiters - if indxLeftPlace != -1 + if indxLeftPlace != -1 if (indxLeftPlace < indxLeft || indxLeft==-1) && (indxLeftPlace < indxLeftAlt || indxLeftAlt==-1) let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, line) endif @@ -2000,7 +2000,7 @@ endfunction function s:AddLeftDelimAligned(delim, theLine, alignIndx) "if the line is not long enough then bung some extra spaces on the front - "so we can align the delim properly + "so we can align the delim properly let theLine = a:theLine if strlen(theLine) < a:alignIndx let theLine = strpart(s:spaces, 0, a:alignIndx - strlen(theLine)) @@ -2032,7 +2032,7 @@ function s:AddRightDelimAligned(delim, theLine, alignIndx) let extraSpaces = '' let extraSpaces = strpart(s:spaces, 0, a:alignIndx-strlen(a:theLine)) - " add the right delim + " add the right delim return substitute(a:theLine, '$', extraSpaces . a:delim, '') endif endfunction @@ -2055,11 +2055,11 @@ function s:CanCommentLine(forceNested, lineNum) let theLine = getline(a:lineNum) " make sure we don't comment lines that are just spaces or tabs or empty. - if theLine =~ "^[ \t]*$" + if theLine =~ "^[ \t]*$" return 0 endif - "if the line is part of a sexy comment then just flag it... + "if the line is part of a sexy comment then just flag it... if s:IsInSexyComment(a:lineNum) return 0 endif @@ -2067,7 +2067,7 @@ function s:CanCommentLine(forceNested, lineNum) let isCommented = s:IsCommentedNormOrSexy(a:lineNum) "if the line isnt commented return true - if !isCommented + if !isCommented return 1 endif @@ -2093,7 +2093,7 @@ endfunction " Function: s:CanSexyCommentLines(topline, bottomline) {{{2 " Return: 1 if the given lines can be commented sexually, 0 otherwise function s:CanSexyCommentLines(topline, bottomline) - " see if the selected regions have any sexy comments + " see if the selected regions have any sexy comments let currentLine = a:topline while(currentLine <= a:bottomline) if s:IsInSexyComment(currentLine) @@ -2116,11 +2116,11 @@ function s:CanToggleCommentLine(forceNested, lineNum) endif " make sure we don't comment lines that are just spaces or tabs or empty. - if theLine =~ "^[ \t]*$" + if theLine =~ "^[ \t]*$" return 0 endif - "if the line is part of a sexy comment then just flag it... + "if the line is part of a sexy comment then just flag it... if s:IsInSexyComment(a:lineNum) return 0 endif @@ -2191,13 +2191,13 @@ function s:CountNonESCedOccurances(str, searchstr, escChar) let indx = stridx(a:str, a:searchstr) "if there is an instance of searchstr in str process it - if indx != -1 + if indx != -1 "get the remainder of str after this instance of searchstr is removed let lensearchstr = strlen(a:searchstr) let strLeft = strpart(a:str, indx+lensearchstr) "if this instance of searchstr is not escaped, add one to the count - "and recurse. If it is escaped, just recurse + "and recurse. If it is escaped, just recurse if !s:IsEscaped(a:str, indx, a:escChar) return 1 + s:CountNonESCedOccurances(strLeft, a:searchstr, a:escChar) else @@ -2265,16 +2265,16 @@ function s:FindDelimiterIndex(delimiter, line) let l:delimiter = a:delimiter let lenDel = strlen(l:delimiter) - "get the index of the first occurrence of the delimiter + "get the index of the first occurrence of the delimiter let delIndx = stridx(a:line, l:delimiter) "keep looping thru the line till we either find a real comment delimiter - "or run off the EOL + "or run off the EOL while delIndx != -1 "if we are not off the EOL get the str before the possible delimiter "in question and check if it really is a delimiter. If it is, return - "its position + "its position if delIndx != -1 if s:IsDelimValid(l:delimiter, delIndx, a:line) return delIndx @@ -2282,13 +2282,13 @@ function s:FindDelimiterIndex(delimiter, line) endif "we have not yet found a real comment delimiter so move past the - "current one we are lookin at + "current one we are lookin at let restOfLine = strpart(a:line, delIndx + lenDel) let distToNextDelim = stridx(restOfLine , l:delimiter) "if distToNextDelim is -1 then there is no more potential delimiters "on the line so set delIndx to -1. Otherwise, move along the line by - "distToNextDelim + "distToNextDelim if distToNextDelim == -1 let delIndx = -1 else @@ -2296,7 +2296,7 @@ function s:FindDelimiterIndex(delimiter, line) endif endwhile - "there is no comment delimiter on this line + "there is no comment delimiter on this line return -1 endfunction @@ -2313,7 +2313,7 @@ endfunction " top/bottom/middle of a sexy comment then -1 is returned function s:FindBoundingLinesOfSexyCom(lineNum) - "find which delimiters to look for as the start/end delims of the comment + "find which delimiters to look for as the start/end delims of the comment let left = '' let right = '' if s:Multipart() @@ -2333,7 +2333,7 @@ function s:FindBoundingLinesOfSexyCom(lineNum) let bottom = -1 let currentLine = a:lineNum - while top == -1 || bottom == -1 + while top == -1 || bottom == -1 let theLine = getline(currentLine) "check if the current line is the top of the sexy comment @@ -2345,26 +2345,26 @@ function s:FindBoundingLinesOfSexyCom(lineNum) elseif theLine =~ '^[ \t]*' . right && theLine !~ '.*' . left && currentLine > 1 let bottom = currentLine - "the right delimiter is on the same line as the last sexyComMarker + "the right delimiter is on the same line as the last sexyComMarker elseif theLine =~ '^[ \t]*' . sexyComMarker . '.*' . right let bottom = currentLine "we have not found the top or bottom line so we assume currentLine is an - "intermediate line and look to prove otherwise + "intermediate line and look to prove otherwise else "if the line doesnt start with a sexyComMarker then it is not a sexy - "comment + "comment if theLine !~ '^[ \t]*' . sexyComMarker return [] endif endif - "if top is -1 then we havent found the top yet so keep looking up + "if top is -1 then we havent found the top yet so keep looking up if top == -1 let currentLine = currentLine - 1 - "if we have found the top line then go down looking for the bottom + "if we have found the top line then go down looking for the bottom else let currentLine = currentLine + 1 endif @@ -2390,7 +2390,7 @@ function s:GetLeft(alt, space, esc) return '' else let delim = b:leftAlt - endif + endif endif if delim == '' return '' @@ -2422,14 +2422,14 @@ function s:GetRight(alt, space, esc) return '' else let delim = b:rightAlt - endif + endif endif if delim == '' return '' endif - if a:space && g:NERDSpaceDelims - let delim = s:spaceStr . delim + if a:space && g:NERDSpaceDelims + let delim = s:spaceStr . delim endif if a:esc @@ -2454,11 +2454,11 @@ endfunction function s:GetSexyComMarker(space, esc) let sexyComMarker = b:sexyComMarker - "if there is no hardcoded marker then we find one + "if there is no hardcoded marker then we find one if sexyComMarker == '' "if the filetype has c style comments then use standard c sexy - "comments + "comments if s:HasCStyleComments() let sexyComMarker = '*' else @@ -2473,17 +2473,17 @@ function s:GetSexyComMarker(space, esc) elseif s:AltMultipart() let left = b:leftAlt else - return -1 + return -1 endif - "get the last char of left + "get the last char of left let sexyComMarker = strpart(left, strlen(left)-1) endif endif if a:space && g:NERDSpaceDelims let sexyComMarker = sexyComMarker . s:spaceStr - endif + endif if a:esc let sexyComMarker = s:Esc(sexyComMarker) @@ -2504,11 +2504,11 @@ function s:GetSexyComLeft(space, esc) let lenLeftAlt = strlen(b:leftAlt) let left = '' - "assume c style sexy comments if possible + "assume c style sexy comments if possible if s:HasCStyleComments() let left = '/*' else - "grab the longest left delim that has a right + "grab the longest left delim that has a right if s:Multipart() && lenLeft >= lenLeftAlt let left = b:left elseif s:AltMultipart() @@ -2542,11 +2542,11 @@ function s:GetSexyComRight(space, esc) let lenLeftAlt = strlen(b:leftAlt) let right = '' - "assume c style sexy comments if possible + "assume c style sexy comments if possible if s:HasCStyleComments() let right = '*/' else - "grab the right delim that pairs with the longest left delim + "grab the right delim that pairs with the longest left delim if s:Multipart() && lenLeft >= lenLeftAlt let right = b:right elseif s:AltMultipart() @@ -2557,7 +2557,7 @@ function s:GetSexyComRight(space, esc) endif if a:space && g:NERDSpaceDelims - let right = s:spaceStr . right + let right = s:spaceStr . right endif if a:esc @@ -2603,7 +2603,7 @@ function s:IsCommentedNormOrSexy(lineNum) return 1 endif - "if the line is part of a sexy comment return 1 + "if the line is part of a sexy comment return 1 if s:IsInSexyComment(a:lineNum) return 1 endif @@ -2661,14 +2661,14 @@ function s:IsCommentedOuttermost(left, right, leftAlt, rightAlt, line) let indxRight = s:LastIndexOfDelim(a:right, a:line) let indxRightAlt = s:LastIndexOfDelim(a:rightAlt, a:line) - "check if the line has a left delim before a leftAlt delim - if (indxLeft <= indxLeftAlt || indxLeftAlt == -1) && indxLeft != -1 + "check if the line has a left delim before a leftAlt delim + if (indxLeft <= indxLeftAlt || indxLeftAlt == -1) && indxLeft != -1 "check if the line has a right delim after any rightAlt delim if (indxRight > indxRightAlt && indxRight > indxLeft) || !s:Multipart() return 1 endif - "check if the line has a leftAlt delim before a left delim + "check if the line has a leftAlt delim before a left delim elseif (indxLeftAlt <= indxLeft || indxLeft == -1) && indxLeftAlt != -1 "check if the line has a rightAlt delim after any right delim if (indxRightAlt > indxRight && indxRightAlt > indxLeftAlt) || !s:AltMultipart() @@ -2698,53 +2698,53 @@ endfunction " -line: the line that delimiter occurs in " " Returns: -" 0 if the given delimiter is not a real delimiter (as far as we can tell) , +" 0 if the given delimiter is not a real delimiter (as far as we can tell) , " 1 otherwise function s:IsDelimValid(delimiter, delIndx, line) - "get the delimiter without the escchars + "get the delimiter without the escchars let l:delimiter = a:delimiter - "get the strings before and after the delimiter + "get the strings before and after the delimiter let preComStr = strpart(a:line, 0, a:delIndx) let postComStr = strpart(a:line, a:delIndx+strlen(delimiter)) "to check if the delimiter is real, make sure it isnt preceded by "an odd number of quotes and followed by the same (which would indicate "that it is part of a string and therefore is not a comment) - if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, '"', "\\")) + if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, '"', "\\")) return 0 endif - if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, "'", "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, "'", "\\")) + if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, "'", "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, "'", "\\")) return 0 endif - if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, "`", "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, "`", "\\")) + if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, "`", "\\")) && !s:IsNumEven(s:CountNonESCedOccurances(postComStr, "`", "\\")) return 0 endif - "if the comment delimiter is escaped, assume it isnt a real delimiter + "if the comment delimiter is escaped, assume it isnt a real delimiter if s:IsEscaped(a:line, a:delIndx, "\\") return 0 endif "vim comments are so fuckin stupid!! Why the hell do they have comment "delimiters that are used elsewhere in the syntax?!?! We need to check - "some conditions especially for vim + "some conditions especially for vim if &filetype == "vim" if !s:IsNumEven(s:CountNonESCedOccurances(preComStr, '"', "\\")) return 0 endif "if the delimiter is on the very first char of the line or is the - "first non-tab/space char on the line then it is a valid comment delimiter + "first non-tab/space char on the line then it is a valid comment delimiter if a:delIndx == 0 || a:line =~ "^[ \t]\\{" . a:delIndx . "\\}\".*$" return 1 endif - let numLeftParen =s:CountNonESCedOccurances(preComStr, "(", "\\") - let numRightParen =s:CountNonESCedOccurances(preComStr, ")", "\\") + let numLeftParen =s:CountNonESCedOccurances(preComStr, "(", "\\") + let numRightParen =s:CountNonESCedOccurances(preComStr, ")", "\\") - "if the quote is inside brackets then assume it isnt a comment + "if the quote is inside brackets then assume it isnt a comment if numLeftParen > numRightParen return 0 endif @@ -2777,12 +2777,12 @@ endfunction " -indx: the index into str that we want to check " -escChar: the escape char the char at indx may be ESCed with function s:IsEscaped(str, indx, escChar) - "initialise numEscChars to 0 and look at the char before indx + "initialise numEscChars to 0 and look at the char before indx let numEscChars = 0 let curIndx = a:indx-1 "keep going back thru str until we either reach the start of the str or - "run out of esc chars + "run out of esc chars while curIndx >= 0 && strpart(a:str, curIndx, 1) == a:escChar "we have found another esc char so add one to the count and move left @@ -2811,7 +2811,7 @@ endfunction " -bottomline: the line that the possible sexy comment stops on function s:IsSexyComment(topline, bottomline) - "get the delim set that would be used for a sexy comment + "get the delim set that would be used for a sexy comment let left = '' let right = '' if s:Multipart() @@ -2824,36 +2824,36 @@ function s:IsSexyComment(topline, bottomline) return 0 endif - "swap the top and bottom line numbers around if need be + "swap the top and bottom line numbers around if need be let topline = a:topline let bottomline = a:bottomline - if bottomline < topline + if bottomline < topline topline = bottomline bottomline = a:topline endif - "if there is < 2 lines in the comment it cannot be sexy + "if there is < 2 lines in the comment it cannot be sexy if (bottomline - topline) <= 0 return 0 endif - "if the top line doesnt begin with a left delim then the comment isnt sexy + "if the top line doesnt begin with a left delim then the comment isnt sexy if getline(a:topline) !~ '^[ \t]*' . left return 0 endif - "if there is a right delim on the top line then this isnt a sexy comment + "if there is a right delim on the top line then this isnt a sexy comment if s:FindDelimiterIndex(right, getline(a:topline)) != -1 return 0 endif - "if there is a left delim on the bottom line then this isnt a sexy comment + "if there is a left delim on the bottom line then this isnt a sexy comment if s:FindDelimiterIndex(left, getline(a:bottomline)) != -1 return 0 endif "if the bottom line doesnt begin with a right delim then the comment isnt - "sexy + "sexy if getline(a:bottomline) !~ '^.*' . right . '$' return 0 endif @@ -2861,12 +2861,12 @@ function s:IsSexyComment(topline, bottomline) let sexyComMarker = s:GetSexyComMarker(0, 1) "check each of the intermediate lines to make sure they start with a - "sexyComMarker + "sexyComMarker let currentLine = a:topline+1 while currentLine < a:bottomline let theLine = getline(currentLine) - if theLine !~ '^[ \t]*' . sexyComMarker + if theLine !~ '^[ \t]*' . sexyComMarker return 0 endif @@ -2901,7 +2901,7 @@ function s:LastIndexOfDelim(delim, str) return -1 endif - "keep moving to the next instance of delim in str till there is none left + "keep moving to the next instance of delim in str till there is none left while 1 "search for the next delim after the previous one @@ -2910,7 +2910,7 @@ function s:LastIndexOfDelim(delim, str) "if we find a delim update indx to record the position of it, if we "dont find another delim then indx is the last one so break out of - "this loop + "this loop if indx2 != -1 let indx = indx + indx2 + lenDelim else @@ -2924,7 +2924,7 @@ endfunction " Function: s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) {{{2 " This function takes in 2 line numbers and returns the index of the left most -" char (that is not a space or a tab) on all of these lines. +" char (that is not a space or a tab) on all of these lines. " Args: " -countCommentedLines: 1 if lines that are commented are to be checked as " well. 0 otherwise @@ -2933,29 +2933,29 @@ endfunction " -bottomline: the bottom line to be checked function s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) - " declare the left most index as an extreme value + " declare the left most index as an extreme value let leftMostIndx = 1000 - " go thru the block line by line updating leftMostIndx + " go thru the block line by line updating leftMostIndx let currentLine = a:topline while currentLine <= a:bottomline " get the next line and if it is allowed to be commented, or is not " commented, check it let theLine = getline(currentLine) - if a:countEmptyLines || theLine !~ '^[ \t]*$' + if a:countEmptyLines || theLine !~ '^[ \t]*$' if a:countCommentedLines || (!s:IsCommented(b:left, b:right, theLine) && !s:IsCommented(b:leftAlt, b:rightAlt, theLine)) " convert spaces to tabs and get the number of leading spaces for " this line and update leftMostIndx if need be let theLine = s:ConvertLeadingTabsToSpaces(theLine) - let leadSpaceOfLine = strlen( substitute(theLine, '\(^[ \t]*\).*$','\1','') ) + let leadSpaceOfLine = strlen( substitute(theLine, '\(^[ \t]*\).*$','\1','') ) if leadSpaceOfLine < leftMostIndx let leftMostIndx = leadSpaceOfLine endif endif endif - " move on to the next line + " move on to the next line let currentLine = currentLine + 1 endwhile @@ -2990,7 +2990,7 @@ endfunction " Function: s:NumberOfLeadingTabs(s) {{{2 " returns the number of leading tabs in the given string function s:NumberOfLeadingTabs(s) - return strlen(substitute(a:s, '^\(\t*\).*$', '\1', "")) + return strlen(substitute(a:s, '^\(\t*\).*$', '\1', "")) endfunction " Function: s:NumLinesInBuf() {{{2 @@ -3002,7 +3002,7 @@ endfunction " Function: s:ReplaceDelims(toReplace1, toReplace2, replacor1, replacor2, str) {{{2 " This function takes in a string, 2 delimiters in that string and 2 strings " to replace these delimiters with. -" +" " Args: " -toReplace1: the first delimiter to replace " -toReplace2: the second delimiter to replace @@ -3026,11 +3026,11 @@ endfunction function s:ReplaceLeftMostDelim(toReplace, replacor, str) let toReplace = a:toReplace let replacor = a:replacor - "get the left most occurrence of toReplace + "get the left most occurrence of toReplace let indxToReplace = s:FindDelimiterIndex(toReplace, a:str) "if there IS an occurrence of toReplace in str then replace it and return - "the resulting string + "the resulting string if indxToReplace != -1 let line = strpart(a:str, 0, indxToReplace) . replacor . strpart(a:str, indxToReplace+strlen(toReplace)) return line @@ -3047,16 +3047,16 @@ endfunction " -toReplace: the delimiter in str that is to be replaced " -replacor: the string to replace toReplace with " -str: the string that contains toReplace -" +" function s:ReplaceRightMostDelim(toReplace, replacor, str) let toReplace = a:toReplace let replacor = a:replacor let lenToReplace = strlen(toReplace) - "get the index of the last delim in str + "get the index of the last delim in str let indxToReplace = s:LastIndexOfDelim(toReplace, a:str) - "if there IS a delimiter in str, replace it and return the result + "if there IS a delimiter in str, replace it and return the result let line = a:str if indxToReplace != -1 let line = strpart(a:str, 0, indxToReplace) . replacor . strpart(a:str, indxToReplace+strlen(toReplace)) @@ -3064,7 +3064,7 @@ function s:ReplaceRightMostDelim(toReplace, replacor, str) return line endfunction -"FUNCTION: s:RestoreScreenState() {{{2 +"FUNCTION: s:RestoreScreenState() {{{2 " "Sets the screen state back to what it was when s:SaveScreenState was last "called. @@ -3081,7 +3081,7 @@ endfunction " Function: s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) {{{2 " This function takes in 2 line numbers and returns the index of the right most -" char on all of these lines. +" char on all of these lines. " Args: " -countCommentedLines: 1 if lines that are commented are to be checked as " well. 0 otherwise @@ -3091,18 +3091,18 @@ endfunction function s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomline) let rightMostIndx = -1 - " go thru the block line by line updating rightMostIndx + " go thru the block line by line updating rightMostIndx let currentLine = a:topline while currentLine <= a:bottomline " get the next line and see if it is commentable, otherwise it doesnt " count let theLine = getline(currentLine) - if a:countEmptyLines || theLine !~ '^[ \t]*$' + if a:countEmptyLines || theLine !~ '^[ \t]*$' if a:countCommentedLines || (!s:IsCommented(b:left, b:right, theLine) && !s:IsCommented(b:leftAlt, b:rightAlt, theLine)) - " update rightMostIndx if need be + " update rightMostIndx if need be let theLine = s:ConvertLeadingTabsToSpaces(theLine) let lineLen = strlen(theLine) if lineLen > rightMostIndx @@ -3111,16 +3111,16 @@ function s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomli endif endif - " move on to the next line + " move on to the next line let currentLine = currentLine + 1 endwhile return rightMostIndx endfunction -"FUNCTION: s:SaveScreenState() {{{2 +"FUNCTION: s:SaveScreenState() {{{2 "Saves the current cursor position in the current buffer and the window -"scroll position +"scroll position function s:SaveScreenState() let t:NERDComOldPos = getpos(".") let t:NERDComOldTopLine = line("w0") @@ -3131,10 +3131,10 @@ endfunction " place holders " Args: " -line: the line to swap the delims in -" +" function s:SwapOutterMultiPartDelimsForPlaceHolders(line) " find out if the line is commented using normal delims and/or - " alternate ones + " alternate ones let isCommented = s:IsCommented(b:left, b:right, a:line) let isCommentedAlt = s:IsCommented(b:leftAlt, b:rightAlt, a:line) @@ -3146,7 +3146,7 @@ function s:SwapOutterMultiPartDelimsForPlaceHolders(line) let line2 = s:ReplaceDelims(b:left, b:right, g:NERDLPlace, g:NERDRPlace, a:line) "similarly if the line is commented with the alternative - "delimiters + "delimiters elseif isCommentedAlt && s:AltMultipart() let line2 = s:ReplaceDelims(b:leftAlt, b:rightAlt, g:NERDLPlace, g:NERDRPlace, a:line) endif @@ -3159,7 +3159,7 @@ endfunction " multi-part delims " Args: " -line: the line to swap the delims in -" +" function s:SwapOutterPlaceHoldersForMultiPartDelims(line) let left = '' let right = '' @@ -3179,14 +3179,14 @@ endfunction " number is the col number when all leading spaces are converted to tabs " Args: " -line:the line to get the rel col for -" -col: the abs col +" -col: the abs col function s:TabbedCol(line, col) let lineTruncated = strpart(a:line, 0, a:col) let lineSpacesToTabs = substitute(lineTruncated, s:TabSpace(), '\t', 'g') return strlen(lineSpacesToTabs) endfunction -"FUNCTION: s:TabSpace() {{{2 -"returns a string of spaces equal in length to &tabstop +"FUNCTION: s:TabSpace() {{{2 +"returns a string of spaces equal in length to &tabstop function s:TabSpace() let tabSpace = "" let spacesPerTab = &tabstop @@ -3222,7 +3222,7 @@ endfunction " This is where the mappings calls are made that set up the commenting key " mappings. -" set up the mapping to switch to/from alternative delimiters +" set up the mapping to switch to/from alternative delimiters execute 'nnoremap ' . g:NERDAltComMap . ' :call SwitchToAlternativeDelimiters(1)' " set up the mappings to comment out lines @@ -3249,23 +3249,23 @@ execute 'vnoremap ' . g:NERDComLineInvertMap . ' :call NERDComment( execute 'nmap ' . g:NERDComLineYankMap . ' :call NERDComment(0, "yank")' execute 'vmap ' . g:NERDComLineYankMap . ' :call NERDComment(1, "yank")' -" set up the mappings for left aligned comments +" set up the mappings for left aligned comments execute 'nnoremap ' . g:NERDComAlignLeftMap . ' :call NERDComment(0, "alignLeft")' execute 'vnoremap ' . g:NERDComAlignLeftMap . ' :call NERDComment(1, "alignLeft")' -" set up the mappings for right aligned comments +" set up the mappings for right aligned comments execute 'nnoremap ' . g:NERDComAlignRightMap . ' :call NERDComment(0, "alignRight")' execute 'vnoremap ' . g:NERDComAlignRightMap . ' :call NERDComment(1, "alignRight")' -" set up the mappings for left and right aligned comments +" set up the mappings for left and right aligned comments execute 'nnoremap ' . g:NERDComAlignBothMap . ' :call NERDComment(0, "alignBoth")' execute 'vnoremap ' . g:NERDComAlignBothMap . ' :call NERDComment(1, "alignBoth")' -" set up the mappings to do nested comments +" set up the mappings to do nested comments execute 'nnoremap ' . g:NERDComLineNestMap . ' :call NERDComment(0, "nested")' execute 'vnoremap ' . g:NERDComLineNestMap . ' :call NERDComment(1, "nested")' -" set up the mapping to uncomment a line +" set up the mapping to uncomment a line execute 'nnoremap ' . g:NERDUncomLineMap . ' :call NERDComment(0, "uncomment")' execute 'vnoremap ' . g:NERDUncomLineMap . ' :call NERDComment(1, "uncomment")' @@ -3283,7 +3283,7 @@ execute 'inoremap ' . g:NERDComInInsertMap . ' ' . ':cal " Section: Menu item setup {{{1 " =========================================================================== -"check if the user wants the menu to be displayed +"check if the user wants the menu to be displayed if g:NERDMenuMode != 0 let menuRoot = "" @@ -3315,7 +3315,7 @@ if g:NERDMenuMode != 0 execute 'nmenu '. menuRoot .'.Comment\ Sexily' . escape(g:NERDComLineSexyMap, '\') . ' :call NERDComment(0,"sexy")' execute 'vmenu '. menuRoot .'.Comment\ Sexily' . escape(g:NERDComLineSexyMap, '\') . ' :call NERDComment(1,"sexy")' - execute 'nmenu '. menuRoot .'.Yank\ line(s)\ then\ comment' . escape(g:NERDComLineYankMap, '\') . ' "0Y' . g:NERDComLineMap + execute 'nmenu '. menuRoot .'.Yank\ line(s)\ then\ comment' . escape(g:NERDComLineYankMap, '\') . ' "0Y' . g:NERDComLineMap execute 'vmenu '. menuRoot .'.Yank\ line(s)\ then\ comment' . escape(g:NERDComLineYankMap, '\') . ' "0ygv' . g:NERDComLineMap execute 'nmenu '. menuRoot .'.Append\ Comment\ to\ Line' . escape(g:NERDAppendComMap, '\') . ' :call NERDComment(0, "append")'