From: Simon Ruderich Date: Tue, 10 May 2011 20:29:23 +0000 (+0200) Subject: vim/bundle/nerdcommenter: Update to version 2.3.0. X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=commitdiff_plain;h=a32e8d26de427e10ea0c3936400c18bd8c9f9053 vim/bundle/nerdcommenter: Update to version 2.3.0. --- diff --git a/vim/bundle/nerdcommenter/doc/NERD_commenter.txt b/vim/bundle/nerdcommenter/doc/NERD_commenter.txt index d79d278..5309f61 100644 --- a/vim/bundle/nerdcommenter/doc/NERD_commenter.txt +++ b/vim/bundle/nerdcommenter/doc/NERD_commenter.txt @@ -11,37 +11,37 @@ CONTENTS *NERDCommenterContents* 1.Intro...................................|NERDCommenter| - 2.Functionality provided..................|NERDComFunctionality| - 2.1 Functionality Summary.............|NERDComFunctionalitySummary| - 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.5 Invert comment map..........|NERDComInvertComment| - 2.2.6 Sexy comment map............|NERDComSexyComment| - 2.2.7 Yank comment map............|NERDComYankComment| - 2.2.8 Comment to EOL map..........|NERDComEOLComment| - 2.2.9 Append com to line map......|NERDComAppendComment| - 2.2.10 Insert comment map.........|NERDComInsertComment| - 2.2.11 Use alternate delims map...|NERDComAltDelim| - 2.2.12 Comment aligned maps.......|NERDComAlignedComment| - 2.2.13 Uncomment line map.........|NERDComUncommentLine| - 2.3 Supported filetypes...............|NERDComFiletypes| - 2.4 Sexy Comments.....................|NERDComSexyComments| - 2.5 The NERDComment function..........|NERDComNERDComment| - 3.Options.................................|NERDComOptions| - 3.1 Options summary...................|NERDComOptionsSummary| - 3.2 Options details...................|NERDComOptionsDetails| - 3.3 Default delimiter Options.........|NERDComDefaultDelims| - 4. Customising key mappings...............|NERDComMappings| - 5. Issues with the script.................|NERDComIssues| - 5.1 Delimiter detection heuristics....|NERDComHeuristics| - 5.2 Nesting issues....................|NERDComNesting| - 6.About.. ............................|NERDComAbout| - 7.Changelog...............................|NERDComChangelog| - 8.Credits.................................|NERDComCredits| - 9.License.................................|NERDComLicense| + 2.Installation............................|NERDComInstallation| + 3.Functionality provided..................|NERDComFunctionality| + 3.1 Functionality Summary.............|NERDComFunctionalitySummary| + 3.2 Functionality Details.............|NERDComFunctionalityDetails| + 3.2.1 Comment map.................|NERDComComment| + 3.2.2 Nested comment map..........|NERDComNestedComment| + 3.2.3 Toggle comment map..........|NERDComToggleComment| + 3.2.4 Minimal comment map.........|NERDComMinimalComment| + 3.2.5 Invert comment map..........|NERDComInvertComment| + 3.2.6 Sexy comment map............|NERDComSexyComment| + 3.2.7 Yank comment map............|NERDComYankComment| + 3.2.8 Comment to EOL map..........|NERDComEOLComment| + 3.2.9 Append com to line map......|NERDComAppendComment| + 3.2.10 Insert comment map.........|NERDComInsertComment| + 3.2.11 Use alternate delims map...|NERDComAltDelim| + 3.2.12 Comment aligned maps.......|NERDComAlignedComment| + 3.2.13 Uncomment line map.........|NERDComUncommentLine| + 3.4 Sexy Comments.....................|NERDComSexyComments| + 3.5 The NERDComment function..........|NERDComNERDComment| + 4.Options.................................|NERDComOptions| + 4.1 Options summary...................|NERDComOptionsSummary| + 4.2 Options details...................|NERDComOptionsDetails| + 4.3 Default delimiter Options.........|NERDComDefaultDelims| + 5. Customising key mappings...............|NERDComMappings| + 6. Issues with the script.................|NERDComIssues| + 6.1 Delimiter detection heuristics....|NERDComHeuristics| + 6.2 Nesting issues....................|NERDComNesting| + 7.About.. ............................|NERDComAbout| + 8.Changelog...............................|NERDComChangelog| + 9.Credits.................................|NERDComCredits| + 10.License................................|NERDComLicense| ============================================================================== 1. Intro *NERDCommenter* @@ -54,48 +54,69 @@ There are also options that allow to tweak the commenting engine to your taste. ============================================================================== -2. Functionality provided *NERDComFunctionality* +2. Installation *NERDComInstallation* + +The NERD Commenter requires Vim 7 or higher. + +Extract the plugin files in your ~/.vim (*nix) or ~/vimfiles (Windows). You +should have 2 files: > + plugin/NERD_commenter.vim + doc/NERD_commenter.txt +< +Next, to finish installing the help file run: > + :helptags ~/.vim/doc +< +See |add-local-help| for more details. + +Make sure that you have filetype plugins enabled, as the script makes use of +|'commentstring'| where possible (which is usually set in a filetype plugin). +See |filetype-plugin-on| for details, but basically, stick this in your vimrc > + filetype plugin on +< + +============================================================================== +3. Functionality provided *NERDComFunctionality* ------------------------------------------------------------------------------ -2.1 Functionality summary *NERDComFunctionalitySummary* +3.1 Functionality summary *NERDComFunctionalitySummary* The following key mappings are provided by default (there is also a menu with items corresponding to all the mappings below): -[count],cc |NERDComComment| +[count]cc |NERDComComment| Comment out the current line or text selected in visual mode. -[count],cn |NERDComNestedComment| -Same as ,cc but forces nesting. +[count]cn |NERDComNestedComment| +Same as cc 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. -[count],ci |NERDComInvertComment| +[count]ci |NERDComInvertComment| Toggles the comment state of the selected line(s) individually. -[count],cs |NERDComSexyComment| +[count]cs |NERDComSexyComment| Comments out the selected lines ``sexily'' -[count],cy |NERDComYankComment| -Same as ,cc except that the commented line(s) are yanked first. +[count]cy |NERDComYankComment| +Same as cc except that the commented line(s) are yanked first. -,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. @@ -105,26 +126,26 @@ Adds comment delimiters at the current cursor position and inserts between. Disabled by default. -,ca |NERDComAltDelim| +ca |NERDComAltDelim| Switches to the alternative set of delimiters. -[count],cl -[count],cb |NERDComAlignedComment| +[count]cl +[count]cb |NERDComAlignedComment| Same as |NERDComComment| except that the delimiters are aligned down the -left side (,cl) or both sides (,cb). +left side (cl) or both sides (cb). -[count],cu |NERDComUncommentLine| +[count]cu |NERDComUncommentLine| Uncomments the selected line(s). ------------------------------------------------------------------------------ -2.2 Functionality details *NERDComFunctionalityDetails* +3.2 Functionality details *NERDComFunctionalityDetails* ------------------------------------------------------------------------------ -2.2.1 Comment map *NERDComComment* +3.2.1 Comment map *NERDComComment* -Default mapping: [count],cc +Default mapping: [count]cc Mapped to: NERDCommenterComment Applicable modes: normal visual visual-line visual-block. @@ -138,14 +159,14 @@ If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ -2.2.2 Nested comment map *NERDComNestedComment* +3.2.2 Nested comment map *NERDComNestedComment* -Default mapping: [count],cn +Default mapping: [count]cn Mapped to: NERDCommenterNest 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. +Performs nested commenting. Works the same as cc except that if a 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 @@ -159,9 +180,9 @@ Related options: |'NERDDefaultNesting'| ------------------------------------------------------------------------------ -2.2.3 Toggle comment map *NERDComToggleComment* +3.2.3 Toggle comment map *NERDComToggleComment* -Default mapping: [count],c +Default mapping: [count]c Mapped to: NERDCommenterToggle Applicable modes: normal visual-line. @@ -176,17 +197,17 @@ 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* +3.2.4 Minimal comment map *NERDComMinimalComment* -Default mapping: [count],cm +Default mapping: [count]cm Mapped to: NERDCommenterMinimal Applicable modes: normal visual-line. Comments the selected lines using one set of multipart delimiters if possible. -For example: if you are programming in c and you select 5 lines and press ,cm -then a '/*' will be placed at the start of the top line and a '*/' will be -placed at the end of the last line. +For example: if you are programming in c and you select 5 lines and press +cm then a '/*' will be placed at the start of the top line and a '*/' +will be placed at the end of the last line. Sets of multipart comment delimiters that are between the top and bottom selected lines are replaced with place holders (see |'NERDLPlace'|) if @@ -198,9 +219,9 @@ If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ -2.2.5 Invert comment map *NERDComInvertComment* +3.2.5 Invert comment map *NERDComInvertComment* -Default mapping: ,ci +Default mapping: ci Mapped to: NERDCommenterInvert Applicable modes: normal visual-line. @@ -215,9 +236,9 @@ If a [count] is given in normal mode, the mapping works as though that many lines were selected in visual-line mode. ------------------------------------------------------------------------------ -2.2.6 Sexy comment map *NERDComSexyComment* +3.2.6 Sexy comment map *NERDComSexyComment* -Default mapping: [count],cs +Default mapping: [count]cs Mapped to: NERDCommenterSexy Applicable modes: normal, visual-line. @@ -235,18 +256,18 @@ Related options: |'NERDCompactSexyComs'| ------------------------------------------------------------------------------ -2.2.7 Yank comment map *NERDComYankComment* +3.2.7 Yank comment map *NERDComYankComment* -Default mapping: [count],cy +Default mapping: [count]cy Mapped to: NERDCommenterYank 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* +3.2.8 Comment to EOL map *NERDComEOLComment* -Default mapping: ,c$ +Default mapping: c$ Mapped to: NERDCommenterToEOL Applicable modes: normal. @@ -254,9 +275,9 @@ Comments the current line from the current cursor position up to the end of the line. ------------------------------------------------------------------------------ -2.2.9 Append com to line map *NERDComAppendComment* +3.2.9 Append com to line map *NERDComAppendComment* -Default mapping: ,cA +Default mapping: cA Mapped to: NERDCommenterAppend Applicable modes: normal. @@ -264,7 +285,7 @@ Appends comment delimiters to the end of the current line and goes to insert mode between the new delimiters. ------------------------------------------------------------------------------ -2.2.10 Insert comment map *NERDComInsertComment* +3.2.10 Insert comment map *NERDComInsertComment* Default mapping: disabled by default. Map it to: NERDCommenterInInsert @@ -280,37 +301,37 @@ mapping add > to your vimrc. ------------------------------------------------------------------------------ -2.2.11 Use alternate delims map *NERDComAltDelim* +3.2.11 Use alternate delims map *NERDComAltDelim* -Default mapping: ,ca +Default mapping: ca Mapped to: NERDCommenterAltDelims 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 +if the user is editing a c++ file using // comments and they hit ca then they will be switched over to /**/ comments. See also |NERDComDefaultDelims| ------------------------------------------------------------------------------ -2.2.12 Comment aligned maps *NERDComAlignedComment* +3.2.12 Comment aligned maps *NERDComAlignedComment* -Default mappings: [count],cl [count],cb +Default mappings: [count]cl [count]cb Mapped to: NERDCommenterAlignLeft NERDCommenterAlignBoth Applicable modes: normal visual-line. -Same as ,cc except that the comment delimiters are aligned on the left side or -both sides respectively. These comments are always nested if the line(s) are -already commented. +Same as cc except that the comment delimiters are aligned on the left +side or both sides respectively. These comments are always nested 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. ------------------------------------------------------------------------------ -2.2.13 Uncomment line map *NERDComUncommentLine* +3.2.13 Uncomment line map *NERDComUncommentLine* -Default mapping: [count],cu +Default mapping: [count]cu Mapped to: NERDCommenterUncomment Applicable modes: normal visual visual-line visual-block. @@ -331,41 +352,7 @@ Related options: |'NERDRemoveExtraSpaces'| ------------------------------------------------------------------------------ -2.3 Supported filetypes *NERDComFiletypes* - -Filetypes that can be commented by this plugin: -abaqus abc acedb ada ahdl amiga aml ampl ant apache apachestyle asm68k asm asn -aspvbs atlas autohotkey autoit automake ave awk basic b bc bdf bib bindzone -bst btm caos catalog c cfg cg ch changelog cl clean clipper cmake conf config -context cpp crontab cs csc csp css cterm cupl csv cvs dcl debchangelog -debcontrol debsources def diff django docbk dns dosbatch dosini dot dracula -dsl dtd dtml dylan ecd eiffel elf elmfilt erlang eruby eterm expect exports -fetchmail fgl focexec form fortran foxpro fstab fvwm fx gdb gdmo geek -gentoo-package-keywords' gentoo-package-mask' gentoo-package-use' gnuplot -gtkrc haskell hb h help hercules hog html htmldjango htmlos ia64 icon idlang -idl indent inform inittab ishd iss ist jam java javascript jess jgraph -jproperties jproperties jsp kconfig kix kscript lace lex lftp lifelines lilo -lisp lite lotos lout lprolog lscript lss lua lynx m4 mail make maple masm -master matlab mel mf mib mma model moduala. modula2 modula3 monk mush muttrc -named nasm nastran natural ncf netdict netrw nqc nroff nsis objc ocaml occam -omlet omnimark openroad opl ora otl ox pascal passwd pcap pccts perl pfmain -php phtml pic pike pilrc pine plaintex plm plsql po postscr pov povini ppd -ppwiz procmail progress prolog psf ptcap python python qf radiance ratpoison r -rc readline rebol registry remind rexx robots rpl rtf ruby sa samba sas sass -sather scheme scilab screen scsh sdl sed selectbuf sgml sgmldecl sgmllnx sh -sicad simula sinda skill slang sl slrnrc sm smarty smil smith sml snnsnet -snnspat snnsres snobol4 spec specman spice sql sqlforms sqlj sqr squid st stp -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 - -If a language is not in the list of hardcoded supported filetypes then the -&commentstring vim option is used. - ------------------------------------------------------------------------------- -2.4 Sexy Comments *NERDComSexyComments* +3.3 Sexy Comments *NERDComSexyComments* These are comments that use one set of multipart comment delimiters as well as one other marker symbol. For example: > /* @@ -380,7 +367,7 @@ one other marker symbol. For example: > Here the multipart delimiters are /* and */ and the marker is *. ------------------------------------------------------------------------------ -2.5 The NERDComment function *NERDComNERDComment* +3.4 The NERDComment function *NERDComNERDComment* All of the NERD commenter mappings and menu items invoke a single function which delegates the commenting work to other functions. This function is @@ -404,10 +391,10 @@ then the script would do a sexy comment on the last visual selection. ============================================================================== -3. Options *NERDComOptions* +4. Options *NERDComOptions* ------------------------------------------------------------------------------ -3.1 Options summary *NERDComOptionsSummary* +4.1 Options summary *NERDComOptionsSummary* |'loaded_nerd_comments'| Turns off the script. |'NERDAllowAnyVisualDelims'| Allows multipart alternative delims to @@ -444,7 +431,7 @@ then the script would do a sexy comment on the last visual selection. style sexy comments. ------------------------------------------------------------------------------ -3.3 Options details *NERDComOptionsDetails* +4.3 Options details *NERDComOptionsDetails* To enable any of the below options you should put the given line in your ~/.vimrc @@ -581,7 +568,7 @@ this option tells the script whether to look for, and remove, comment delimiters of the alternative style. For example, if you are editing a c++ file using // style comments and you go -,cu on this line: > +cu on this line: > /* This is a c++ comment baby! */ < It will not be uncommented if the NERDRemoveAltComs is set to 0. @@ -633,7 +620,7 @@ To set these options use lines like: > Following the above example, if we have line of c code: > /* int horse */ < -and we comment it with ,cn it will be changed to: > +and we comment it with cn it will be changed to: > /*FOO int horse BAR*/ < When we uncomment this line it will go back to what it was. @@ -698,7 +685,8 @@ Values: 0 or 1. Default 1. When this option is set to 1, comments are nested automatically. That is, if -you hit ,cc on a line that is already commented it will be commented again +you hit cc on a line that is already commented it will be commented +again. ------------------------------------------------------------------------------ 3.3 Default delimiter customisation *NERDComDefaultDelims* @@ -715,7 +703,7 @@ Example: java uses // style comments by default, but you want it to default to See |NERDComAltDelim| for switching commenting styles at runtime. ============================================================================== -4. Key mapping customisation *NERDComMappings* +5. Key mapping customisation *NERDComMappings* To change a mapping just map another key combo to the internal mapping. For example, to remap the |NERDComComment| mapping to ",omg" you would put @@ -730,11 +718,11 @@ map to. See also |'NERDCreateDefaultMappings'|. ============================================================================== -5. Issues with the script *NERDComIssues* +6. Issues with the script *NERDComIssues* ------------------------------------------------------------------------------ -5.1 Delimiter detection heuristics *NERDComHeuristics* +6.1 Delimiter detection heuristics *NERDComHeuristics* Heuristics are used to distinguish the real comment delimiters @@ -754,7 +742,7 @@ string. These heuristics, while usually pretty accurate, will not work for all cases. ------------------------------------------------------------------------------ -5.2 Nesting issues *NERDComNesting* +6.2 Nesting issues *NERDComNesting* If we have some line of code like this: > /*int foo */ = /*5 + 9;*/ @@ -774,7 +762,7 @@ will become: > for simplicity) ============================================================================== -6. About *NERDComAbout* +7. About *NERDComAbout* The author of the NERD commenter is Martyzillatron --- the half robot, half dinosaur bastard son of Megatron and Godzilla. He enjoys destroying @@ -793,6 +781,15 @@ The latest dev versions are on github ============================================================================== 8. Changelog *NERDComChangelog* +2.3.0 + - remove all filetypes which have a &commentstring in the standard vim + runtime for vim > 7.0 unless the script stores an alternate set of + delimiters + - make the script complain if the user doesnt have filetype plugins enabled + - use instead of comma to start the default mappings + - fix a couple of bugs with sexy comments - thanks to Tim Smart + - lots of refactoring + 2.2.2 - remove the NERDShutup option and the message is suppresses, this makes the plugin silently rely on &commentstring for unknown filetypes. @@ -848,7 +845,7 @@ The latest dev versions are on github NERDComInsertComment if you wish to restore it ============================================================================== -8. Credits *NERDComCredits* +9. Credits *NERDComCredits* Thanks to the follow people for suggestions and patches: @@ -985,7 +982,7 @@ Matt Tolton javacc Ivan Devat javascript.jquery tpope cucumber,pdf ============================================================================== -9. License *NERDComLicense* +10. License *NERDComLicense* The NERD commenter is released under the wtfpl. See http://sam.zoy.org/wtfpl/COPYING. diff --git a/vim/bundle/nerdcommenter/plugin/NERD_commenter.vim b/vim/bundle/nerdcommenter/plugin/NERD_commenter.vim index 18a348f..ef88dd4 100644 --- a/vim/bundle/nerdcommenter/plugin/NERD_commenter.vim +++ b/vim/bundle/nerdcommenter/plugin/NERD_commenter.vim @@ -1,9 +1,9 @@ " ============================================================================ " File: NERD_commenter.vim " Description: vim global plugin that provides easy code commenting -" Maintainer: Martin Grenfell -" Version: 2.2.2 -" Last Change: 30th March, 2008 +" Maintainer: Martin Grenfell +" Version: 2.3.0 +" Last Change: 08th December, 2010 " License: This program is free software. It comes without any warranty, " to the extent permitted by applicable law. You can redistribute " it and/or modify it under the terms of the Do What The Fuck You @@ -63,9 +63,318 @@ call s:InitVariable("g:NERDRPlace", "<]") call s:InitVariable("g:NERDSpaceDelims", 0) call s:InitVariable("g:NERDDelimiterRequests", 1) - - let s:NERDFileNameEscape="[]#*$%'\" ?`!&();<>\\" +"vf ;;dA:hcs"'A {j^f(lyi(k$p0f{a A }0f{a 'left':jdd^ + +let s:delimiterMap = { + \ 'aap': { 'left': '#' }, + \ 'abc': { 'left': '%' }, + \ 'acedb': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'actionscript': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'ada': { 'left': '--', 'leftAlt': '-- ' }, + \ 'ahdl': { 'left': '--' }, + \ 'ahk': { 'left': ';', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'amiga': { 'left': ';' }, + \ 'aml': { 'left': '/*' }, + \ 'ampl': { 'left': '#' }, + \ 'apache': { 'left': '#' }, + \ 'apachestyle': { 'left': '#' }, + \ 'asciidoc': { 'left': '//' }, + \ 'applescript': { 'left': '--', 'leftAlt': '(*', 'rightAlt': '*)' }, + \ 'asm68k': { 'left': ';' }, + \ 'asm': { 'left': ';', 'leftAlt': '#' }, + \ 'asn': { 'left': '--' }, + \ 'aspvbs': { 'left': '''' }, + \ 'asterisk': { 'left': ';' }, + \ 'asy': { 'left': '//' }, + \ 'atlas': { 'left': 'C', 'right': '$' }, + \ 'autohotkey': { 'left': ';' }, + \ 'autoit': { 'left': ';' }, + \ 'ave': { 'left': "'" }, + \ 'awk': { 'left': '#' }, + \ 'basic': { 'left': "'", 'leftAlt': 'REM ' }, + \ 'bbx': { 'left': '%' }, + \ 'bc': { 'left': '#' }, + \ 'bib': { 'left': '%' }, + \ 'bindzone': { 'left': ';' }, + \ 'bst': { 'left': '%' }, + \ 'btm': { 'left': '::' }, + \ 'caos': { 'left': '*' }, + \ 'calibre': { 'left': '//' }, + \ 'catalog': { 'left': '--', 'right': '--' }, + \ 'c': { 'left': '/*','right': '*/', 'leftAlt': '//' }, + \ 'cfg': { 'left': '#' }, + \ 'cg': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'ch': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'cl': { 'left': '#' }, + \ 'clean': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'clipper': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'clojure': { 'left': ';' }, + \ 'cmake': { 'left': '#' }, + \ 'conkyrc': { 'left': '#' }, + \ 'cpp': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'crontab': { 'left': '#' }, + \ 'cs': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'csp': { 'left': '--' }, + \ 'cterm': { 'left': '*' }, + \ 'cucumber': { 'left': '#' }, + \ 'cvs': { 'left': 'CVS:' }, + \ 'd': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'dcl': { 'left': '$!' }, + \ 'dakota': { 'left': '#' }, + \ 'debcontrol': { 'left': '#' }, + \ 'debsources': { 'left': '#' }, + \ 'def': { 'left': ';' }, + \ 'desktop': { 'left': '#' }, + \ 'dhcpd': { 'left': '#' }, + \ 'diff': { 'left': '#' }, + \ 'django': { 'left': '', 'leftAlt': '{#', 'rightAlt': '#}' }, + \ 'docbk': { 'left': '' }, + \ 'dns': { 'left': ';' }, + \ 'dosbatch': { 'left': 'REM ', 'leftAlt': '::' }, + \ 'dosini': { 'left': ';' }, + \ 'dot': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'dracula': { 'left': ';' }, + \ 'dsl': { 'left': ';' }, + \ 'dtml': { 'left': '', 'right': '' }, + \ 'dylan': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'ebuild': { 'left': '#' }, + \ 'ecd': { 'left': '#' }, + \ 'eclass': { 'left': '#' }, + \ 'eiffel': { 'left': '--' }, + \ 'elf': { 'left': "'" }, + \ 'elmfilt': { 'left': '#' }, + \ 'erlang': { 'left': '%' }, + \ 'eruby': { 'left': '<%#', 'right': '%>', 'leftAlt': '' }, + \ 'expect': { 'left': '#' }, + \ 'exports': { 'left': '#' }, + \ 'factor': { 'left': '! ', 'leftAlt': '!# ' }, + \ 'fgl': { 'left': '#' }, + \ 'focexec': { 'left': '-*' }, + \ 'form': { 'left': '*' }, + \ 'foxpro': { 'left': '*' }, + \ 'fstab': { 'left': '#' }, + \ 'fvwm': { 'left': '#' }, + \ 'fx': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'gams': { 'left': '*' }, + \ 'gdb': { 'left': '#' }, + \ 'gdmo': { 'left': '--' }, + \ 'geek': { 'left': 'GEEK_COMMENT:' }, + \ 'genshi': { 'left': '', 'leftAlt': '{#', 'rightAlt': '#}' }, + \ 'gentoo-conf-d': { 'left': '#' }, + \ 'gentoo-env-d': { 'left': '#' }, + \ 'gentoo-init-d': { 'left': '#' }, + \ 'gentoo-make-conf': { 'left': '#' }, + \ 'gentoo-package-keywords': { 'left': '#' }, + \ 'gentoo-package-mask': { 'left': '#' }, + \ 'gentoo-package-use': { 'left': '#' }, + \ 'gitcommit': { 'left': '#' }, + \ 'gitconfig': { 'left': ';' }, + \ 'gitrebase': { 'left': '#' }, + \ 'gnuplot': { 'left': '#' }, + \ 'groovy': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'gsp': { 'left': '<%--', 'right': '--%>' }, + \ 'gtkrc': { 'left': '#' }, + \ 'haskell': { 'left': '{-','right': '-}', 'leftAlt': '--' }, + \ 'hb': { 'left': '#' }, + \ 'h': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'haml': { 'left': '-#', 'leftAlt': '/' }, + \ 'hercules': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'hog': { 'left': '#' }, + \ 'hostsaccess': { 'left': '#' }, + \ 'htmlcheetah': { 'left': '##' }, + \ 'htmldjango': { 'left': '', 'leftAlt': '{#', 'rightAlt': '#}' }, + \ 'htmlos': { 'left': '#', 'right': '/#' }, + \ 'ia64': { 'left': '#' }, + \ 'icon': { 'left': '#' }, + \ 'idlang': { 'left': ';' }, + \ 'idl': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'inform': { 'left': '!' }, + \ 'inittab': { 'left': '#' }, + \ 'ishd': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'iss': { 'left': ';' }, + \ 'ist': { 'left': '%' }, + \ 'java': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'javacc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'javascript': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'javascript.jquery': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'jess': { 'left': ';' }, + \ 'jgraph': { 'left': '(*', 'right': '*)' }, + \ 'jproperties': { 'left': '#' }, + \ 'jsp': { 'left': '<%--', 'right': '--%>' }, + \ 'kix': { 'left': ';' }, + \ 'kscript': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'lace': { 'left': '--' }, + \ 'ldif': { 'left': '#' }, + \ 'lilo': { 'left': '#' }, + \ 'lilypond': { 'left': '%' }, + \ 'liquid': { 'left': '{%', 'right': '%}' }, + \ 'lisp': { 'left': ';', 'leftAlt': '#|', 'rightAlt': '|#' }, + \ 'llvm': { 'left': ';' }, + \ 'lotos': { 'left': '(*', 'right': '*)' }, + \ 'lout': { 'left': '#' }, + \ 'lprolog': { 'left': '%' }, + \ 'lscript': { 'left': "'" }, + \ 'lss': { 'left': '#' }, + \ 'lua': { 'left': '--', 'leftAlt': '--[[', 'rightAlt': ']]' }, + \ 'lynx': { 'left': '#' }, + \ 'lytex': { 'left': '%' }, + \ 'mail': { 'left': '> ' }, + \ 'mako': { 'left': '##' }, + \ 'man': { 'left': '."' }, + \ 'map': { 'left': '%' }, + \ 'maple': { 'left': '#' }, + \ 'markdown': { 'left': '' }, + \ 'masm': { 'left': ';' }, + \ 'mason': { 'left': '<% #', 'right': '%>' }, + \ 'master': { 'left': '$' }, + \ 'matlab': { 'left': '%' }, + \ 'mel': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'mib': { 'left': '--' }, + \ 'mkd': { 'left': '>' }, + \ 'mma': { 'left': '(*', 'right': '*)' }, + \ 'model': { 'left': '$', 'right': '$' }, + \ 'moduala.': { 'left': '(*', 'right': '*)' }, + \ 'modula2': { 'left': '(*', 'right': '*)' }, + \ 'modula3': { 'left': '(*', 'right': '*)' }, + \ 'monk': { 'left': ';' }, + \ 'mush': { 'left': '#' }, + \ 'named': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'nasm': { 'left': ';' }, + \ 'nastran': { 'left': '$' }, + \ 'natural': { 'left': '/*' }, + \ 'ncf': { 'left': ';' }, + \ 'newlisp': { 'left': ';' }, + \ 'nroff': { 'left': '\"' }, + \ 'nsis': { 'left': '#' }, + \ 'ntp': { 'left': '#' }, + \ 'objc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'objcpp': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'objj': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'ocaml': { 'left': '(*', 'right': '*)' }, + \ 'occam': { 'left': '--' }, + \ 'omlet': { 'left': '(*', 'right': '*)' }, + \ 'omnimark': { 'left': ';' }, + \ 'openroad': { 'left': '//' }, + \ 'opl': { 'left': "REM" }, + \ 'ora': { 'left': '#' }, + \ 'ox': { 'left': '//' }, + \ 'pascal': { 'left': '{','right': '}', 'leftAlt': '(*', 'rightAlt': '*)' }, + \ 'patran': { 'left': '$', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'pcap': { 'left': '#' }, + \ 'pccts': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'pdf': { 'left': '%' }, + \ 'pfmain': { 'left': '//' }, + \ 'php': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'pic': { 'left': ';' }, + \ 'pike': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'pilrc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'pine': { 'left': '#' }, + \ 'plm': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'plsql': { 'left': '--', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'po': { 'left': '#' }, + \ 'postscr': { 'left': '%' }, + \ 'pov': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'povini': { 'left': ';' }, + \ 'ppd': { 'left': '%' }, + \ 'ppwiz': { 'left': ';;' }, + \ 'processing': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'prolog': { 'left': '%', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'ps1': { 'left': '#' }, + \ 'psf': { 'left': '#' }, + \ 'ptcap': { 'left': '#' }, + \ 'python': { 'left': '#' }, + \ 'radiance': { 'left': '#' }, + \ 'ratpoison': { 'left': '#' }, + \ 'r': { 'left': '#' }, + \ 'rc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'rebol': { 'left': ';' }, + \ 'registry': { 'left': ';' }, + \ 'remind': { 'left': '#' }, + \ 'resolv': { 'left': '#' }, + \ 'rgb': { 'left': '!' }, + \ 'rib': { 'left': '#' }, + \ 'robots': { 'left': '#' }, + \ 'sa': { 'left': '--' }, + \ 'samba': { 'left': ';', 'leftAlt': '#' }, + \ 'sass': { 'left': '//', 'leftAlt': '/*' }, + \ 'sather': { 'left': '--' }, + \ 'scala': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'scilab': { 'left': '//' }, + \ 'scsh': { 'left': ';' }, + \ 'sed': { 'left': '#' }, + \ 'sgmldecl': { 'left': '--', 'right': '--' }, + \ 'sgmllnx': { 'left': '' }, + \ 'sicad': { 'left': '*' }, + \ 'simula': { 'left': '%', 'leftAlt': '--' }, + \ 'sinda': { 'left': '$' }, + \ 'skill': { 'left': ';' }, + \ 'slang': { 'left': '%' }, + \ 'slice': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'slrnrc': { 'left': '%' }, + \ 'sm': { 'left': '#' }, + \ 'smarty': { 'left': '{*', 'right': '*}' }, + \ 'smil': { 'left': '' }, + \ 'smith': { 'left': ';' }, + \ 'sml': { 'left': '(*', 'right': '*)' }, + \ 'snnsnet': { 'left': '#' }, + \ 'snnspat': { 'left': '#' }, + \ 'snnsres': { 'left': '#' }, + \ 'snobol4': { 'left': '*' }, + \ 'spec': { 'left': '#' }, + \ 'specman': { 'left': '//' }, + \ 'spectre': { 'left': '//', 'leftAlt': '*' }, + \ 'spice': { 'left': '$' }, + \ 'sql': { 'left': '--' }, + \ 'sqlforms': { 'left': '--' }, + \ 'sqlj': { 'left': '--' }, + \ 'sqr': { 'left': '!' }, + \ 'squid': { 'left': '#' }, + \ 'st': { 'left': '"' }, + \ 'stp': { 'left': '--' }, + \ 'systemverilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'tads': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'tags': { 'left': ';' }, + \ 'tak': { 'left': '$' }, + \ 'tasm': { 'left': ';' }, + \ 'tcl': { 'left': '#' }, + \ 'texinfo': { 'left': "@c " }, + \ 'texmf': { 'left': '%' }, + \ 'tf': { 'left': ';' }, + \ 'tidy': { 'left': '#' }, + \ 'tli': { 'left': '#' }, + \ 'tmux': { 'left': '#' }, + \ 'trasys': { 'left': "$" }, + \ 'tsalt': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'tsscl': { 'left': '#' }, + \ 'tssgm': { 'left': "comment = '", 'right': "'" }, + \ 'txt2tags': { 'left': '%' }, + \ 'uc': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'uil': { 'left': '!' }, + \ 'vb': { 'left': "'" }, + \ 'velocity': { 'left': "##", 'right': "", 'leftAlt': '#*', 'rightAlt': '*#' }, + \ 'vera': { 'left': '/*','right': '*/', 'leftAlt': '//' }, + \ 'verilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'verilog_systemverilog': { 'left': '//', 'leftAlt': '/*', 'rightAlt': '*/' }, + \ 'vgrindefs': { 'left': '#' }, + \ 'vhdl': { 'left': '--' }, + \ 'vimperator': { 'left': '"' }, + \ 'virata': { 'left': '%' }, + \ 'vrml': { 'left': '#' }, + \ 'vsejcl': { 'left': '/*' }, + \ 'webmacro': { 'left': '##' }, + \ 'wget': { 'left': '#' }, + \ 'Wikipedia': { 'left': '' }, + \ 'winbatch': { 'left': ';' }, + \ 'wml': { 'left': '#' }, + \ 'wvdial': { 'left': ';' }, + \ 'xdefaults': { 'left': '!' }, + \ 'xkb': { 'left': '//' }, + \ 'xmath': { 'left': '#' }, + \ 'xpm2': { 'left': '!' }, + \ 'xquery': { 'left': '(:', 'right': ':)' }, + \ 'z8a': { 'left': ';' } + \ } " Section: Comment mapping functions, autocommands and commands {{{1 " ============================================================================ @@ -88,677 +397,33 @@ augroup END " 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 -" MapDelimiters or MapDelimitersWithAlternative passing in these delimiters. -" " Args: " -filetype: the filetype to set delimiters for " -forceReset: 1 if the delimiters should be reset if they have already be " set for this buffer. " function s:SetUpForNewFiletype(filetype, forceReset) - "if we have already set the delimiters for this buffer then dont go thru - "it again - if !a:forceReset && exists("b:NERDLeft") && b:NERDLeft != '' - return - endif - let b:NERDSexyComMarker = '' - "check the filetype against all known filetypes to see if we have - "hardcoded the comment delimiters to use - if a:filetype ==? "" - call s:MapDelimiters('', '') - elseif a:filetype ==? "aap" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "abc" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "acedb" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "actionscript" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "ada" - call s:MapDelimitersWithAlternative('--','', '-- ', '') - elseif a:filetype ==? "ahdl" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "ahk" - call s:MapDelimitersWithAlternative(';', '', '/*', '*/') - elseif a:filetype ==? "amiga" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "aml" - call s:MapDelimiters('/*', '') - elseif a:filetype ==? "ampl" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "apache" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "apachestyle" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "asciidoc" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "applescript" - call s:MapDelimitersWithAlternative('--', '', '(*', '*)') - elseif a:filetype ==? "asm68k" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "asm" - call s:MapDelimitersWithAlternative(';', '', '#', '') - elseif a:filetype ==? "asn" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "aspvbs" - call s:MapDelimiters('''', '') - elseif a:filetype ==? "asterisk" - call s:MapDelimiters(';', '') - 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 ==? "ave" - call s:MapDelimiters("'",'') - elseif a:filetype ==? "awk" - call s:MapDelimiters('#','') - elseif a:filetype ==? "basic" - call s:MapDelimitersWithAlternative("'",'', 'REM ', '') - elseif a:filetype ==? "bbx" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "bc" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "bib" - call s:MapDelimiters('%','') - elseif a:filetype ==? "bindzone" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "bst" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "btm" - call s:MapDelimiters('::', '') - elseif a:filetype ==? "caos" - call s:MapDelimiters('*', '') - elseif a:filetype ==? "calibre" - call s:MapDelimiters('//','') - 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" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "ch" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "cl" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "clean" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "clipper" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "clojure" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "cmake" - call s:MapDelimiters('#','') - elseif a:filetype ==? "conkyrc" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "cpp" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "crontab" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "cs" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "csp" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "cterm" - call s:MapDelimiters('*', '') - elseif a:filetype ==? "cucumber" - call s:MapDelimiters('#','') - elseif a:filetype ==? "cvs" - call s:MapDelimiters('CVS:','') - elseif a:filetype ==? "d" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "dcl" - call s:MapDelimiters('$!', '') - elseif a:filetype ==? "dakota" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "debcontrol" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "debsources" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "def" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "desktop" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "dhcpd" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "diff" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "django" - call s:MapDelimitersWithAlternative('', '{#', '#}') - elseif a:filetype ==? "docbk" - call s:MapDelimiters('') - elseif a:filetype ==? "dns" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "dosbatch" - call s:MapDelimitersWithAlternative('REM ','', '::', '') - elseif a:filetype ==? "dosini" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "dot" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "dracula" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "dsl" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "dtml" - call s:MapDelimiters('','') - elseif a:filetype ==? "dylan" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? 'ebuild' - call s:MapDelimiters('#', '') - elseif a:filetype ==? "ecd" - call s:MapDelimiters('#', '') - elseif a:filetype ==? 'eclass' - call s:MapDelimiters('#', '') - elseif a:filetype ==? "eiffel" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "elf" - call s:MapDelimiters("'", '') - elseif a:filetype ==? "elmfilt" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "erlang" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "eruby" - call s:MapDelimitersWithAlternative('<%#', '%>', '') - elseif a:filetype ==? "expect" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "exports" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "factor" - call s:MapDelimitersWithAlternative('! ', '', '!# ', '') - elseif a:filetype ==? "fgl" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "focexec" - call s:MapDelimiters('-*', '') - elseif a:filetype ==? "form" - call s:MapDelimiters('*', '') - elseif a:filetype ==? "foxpro" - call s:MapDelimiters('*', '') - elseif a:filetype ==? "fstab" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "fvwm" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "fx" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "gams" - call s:MapDelimiters('*', '') - elseif a:filetype ==? "gdb" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "gdmo" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "geek" - call s:MapDelimiters('GEEK_COMMENT:', '') - elseif a:filetype ==? "genshi" - call s:MapDelimitersWithAlternative('', '{#', '#}') - elseif a:filetype ==? "gentoo-conf-d" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "gentoo-env-d" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "gentoo-init-d" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "gentoo-make-conf" - call s:MapDelimiters('#', '') - elseif a:filetype ==? 'gentoo-package-keywords' - call s:MapDelimiters('#', '') - elseif a:filetype ==? 'gentoo-package-mask' - call s:MapDelimiters('#', '') - elseif a:filetype ==? 'gentoo-package-use' - call s:MapDelimiters('#', '') - elseif a:filetype ==? 'gitcommit' - call s:MapDelimiters('#', '') - elseif a:filetype ==? 'gitconfig' - call s:MapDelimiters(';', '') - elseif a:filetype ==? 'gitrebase' - call s:MapDelimiters('#', '') - elseif a:filetype ==? "gnuplot" - call s:MapDelimiters('#','') - elseif a:filetype ==? "groovy" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "gtkrc" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "haskell" - call s:MapDelimitersWithAlternative('{-','-}', '--', '') - elseif a:filetype ==? "hb" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "h" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "haml" - call s:MapDelimitersWithAlternative('-#', '', '/', '') - elseif a:filetype ==? "hercules" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "hog" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "hostsaccess" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "htmlcheetah" - call s:MapDelimiters('##','') - elseif a:filetype ==? "htmldjango" - call s:MapDelimitersWithAlternative('', '{#', '#}') - elseif a:filetype ==? "htmlos" - call s:MapDelimiters('#','/#') - elseif a:filetype ==? "ia64" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "icon" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "idlang" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "idl" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "inform" - call s:MapDelimiters('!', '') - elseif a:filetype ==? "inittab" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "ishd" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "iss" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "ist" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "java" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "javacc" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "javascript" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype == "javascript.jquery" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "jess" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "jgraph" - call s:MapDelimiters('(*','*)') - elseif a:filetype ==? "jproperties" - call s:MapDelimiters('#','') - elseif a:filetype ==? "jsp" - call s:MapDelimiters('<%--', '--%>') - elseif a:filetype ==? "kix" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "kscript" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "lace" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "ldif" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "lilo" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "lilypond" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "liquid" - call s:MapDelimiters('{%', '%}') - elseif a:filetype ==? "lisp" - call s:MapDelimitersWithAlternative(';','', '#|', '|#') - elseif a:filetype ==? "llvm" - call s:MapDelimiters(';','') - elseif a:filetype ==? "lotos" - call s:MapDelimiters('(*','*)') - elseif a:filetype ==? "lout" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "lprolog" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "lscript" - call s:MapDelimiters("'", '') - elseif a:filetype ==? "lss" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "lua" - call s:MapDelimitersWithAlternative('--','', '--[[', ']]') - elseif a:filetype ==? "lynx" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "lytex" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "mail" - call s:MapDelimiters('> ','') - elseif a:filetype ==? "mako" - call s:MapDelimiters('##', '') - elseif a:filetype ==? "man" - call s:MapDelimiters('."', '') - elseif a:filetype ==? "map" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "maple" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "markdown" - call s:MapDelimiters('') - elseif a:filetype ==? "masm" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "mason" - call s:MapDelimiters('<% #', '%>') - elseif a:filetype ==? "master" - call s:MapDelimiters('$', '') - elseif a:filetype ==? "matlab" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "mel" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "mib" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "mkd" - call s:MapDelimiters('>', '') - elseif a:filetype ==? "mma" - 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 ==? "mush" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "named" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "nasm" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "nastran" - call s:MapDelimiters('$', '') - elseif a:filetype ==? "natural" - call s:MapDelimiters('/*', '') - elseif a:filetype ==? "ncf" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "newlisp" - call s:MapDelimiters(';','') - elseif a:filetype ==? "nroff" - call s:MapDelimiters('\"', '') - elseif a:filetype ==? "nsis" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "ntp" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "objc" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "objcpp" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "objj" - 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" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "openroad" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "opl" - call s:MapDelimiters("REM", "") - elseif a:filetype ==? "ora" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "ox" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "pascal" - call s:MapDelimitersWithAlternative('{','}', '(*', '*)') - elseif a:filetype ==? "patran" - call s:MapDelimitersWithAlternative('$','','/*', '*/') - elseif a:filetype ==? "pcap" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "pccts" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "pdf" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "pfmain" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "php" - call s:MapDelimitersWithAlternative('//','','/*', '*/') - elseif a:filetype ==? "pic" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "pike" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "pilrc" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "pine" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "plm" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "plsql" - call s:MapDelimitersWithAlternative('--', '', '/*', '*/') - elseif a:filetype ==? "po" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "postscr" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "pov" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "povini" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "ppd" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "ppwiz" - call s:MapDelimiters(';;', '') - elseif a:filetype ==? "processing" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "prolog" - call s:MapDelimitersWithAlternative('%','','/*','*/') - elseif a:filetype ==? "ps1" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "psf" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "ptcap" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "radiance" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "ratpoison" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "r" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "rc" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "rebol" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "registry" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "remind" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "resolv" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "rgb" - call s:MapDelimiters('!', '') - elseif a:filetype ==? "rib" - call s:MapDelimiters('#','') - elseif a:filetype ==? "robots" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "sa" - call s:MapDelimiters('--','') - elseif a:filetype ==? "samba" - call s:MapDelimitersWithAlternative(';','', '#', '') - elseif a:filetype ==? "sass" - call s:MapDelimitersWithAlternative('//','', '/*', '') - elseif a:filetype ==? "sather" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "scala" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "scilab" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "scsh" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "sed" - 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" - call s:MapDelimitersWithAlternative('%', '', '--', '') - elseif a:filetype ==? "sinda" - call s:MapDelimiters('$', '') - elseif a:filetype ==? "skill" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "slang" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "slice" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "slrnrc" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "sm" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "smarty" - call s:MapDelimiters('{*', '*}') - 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" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "snnspat" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "snnsres" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "snobol4" - call s:MapDelimiters('*', '') - elseif a:filetype ==? "spec" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "specman" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "spectre" - call s:MapDelimitersWithAlternative('//', '', '*', '') - elseif a:filetype ==? "spice" - call s:MapDelimiters('$', '') - elseif a:filetype ==? "sql" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "sqlforms" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "sqlj" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "sqr" - call s:MapDelimiters('!', '') - elseif a:filetype ==? "squid" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "st" - call s:MapDelimiters('"','') - elseif a:filetype ==? "stp" - call s:MapDelimiters('--', '') - elseif a:filetype ==? "systemverilog" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "tads" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "tags" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "tak" - call s:MapDelimiters('$', '') - elseif a:filetype ==? "tasm" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "tcl" - 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 ==? "txt2tags" - call s:MapDelimiters('%','') - elseif a:filetype ==? "uc" - call s:MapDelimitersWithAlternative('//','', '/*','*/') - elseif a:filetype ==? "uil" - call s:MapDelimiters('!', '') - elseif a:filetype ==? "vb" - 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 ==? "vimperator" - call s:MapDelimiters('"','') - elseif a:filetype ==? "virata" - call s:MapDelimiters('%', '') - elseif a:filetype ==? "vrml" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "vsejcl" - call s:MapDelimiters('/*', '') - elseif a:filetype ==? "webmacro" - call s:MapDelimiters('##', '') - elseif a:filetype ==? "wget" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "Wikipedia" - call s:MapDelimiters('') - elseif a:filetype ==? "winbatch" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "wml" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "wvdial" - call s:MapDelimiters(';', '') - elseif a:filetype ==? "xdefaults" - call s:MapDelimiters('!', '') - elseif a:filetype ==? "xkb" - call s:MapDelimiters('//', '') - elseif a:filetype ==? "xmath" - call s:MapDelimiters('#', '') - elseif a:filetype ==? "xpm2" - call s:MapDelimiters('!', '') - elseif a:filetype ==? "xquery" - call s:MapDelimiters('(:',':)') - elseif a:filetype ==? "z8a" - call s:MapDelimiters(';', '') - + if has_key(s:delimiterMap, a:filetype) + let b:NERDCommenterDelims = s:delimiterMap[a:filetype] + for i in ['left', 'leftAlt', 'right', 'rightAlt'] + if !has_key(b:NERDCommenterDelims, i) + let b:NERDCommenterDelims[i] = '' + endif + endfor else - - "extract the delims from &commentstring - let left= substitute(&commentstring, '\([^ \t]*\)\s*%s.*', '\1', '') - let right= substitute(&commentstring, '.*%s\s*\(.*\)', '\1', 'g') - call s:MapDelimiters(left,right) - + let b:NERDCommenterDelims = s:CreateDelimMapFromCms() endif -endfunction -" Function: s:MapDelimiters(left, right) function {{{2 -" This function is a wrapper for s:MapDelimiters(left, right, leftAlt, rightAlt, useAlt) and is called when there -" is no alternative comment delimiters for the current filetype -" -" Args: -" -left: the left comment delimiter -" -right: the right comment delimiter -function s:MapDelimiters(left, right) - call s:MapDelimitersWithAlternative(a:left, a:right, "", "") endfunction -" Function: s:MapDelimitersWithAlternative(left, right, leftAlt, rightAlt) function {{{2 -" this function sets up the comment delimiter buffer variables -" -" Args: -" -left: the string defining the comment start delimiter -" -right: the string defining the comment end delimiter -" -leftAlt: the string for the alternative comment style defining the comment start delimiter -" -rightAlt: the string for the alternative comment style defining the comment end delimiter -function s:MapDelimitersWithAlternative(left, right, leftAlt, rightAlt) - if !exists('g:NERD_' . &filetype . '_alt_style') - let b:NERDLeft = a:left - let b:NERDRight = a:right - let b:NERDLeftAlt = a:leftAlt - let b:NERDRightAlt = a:rightAlt - else - let b:NERDLeft = a:leftAlt - let b:NERDRight = a:rightAlt - let b:NERDLeftAlt = a:left - let b:NERDRightAlt = a:right - endif +function s:CreateDelimMapFromCms() + return { + \ 'left': substitute(&commentstring, '\([^ \t]*\)\s*%s.*', '\1', ''), + \ 'right': substitute(&commentstring, '.*%s\s*\(.*\)', '\1', 'g'), + \ 'leftAlt': '', + \ 'rightAlt': '' } endfunction " Function: s:SwitchToAlternativeDelimiters(printMsgs) function {{{2 @@ -773,7 +438,7 @@ endfunction function s:SwitchToAlternativeDelimiters(printMsgs) "if both of the alternative delimiters are empty then there is no "alternative comment style so bail out - if b:NERDLeftAlt == "" && b:NERDRightAlt == "" + if b:NERDCommenterDelims['leftAlt'] == '' && b:NERDCommenterDelims['rightAlt'] == '' if a:printMsgs call s:NerdEcho("Cannot use alternative delimiters, none are specified", 0) endif @@ -781,22 +446,20 @@ function s:SwitchToAlternativeDelimiters(printMsgs) endif "save the current delimiters - let tempLeft = b:NERDLeft - let tempRight = b:NERDRight + let tempLeft = s:Left() + let tempRight = s:Right() "swap current delimiters for alternative - let b:NERDLeft = b:NERDLeftAlt - let b:NERDRight = b:NERDRightAlt + let b:NERDCommenterDelims['left'] = b:NERDCommenterDelims['leftAlt'] + let b:NERDCommenterDelims['right'] = b:NERDCommenterDelims['rightAlt'] "set the previously current delimiters to be the new alternative ones - let b:NERDLeftAlt = tempLeft - let b:NERDRightAlt = tempRight + let b:NERDCommenterDelims['leftAlt'] = tempLeft + let b:NERDCommenterDelims['rightAlt'] = tempRight "tell the user what comment delimiters they are now using if a:printMsgs - let leftNoEsc = b:NERDLeft - let rightNoEsc = b:NERDRight - call s:NerdEcho("Now using " . leftNoEsc . " " . rightNoEsc . " to delimit comments", 1) + call s:NerdEcho("Now using " . s:Left() . " " . s:Right() . " to delimit comments", 1) endif return 1 @@ -808,8 +471,8 @@ endfunction " This function appends comment delimiters at the EOL and places the cursor in " position to start typing the comment function s:AppendCommentToLine() - let left = s:GetLeft(0,1,0) - let right = s:GetRight(0,1,0) + let left = s:Left({'space': 1}) + let right = s:Right({'space': 1}) " get the len of the right delim let lenRight = strlen(right) @@ -915,8 +578,8 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) call setline(currentLine, theLine) if s:CanPlaceCursor(currentLine, lSide) - let leftSpaced = s:GetLeft(0,1,0) - let rightSpaced = s:GetRight(0,1,0) + let leftSpaced = s:Left({'space': 1}) + let rightSpaced = s:Right({'space': 1}) "stick the left delimiter down let theLine = strpart(theLine, 0, lSide-1) . leftSpaced . strpart(theLine, lSide-1) @@ -925,19 +588,19 @@ function s:CommentBlock(top, bottom, lSide, rSide, forceNested ) "stick the right delimiter down let theLine = strpart(theLine, 0, rSide+strlen(leftSpaced)) . rightSpaced . strpart(theLine, rSide+strlen(leftSpaced)) - let firstLeftDelim = s:FindDelimiterIndex(b:NERDLeft, theLine) - let lastRightDelim = s:LastIndexOfDelim(b:NERDRight, theLine) + let firstLeftDelim = s:FindDelimiterIndex(s:Left(), theLine) + let lastRightDelim = s:LastIndexOfDelim(s:Right(), theLine) if firstLeftDelim != -1 && lastRightDelim != -1 let searchStr = strpart(theLine, 0, lastRightDelim) - let searchStr = strpart(searchStr, firstLeftDelim+strlen(b:NERDLeft)) + let searchStr = strpart(searchStr, firstLeftDelim+strlen(s:Left())) "replace the outter most delims in searchStr with "place-holders - let theLineWithPlaceHolders = s:ReplaceDelims(b:NERDLeft, b:NERDRight, g:NERDLPlace, g:NERDRPlace, searchStr) + let theLineWithPlaceHolders = s:ReplaceDelims(s:Left(), s:Right(), g:NERDLPlace, g:NERDRPlace, searchStr) "add the right delimiter onto the line - let theLine = strpart(theLine, 0, firstLeftDelim+strlen(b:NERDLeft)) . theLineWithPlaceHolders . strpart(theLine, lastRightDelim) + let theLine = strpart(theLine, 0, firstLeftDelim+strlen(s:Left())) . theLineWithPlaceHolders . strpart(theLine, lastRightDelim) endif endif endif @@ -977,7 +640,7 @@ function s:CommentLines(forceNested, align, firstLine, lastLine) " gotta add the length of the left delimiter onto the rightAlignIndx cos " we'll be adding a left delim to the line - let rightAlignIndx = rightAlignIndx + strlen(s:GetLeft(0,1,0)) + let rightAlignIndx = rightAlignIndx + strlen(s:Left({'space': 1})) " now we actually comment the lines. Do it line by line let currentLine = a:firstLine @@ -996,19 +659,19 @@ function s:CommentLines(forceNested, align, firstLine, lastLine) " find out if the line is commented using normal delims and/or " alternate ones - let isCommented = s:IsCommented(b:NERDLeft, b:NERDRight, theLine) || s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine) + let isCommented = s:IsCommented(s:Left(), s:Right(), theLine) || s:IsCommented(s:Left({'alt': 1}), s:Right({'alt': 1}), theLine) " check if we can comment this line if !isCommented || g:NERDUsePlaceHolders || s:Multipart() if a:align == "left" || a:align == "both" - let theLine = s:AddLeftDelimAligned(s:GetLeft(0,1,0), theLine, leftAlignIndx) + let theLine = s:AddLeftDelimAligned(s:Left({'space': 1}), theLine, leftAlignIndx) else - let theLine = s:AddLeftDelim(s:GetLeft(0,1,0), theLine) + let theLine = s:AddLeftDelim(s:Left({'space': 1}), theLine) endif if a:align == "both" - let theLine = s:AddRightDelimAligned(s:GetRight(0,1,0), theLine, rightAlignIndx) + let theLine = s:AddRightDelimAligned(s:Right({'space': 1}), theLine, rightAlignIndx) else - let theLine = s:AddRightDelim(s:GetRight(0,1,0), theLine) + let theLine = s:AddRightDelim(s:Right({'space': 1}), theLine) endif endif endif @@ -1039,7 +702,7 @@ function s:CommentLinesMinimal(firstLine, lastLine) "if we need to use place holders for the comment, make sure they are "enabled for this filetype if !g:NERDUsePlaceHolders && s:DoesBlockHaveMultipartDelim(a:firstLine, a:lastLine) - throw 'NERDCommenter.Settings exception: Placeoholders are required but disabled.' + throw 'NERDCommenter.Settings exception: Place holders are required but disabled.' endif "get the left and right delims to smack on @@ -1145,13 +808,25 @@ function s:CommentLinesSexy(topline, bottomline) " 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, repeat(' ', leftAlignIndx) . left ) + let theLine = repeat(' ', leftAlignIndx) . left + + " Make sure tabs are respected + if !&expandtab + let theLine = s:ConvertLeadingSpacesToTabs(theLine) + endif + call setline(a:topline, theLine) " 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) execute 'normal! o' - call setline(a:bottomline+2, repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right ) + let theLine = repeat(' ', leftAlignIndx) . repeat(' ', strlen(left)-strlen(sexyComMarker)) . right + + " Make sure tabs are respected + if !&expandtab + let theLine = s:ConvertLeadingSpacesToTabs(theLine) + endif + call setline(a:bottomline+2, theLine) endif @@ -1206,8 +881,8 @@ function s:CommentLinesToggle(forceNested, firstLine, lastLine) let theLine = s:SwapOutterMultiPartDelimsForPlaceHolders(theLine) endif - let theLine = s:AddLeftDelim(s:GetLeft(0, 1, 0), theLine) - let theLine = s:AddRightDelim(s:GetRight(0, 1, 0), theLine) + let theLine = s:AddLeftDelim(s:Left({'space': 1}), theLine) + let theLine = s:AddRightDelim(s:Right({'space': 1}), theLine) endif " restore leading tabs if appropriate @@ -1265,7 +940,7 @@ function s:CommentRegion(topLine, topCol, bottomLine, bottomCol, forceNested) endif "stick the cursor back on the char it was on before the comment - call cursor(a:topLine, a:topCol + strlen(b:NERDLeft) + g:NERDSpaceDelims) + call cursor(a:topLine, a:topCol + strlen(s:Left()) + g:NERDSpaceDelims) "if we switched delims then we gotta go back to what they were before if switchedDelims == 1 @@ -1290,7 +965,7 @@ function s:InvertComment(firstLine, lastLine) let sexyComBounds = s:FindBoundingLinesOfSexyCom(currentLine) " if the line is commented normally, uncomment it - if s:IsCommentedFromStartOfLine(b:NERDLeft, theLine) || s:IsCommentedFromStartOfLine(b:NERDLeftAlt, theLine) + if s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine) call s:UncommentLines(currentLine, currentLine) let currentLine = currentLine + 1 @@ -1301,7 +976,7 @@ function s:InvertComment(firstLine, lastLine) "move to the line after last line of the sexy comment let numLinesAfterSexyComRemoved = s:NumLinesInBuf() - let currentLine = bottomBound - (numLinesBeforeSexyComRemoved - numLinesAfterSexyComRemoved) + 1 + let currentLine = sexyComBounds[1] - (numLinesBeforeSexyComRemoved - numLinesAfterSexyComRemoved) + 1 " the line isnt commented else @@ -1326,6 +1001,10 @@ function! NERDComment(isVisual, type) range let oldIgnoreCase = &ignorecase set noignorecase + if !exists("g:did_load_ftplugin") || g:did_load_ftplugin != 1 + call s:NerdEcho("filetype plugins should be enabled. See :help NERDComInstallation and :help :filetype-plugin-on", 0) + endif + if a:isVisual let firstLine = line("'<") let lastLine = line("'>") @@ -1373,7 +1052,7 @@ function! NERDComment(isVisual, type) range elseif a:type == 'toggle' let theLine = getline(firstLine) - if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(b:NERDLeft, theLine) || s:IsCommentedFromStartOfLine(b:NERDLeftAlt, theLine) + if s:IsInSexyComment(firstLine) || s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine) call s:UncommentLines(firstLine, lastLine) else call s:CommentLinesToggle(forceNested, firstLine, lastLine) @@ -1421,8 +1100,8 @@ endfunction " cursor between them function s:PlaceDelimitersAndInsBetween() " 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) + let left = s:Left({'space': 1}) + let right = s:Right({'space': 1}) let theLine = getline(".") let lineHasLeadTabs = s:HasLeadingTabs(theLine) || (theLine =~ '^ *$' && !&expandtab) @@ -1690,54 +1369,54 @@ 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:NERDLeft, b:NERDRight, b:NERDLeftAlt, b:NERDRightAlt, line) + let lineCommentStatus = s:IsCommentedOuttermost(s:Left(), s:Right(), s:Left({'alt': 1}), s:Right({'alt': 1}), line) - "it is commented with b:NERDLeft and b:NERDRight so remove these delims + "it is commented with s:Left() and s:Right() so remove these delims if lineCommentStatus == 1 - let line = s:RemoveDelimiters(b:NERDLeft, b:NERDRight, line) + let line = s:RemoveDelimiters(s:Left(), s:Right(), line) - "it is commented with b:NERDLeftAlt and b:NERDRightAlt so remove these delims + "it is commented with s:Left({'alt': 1}) and s:Right({'alt': 1}) so remove these delims elseif lineCommentStatus == 2 && g:NERDRemoveAltComs - let line = s:RemoveDelimiters(b:NERDLeftAlt, b:NERDRightAlt, line) + let line = s:RemoveDelimiters(s:Left({'alt': 1}), s:Right({'alt': 1}), 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 else "get the positions of all delim types on the line - let indxLeft = s:FindDelimiterIndex(b:NERDLeft, line) - let indxLeftAlt = s:FindDelimiterIndex(b:NERDLeftAlt, line) - let indxRight = s:FindDelimiterIndex(b:NERDRight, line) - let indxRightAlt = s:FindDelimiterIndex(b:NERDRightAlt, line) + let indxLeft = s:FindDelimiterIndex(s:Left(), line) + let indxLeftAlt = s:FindDelimiterIndex(s:Left({'alt': 1}), line) + let indxRight = s:FindDelimiterIndex(s:Right(), line) + let indxRightAlt = s:FindDelimiterIndex(s:Right({'alt': 1}), line) "remove the outter most left comment delim if indxLeft != -1 && (indxLeft < indxLeftAlt || indxLeftAlt == -1) - let line = s:RemoveDelimiters(b:NERDLeft, '', line) + let line = s:RemoveDelimiters(s:Left(), '', line) elseif indxLeftAlt != -1 - let line = s:RemoveDelimiters(b:NERDLeftAlt, '', line) + let line = s:RemoveDelimiters(s:Left({'alt': 1}), '', line) endif "remove the outter most right comment delim if indxRight != -1 && (indxRight < indxRightAlt || indxRightAlt == -1) - let line = s:RemoveDelimiters('', b:NERDRight, line) + let line = s:RemoveDelimiters('', s:Right(), line) elseif indxRightAlt != -1 - let line = s:RemoveDelimiters('', b:NERDRightAlt, line) + let line = s:RemoveDelimiters('', s:Right({'alt': 1}), line) endif endif - let indxLeft = s:FindDelimiterIndex(b:NERDLeft, line) - let indxLeftAlt = s:FindDelimiterIndex(b:NERDLeftAlt, line) + let indxLeft = s:FindDelimiterIndex(s:Left(), line) + let indxLeftAlt = s:FindDelimiterIndex(s:Left({'alt': 1}), line) let indxLeftPlace = s:FindDelimiterIndex(g:NERDLPlace, line) let indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line) - let indxRightAlt = s:FindDelimiterIndex(b:NERDRightAlt, line) + let indxRightAlt = s:FindDelimiterIndex(s:Right({'alt': 1}), line) let indxRightPlace = s:FindDelimiterIndex(g:NERDRPlace, line) - let right = b:NERDRight - let left = b:NERDLeft + let right = s:Right() + let left = s:Left() if !s:Multipart() - let right = b:NERDRightAlt - let left = b:NERDLeftAlt + let right = s:Right({'alt': 1}) + let left = s:Left({'alt': 1}) endif @@ -1828,7 +1507,7 @@ endfunction " Function: s:AltMultipart() {{{2 " returns 1 if the alternative delims are multipart function s:AltMultipart() - return b:NERDRightAlt != '' + return b:NERDCommenterDelims['rightAlt'] != '' endfunction " Function: s:CanCommentLine(forceNested, line) {{{2 @@ -1899,7 +1578,7 @@ endfunction " -lineNum: the line num of the line to check for commentability function s:CanToggleCommentLine(forceNested, lineNum) let theLine = getline(a:lineNum) - if (s:IsCommentedFromStartOfLine(b:NERDLeft, theLine) || s:IsCommentedFromStartOfLine(b:NERDLeftAlt, theLine)) && !a:forceNested + if (s:IsCommentedFromStartOfLine(s:Left(), theLine) || s:IsCommentedFromStartOfLine(s:Left({'alt': 1}), theLine)) && !a:forceNested return 0 endif @@ -2019,9 +1698,9 @@ endfunction function s:DoesBlockHaveMultipartDelim(top, bottom) if s:HasMultipartDelims() if s:Multipart() - return s:DoesBlockHaveDelim(b:NERDLeft, a:top, a:bottom) || s:DoesBlockHaveDelim(b:NERDRight, a:top, a:bottom) + return s:DoesBlockHaveDelim(s:Left(), a:top, a:bottom) || s:DoesBlockHaveDelim(s:Right(), a:top, a:bottom) else - return s:DoesBlockHaveDelim(b:NERDLeftAlt, a:top, a:bottom) || s:DoesBlockHaveDelim(b:NERDRightAlt, a:top, a:bottom) + return s:DoesBlockHaveDelim(s:Left({'alt': 1}), a:top, a:bottom) || s:DoesBlockHaveDelim(s:Right({'alt': 1}), a:top, a:bottom) endif endif return 0 @@ -2105,11 +1784,11 @@ function s:FindBoundingLinesOfSexyCom(lineNum) let left = '' let right = '' if s:Multipart() - let left = s:GetLeft(0,0,1) - let right = s:GetRight(0,0,1) + let left = s:Left({'esc': 1}) + let right = s:Right({'esc': 1}) elseif s:AltMultipart() - let left = s:GetLeft(1,0,1) - let right = s:GetRight(1,0,1) + let left = s:Left({'alt': 1, 'esc': 1}) + let right = s:Right({'alt': 1, 'esc': 1}) else return [] endif @@ -2163,71 +1842,6 @@ function s:FindBoundingLinesOfSexyCom(lineNum) endfunction -" Function: s:GetLeft(alt, space, esc) {{{2 -" returns the left/left-alternative delimiter -" Args: -" -alt: specifies whether to get left or left-alternative delim -" -space: specifies whether the delim should be spaced or not -" (the space string will only be added if NERDSpaceDelims is set) -" -esc: specifies whether the tricky chars in the delim should be ESCed -function s:GetLeft(alt, space, esc) - let delim = b:NERDLeft - - if a:alt - if b:NERDLeftAlt == '' - return '' - else - let delim = b:NERDLeftAlt - endif - endif - if delim == '' - return '' - endif - - if a:space && g:NERDSpaceDelims - let delim = delim . s:spaceStr - endif - - if a:esc - let delim = s:Esc(delim) - endif - - return delim -endfunction - -" Function: s:GetRight(alt, space, esc) {{{2 -" returns the right/right-alternative delimiter -" Args: -" -alt: specifies whether to get right or right-alternative delim -" -space: specifies whether the delim should be spaced or not -" (the space string will only be added if NERDSpaceDelims is set) -" -esc: specifies whether the tricky chars in the delim should be ESCed -function s:GetRight(alt, space, esc) - let delim = b:NERDRight - - if a:alt - if !s:AltMultipart() - return '' - else - let delim = b:NERDRightAlt - endif - endif - if delim == '' - return '' - endif - - if a:space && g:NERDSpaceDelims - let delim = s:spaceStr . delim - endif - - if a:esc - let delim = s:Esc(delim) - endif - - return delim -endfunction - - " Function: s:GetSexyComMarker() {{{2 " Returns the sexy comment marker for the current filetype. " @@ -2252,14 +1866,14 @@ function s:GetSexyComMarker(space, esc) else "find a comment marker by getting the longest available left delim "(that has a corresponding right delim) and taking the last char - let lenLeft = strlen(b:NERDLeft) - let lenLeftAlt = strlen(b:NERDLeftAlt) + let lenLeft = strlen(s:Left()) + let lenLeftAlt = strlen(s:Left({'alt': 1})) let left = '' let right = '' if s:Multipart() && lenLeft >= lenLeftAlt - let left = b:NERDLeft + let left = s:Left() elseif s:AltMultipart() - let left = b:NERDLeftAlt + let left = s:Left({'alt': 1}) else return -1 endif @@ -2288,8 +1902,8 @@ endfunction " (the space string will only be added if NERDSpaceDelims is set) " -esc: specifies whether the tricky chars in the string are ESCed function s:GetSexyComLeft(space, esc) - let lenLeft = strlen(b:NERDLeft) - let lenLeftAlt = strlen(b:NERDLeftAlt) + let lenLeft = strlen(s:Left()) + let lenLeftAlt = strlen(s:Left({'alt': 1})) let left = '' "assume c style sexy comments if possible @@ -2298,9 +1912,9 @@ function s:GetSexyComLeft(space, esc) else "grab the longest left delim that has a right if s:Multipart() && lenLeft >= lenLeftAlt - let left = b:NERDLeft + let left = s:Left() elseif s:AltMultipart() - let left = b:NERDLeftAlt + let left = s:Left({'alt': 1}) else return -1 endif @@ -2326,8 +1940,8 @@ endfunction " is specified for the current filetype) " -esc: specifies whether the tricky chars in the string are ESCed function s:GetSexyComRight(space, esc) - let lenLeft = strlen(b:NERDLeft) - let lenLeftAlt = strlen(b:NERDLeftAlt) + let lenLeft = strlen(s:Left()) + let lenLeftAlt = strlen(s:Left({'alt': 1})) let right = '' "assume c style sexy comments if possible @@ -2336,9 +1950,9 @@ function s:GetSexyComRight(space, esc) else "grab the right delim that pairs with the longest left delim if s:Multipart() && lenLeft >= lenLeftAlt - let right = b:NERDRight + let right = s:Right() elseif s:AltMultipart() - let right = b:NERDRightAlt + let right = s:Right({'alt': 1}) else return -1 endif @@ -2374,7 +1988,7 @@ endfunction " Function: s:HasCStyleComments() {{{2 " Returns 1 iff the current filetype has c style comment delimiters function s:HasCStyleComments() - return (b:NERDLeft == '/*' && b:NERDRight == '*/') || (b:NERDLeftAlt == '/*' && b:NERDRightAlt == '*/') + return (s:Left() == '/*' && s:Right() == '*/') || (s:Left({'alt': 1}) == '/*' && s:Right({'alt': 1}) == '*/') endfunction " Function: s:IsCommentedNormOrSexy(lineNum) {{{2 @@ -2387,7 +2001,7 @@ function s:IsCommentedNormOrSexy(lineNum) let theLine = getline(a:lineNum) "if the line is commented normally return 1 - if s:IsCommented(b:NERDLeft, b:NERDRight, theLine) || s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine) + if s:IsCommented(s:Left(), s:Right(), theLine) || s:IsCommented(s:Left({'alt': 1}), s:Right({'alt': 1}), theLine) return 1 endif @@ -2603,11 +2217,11 @@ function s:IsSexyComment(topline, bottomline) let left = '' let right = '' if s:Multipart() - let left = b:NERDLeft - let right = b:NERDRight + let left = s:Left() + let right = s:Right() elseif s:AltMultipart() - let left = b:NERDLeftAlt - let right = b:NERDRightAlt + let left = s:Left({'alt': 1}) + let right = s:Right({'alt': 1}) else return 0 endif @@ -2710,6 +2324,28 @@ function s:LastIndexOfDelim(delim, str) endfunction +" Function: s:Left(...) {{{2 +" returns left delimiter data +function s:Left(...) + let params = a:0 ? a:1 : {} + + let delim = has_key(params, 'alt') ? b:NERDCommenterDelims['leftAlt'] : b:NERDCommenterDelims['left'] + + if delim == '' + return '' + endif + + if has_key(params, 'space') && g:NERDSpaceDelims + let delim = delim . s:spaceStr + endif + + if has_key(params, 'esc') + let delim = s:Esc(delim) + endif + + return delim +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. @@ -2732,7 +2368,7 @@ function s:LeftMostIndx(countCommentedLines, countEmptyLines, topline, bottomlin " commented, check it let theLine = getline(currentLine) if a:countEmptyLines || theLine !~ '^[ \t]*$' - if a:countCommentedLines || (!s:IsCommented(b:NERDLeft, b:NERDRight, theLine) && !s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine)) + if a:countCommentedLines || (!s:IsCommented(s:Left(), s:Right(), theLine) && !s:IsCommented(s:Left({'alt': 1}), s:Right({'alt': 1}), 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) @@ -2757,7 +2393,7 @@ endfunction " Function: s:Multipart() {{{2 " returns 1 if the current delims are multipart function s:Multipart() - return b:NERDRight != '' + return s:Right() != '' endfunction " Function: s:NerdEcho(msg, typeOfMsg) {{{2 @@ -2768,10 +2404,10 @@ endfunction function s:NerdEcho(msg, typeOfMsg) if a:typeOfMsg == 0 echohl WarningMsg - echo 'NERDCommenter:' . a:msg + echom 'NERDCommenter:' . a:msg echohl None elseif a:typeOfMsg == 1 - echo 'NERDCommenter:' . a:msg + echom 'NERDCommenter:' . a:msg endif endfunction @@ -2867,6 +2503,28 @@ function s:RestoreScreenState() call setpos(".", t:NERDComOldPos) endfunction +" Function: s:Right(...) {{{2 +" returns right delimiter data +function s:Right(...) + let params = a:0 ? a:1 : {} + + let delim = has_key(params, 'alt') ? b:NERDCommenterDelims['rightAlt'] : b:NERDCommenterDelims['right'] + + if delim == '' + return '' + endif + + if has_key(params, 'space') && g:NERDSpaceDelims + let delim = s:spaceStr . delim + endif + + if has_key(params, 'esc') + let delim = s:Esc(delim) + endif + + return delim +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. @@ -2888,7 +2546,7 @@ function s:RightMostIndx(countCommentedLines, countEmptyLines, topline, bottomli let theLine = getline(currentLine) if a:countEmptyLines || theLine !~ '^[ \t]*$' - if a:countCommentedLines || (!s:IsCommented(b:NERDLeft, b:NERDRight, theLine) && !s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, theLine)) + if a:countCommentedLines || (!s:IsCommented(s:Left(), s:Right(), theLine) && !s:IsCommented(s:Left({'alt': 1}), s:Right({'alt': 1}), theLine)) " update rightMostIndx if need be let theLine = s:ConvertLeadingTabsToSpaces(theLine) @@ -2923,20 +2581,20 @@ endfunction function s:SwapOutterMultiPartDelimsForPlaceHolders(line) " find out if the line is commented using normal delims and/or " alternate ones - let isCommented = s:IsCommented(b:NERDLeft, b:NERDRight, a:line) - let isCommentedAlt = s:IsCommented(b:NERDLeftAlt, b:NERDRightAlt, a:line) + let isCommented = s:IsCommented(s:Left(), s:Right(), a:line) + let isCommentedAlt = s:IsCommented(s:Left({'alt': 1}), s:Right({'alt': 1}), a:line) let line2 = a:line "if the line is commented and there is a right delimiter, replace "the delims with place-holders if isCommented && s:Multipart() - let line2 = s:ReplaceDelims(b:NERDLeft, b:NERDRight, g:NERDLPlace, g:NERDRPlace, a:line) + let line2 = s:ReplaceDelims(s:Left(), s:Right(), g:NERDLPlace, g:NERDRPlace, a:line) "similarly if the line is commented with the alternative "delimiters elseif isCommentedAlt && s:AltMultipart() - let line2 = s:ReplaceDelims(b:NERDLeftAlt, b:NERDRightAlt, g:NERDLPlace, g:NERDRPlace, a:line) + let line2 = s:ReplaceDelims(s:Left({'alt': 1}), s:Right({'alt': 1}), g:NERDLPlace, g:NERDRPlace, a:line) endif return line2 @@ -2952,11 +2610,11 @@ function s:SwapOutterPlaceHoldersForMultiPartDelims(line) let left = '' let right = '' if s:Multipart() - let left = b:NERDLeft - let right = b:NERDRight + let left = s:Left() + let right = s:Right() elseif s:AltMultipart() - let left = b:NERDLeftAlt - let right = b:NERDRightAlt + let left = s:Left({'alt': 1}) + let right = s:Right({'alt': 1}) endif let line = s:ReplaceDelims(g:NERDLPlace, g:NERDRPlace, left, right, a:line) @@ -3072,21 +2730,21 @@ function! s:CreateMaps(target, combo) endfunction if g:NERDCreateDefaultMappings - call s:CreateMaps('NERDCommenterComment', ',cc') - call s:CreateMaps('NERDCommenterToggle', ',c') - call s:CreateMaps('NERDCommenterMinimal', ',cm') - call s:CreateMaps('NERDCommenterSexy', ',cs') - call s:CreateMaps('NERDCommenterInvert', ',ci') - call s:CreateMaps('NERDCommenterYank', ',cy') - call s:CreateMaps('NERDCommenterAlignLeft', ',cl') - call s:CreateMaps('NERDCommenterAlignBoth', ',cb') - call s:CreateMaps('NERDCommenterNest', ',cn') - call s:CreateMaps('NERDCommenterUncomment', ',cu') - call s:CreateMaps('NERDCommenterToEOL', ',c$') - call s:CreateMaps('NERDCommenterAppend', ',cA') + call s:CreateMaps('NERDCommenterComment', 'cc') + call s:CreateMaps('NERDCommenterToggle', 'c') + call s:CreateMaps('NERDCommenterMinimal', 'cm') + call s:CreateMaps('NERDCommenterSexy', 'cs') + call s:CreateMaps('NERDCommenterInvert', 'ci') + call s:CreateMaps('NERDCommenterYank', 'cy') + call s:CreateMaps('NERDCommenterAlignLeft', 'cl') + call s:CreateMaps('NERDCommenterAlignBoth', 'cb') + call s:CreateMaps('NERDCommenterNest', 'cn') + call s:CreateMaps('NERDCommenterUncomment', 'cu') + call s:CreateMaps('NERDCommenterToEOL', 'c$') + call s:CreateMaps('NERDCommenterAppend', 'cA') if !hasmapto('NERDCommenterAltDelims', 'n') - nmap ,ca NERDCommenterAltDelims + nmap ca NERDCommenterAltDelims endif endif