summaryrefslogtreecommitdiff
path: root/config/nvim-2/nvim/vscript/lua.vim
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /config/nvim-2/nvim/vscript/lua.vim
Diffstat (limited to 'config/nvim-2/nvim/vscript/lua.vim')
-rw-r--r--config/nvim-2/nvim/vscript/lua.vim87
1 files changed, 87 insertions, 0 deletions
diff --git a/config/nvim-2/nvim/vscript/lua.vim b/config/nvim-2/nvim/vscript/lua.vim
new file mode 100644
index 0000000..aa14c46
--- /dev/null
+++ b/config/nvim-2/nvim/vscript/lua.vim
@@ -0,0 +1,87 @@
+lua << EOF
+
+vim.o.termguicolors = true
+
+local on_attach = function(client, bufnr)
+ local opts = { buffer = bufnr, remap = false }
+
+ vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
+ vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
+ vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
+ vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
+ vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
+ vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
+ vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
+end
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "lua" },
+ callback = function()
+ vim.lsp.start({
+ name = "lua_ls",
+ cmd = { "lua-language-server" },
+ on_attach = on_attach,
+ })
+ end,
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "python" },
+ callback = function()
+ vim.lsp.start({
+ name = "pyright",
+ cmd = { "pyright-langserver", "--stdio" },
+ on_attach = on_attach,
+ })
+ end,
+})
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "c", "cpp" },
+ callback = function()
+ vim.lsp.start({
+ name = "clangd",
+ cmd = { "clangd" },
+ on_attach = on_attach,
+ })
+ end,
+})
+
+local cmp = require("cmp")
+
+cmp.setup({
+ snippet = {
+ expand = function(args)
+ vim.snippet.expand(args.body)
+ end,
+ },
+
+ mapping = cmp.mapping.preset.insert({
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<CR>"] = cmp.mapping.confirm({ select = true }),
+ }),
+
+ sources = cmp.config.sources({
+ { name = "nvim_lsp" },
+ { name = "buffer" },
+ }),
+})
+
+vim.diagnostic.config({
+ virtual_text = true,
+ signs = true,
+ underline = true,
+ update_in_insert = false,
+ severity_sort = true,
+
+ float = {
+ border = "rounded",
+ source = true,
+ },
+})
+
+
+--autopairs?
+require("nvim-autopairs").setup()
+
+EOF