Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798-- Autocompletion--- @module 'blink.cmp'--- @type blink.cmp.Configlocal blink_opts = { keymap = { preset = "default" }, appearance = { nerd_font_variant = "mono", }, completion = { documentation = { auto_show = false } },
sources = { default = { "lsp", "path", "snippets", "buffer" }, },
fuzzy = { implementation = "prefer_rust" },}
require("blink.cmp").setup(blink_opts)
-- LSPvim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), callback = function(event) local map = function(keys, func, desc, mode) mode = mode or "n" vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) end
-- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. map("grn", vim.lsp.buf.rename, "[R]e[n]ame")
-- Execute a code action, usually your cursor needs to be on top of an error -- or a suggestion from your LSP for this to activate. map("gra", vim.lsp.buf.code_action, "[G]oto Code [A]ction", { "n", "x" })
-- WARN: This is not Goto Definition, this is Goto Declaration. -- For example, in C this would take you to the header. map("grD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
-- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed -- -- When you move your cursor, the highlights will be cleared (the second autocommand). local client = vim.lsp.get_client_by_id(event.data.client_id) if client and client:supports_method("textDocument/documentHighlight", event.buf) then local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.document_highlight, })
vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { buffer = event.buf, group = highlight_augroup, callback = vim.lsp.buf.clear_references, })
vim.api.nvim_create_autocmd("LspDetach", { group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), callback = function(event2) vim.lsp.buf.clear_references() vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) end, }) end
-- The following code creates a keymap to toggle inlay hints in your -- code, if the language server you are using supports them -- -- This may be unwanted, since they displace some of your code if client and client:supports_method("textDocument/inlayHint", event.buf) then map( "<leader>th", function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) end, "[T]oggle Inlay [H]ints" ) end end,})
vim.lsp.enable("lua_ls")vim.lsp.config("lua_ls", { settings = { Lua = { diagnostics = { globals = { "vim", }, }, }, },})
vim.lsp.enable("rust_analyzer")