summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackson Taylor <jtaylor@classicalconversations.com>2024-01-30 11:23:49 -0500
committerJackson Taylor <jtaylor@classicalconversations.com>2024-01-30 11:23:49 -0500
commit0c196909a3f3ef9388344ef88e1f0002aa445fd6 (patch)
treece6413c024334153d5f0ffcd56b7cea1c5a0610a
parentd666fe136110e2a39176b15462bd83ac5a76110e (diff)
NOT WORKING: Add custom snippets
-rw-r--r--after/plugin/lsp.lua9
-rw-r--r--after/plugin/luasnip.lua0
-rw-r--r--my_snippets/package.json25
-rw-r--r--my_snippets/python.json8
-rw-r--r--my_snippets/snippets/all.json16
5 files changed, 56 insertions, 2 deletions
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua
index a923813..a438d00 100644
--- a/after/plugin/lsp.lua
+++ b/after/plugin/lsp.lua
@@ -21,6 +21,9 @@ 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')
@@ -48,8 +51,10 @@ lsp.setup_nvim_cmp({
-- 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'}, -- 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)
}
})
@@ -81,6 +86,6 @@ end)
lsp.setup()
vim.diagnostic.config({
- virtual_text = true
+ virtual_text = true
})
diff --git a/after/plugin/luasnip.lua b/after/plugin/luasnip.lua
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/after/plugin/luasnip.lua
diff --git a/my_snippets/package.json b/my_snippets/package.json
new file mode 100644
index 0000000..0059209
--- /dev/null
+++ b/my_snippets/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/python.json b/my_snippets/python.json
new file mode 100644
index 0000000..1ebe30a
--- /dev/null
+++ b/my_snippets/python.json
@@ -0,0 +1,8 @@
+{
+ "snip1": {
+ "prefix": "python",
+ "body": [
+ "pythonpythonpython"
+ ]
+ }
+}
diff --git a/my_snippets/snippets/all.json b/my_snippets/snippets/all.json
new file mode 100644
index 0000000..29df278
--- /dev/null
+++ b/my_snippets/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"
+ ]
+ }
+}