diff options
-rw-r--r-- | configs/nvim/init.lua | 53 | ||||
-rw-r--r-- | configs/nvim/lazy-lock.json | 12 | ||||
-rw-r--r-- | configs/nvim/lua/plugins.lua | 15 | ||||
-rw-r--r-- | configs/nvim/lua/plugins/nvim-autopairs.lua | 2 |
4 files changed, 82 insertions, 0 deletions
diff --git a/configs/nvim/init.lua b/configs/nvim/init.lua index e849071..0b423a1 100644 --- a/configs/nvim/init.lua +++ b/configs/nvim/init.lua @@ -5,10 +5,63 @@ vim.opt.fileformats = "unix,dos"; vim.opt.softtabstop = 4; vim.opt.shiftwidth = 4; vim.opt.expandtab = true; +vim.opt.wrap = false; if vim.g.neovide then + vim.opt.guifont = "FiraCodeNerdFont"; vim.g.neovide_transparency = 0.95; vim.g.neovide_input_ime = false; vim.g.neovide_cursor_vfx_mode = "railgun"; end +-- Init lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.uv.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Use lazy.nvim +require("lazy").setup("plugins") + +-- setup nvim-cmp +local cmp = require("cmp") + +cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + }) +}) + +-- setup lsp +local capabilities = require("cmp_nvim_lsp").default_capabilities() +local lspconfig = require("lspconfig") + +lspconfig.clangd.setup { + capabilities = capabilites +} + diff --git a/configs/nvim/lazy-lock.json b/configs/nvim/lazy-lock.json new file mode 100644 index 0000000..9f1e4fa --- /dev/null +++ b/configs/nvim/lazy-lock.json @@ -0,0 +1,12 @@ +{ + "LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, + "lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" }, + "nvim-autopairs": { "branch": "master", "commit": "35493556b895f54c129918aca43ae9a63af42a1f" }, + "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, + "nvim-lspconfig": { "branch": "master", "commit": "0517d8522dcec286b1dba47aa3ee1ed8f523aed6" } +}
\ No newline at end of file diff --git a/configs/nvim/lua/plugins.lua b/configs/nvim/lua/plugins.lua new file mode 100644 index 0000000..cc2b31c --- /dev/null +++ b/configs/nvim/lua/plugins.lua @@ -0,0 +1,15 @@ +return { + "neovim/nvim-lspconfig", + "hrsh7th/nvim-cmp", + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "L3MON4D3/LuaSnip", + "saadparwaiz1/cmp_luasnip", + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {} + } +} diff --git a/configs/nvim/lua/plugins/nvim-autopairs.lua b/configs/nvim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..acfa202 --- /dev/null +++ b/configs/nvim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,2 @@ +return { "windwp/nvim-autopairs", event = +"InsertEnter", opts = {} } |