update nvim config for 0.11
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
- tmux
|
- tmux
|
||||||
- tmux-plugin-manager
|
- tmux-plugin-manager
|
||||||
- neovim
|
- neovim
|
||||||
|
- lua-language-server
|
||||||
- stylua
|
- stylua
|
||||||
- luacheck
|
- luacheck
|
||||||
- prettier
|
- prettier
|
||||||
|
|||||||
6
nvim/.config/nvim/.luacheckrc
Normal file
6
nvim/.config/nvim/.luacheckrc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
globals = {
|
||||||
|
"vim",
|
||||||
|
}
|
||||||
|
read_globals = {
|
||||||
|
"Snacks",
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
return {
|
|
||||||
cmd = { "lua-language-server" },
|
|
||||||
root_markers = { ".luarc.json", ".luarc.jsonc" },
|
|
||||||
filetypes = { "lua" },
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
runtime = {
|
|
||||||
version = "LuaJIT",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
17
nvim/.config/nvim/lsp/luals.lua
Normal file
17
nvim/.config/nvim/lsp/luals.lua
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
return {
|
||||||
|
cmd = { "lua-language-server" },
|
||||||
|
root_markers = { ".luarc.json", ".luarc.jsonc" },
|
||||||
|
filetypes = { "lua" },
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
completion = { callSnippet = "Both" },
|
||||||
|
hint = { enable = true },
|
||||||
|
workspace = {
|
||||||
|
library = {
|
||||||
|
vim.env.VIMRUNTIME,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
runtime = { version = "LuaJIT" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -15,7 +15,9 @@ vim.w.signcolumn = "yes" -- Keep signcolumn on by default
|
|||||||
vim.opt.updatetime = 250 -- Decrease update time
|
vim.opt.updatetime = 250 -- Decrease update time
|
||||||
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
|
vim.opt.timeoutlen = 300 -- time to wait for a mapped sequence to complete (in milliseconds)
|
||||||
vim.opt.backup = false -- creates a backup file
|
vim.opt.backup = false -- creates a backup file
|
||||||
vim.opt.writebackup = false -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited
|
-- if a file is being edited by another program (or was written to file while editing with another program), it is not
|
||||||
|
-- allowed to be edited
|
||||||
|
vim.opt.writebackup = false
|
||||||
vim.opt.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience
|
vim.opt.completeopt = "menuone,noselect" -- Set completeopt to have a better completion experience
|
||||||
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
|
vim.opt.termguicolors = true -- set termguicolors to enable highlight groups
|
||||||
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
|
vim.opt.whichwrap = "bs<>[]hl" -- which "horizontal" keys are allowed to travel to prev/next line
|
||||||
@@ -43,7 +45,9 @@ vim.opt.autoindent = true
|
|||||||
|
|
||||||
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
|
vim.opt.shortmess:append("c") -- don't give |ins-completion-menu| messages
|
||||||
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
|
vim.opt.iskeyword:append("-") -- hyphenated words recognized by searches
|
||||||
vim.opt.formatoptions:remove({ "c", "r", "o" }) -- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter> in insert mode, or hitting 'o' or 'O' in normal mode.
|
-- don't insert the current comment leader automatically for auto-wrapping comments using 'textwidth', hitting <Enter>
|
||||||
|
-- in insert mode, or hitting 'o' or 'O' in normal mode.
|
||||||
|
vim.opt.formatoptions:remove({ "c", "r", "o" })
|
||||||
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
|
vim.opt.runtimepath:remove("/usr/share/vim/vimfiles") -- separate vim plugins from neovim in case vim still in use
|
||||||
|
|
||||||
vim.opt.foldmethod = "expr"
|
vim.opt.foldmethod = "expr"
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
--- [[ LSP setup]]
|
||||||
vim.lsp.config("*", {
|
vim.lsp.config("*", {
|
||||||
capabilities = {
|
capabilities = {
|
||||||
textDocument = {
|
textDocument = {
|
||||||
@@ -6,37 +7,68 @@ vim.lsp.config("*", {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
root_markers = { ".git" },
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.config("lua", {
|
|
||||||
filetypes = { "lua" },
|
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.config("rust", {
|
vim.lsp.config("rust", {
|
||||||
filetypes = { "rust" },
|
filetypes = { "rust" },
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.enable("lua")
|
vim.lsp.enable("luals")
|
||||||
vim.lsp.enable("rust")
|
vim.lsp.enable("rust")
|
||||||
-- vim.lsp.completion.enable(true)
|
|
||||||
|
---[[AUTOCOMPLETION SETUP
|
||||||
|
vim.o.completeopt = "menuone,noinsert,popup,fuzzy"
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
group = vim.api.nvim_create_augroup("my.lsp", {}),
|
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||||
if client:supports_method("textDocument/implementation") then
|
client.server_capabilities.completionProvider.triggerCharacters = vim.split("qwertyuiopasdfghjklzxcvbnm. ", "")
|
||||||
-- Create a keymap for vim.lsp.buf.implementation ...
|
vim.api.nvim_create_autocmd({ "TextChangedI" }, {
|
||||||
end
|
buffer = args.buf,
|
||||||
-- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y|
|
callback = function()
|
||||||
if client:supports_method("textDocument/completion") then
|
vim.lsp.completion.get()
|
||||||
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
|
end,
|
||||||
-- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
|
})
|
||||||
-- client.server_capabilities.completionProvider.triggerCharacters = chars
|
-- if client:supports_method("textDocument/implementation") then
|
||||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
-- Create a keymap for vim.lsp.buf.implementation ...
|
||||||
end
|
-- end
|
||||||
|
|
||||||
if client.server_capabilities.inlayHintProvider then
|
if client.server_capabilities.inlayHintProvider then
|
||||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
vim.lsp.inlay_hint.enable(true, { bufnr = vim.fn.bufnr() })
|
||||||
end
|
end
|
||||||
|
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||||
|
---
|
||||||
|
---[[Code required to add documentation popup for an item
|
||||||
|
local _, cancel_prev = nil, function() end
|
||||||
|
vim.api.nvim_create_autocmd("CompleteChanged", {
|
||||||
|
buffer = args.buf,
|
||||||
|
callback = function()
|
||||||
|
if client:supports_method("textDocument/implementation") then
|
||||||
|
cancel_prev()
|
||||||
|
local info = vim.fn.complete_info({ "selected" })
|
||||||
|
local completionItem =
|
||||||
|
vim.tbl_get(vim.v.completed_item, "user_data", "nvim", "lsp", "completion_item")
|
||||||
|
if nil == completionItem then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
_, cancel_prev = vim.lsp.buf_request(
|
||||||
|
args.buf,
|
||||||
|
vim.lsp.protocol.Methods.completionItem_resolve,
|
||||||
|
completionItem,
|
||||||
|
function(err, item, ctx)
|
||||||
|
if not item then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local docs = (item.documentation or {}).value
|
||||||
|
local win = vim.api.nvim__complete_set(info["selected"], { info = docs })
|
||||||
|
if win.winid and vim.api.nvim_win_is_valid(win.winid) then
|
||||||
|
vim.treesitter.start(win.bufnr, "markdown")
|
||||||
|
vim.wo[win.winid].conceallevel = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
---]]
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
---AUTOCOMPLETION SETUP END]]
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ local function filestatus()
|
|||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
TabLine = function()
|
function _G.TabLine()
|
||||||
return table.concat({
|
return table.concat({
|
||||||
tab_info(),
|
tab_info(),
|
||||||
filestatus(),
|
filestatus(),
|
||||||
|
|||||||
@@ -22,6 +22,13 @@ return {
|
|||||||
vim.keymap.set("n", "<leader>l", function()
|
vim.keymap.set("n", "<leader>l", function()
|
||||||
lint.try_lint()
|
lint.try_lint()
|
||||||
end, { desc = "Trigger linting for current file" })
|
end, { desc = "Trigger linting for current file" })
|
||||||
|
vim.keymap.set("n", "<leader>d", function()
|
||||||
|
if vim.diagnostic.config().virtual_lines then
|
||||||
|
vim.diagnostic.config({ virtual_lines = false })
|
||||||
|
else
|
||||||
|
vim.diagnostic.config({ virtual_lines = { current_line = true } })
|
||||||
|
end
|
||||||
|
end, { desc = "Toggle inline diagnostics" })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user