diff --git a/after/ftplugin/rust.lua b/after/ftplugin/rust.lua new file mode 100644 index 0000000..4afb6a5 --- /dev/null +++ b/after/ftplugin/rust.lua @@ -0,0 +1,17 @@ +local bufnr = vim.api.nvim_get_current_buf() +local opts = { buffer = bufnr } + +vim.keymap.set("n", "ga", function() + vim.cmd.RustLsp("codeAction") +end, opts) +vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts) + +vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) + +vim.keymap.set("n", "gd", require("telescope.builtin").lsp_definitions, opts) +vim.keymap.set("n", "]d", vim.diagnostic.goto_next, opts) +vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) +vim.keymap.set("n", "rn", vim.lsp.buf.rename, opts) +vim.keymap.set("n", "t", function() + vim.cmd.RustLsp({ "testables" }) +end, opts) diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..faaa810 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,33 @@ +{ + "LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, + "NvChad": { "branch": "v2.5", "commit": "b83a949d9e883b6ab98070f224535f1018174a5d" }, + "base46": { "branch": "v2.5", "commit": "898a0ed96bf4a20e12fae0b11c9bb771334b066f" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, + "conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" }, + "friendly-snippets": { "branch": "main", "commit": "00ba9dd3df89509f95437b8d595553707c46d5ea" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "indent-blankline.nvim": { "branch": "master", "commit": "3af6493bf69e4a857a8b1fab36f333629d413a18" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "menu": { "branch": "main", "commit": "205b3de60bbd1dfa73fd12b04530743cd0e70b22" }, + "minty": { "branch": "main", "commit": "8809b2c7c2edbeb3fa9c3b05bd2e89934d54f526" }, + "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-lspconfig": { "branch": "master", "commit": "39f31e178466e4ed23c8ea6fddd5b7a4d9699398" }, + "nvim-tree.lua": { "branch": "master", "commit": "c9104a5d079db5a158c9562c54689df27d52dccc" }, + "nvim-treesitter": { "branch": "master", "commit": "45386764cc9535200d2288cab929c5093d33660e" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "4a2d05ec24eaa6b655c7d19092a3b6c0219d46b9" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "44fd461b879d80a21d5041f312f070f22551c0bc" }, + "nvim-web-devicons": { "branch": "master", "commit": "6b53401918a9033a41159d012160c5fb5eb249ae" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "rustaceanvim": { "branch": "master", "commit": "29f42cc149f915d771c550b6dfe7c788d856cf04" }, + "telescope.nvim": { "branch": "master", "commit": "eae0d8fbde590b0eaa2f9481948cd6fd7dd21656" }, + "ui": { "branch": "v3.0", "commit": "902cace97a6d1bb6e71274fc867c3e6ff5835ee4" }, + "vim-kitty": { "branch": "main", "commit": "9cc594a634308aa3bfaf3da5b5e741da1c0144c1" }, + "volt": { "branch": "main", "commit": "ce1e55d52d86e33f340a20b45701b434cc684c15" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" } +} diff --git a/lua/configs/lspconfig.lua b/lua/configs/lspconfig.lua index 478df01..82351cd 100644 --- a/lua/configs/lspconfig.lua +++ b/lua/configs/lspconfig.lua @@ -4,7 +4,7 @@ require("nvchad.configs.lspconfig").defaults() local lspconfig = require "lspconfig" -- EXAMPLE -local servers = { "html", "cssls" } +local servers = { "html", "cssls", "lua_ls", "biome" } local nvlsp = require "nvchad.configs.lspconfig" -- lsps with default config diff --git a/lua/mappings.lua b/lua/mappings.lua index 783b78f..75f45a1 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -7,4 +7,13 @@ local map = vim.keymap.set map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "") --- map({ "n", "i", "v" }, "", " w ") +-- close current buffer +map("n", "q", ":q") + +-- go back to normal mode +map("i", "jj", "") +map("i", "jk", "") + +--save file +map("n", "", ":update") +map("i", "", ":update") diff --git a/lua/options.lua b/lua/options.lua index 738f20b..04d4a06 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -2,5 +2,16 @@ require "nvchad.options" -- add yours here! --- local o = vim.o + +local o = vim.o -- o.cursorlineopt ='both' -- to enable cursorline! +o.cursorlineopt = 'both' + +-- line numbering +o.number = true +o.relativenumber = true + +-- search options +o.showmatch = true +o.smartcase = true +o.gdefault = true diff --git a/lua/plugins/editing.lua b/lua/plugins/editing.lua new file mode 100644 index 0000000..2436b47 --- /dev/null +++ b/lua/plugins/editing.lua @@ -0,0 +1,14 @@ +return { + { + "m4xshen/hardtime.nvim", + dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" }, + opts = { + restricted_keys = { + ["w"] = { "n", "x" }, + ["W"] = { "n", "x" }, + ["b"] = { "n", "x" }, + ["B"] = { "n", "x" }, + }, + }, + }, +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 6474776..bec766f 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -4,22 +4,4 @@ return { -- event = 'BufWritePre', -- uncomment for format on save opts = require "configs.conform", }, - - -- These are some examples, uncomment them if you want to see them work! - { - "neovim/nvim-lspconfig", - config = function() - require "configs.lspconfig" - end, - }, - - -- { - -- "nvim-treesitter/nvim-treesitter", - -- opts = { - -- ensure_installed = { - -- "vim", "lua", "vimdoc", - -- "html", "css" - -- }, - -- }, - -- }, } diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..789d0d1 --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,14 @@ +return { + { + "neovim/nvim-lspconfig", + config = function() + require "configs.lspconfig" + end, + }, + + { + "mrcjkb/rustaceanvim", + version = "^5", -- Recommended + lazy = false, -- This plugin is already lazy + }, +} diff --git a/lua/plugins/syntax.lua b/lua/plugins/syntax.lua new file mode 100644 index 0000000..6c27abd --- /dev/null +++ b/lua/plugins/syntax.lua @@ -0,0 +1,3 @@ +return { + { "fladson/vim-kitty" }, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d761cf8 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,48 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + "nvim-treesitter/nvim-treesitter-textobjects", + }, + opts = { + ensure_installed = { + "vim", + "lua", + "vimdoc", + "html", + "css", + "rust", + "regex", + "javascript", + "typescript", + "tsx", + "solidity", + "toml", + "bash", + "markdown", + "markdown_inline", + "json", + "elixir", + "erlang", + "eex", + "kdl", + "yuck", + "sql", + "typst" + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = "", + node_decremental = "", + }, + }, + textobjects = { + select = { enable = true }, + }, + }, + }, +}