From 9d06f129a08819e41d11a7eed84d61d756f32967 Mon Sep 17 00:00:00 2001 From: Juni Kim Date: Fri, 13 Dec 2024 00:55:51 -0500 Subject: [PATCH] neovim lsp works now --- .config/hypr/hyprpaper.conf | 4 +- .config/nvim/lazy-lock.json | 5 +++ .config/nvim/lua/junikim/plugins/lsp.lua | 42 +++++++++++++++++-- .../nvim/lua/junikim/plugins/treesitter.lua | 2 +- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/.config/hypr/hyprpaper.conf b/.config/hypr/hyprpaper.conf index 42e2f51..a16f0e5 100644 --- a/.config/hypr/hyprpaper.conf +++ b/.config/hypr/hyprpaper.conf @@ -1,2 +1,2 @@ -preload = /home/junikim/wallpaper/trees.png -wallpaper = eDP-1, /home/junikim/wallpaper/trees.png +preload = /home/junikim/wallpaper/valley.png +wallpaper = eDP-1, /home/junikim/wallpaper/valley.png diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 45f4764..fb7ee00 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,6 +1,11 @@ { + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, + "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": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "emmet-vim": { "branch": "master", "commit": "6c511a8d7d2863066f32e25543e2bb99d505172c" }, "everforest-nvim": { "branch": "main", "commit": "3598755ade98f87e66415cb0e15d3f99b895bdf8" }, "gitsigns.nvim": { "branch": "main", "commit": "5f808b5e4fef30bd8aca1b803b4e555da07fc412" }, diff --git a/.config/nvim/lua/junikim/plugins/lsp.lua b/.config/nvim/lua/junikim/plugins/lsp.lua index c1390e1..d808bc8 100644 --- a/.config/nvim/lua/junikim/plugins/lsp.lua +++ b/.config/nvim/lua/junikim/plugins/lsp.lua @@ -9,24 +9,57 @@ return { { 'hrsh7th/nvim-cmp', event = 'InsertEnter', + dependencies = { + { "L3MON4D3/LuaSnip" }, + { 'hrsh7th/cmp-nvim-lsp' }, -- Required + { 'hrsh7th/cmp-buffer' }, -- Optional + { 'hrsh7th/cmp-path' }, -- Optional + { 'saadparwaiz1/cmp_luasnip' }, -- Optional + { 'hrsh7th/cmp-nvim-lua' }, -- Optional + }, config = function() local cmp = require('cmp') + local luasnip = require("luasnip") + local cmp_select = { behavior = cmp.SelectBehavior.Select } cmp.setup({ - sources = { + sources = cmp.config.sources({ { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'path' }, + { name = 'buffer' }, + { name = 'nvim_lua' }, + }, { + { name = 'buffer' }, + }), + completion = { + completeopt = 'menu,menuone,noinsert' }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.select_prev_item(cmp_select), [''] = cmp.mapping.select_next_item(cmp_select), - [''] = cmp.mapping.confirm({ select = true }), [""] = cmp.mapping.complete(), - [''] = nil, + [''] = cmp.mapping.select_next_item(cmp_select), [''] = nil, + [""] = cmp.mapping({ + i = function(fallback) + -- and cmp.get_selected_entry() + if cmp.visible() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }) + else + fallback() + end + end, + s = cmp.mapping.confirm({ select = true }), + c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), + }), }), + experimental = { + ghost_text = true + }, snippet = { expand = function(args) - vim.snippet.expand(args.body) + luasnip.lsp_expand(args.body) end, }, }) @@ -42,6 +75,7 @@ return { { 'hrsh7th/cmp-nvim-lsp' }, { 'williamboman/mason.nvim' }, { 'williamboman/mason-lspconfig.nvim' }, + { "L3MON4D3/LuaSnip" } }, init = function() -- Reserve a space in the gutter diff --git a/.config/nvim/lua/junikim/plugins/treesitter.lua b/.config/nvim/lua/junikim/plugins/treesitter.lua index ab9abf9..0498371 100644 --- a/.config/nvim/lua/junikim/plugins/treesitter.lua +++ b/.config/nvim/lua/junikim/plugins/treesitter.lua @@ -13,7 +13,7 @@ return { -- Highlight, edit, and navigate code -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. -- If you are experiencing weird indenting issues, add the language to -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, + disable = { "latex", "perl", "htmldjango" }, }, indent = { enable = true, disable = { 'ruby' } }, },