2017-11-25 8 views
0

공식 문서에 제시된 예는 C 이며, 또한하지 않는 파이썬NERD 코멘트를 사용하여/코멘트 파이썬 파일의 주석을 해제하는 방법

" Add spaces after comment delimiters by default 
let g:NERDSpaceDelims = 1 

" Use compact syntax for prettified multi-line comments 
let g:NERDCompactSexyComs = 1 

" Align line-wise comment delimiters flush left instead of following code indentation 
let g:NERDDefaultAlign = 'left' 

" Add your own custom formats or override the defaults 
let g:NERDCustomDelimiters = { 'python': { 'left': '#' } } <== 

" Allow commenting and inverting empty lines (useful when commenting a region) 
let g:NERDCommentEmptyLines = 1 

" Enable trimming of trailing whitespace when uncommenting 
let g:NERDTrimTrailingWhitespace = 1 

" 

로 변경하지만 <leader>cc를 쳤을 때 그것이 작동하지 않았고, <leader>cu을 타격하여 작동합니까?

게다가, <leader>cc에서 <leader>c으로 변경하는 것과 같은이 플러그인의 기본 매핑 키를 변경하려면 어떻게해야하나요?

답변

1

NERDCommenter에게 Python을 가르 칠 필요는 없습니다. 주석 접두사가 #이라는 것을 이미 알고 있습니다 (그렇지 않은 경우 Vim의 'commentstring' 옵션으로 돌아가며 파이썬에 대해서도 알고 있습니다).

그래도 작동하지 않으면 플러그인 설치가 손상된 것처럼 보입니다.


:help NERDComMappings에 설명되어 있습니다. 즉, 매핑은 다음과 같습니다

map <Leader>c <Plug>NERDCommenterComment 

다른 NERDCommenter 매핑 <Leader>c 시작으로, 나는이에 대해 조언한다. Vim은 매핑이 완료되었는지 또는 입력을 계속할지 여부를 알 수 없기 때문에 매핑이 적용될 때까지 지연이 발생합니다. 그 것을 제거하는 유일한 방법은 다른 모든 NERDCommenter 매핑을 재 매핑/삭제하는 것입니다. 시간 초과로 인해 기본값 인 <Leader>cc은 실제로 생각한 것보다 실행이 빠릅니다.