简体   繁体   English

'=' 预计在 'g' neovim lsp 配置初始化文件附近

[英]'=' expected near 'g' neovim lsp config init file

I'm trying to setup neovim config using lua config.我正在尝试使用 lua 配置设置 neovim 配置。

I want to use vim-terminator to run current file.我想使用vim-terminator来运行当前文件。

I've my config file in this branch in the repo .我在repo的这个分支中有我的配置文件。

I've added the below config of vim-terminator plugin.我添加了以下 vim-terminator 插件的配置。

let g:terminator_runfile_map = {
            \ "javascript": "node",
            \ "python": "python -u",
            \ "c": "gcc $dir$fileName -o $dir$fileNameWithoutExt && $dir$fileNameWithoutExt",
            \ "fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
            \ }

I get the below error -我收到以下错误 -

 Error detected while processing /home/rajkumar/.config/nvim/init.lua: E5113: Error while calling lua chunk: vim/_init_packages.lua:0: /home/rajkumar/.config/nvim/lua/v im-terminator/init.lua:1: '=' expected near 'g' stack traceback: [C]: in function 'error' vim/_init_packages.lua: in function <vim/_init_packages.lua:0> [C]: in function 'require' "." is a directory Press ENTER or type command to continue

在此处输入图像描述

I'm novice in lua.我是 lua 的新手。 Not sure how to fix this error.不知道如何解决这个错误。 Any Idea what I'm missing in my config.任何想法我在我的配置中缺少什么。

let g:terminator_runfile_map = {
            \ "javascript": "node",
            \ "python": "python -u",
            \ "c": "gcc $dir$fileName -o $dir$fileNameWithoutExt && $dir$fileNameWithoutExt",
            \ "fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt"
            \ }

is not valid Lua code.不是有效的 Lua 代码。 let g:terminator_runfile_map =... is Vim script. let g:terminator_runfile_map =...是 Vim 脚本。

If you require this file it is executed as Lua code and hence Lua would first complain about a missing = between let and g because an identifyer alone is not a valid Lua expression.如果您需要此文件,它会作为 Lua 代码执行,因此 Lua 首先会抱怨letg之间缺少= ,因为单独的标识符不是有效的 Lua 表达式。

You're confusing two scripting languages here.您在这里混淆了两种脚本语言。

vim.g.terminator_runfile_map = {
  javascript = "node",
  python = "python -u",
  c = "c": "gcc $dir$fileName -o $dir$fileNameWithoutExt && $dir$fileNameWithoutExt",
  fortran = "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
 }

would be a Lua equivalent.将是 Lua 等价物。 I don't know if this makes sense in nvim context though.我不知道这在 nvim 上下文中是否有意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM