|
| 1 | +-- get from: https://github.com/rafamadriz/friendly-snippets/blob/main/debug/lazy-nvim.lua |
| 2 | +local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp" |
| 3 | +local install_dir = temp_dir .. "/lazy-nvim" |
| 4 | + |
| 5 | +-- set stdpaths to use "/tmp/lazy-nvim" |
| 6 | +for _, name in ipairs({ "config", "data", "state", "cache" }) do |
| 7 | + vim.env[("XDG_%s_HOME"):format(name:upper())] = install_dir .. "/" .. name |
| 8 | +end |
| 9 | + |
| 10 | +-- bootstrap lazy |
| 11 | +local lazypath = install_dir .. "/plugins/lazy.nvim" |
| 12 | +if not vim.loop.fs_stat(lazypath) then |
| 13 | + vim.fn.system({ |
| 14 | + "git", |
| 15 | + "clone", |
| 16 | + "--filter=blob:none", |
| 17 | + "--single-branch", |
| 18 | + "https://github.com/folke/lazy.nvim.git", |
| 19 | + lazypath, |
| 20 | + }) |
| 21 | +end |
| 22 | +vim.opt.runtimepath:prepend(lazypath) |
| 23 | + |
| 24 | +-- install plugins |
| 25 | +-- modify according to which snippet engine,etc you're using |
| 26 | +local plugins = { |
| 27 | + "mstuttgart/odoo-snippets", |
| 28 | + { |
| 29 | + -- snippet engine is necessary to load snippets |
| 30 | + "L3MON4D3/LuaSnip", |
| 31 | + config = function() |
| 32 | + require("luasnip.loaders.from_vscode").load({}) |
| 33 | + end, |
| 34 | + }, |
| 35 | + { |
| 36 | + -- completion engine is not needed but makes debuggin much easir |
| 37 | + -- since you type and instantly see if snippets are being loaded |
| 38 | + "hrsh7th/nvim-cmp", |
| 39 | + config = function() |
| 40 | + local cmp = require("cmp") |
| 41 | + cmp.setup({ |
| 42 | + snippet = { |
| 43 | + expand = function(args) |
| 44 | + require("luasnip").lsp_expand(args.body) |
| 45 | + end, |
| 46 | + }, |
| 47 | + mapping = cmp.mapping.preset.insert({ |
| 48 | + ["<C-b>"] = cmp.mapping.scroll_docs(-4), |
| 49 | + ["<C-f>"] = cmp.mapping.scroll_docs(4), |
| 50 | + ["<C-Space>"] = cmp.mapping.complete(), |
| 51 | + ["<C-e>"] = cmp.mapping.abort(), |
| 52 | + ["<CR>"] = cmp.mapping.confirm({ select = true }), |
| 53 | + }), |
| 54 | + sources = cmp.config.sources({ |
| 55 | + { name = "luasnip" }, |
| 56 | + }), |
| 57 | + }) |
| 58 | + end, |
| 59 | + }, |
| 60 | + -- cmp completion source for snippets |
| 61 | + "saadparwaiz1/cmp_luasnip", |
| 62 | +} |
| 63 | +require("lazy").setup(plugins, { |
| 64 | + root = install_dir .. "/plugins", |
| 65 | +}) |
| 66 | + |
| 67 | +vim.opt.termguicolors = true |
0 commit comments