Adjusting COC
This commit is contained in:
@@ -17,26 +17,49 @@
|
||||
"coc-tsserver",
|
||||
"coc-lua",
|
||||
"coc-sh",
|
||||
"coc-go"
|
||||
"coc-go",
|
||||
"coc-prettier",
|
||||
"coc-eslint",
|
||||
"coc-markdownlint",
|
||||
"coc-vimlsp"
|
||||
],
|
||||
"pyright.enable": true,
|
||||
"python.analysis.autoImportCompletions": true,
|
||||
"python.analysis.autoSearchPaths": true,
|
||||
"python.analysis.diagnosticMode": "workspace",
|
||||
"rust-analyzer.enable": true,
|
||||
"rust-analyzer.cargo.loadOutDirsFromCheck": true,
|
||||
"rust-analyzer.procMacro.enable": true,
|
||||
"clangd.enabled": true,
|
||||
"clangd.fallbackFlags": ["-std=c++17"],
|
||||
"html.enable": true,
|
||||
"css.enable": true,
|
||||
"typescript.enable": true,
|
||||
"javascript.enable": true,
|
||||
"eslint.enable": true,
|
||||
"prettier.enable": true,
|
||||
"languageserver": {
|
||||
"zig": {
|
||||
"command": "zls",
|
||||
"filetypes": ["zig"],
|
||||
"rootPatterns": ["build.zig"]
|
||||
"rootPatterns": ["build.zig", "build.zig.zon"],
|
||||
"settings": {
|
||||
"zls": {
|
||||
"enable_snippets": true,
|
||||
"enable_ast_check_diagnostics": true,
|
||||
"enable_build_on_save": true,
|
||||
"build_on_save_step": "check"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nim": {
|
||||
"command": "nimlangserver",
|
||||
"filetypes": ["nim"],
|
||||
"rootPatterns": ["*.nimble", "*.nim"],
|
||||
"trace.server": "verbose",
|
||||
"settings": {
|
||||
"nim": {
|
||||
"nimsuggestPath": "${pkgs.nim}/bin/nimsuggest"
|
||||
"nimsuggestPath": "nimsuggest",
|
||||
"timeout": 120000
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -44,6 +67,27 @@
|
||||
"command": "vls",
|
||||
"filetypes": ["v"],
|
||||
"rootPatterns": ["v.mod"]
|
||||
},
|
||||
"lua": {
|
||||
"command": "lua-language-server",
|
||||
"filetypes": ["lua"],
|
||||
"rootPatterns": [".luarc.json", ".luacheckrc", ".stylua.toml", "stylua.toml", "selene.toml"],
|
||||
"settings": {
|
||||
"Lua": {
|
||||
"runtime": {
|
||||
"version": "LuaJIT"
|
||||
},
|
||||
"diagnostics": {
|
||||
"globals": ["vim"]
|
||||
},
|
||||
"workspace": {
|
||||
"library": {
|
||||
"${3rd}/luv/library": true,
|
||||
"${3rd}/busted/library": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
44
lua/coc.lua
44
lua/coc.lua
@@ -0,0 +1,44 @@
|
||||
-- CoC configuration
|
||||
vim.g.coc_global_extensions = {
|
||||
'coc-json',
|
||||
'coc-html',
|
||||
'coc-css',
|
||||
'coc-python',
|
||||
'coc-clangd',
|
||||
'coc-rust-analyzer',
|
||||
'coc-yaml',
|
||||
'coc-tsserver',
|
||||
'coc-lua',
|
||||
'coc-sh',
|
||||
'coc-go',
|
||||
'coc-prettier',
|
||||
'coc-eslint',
|
||||
'coc-markdownlint',
|
||||
'coc-vimlsp'
|
||||
}
|
||||
|
||||
-- Use <Tab> and <S-Tab> to navigate completion list
|
||||
vim.keymap.set('i', '<Tab>', function()
|
||||
if vim.fn['coc#pum#visible']() == 1 then
|
||||
return vim.fn['coc#pum#next'](1)
|
||||
else
|
||||
return '<Tab>'
|
||||
end
|
||||
end, { expr = true, silent = true })
|
||||
|
||||
vim.keymap.set('i', '<S-Tab>', function()
|
||||
if vim.fn['coc#pum#visible']() == 1 then
|
||||
return vim.fn['coc#pum#prev'](1)
|
||||
else
|
||||
return '<S-Tab>'
|
||||
end
|
||||
end, { expr = true, silent = true })
|
||||
|
||||
-- Use <CR> to confirm completion
|
||||
vim.keymap.set('i', '<CR>', function()
|
||||
if vim.fn['coc#pum#visible']() == 1 then
|
||||
return vim.fn['coc#pum#confirm']()
|
||||
else
|
||||
return '<CR>'
|
||||
end
|
||||
end, { expr = true, silent = true })
|
||||
@@ -187,10 +187,11 @@ vim.api.nvim_create_user_command("Vsplit", function()
|
||||
end, {})
|
||||
|
||||
function _G.ShowDocumentation()
|
||||
if vim.fn.CocAction("hasProvider", "hover") then
|
||||
vim.fn.CocActionAsync("doHover")
|
||||
local filetype = vim.bo.filetype
|
||||
if filetype == "vim" or filetype == "help" then
|
||||
vim.cmd("h " .. vim.fn.expand("<cword>"))
|
||||
else
|
||||
vim.cmd("h " .. vim.bo.filetype)
|
||||
vim.fn.CocActionAsync("doHover")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user