[英]Getting 'E488: Trailing characters' With the following function
Does anyone know why I'm getting the following error? 有谁知道为什么我遇到以下错误? I'm mapping the following function 我正在映射以下功能
function! ToggleCompileErrors()
:if w:syntastic_is_open == 1
:call SyntasticReset()<CR>
let w:syntastic_is_open = 0
:else
:call SyntasticCheck()<CR>
let w:syntastic_is_open = 1
:endif
endfunction
With this command 使用此命令
command ToggleCompileErrors :call ToggleCompileErrors()
and it is getting called by the following keymapping 它被以下键盘映射调用
nnoremap <Leader>b :ToggleCompileErrors<CR>
And I don't know if it makes a difference but I am using neovim 0.2.2 而且我不知道它是否有区别,但是我使用的是neovim 0.2.2
Watch your modes. 观看您的模式。 That <CR>
:help key-notation
is necessary for mappings , but not inside functions, which use Ex commands . 对于映射来说 , <CR>
:help key-notation
是必需的,但对于使用Ex命令的内部函数则不是必需的。
Likewise, you don't need to prefix commands inside a function with :
(and this is rather odd here, especially because you're not even consistent about it). 同样,您不需要在函数内部以:
作为前缀(这在这里很奇怪,特别是因为您甚至对此并不一致)。 :
is a normal mode command that enters command-line mode . :
是进入命令行模式的普通模式命令。 As commands in a function already are Ex commands, the :
is not needed. 作为一个功能的命令已经是Ex命令,则:
不需要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.