From 82fae7bfb4269fe4b1123264bd594c6393784f5c Mon Sep 17 00:00:00 2001 From: Jackson Taylor Date: Tue, 30 Jan 2024 19:58:03 -0500 Subject: NOT WORKING: enable personal snippets --- after/plugin/lsp.lua | 24 ++++++++++++++---------- my_snippets.bak/package.json | 25 +++++++++++++++++++++++++ my_snippets.bak/python.json | 8 ++++++++ my_snippets.bak/snippets/all.json | 16 ++++++++++++++++ my_snippets/lua.json | 7 +++++++ my_snippets/package.json | 25 ------------------------- my_snippets/python.json | 8 -------- my_snippets/snippets/all.json | 16 ---------------- 8 files changed, 70 insertions(+), 59 deletions(-) create mode 100644 my_snippets.bak/package.json create mode 100644 my_snippets.bak/python.json create mode 100644 my_snippets.bak/snippets/all.json create mode 100644 my_snippets/lua.json delete mode 100644 my_snippets/package.json delete mode 100644 my_snippets/python.json delete mode 100644 my_snippets/snippets/all.json diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua index a438d00..07ce999 100644 --- a/after/plugin/lsp.lua +++ b/after/plugin/lsp.lua @@ -2,6 +2,7 @@ local lsp = require("lsp-zero") lsp.preset("recommended") +-- Language servers I use most lsp.ensure_installed({ 'tsserver', 'eslint', @@ -10,7 +11,7 @@ lsp.ensure_installed({ 'lua_ls', }) --- Fix Undefined global 'vim' +-- Fix Undefined global 'vim'. Does not work lol, using vim outright is still shown as an issue. lsp.configure('lua-language-server', { settings = { Lua = { @@ -21,18 +22,22 @@ lsp.configure('lua-language-server', { } }) --- require("luasnip.loaders.from_vscode").lazy_load({ paths = { "./my-cool-snippets" } }) -require("luasnip.loaders.from_vscode").lazy_load({paths = {"~/snippets"}}) - -- Autocomplettion engine setup -- This is the drop downs that come up local cmp = require('cmp') +-- Not working as far as I can tell +-- require("luasnip.loaders.from_vscode").lazy_load('~') +require("luasnip.loaders.from_vscode").lazy_load() + cmp.setup({ performance = { debounce = 150 -- I'm pretty sure this is the god-sent setting that I have been looking for -}}) + } +}) + local cmp_select = {behavior = cmp.SelectBehavior.Select} + -- These are the mappings to use to navigate the dropdown menu. I usually use (Enter) the most, or the arrow keys, but these are nice. local cmp_mappings = lsp.defaults.cmp_mappings({ [''] = cmp.mapping.select_prev_item(cmp_select), @@ -50,11 +55,10 @@ lsp.setup_nvim_cmp({ -- NOTE: Priority matters for this. I put buffer on top because I was getting a lot of lag if I happened to type a snippet. -- I feel like what I'm writing is, more often than not, something I've already written so I don't mind scrolling down in the list if I have to make a function or actually use one of the snippets. sources = { - {name = 'buffer'}, -- words found in your buffer (cmp-buffer) - -- {name = 'nvim_lsp'}, -- everything the language server finds (neovim/nvim-lspconfig) - { name = 'nvim_lsp', max_item_count = 10, keyword_length = 4 }, - {name = 'luasnip'}, -- custom/popular snippets for languages (L3MON4D3/LuaSnip and rafamadriz/friendly-snippets) - {name = 'cmd_luasnip'}, -- custom/popular snippets for languages (L3MON4D3/LuaSnip and rafamadriz/friendly-snippets) + {name = 'buffer'}, -- words found in your buffer (cmp-buffer) + {name = 'nvim_lsp', max_item_count = 10, keyword_length = 4}, -- everything the language server finds (neovim/nvim-lspconfig) + {name = 'luasnip'}, -- custom/popular snippets for languages (L3MON4D3/LuaSnip and rafamadriz/friendly-snippets) + {name = 'cmd_luasnip'}, -- custom/popular snippets for languages (L3MON4D3/LuaSnip and rafamadriz/friendly-snippets) } }) diff --git a/my_snippets.bak/package.json b/my_snippets.bak/package.json new file mode 100644 index 0000000..0059209 --- /dev/null +++ b/my_snippets.bak/package.json @@ -0,0 +1,25 @@ +{ + "name": "example-snippets", + "contributes": { + "snippets": [ + { + "language": [ + "all" + ], + "path": "./snippets/all.json" + }, + { + "language": [ + "lua" + ], + "path": "./lua.json" + } + { + "language": [ + "python" + ], + "path": "./python.json" + } + ] + } +} diff --git a/my_snippets.bak/python.json b/my_snippets.bak/python.json new file mode 100644 index 0000000..1ebe30a --- /dev/null +++ b/my_snippets.bak/python.json @@ -0,0 +1,8 @@ +{ + "snip1": { + "prefix": "python", + "body": [ + "pythonpythonpython" + ] + } +} diff --git a/my_snippets.bak/snippets/all.json b/my_snippets.bak/snippets/all.json new file mode 100644 index 0000000..29df278 --- /dev/null +++ b/my_snippets.bak/snippets/all.json @@ -0,0 +1,16 @@ +{ + "snip1": { + "prefix": "all1", + "body": [ + "expands? jumps? $1 $2 !" + ] + }, + "snip2": { + "prefix": "all2", + "body": [ + "multi $1", + "line $2", + "snippet$0" + ] + } +} diff --git a/my_snippets/lua.json b/my_snippets/lua.json new file mode 100644 index 0000000..0af009e --- /dev/null +++ b/my_snippets/lua.json @@ -0,0 +1,7 @@ +{ + "jackson": { + "prefix": "jackson", + "body": ["ohahahah"], + "description": "down with the sickness" + }, +} diff --git a/my_snippets/package.json b/my_snippets/package.json deleted file mode 100644 index 0059209..0000000 --- a/my_snippets/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "example-snippets", - "contributes": { - "snippets": [ - { - "language": [ - "all" - ], - "path": "./snippets/all.json" - }, - { - "language": [ - "lua" - ], - "path": "./lua.json" - } - { - "language": [ - "python" - ], - "path": "./python.json" - } - ] - } -} diff --git a/my_snippets/python.json b/my_snippets/python.json deleted file mode 100644 index 1ebe30a..0000000 --- a/my_snippets/python.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "snip1": { - "prefix": "python", - "body": [ - "pythonpythonpython" - ] - } -} diff --git a/my_snippets/snippets/all.json b/my_snippets/snippets/all.json deleted file mode 100644 index 29df278..0000000 --- a/my_snippets/snippets/all.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "snip1": { - "prefix": "all1", - "body": [ - "expands? jumps? $1 $2 !" - ] - }, - "snip2": { - "prefix": "all2", - "body": [ - "multi $1", - "line $2", - "snippet$0" - ] - } -} -- cgit v1.2.3