Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Change nmap \\\ to nmap \\\\ to fix the mapping and get rid of spurious startup message. #16

Open
wants to merge 2 commits into from

3 participants

@mortonfox

In Vim 7.3.754, the nmap \\\ <Plug>CommentaryLine line causes the following message to be displayed every time I start vim:

n  \             <Plug>Commentary

and the \\ mapping does not get defined.

Changing it to nmap \\\\ <Plug>CommentaryLine seems to correct this problem.

@tpope
Owner

Breaks it for me on .547. It's very uncharacteristic of Vim to break backwards compatibility in this way; can you figure out if there's an additional backstory?

@graywh

I don't have this problem on .831. Could it be an issue with 'cpoptions'?

@mortonfox

cpoptions was indeed the reason. My cpoptions setting is missing 'B' and that seems to affect the left side of the mapping too.

I'll revise the patch to temporarily set 'B' in cpoptions instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 19, 2013
  1. @mortonfox
Commits on Jul 22, 2013
  1. @mortonfox
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 0 deletions.
  1. +9 −0 plugin/commentary.vim
View
9 plugin/commentary.vim
@@ -66,10 +66,19 @@ if !hasmapto('<Plug>Commentary') || maparg('gc','n') ==# ''
endif
if maparg('\\','n') ==# '' && maparg('\','n') ==# ''
+
+ " If B is missing from cpoptions, Vim will treat backslashes in the
+ " following mappings as escape sequences, when we actually want these to
+ " be literal backslashes. So temporarily set B in cpoptions.
+ let save_cpo = &cpoptions
+ set cpoptions+=B
+
xmap \\ <Plug>Commentary
nmap \\ <Plug>Commentary
nmap \\\ <Plug>CommentaryLine
nmap \\u <Plug>CommentaryUndo
+
+ let &cpoptions = save_cpo
endif
" vim:set et sw=2:
Something went wrong with that request. Please try again.