From 14e6013ad2a0f8069a4497e10473c4679354de18 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Tue, 28 May 2024 13:59:18 +0545 Subject: [PATCH] update --- lua/core/keymaps.lua | 50 + lua/lib/icons.lua | 4 +- lua/plugins/lang/cmp.lua | 2 - lua/plugins/lang/dap.lua | 45 + lua/plugins/list.lua | 25 +- lua/plugins/lock.json | 63 +- lua/plugins/tools/code-runner.lua | 34 - lua/plugins/tools/nvim-tree.lua | 10 +- snippets/c.json | 360 ++++++ snippets/cpp.json | 219 ++++ snippets/css.json | 651 ++++++++++ snippets/frameworks/django/filetemplates.json | 35 + snippets/frameworks/django/forms.json | 168 +++ snippets/frameworks/django/imports.json | 43 + snippets/frameworks/django/models.json | 183 +++ snippets/frameworks/django/views.json | 243 ++++ snippets/frameworks/ejs.json | 87 ++ snippets/frameworks/flutter.json | 498 ++++++++ snippets/frameworks/jekyll.json | 526 ++++++++ snippets/frameworks/rails.json | 294 +++++ snippets/frameworks/twig.json | 536 ++++++++ snippets/frameworks/vue/html.json | 397 ++++++ snippets/frameworks/vue/javascript.json | 1075 +++++++++++++++++ snippets/frameworks/vue/pug.json | 352 ++++++ snippets/frameworks/vue/vue.json | 33 + snippets/gitcommit.json | 96 ++ snippets/global.json | 44 + snippets/go.json | 286 +++++ snippets/go.snippets | 62 - snippets/html.json | 850 +++++++++++++ snippets/html.snippets | 25 - snippets/java.json | 161 +++ snippets/java.snippets | 298 ----- snippets/javascript.snippets | 19 - snippets/javascript/javascript.json | 693 +++++++++++ snippets/javascript/react-native-ts.json | 445 +++++++ snippets/javascript/react-native.json | 476 ++++++++ snippets/javascript/react-ts.json | 385 ++++++ snippets/javascript/react.json | 394 ++++++ snippets/javascript/typescript.json | 282 +++++ snippets/javascriptreact.snippets | 27 - snippets/lua.json | 88 ++ snippets/lua.snippets | 24 - snippets/make.json | 45 + snippets/make.snippets | 54 - snippets/markdown.json | 288 +++++ snippets/markdown.snippets | 34 - snippets/package.json | 174 +++ snippets/plaintex.snippets | 2 - snippets/python/base.json | 163 +++ snippets/python/comprehension.json | 47 + snippets/python/debug.json | 34 + snippets/python/python.json | 122 ++ snippets/python/unittest.json | 54 + snippets/rust.snippets | 11 - snippets/sh.snippets | 151 --- snippets/shell.json | 93 ++ snippets/tex.snippets | 305 ----- snippets/typescript.snippets | 1 - snippets/typescriptreact.snippets | 40 - snippets/vue.snippets | 14 - 61 files changed, 11076 insertions(+), 1144 deletions(-) delete mode 100644 lua/plugins/tools/code-runner.lua create mode 100644 snippets/c.json create mode 100644 snippets/cpp.json create mode 100644 snippets/css.json create mode 100644 snippets/frameworks/django/filetemplates.json create mode 100644 snippets/frameworks/django/forms.json create mode 100644 snippets/frameworks/django/imports.json create mode 100644 snippets/frameworks/django/models.json create mode 100644 snippets/frameworks/django/views.json create mode 100644 snippets/frameworks/ejs.json create mode 100644 snippets/frameworks/flutter.json create mode 100644 snippets/frameworks/jekyll.json create mode 100644 snippets/frameworks/rails.json create mode 100644 snippets/frameworks/twig.json create mode 100644 snippets/frameworks/vue/html.json create mode 100644 snippets/frameworks/vue/javascript.json create mode 100644 snippets/frameworks/vue/pug.json create mode 100644 snippets/frameworks/vue/vue.json create mode 100644 snippets/gitcommit.json create mode 100644 snippets/global.json create mode 100644 snippets/go.json delete mode 100644 snippets/go.snippets create mode 100644 snippets/html.json delete mode 100644 snippets/html.snippets create mode 100644 snippets/java.json delete mode 100644 snippets/java.snippets delete mode 100644 snippets/javascript.snippets create mode 100644 snippets/javascript/javascript.json create mode 100644 snippets/javascript/react-native-ts.json create mode 100644 snippets/javascript/react-native.json create mode 100644 snippets/javascript/react-ts.json create mode 100644 snippets/javascript/react.json create mode 100644 snippets/javascript/typescript.json delete mode 100644 snippets/javascriptreact.snippets create mode 100644 snippets/lua.json delete mode 100644 snippets/lua.snippets create mode 100644 snippets/make.json delete mode 100644 snippets/make.snippets create mode 100644 snippets/markdown.json delete mode 100644 snippets/markdown.snippets create mode 100644 snippets/package.json delete mode 100644 snippets/plaintex.snippets create mode 100644 snippets/python/base.json create mode 100644 snippets/python/comprehension.json create mode 100644 snippets/python/debug.json create mode 100644 snippets/python/python.json create mode 100644 snippets/python/unittest.json delete mode 100644 snippets/rust.snippets delete mode 100644 snippets/sh.snippets create mode 100644 snippets/shell.json delete mode 100644 snippets/tex.snippets delete mode 100644 snippets/typescript.snippets delete mode 100644 snippets/typescriptreact.snippets delete mode 100644 snippets/vue.snippets diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index c966c0c..dc5ab9d 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -60,6 +60,12 @@ map("i", "jk", "") map("i", "kj", "") map("i", "jj", "") +-- Terminal Mappings +map("t", "jk", "") +map("t", "kj", "") +map("t", "", "") + + -- Visual overwrite paste map({ 'v', 'x' }, 'p', '"_dP', opts) @@ -171,6 +177,20 @@ vim.keymap.set("n", "", "k", { desc = "Go to Upper Window", remap = tr vim.keymap.set("n", "", "l", { desc = "Go to Right Window", remap = true }) +-- Move with shift-arrows +map("n", "", "", { + desc = "Move window to the left" +}) +map("n", "", "", { + desc = "Move window down" +}) +map("n", "", "", { + desc = "Move window up" +}) +map("n", "", "", { + desc = "Move window to the right" +}) + -- Resize window using arrow keys vim.keymap.set("n", "", "resize +2", { desc = "Increase Window Height" }) vim.keymap.set("n", "", "resize -2", { desc = "Decrease Window Height" }) @@ -196,3 +216,33 @@ map('n', 'mu', function() end, { desc = 'Dismiss All Notifications' }) +-- Tab management +--keymap.set("n", "to", ":tabnew") -- open a new tab +--keymap.set("n", "tx", ":tabclose") -- close a tab +--keymap.set("n", "tn", ":tabn") -- next tab +--keymap.set("n", "tp", ":tabp") -- previous tab + +map("n", 'jo', function() + if vim.bo.filetype == 'java' then + require('jdtls').organize_imports(); + end +end) + +map("n", 'ju', function() + if vim.bo.filetype == 'java' then + require('jdtls').update_projects_config(); + end +end) + +map("n", 'jc', function() + if vim.bo.filetype == 'java' then + require('jdtls').test_class(); + end +end) + +map("n", 'jm', function() + if vim.bo.filetype == 'java' then + require('jdtls').test_nearest_method(); + end +end) + diff --git a/lua/lib/icons.lua b/lua/lib/icons.lua index cf664f3..6a8d404 100644 --- a/lua/lib/icons.lua +++ b/lua/lib/icons.lua @@ -69,7 +69,6 @@ return { String = ' ', }, ui = { - AI = ' ', Arrow = ' ', ArrowClosed = ' ', ArrowLeft = ' ', @@ -92,6 +91,8 @@ return { Color = ' ', Command = ' ', Comment = ' ', + Copilot = ' ', + CopilotError = ' ', Corner = '└ ', Dashboard = ' ', Database = ' ', @@ -149,6 +150,7 @@ return { Test = ' ', Time = ' ', Trash = ' ', + User = ' ', Vim = ' ', Wifi = ' ', Windows = ' ', diff --git a/lua/plugins/lang/cmp.lua b/lua/plugins/lang/cmp.lua index dd1df7f..3fd4283 100644 --- a/lua/plugins/lang/cmp.lua +++ b/lua/plugins/lang/cmp.lua @@ -121,7 +121,6 @@ cmp.setup({ vim_item.menu = ({ codeium = '[Codeium]', nvim_lsp = '[LSP]', - nvim_lua = '[nvim_lua]', luasnip = '[Snippet]', buffer = '[Buffer]', path = '[Path]', @@ -132,7 +131,6 @@ cmp.setup({ sources = { { name = 'nvim_lsp' }, { name = 'path' }, - { name = 'nvim_lua' }, { name = 'luasnip', keyword_length = 2 }, { name = 'buffer', keyword_length = 3 }, { name = 'codeium'}, diff --git a/lua/plugins/lang/dap.lua b/lua/plugins/lang/dap.lua index 0d54ed2..c427723 100644 --- a/lua/plugins/lang/dap.lua +++ b/lua/plugins/lang/dap.lua @@ -102,6 +102,51 @@ dap.configurations.ruby = { }, } +dap.configurations.java = { + { + name = "Debug Launch (2GB)"; + type = 'java'; + request = 'launch'; + vmArgs = "" .. + "-Xmx2g " + }, + { + name = "Debug Attach (8000)"; + type = 'java'; + request = 'attach'; + hostName = "127.0.0.1"; + port = 8000; + }, + { + name = "Debug Attach (5005)"; + type = 'java'; + request = 'attach'; + hostName = "127.0.0.1"; + port = 5005; + }, + { + name = "My Custom Java Run Configuration", + type = "java", + request = "launch", + -- You need to extend the classPath to list your dependencies. + -- `nvim-jdtls` would automatically add the `classPaths` property if it is missing + -- classPaths = {}, + + -- If using multi-module projects, remove otherwise. + -- projectName = "yourProjectName", + + -- javaExec = "java", + mainClass = "replace.with.your.fully.qualified.MainClass", + + -- If using the JDK9+ module system, this needs to be extended + -- `nvim-jdtls` would automatically populate this property + -- modulePaths = {}, + vmArgs = "" .. + "-Xmx2g " + }, + } + + vim.api.nvim_create_user_command('DapUIToggle', function() require('dapui').toggle() end, {}) diff --git a/lua/plugins/list.lua b/lua/plugins/list.lua index ff2ad90..81a3192 100644 --- a/lua/plugins/list.lua +++ b/lua/plugins/list.lua @@ -218,6 +218,16 @@ local plugins = { }, }, -- Tools + { + 'sontungexpt/url-open', + cmd = 'URLOpenUnderCursor', + config = load_config('tools.url-open'), + }, + { + 'stevearc/conform.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + config = load_config('tools.conform'), + }, { 'akinsho/flutter-tools.nvim', dependencies = { @@ -412,10 +422,6 @@ local plugins = { event = 'VeryLazy', config = load_config('tools.auto-save'), }, - { - 'CRAG666/code_runner.nvim', - config = load_config('tools.code-runner'), - }, -- Telescope { 'nvim-telescope/telescope.nvim', @@ -471,6 +477,7 @@ local plugins = { local ts_parsers = { 'bash', + 'c', 'css', 'dart', 'elixir', @@ -480,6 +487,7 @@ local ts_parsers = { 'java', 'javascript', 'json', + 'kotlin', 'lua', 'markdown', 'markdown_inline', -- markdown code blocks @@ -500,8 +508,17 @@ local lsp_servers = { 'bashls', 'jsonls', 'lua_ls', + 'html', + 'kotlin_language_server', + 'sqlls', 'typos_lsp', -- check typos 'vimls', + 'volar', + 'yamlls', + 'tailwindcss', + 'cmake', + 'tsserver', + 'pylsp', } local util = require('lib.util') diff --git a/lua/plugins/lock.json b/lua/plugins/lock.json index 02188be..23522c5 100644 --- a/lua/plugins/lock.json +++ b/lua/plugins/lock.json @@ -1,5 +1,5 @@ { - "LuaSnip": { "branch": "master", "commit": "de1a287c9cb525ae52bc846e8f6207e5ef1da5ac" }, + "LuaSnip": { "branch": "master", "commit": "878ace11983444d865a72e1759dbcc331d1ace4c" }, "Navigator.nvim": { "branch": "master", "commit": "91d86506ac2a039504d5205d32a1d4bc7aa57072" }, "auto-save.nvim": { "branch": "main", "commit": "5fe9ab0c42f0457f2a973e814a6352b8eeb04730" }, "ccc.nvim": { "branch": "main", "commit": "f388f1981d222967c741fe9927edf9ba5fa3bcbe" }, @@ -10,24 +10,24 @@ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "co-author.nvim": { "branch": "main", "commit": "3beddbbd5fdf3121921fc7b28fd731cffc70f952" }, - "code_runner.nvim": { "branch": "main", "commit": "d135c4178bf8980ca5fa4aa6e27ab9ee4373c875" }, - "codeium.vim": { "branch": "main", "commit": "9406f13cf3eaa08318b76746bd105a04506cab27" }, - "compiler.nvim": { "branch": "main", "commit": "cb14acd32ba9ea09d01bbe3493aefdc59b68965c" }, + "codeium.vim": { "branch": "main", "commit": "289eb724e5d6fab2263e94a1ad6e54afebefafb2" }, + "compiler.nvim": { "branch": "main", "commit": "1cf17971b21415d634fe4c8af791f0b1b4d3a727" }, + "conform.nvim": { "branch": "master", "commit": "f3b930db4964d60e255c8f9e37b7f2218dfc08cb" }, "dashboard-nvim": { "branch": "master", "commit": "5182c09ac8085dc73b78ad0ea9f5479c9a866fc4" }, - "dressing.nvim": { "branch": "master", "commit": "572314728cb1ce012e825fd66331f52c94acac12" }, + "dressing.nvim": { "branch": "master", "commit": "3c38ac861e1b8d4077ff46a779cde17330b29f3a" }, "flash.nvim": { "branch": "main", "commit": "11a2e667d19d8f48c93c6ed2e2e525ac6b1b79be" }, "flutter-tools.nvim": { "branch": "main", "commit": "990a1349c29f7d474a0cd51355aba773ccc9deea" }, - "fortune.nvim": { "branch": "master", "commit": "12644a2939e5db8144f3fcbc77ce6adc684ed565" }, - "friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" }, + "fortune.nvim": { "branch": "master", "commit": "57ac0b96f58180eab8c0293b7bd0bb5f834433fc" }, + "friendly-snippets": { "branch": "main", "commit": "d0610077b6129cf9f7f78afbe3a1425d60f6e2f1" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, + "gitsigns.nvim": { "branch": "main", "commit": "cdfcd9d39d23c46ae9a040de2c6a8b8bf868746e" }, "hardtime.nvim": { "branch": "main", "commit": "eaf4bc31b86419c26ad7b3a142dd36ca545ca2e4" }, "harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" }, - "indent-blankline.nvim": { "branch": "master", "commit": "ece00d5fb44d196680a81fd2761062d2fa44663b" }, - "lazy.nvim": { "branch": "main", "commit": "0de782a6b0ffba599dbd332a4019d852564bf28c" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, + "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, "live-server.nvim": { "branch": "main", "commit": "f6f00a3f541251f0320910bb0d03c4ae14ee6d10" }, "lsp_lines.nvim": { "branch": "main", "commit": "dbfd8e96ec2696e1ceedcd23fd70e842256e3dea" }, - "lspsaga.nvim": { "branch": "main", "commit": "ad61778283f26a9fa2c5a8d2f0aca52ba49f32f3" }, + "lspsaga.nvim": { "branch": "main", "commit": "59d4648c3d4b40f316c3db852b3758c66ff6ca03" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "a4caa0d083aab56f6cd5acf2d42331b74614a585" }, @@ -37,49 +37,50 @@ "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, "mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" }, "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, - "neotest": { "branch": "master", "commit": "5caac5cc235d495a2382bc2980630ef36ac87032" }, + "neotest": { "branch": "master", "commit": "6f35d797882c6ce0ab7c87dc86561512dc3d7aba" }, "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, "neotest-rspec": { "branch": "main", "commit": "48573d5882cbe8d8bcd3b735d9ee7705168b1b87" }, "nerdy.nvim": { "branch": "main", "commit": "7d256222fda0031feae405f14d7a9414c7b6529f" }, - "noice.nvim": { "branch": "main", "commit": "9f6f6ba74f8bfbf7e43d6302cf86b070362f6203" }, - "none-ls.nvim": { "branch": "main", "commit": "37671797d6e5f9bd0ee3ab965ab2e6de251e1930" }, + "noice.nvim": { "branch": "main", "commit": "f119045f38792ad5311e5f9be7a879e4c1a95fe0" }, + "none-ls.nvim": { "branch": "main", "commit": "60f5f80686f5a272ed3281a7d4962cb54dc5348e" }, "nui.nvim": { "branch": "main", "commit": "b1b3dcd6ed8f355c78bad3d395ff645be5f8b6ae" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-dap": { "branch": "master", "commit": "5a2f7121869394502521c52b2bc581ab22c69447" }, - "nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" }, - "nvim-lspconfig": { "branch": "master", "commit": "9bda20fb967075355f253911bc066a8b5a03c77e" }, - "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, + "nvim-dap": { "branch": "master", "commit": "922ebc75c2fa9305e36402fbd8c984c8638770a0" }, + "nvim-dap-ui": { "branch": "master", "commit": "334cf3038c4756e6ab999cbac67c847fb654c190" }, + "nvim-lspconfig": { "branch": "master", "commit": "d70633830acf605ec03d9728698d9e7232442eb4" }, + "nvim-nio": { "branch": "master", "commit": "632024157d01e8bc48fd7df6a7de8ffe3fdd4f3a" }, "nvim-notify": { "branch": "master", "commit": "d333b6f167900f6d9d42a59005d82919830626bf" }, - "nvim-spectre": { "branch": "master", "commit": "50e96602153f14c913e1969aaf9720e080394eb3" }, + "nvim-spectre": { "branch": "master", "commit": "366f46fdd4a1593cc237aea13d5ef113739a472c" }, "nvim-spider": { "branch": "main", "commit": "b2f2af0563bb631864cab262d483118f3610e662" }, - "nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" }, - "nvim-treesitter": { "branch": "master", "commit": "7c9c5bed8340031f8a6dad47a58a26eaf15b9a56" }, + "nvim-tree.lua": { "branch": "master", "commit": "5a87ffe35c4739ffb6b62052572583ad277a20ae" }, + "nvim-treesitter": { "branch": "master", "commit": "ea2b137f35fb1e87a6471ec311805920fdf45745" }, "nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" }, "nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "5f9bf4b1ead7707e4e74e5319ee56bdc81fb73db" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3557e41418b4a6c5b85d5d64abe94c9c50fa9b14" }, "nvim-treesitter-textsubjects": { "branch": "master", "commit": "1428108f18ce9d8cc4481dcedebeeb490eabf395" }, - "nvim-ts-autotag": { "branch": "main", "commit": "cb57b07803476ee902c89412aeff219a9a58be13" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "cbab9ad88036915beebd13b47e100743ff2ed2d5" }, - "nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" }, - "oil.nvim": { "branch": "master", "commit": "06a19f77f1a1da37b675635e6f9c5b5d50bcaacd" }, + "nvim-ts-autotag": { "branch": "main", "commit": "8ae54b90e36ef1fc5267214b30c2cbff71525fe4" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "cb064386e667def1d241317deed9fd1b38f0dc2e" }, + "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, + "oil.nvim": { "branch": "master", "commit": "2cb39e838e9dcd8b374f09a3a87a2e5ec9d372f6" }, "onedark.nvim": { "branch": "master", "commit": "8e4b79b0e6495ddf29552178eceba1e147e6cecf" }, - "overseer.nvim": { "branch": "master", "commit": "7a9b654df4b3b246d05fff857f32e9fb8ddfb013" }, - "plenary.nvim": { "branch": "master", "commit": "b5c8de02a44ffeabff678090edd6a132ff8ab77d" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "dd1156723eb8483e4403eb8765bbdff456b6981d" }, + "overseer.nvim": { "branch": "master", "commit": "31f309692c9dd9162d3f63b5456a7932799c347c" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "849803e0a687c6ef7c9a0d305bd4d441017b8abf" }, "refactoring.nvim": { "branch": "master", "commit": "d2786877c91aa409c824f27b4ce8a9f560dda60a" }, "sniprun": { "branch": "master", "commit": "9006d4af4f7016523f8619ae1526ab4e7f0df785" }, "tabout.nvim": { "branch": "master", "commit": "3d7fbc7f5e91ef0f96b4d787c78ad9f8820de3ec" }, "tdo.nvim": { "branch": "main", "commit": "95d4651bc5aef366b7d53a0ba6872cf444c09f33" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "4d5fd21bae12ee6e9a79232e1c377f43c419d0c5" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" }, - "telescope-menufacture": { "branch": "main", "commit": "79376f887f589a4240267383e8abc0a31861325a" }, + "telescope-menufacture": { "branch": "main", "commit": "013c6816e62fd024c66ba2a4fe9335ab65d107da" }, "telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" }, "telescope-undo.nvim": { "branch": "main", "commit": "95b61c01ea3a4c9e8747731148e905bbcf0ccaee" }, - "telescope.nvim": { "branch": "master", "commit": "0c12735d5aff6a48ffd8111bf144dc2ff44e5975" }, + "telescope.nvim": { "branch": "master", "commit": "2df52609a1632de5d77a0b2416db6ad9cf32e463" }, "termim.nvim": { "branch": "main", "commit": "1f88c66449c832445399c414fc4313dba5174b1b" }, "ts-node-action": { "branch": "master", "commit": "6d3b60754fd87963d70eadaa2f77873b447eac26" }, "twilight.nvim": { "branch": "main", "commit": "8b7b50c0cb2dc781b2f4262a5ddd57571556d1e4" }, + "url-open": { "branch": "main", "commit": "9f8f4a56ac709f26aa17d8ef921b272bf2262a30" }, "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } diff --git a/lua/plugins/tools/code-runner.lua b/lua/plugins/tools/code-runner.lua deleted file mode 100644 index 4ad77c2..0000000 --- a/lua/plugins/tools/code-runner.lua +++ /dev/null @@ -1,34 +0,0 @@ -require('code_runner').setup({ - filetype = { - java = { - "cd $dir &&", - "javac $fileName &&", - "java $fileNameWithoutExt" - }, - dart = "cd $path && dart $fn", - python = "python3 -u", - typescript = "deno run", - rust = { - "cd $dir &&", - "rustc $fileName &&", - "$dir/$fileNameWithoutExt" - }, - c = function(...) - c_base = { - "cd $dir &&", - "gcc $fileName -o", - "/tmp/$fileNameWithoutExt", - } - local c_exec = { - "&& /tmp/$fileNameWithoutExt &&", - "rm /tmp/$fileNameWithoutExt", - } - vim.ui.input({ prompt = "Add more args:" }, function(input) - c_base[4] = input - vim.print(vim.tbl_extend("force", c_base, c_exec)) - require("code_runner.commands").run_from_fn(vim.list_extend(c_base, c_exec)) - end) - end, - }, -}) - diff --git a/lua/plugins/tools/nvim-tree.lua b/lua/plugins/tools/nvim-tree.lua index 605ade2..a465434 100644 --- a/lua/plugins/tools/nvim-tree.lua +++ b/lua/plugins/tools/nvim-tree.lua @@ -83,10 +83,10 @@ nvim_tree.setup({ update_focused_file = { enable = true, update_cwd = true, ignore_list = {} }, git = { enable = true, ignore = true, timeout = 500 }, view = { - width = 40, - side = 'left', - adaptive_size = true, - number = false, - relativenumber = false, + width = 50, + side = 'right', + adaptive_size = false, + number = true, + relativenumber = true, }, }) diff --git a/snippets/c.json b/snippets/c.json new file mode 100644 index 0000000..96cbe4e --- /dev/null +++ b/snippets/c.json @@ -0,0 +1,360 @@ +{ + "for": { + "prefix": "for", + "body": [ + "for (${1:size_t} ${2:i} = ${3:0}; $2 < ${4:length}; $2++) {", + "\t$0", + "}" + ], + "description": "Code snippet for 'for' loop" + }, + "_FOREACH": { + "prefix": "_FOREACH", + "body": [ + "#define foreach(item, array) \\", + "\tfor(int keep = 1, \\", + "\tcount = 0,\\", + "\tsize = sizeof (array) / sizeof *(array); \\", + "\tkeep && count != size; \\", + "\tkeep = !keep, count++) \\", + "\tfor(item = (array) + count; keep; keep = !keep)" + ], + "description": "foreach loop C" + }, + "*": { + "prefix": "*", + "body": ["/* $0 */"], + "description": "Block comment" + }, + "glfw330win": { + "prefix": "glfw330win", + "body": [ + "if (!glfwInit()) {", + "log_warn(\"GLFW failed\");", + "glfwTerminate();", + "return 1;", + "}", + "glfwWindowHint(GLFW_SAMPLES, 4);", + "glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);", + "glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);", + "glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);" + ], + "description": "Glfw window hint for opengl v3.3" + }, + "gl_vertex_arr": { + "prefix": "gl_vertex_arr", + "body": [ + "glGenVertexArrays(${1:size}, &$2);", + "glBindVertexArray($2);" + ], + "description": "GL generate vertex array" + }, + "gl_vertex_buffer": { + "prefix": "gl_vertex_buffer", + "body": [ + "glGenBuffers(${1:1}, &$2);", + "glBindBuffer(${3:buffer_type}, $2);", + "glBufferData($3, sizeof($4), $4, $5)" + ], + "description": "gl generate buffer" + }, + "DBG": { + "prefix": "DBG", + "body": ["#define WHERE fprintf(stderr,\"[LOG]%s:%d\\n\",__FILE__,__LINE__);"], + "description": "Debug code line" + }, + "forr": { + "prefix": "forr", + "body": [ + "for (${1:size_t} ${2:i} = ${3:length} - 1; $2 >= ${4:0}; $2--) {", + "\t$0", + "}" + ], + "description": "Code snippet for reverse 'for' loop" + }, + "mod": { + "prefix": "_MOD", + "body": ["#define MOD(N,M)\t((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M))\n"], + "description": "mod of N,M" + }, + "between": { + "prefix": "_BETWEEN", + "body": ["#define BETWEEN(x, a, b) ((a) <= (x) && (x) <= (b))\n"], + "description": "x is between a, b" + }, + "length" : { + "prefix": "_LENGTH", + "body": ["#define LENGTH(x) sizeof(x)/sizeof(x[0])\n"], + "description": "Array size macro" + }, + "max" : { + "prefix": "_MAX", + "body": ["#define MAX(x,y) (x) > (y) ? (x) : (y)","$0"], + "description": "Get max element" + }, + "min" : { + "prefix": "_MIN", + "body": ["#define MIN(x,y) (x) < (y) ? (x) : (y)","$0"], + "description": "Get min element" + }, + "getbit": { + "prefix": "_GETBIT", + "body": ["#define GETBIT(x,i) (x&(1<"], + "description": "Code snippet for #include < >" + }, + "#def": { + "prefix": "def", + "body": ["#define $0"], + "description": "Code snippet for #define \" \"" + }, + "Main function template": { + "prefix": "main", + "body": [ + "int main (int argc, char *argv[])", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard main function for a C program" + }, + "Standard Starter Template": { + "prefix": "sst", + "body": [ + "#include ", + "", + "int main ()", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard starter template for a C program" + }, + "Stdlib Variant Starter Template": { + "prefix": "libsst", + "body": [ + "#include ", + "#include ", + "", + "int main (int argc, char *argv[])", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard starter template for a C program with stdlib included" + }, + "Create linked list": { + "prefix": "clist", + "body": [ + "typedef struct _node * Link;", + "typedef struct _node node;", + "struct _node {", + "\tint value;", + "\tLink next;", + "};" + ], + "description": "Creates a linked list template" + }, + "Scan integer": { + "prefix": "sci", + "body": ["scanf(\"%d\", &$1);"], + "description": "Scan int" + }, + "Scan 2 integer": { + "prefix": "sci2", + "body": ["scanf(\"%d %d\", &$1, &$2);"], + "description": "Scan 2 int" + }, + "Scan unsigned integer": { + "prefix": "scui", + "body": ["scanf(\"%d\", &$1);"], + "description": "Scan unsigned int" + }, + "Scan float": { + "prefix": "scf", + "body": ["scanf(\"%f\", &$1);"], + "description": "Scan float" + }, + "Scan 2 float": { + "prefix": "scf2", + "body": ["scanf(\"%f %f\", &$1, &$2);"], + "description": "Scan 2 float" + }, + "Scan long": { + "prefix": "scl", + "body": ["scanf(\"%ld\", &$1);"], + "description": "Scan long" + }, + "Scan 2 long": { + "prefix": "scl2", + "body": ["scanf(\"%ld %ld\", &$1, &$2);"], + "description": "Scan 2 long" + }, + "Scan unsigned long": { + "prefix": "scul", + "body": ["scanf(\"%lu\", &$1);"], + "description": "Scan unsigned long" + }, + "Scan unsigned long long": { + "prefix": "scull", + "body": ["scanf(\"%llu\", &$1);"], + "description": "Scan unsigned long long" + }, + "Print variable of type float (2 decimal places)": { + "prefix": "pflo", + "body": ["printf(\"$1 :>> %.2f\\n\", $1);"], + "description": "Calls printf() to log value of variable of type float rounded to 2 decimal places" + }, + "Print variable of type integer": { + "prefix": "pint", + "body": ["printf(\"$1 : %d\\n\", $1);"], + "description": "Calls printf() to log value of variable of type signed integer" + }, + "Print variable of type char": { + "prefix": "pcha", + "body": ["printf(\"$1 : %c\\n\", $1);"], + "description": "Calls printf() to log value of variable of type char" + }, + "Print variable of type pointer": { + "prefix": "ppoint", + "body": ["printf(\"$1 : %p\\n\", (void *) $1);"], + "description": "Calls printf() to log value of variable of type pointer" + }, + "Print variable of type size_t": { + "prefix": "psiz", + "body": ["printf(\"$1 : %zu\\n\", $1);"], + "description": "Calls printf() to log value of variable of type size_t" + }, + "printf": { + "prefix": "printf", + "body": ["printf(\"$1\\n\"$0);"], + "description": "Generic printf() snippet" + }, + "sprintf": { + "prefix": "sprintf", + "body": ["sprintf($1, \"$2\\n\"$0);"], + "description": "Generic sprintf() snippet" + }, + "fprintf": { + "prefix": "fprintf", + "body": ["fprintf(${1:stderr}, \"$2\\n\"$0);"], + "description": "Generic fprintf() snippet" + }, + "scanf": { + "prefix": "scanf", + "body": ["scanf(\"$1\"$0);"], + "description": "Generic scanf() snippet" + }, + "sscanf": { + "prefix": "sscanf", + "body": ["sscanf($1, \"$2\"$0);"], + "description": "Generic sscanf() snippet" + }, + "fscanf": { + "prefix": "fscanf", + "body": ["fscanf($1, \"$2\"$0);"], + "description": "Generic fscanf() snippet" + }, + "Allocate memory using malloc": { + "prefix": "mal", + "body": [ + "${1:int} *${2:v} = malloc(${3:1} * sizeof($1));", + "", + "if (!$2) {", + "\tfprintf(stderr, \"Memory allocation failed!\\n\");", + "\t$4;", + "}", + "$0", + "free($2);" + ], + "description": "Allocates memory to a pointer variable using malloc(), then deallocates using free()." + }, + "Allocate memory using calloc": { + "prefix": "cal", + "body": [ + "${1:int} *${2:v} = calloc(${3:1}, sizeof($1));", + "", + "if (!$2) {", + "\tfprintf(stderr, \"Memory allocation failed!\\n\");", + "\t$4;", + "}", + "$0", + "free($2);" + ], + "description": "Allocates memory to a pointer variable using calloc(), then deallocates using free()." + }, + "X11 default incs": { + "prefix": "_X11", + "body": ["#include \n#include \n#include \n#include \n"], + "description": "X11 default library headers" + }, + "Primitive macros": { + "prefix": "_PRIMITIVE", + "body": [ + "#define i16 short", + "#define ui16 unsigned short", + "#define i32 int", + "#define ui32 unsigned int", + "#define i64 long long", + "#define ui64 unsigned long long" + ], + "description": "Primitive macros for int type" + } +} diff --git a/snippets/cpp.json b/snippets/cpp.json new file mode 100644 index 0000000..c949464 --- /dev/null +++ b/snippets/cpp.json @@ -0,0 +1,219 @@ +{ + "for": { + "prefix": "for", + "body": [ + "for (${1:size_t} ${2:i} = ${3:0}; $2 < ${4:length}; $2++) {", + "\t$0", + "}" + ], + "description": "Code snippet for 'for' loop" + }, + "*": { + "prefix": "*", + "body": ["/* $0 */"], + "description": "Block comment" + }, + "forr": { + "prefix": "forr", + "body": [ + "for (${1:size_t} ${2:i} = ${3:length} - 1; $2 >= ${4:0}; $2--) {", + "\t$0", + "}" + ], + "description": "Code snippet for reverse 'for' loop" + }, + "mod": { + "prefix": "MOD", + "body": ["#define MOD(N,M)\t((N)%(M) < 0 ? (N)%(M) + (M) : (N)%(M))"], + "description": "mod of N,M" + }, + "between": { + "prefix": "between", + "body": ["#define BETWEEN(x, a, b)\t((a) <= (x) && (x) <= (b))"], + "description": "x is between a, b" + }, + "sze" : { + "prefix": "sze", + "body": ["#define SIZE(x) sizeof(x)/sizeof(x[0])","$0"], + "description": "Array size macro" + }, + "do": { + "prefix": "do", + "body": ["do", "{", "\t$1", "} while($2);"], + "description": "Code snippet for do...while loop" + }, + "while": { + "prefix": "while", + "body": ["while ($1) {", "\t$2", "}"], + "description": "" + }, + "foreach": { + "prefix": "foreach", + "body": ["for (${1:auto} ${2:var} : ${3:collection_to_loop}) {", "\t$0", "}"], + "description": "Code snippet for range-based for loop (c++11) statement" + }, + "enum": { + "prefix": "enum", + "body": ["enum ${1:MyEnum} {", "\t$0", "};"], + "description": "Code snippet for enum" + }, + "enum class": { + "prefix": "enum class", + "body": ["enum class ${1:MyClass} {$0};"], + "description": "Code snippet for enum class (c++11)" + }, + "class": { + "prefix": "class", + "body": [ + "class ${1:MyClass}", + "{", + "public:", + "\t$1();", + "\t$1($1 &&) = default;", + "\t$1(const $1 &) = default;", + "\t$1 &operator=($1 &&) = default;", + "\t$1 &operator=(const $1 &) = default;", + "\t~$1();", + "", + "private:", + "\t$2", + "};", + "", + "$1::$1()", + "{", + "}", + "", + "$1::~$1()", + "{", + "}" + ], + "description": "Code snippet for class" + }, + "classi": { + "prefix": "classi", + "body": [ + "class ${1:MyClass}", + "{", + "public:", + "\t$1() = default;", + "\t$1($1 &&) = default;", + "\t$1(const $1 &) = default;", + "\t$1 &operator=($1 &&) = default;", + "\t$1 &operator=(const $1 &) = default;", + "\t~$1() = default;", + "", + "private:", + "\t$2", + "};" + ], + "description": "Code snippet for class with inline constructor/destructor" + }, + "interface": { + "prefix": "interface", + "body": ["__interface I${1:Interface}", "{", "\t$0", "};"], + "description": "Code snippet for interface (Visual C++)" + }, + "namespace": { + "prefix": "namespace", + "body": ["namespace ${1:MyNamespace}", "{", "\t$0", "}"] + }, + "#ifdef": { + "prefix": "#ifdef", + "body": ["#ifdef ${1:DEBUG}", "$0", "#endif // ${DEBUG}"], + "description": "Code snippet for #ifdef" + }, + "#ifndef": { + "prefix": "#ifndef", + "body": ["#ifndef ${1:DEBUG}", "$0", "#endif // !$1"], + "description": "Code snippet for #ifndef" + }, + "#if": { + "prefix": "#if", + "body": ["#if ${1:0}", "$0", "#endif // $1"], + "description": "Code snippet for #if" + }, + "struct": { + "prefix": "struct", + "body": ["struct ${1:MyStruct}", "{", "\t$0", "};"], + "description": "Code snippet for struct" + }, + "switch": { + "prefix": "switch", + "body": ["switch (${1:switch_on}) {", "\tdefault:", "\t\t$0", "\t\tbreak;", "}"], + "description": "Code snippet for switch statement" + }, + "try": { + "prefix": "try", + "body": [ + "try {", + "\t", + "}", + "catch (const std::exception&)", + "{", + "\t$1", + "}" + ], + "description": "Code snippet for try catch" + }, + "union": { + "prefix": "union", + "body": ["union ${1:MyUnion}", "{", "\t$0", "};"], + "description": "Code snippet for union" + }, + "printf": { + "prefix": "printf", + "body": ["printf(\"$1\\n\"$0);"], + "description": "Generic printf() snippet" + }, + "sprintf": { + "prefix": "sprintf", + "body": ["sprintf($1, \"$2\\n\"$0);"], + "description": "Generic sprintf() snippet" + }, + "fprintf": { + "prefix": "fprintf", + "body": ["fprintf(${1:stderr}, \"$2\\n\"$0);"], + "description": "Generic fprintf() snippet" + }, + "scanf": { + "prefix": "scanf", + "body": ["scanf(\"$1\"$0);"], + "description": "Generic scanf() snippet" + }, + "sscanf": { + "prefix": "sscanf", + "body": ["sscanf($1, \"$2\"$0);"], + "description": "Generic sscanf() snippet" + }, + "fscanf": { + "prefix": "fscanf", + "body": ["fscanf($1, \"$2\"$0);"], + "description": "Generic fscanf() snippet" + }, + "#inc": { + "prefix": "#inc", + "body": ["#include \"$0\""], + "description": "Code snippet for #include \" \"" + }, + "#inc<": { + "prefix": "#inc<", + "body": ["#include <$0>"], + "description": "Code snippet for #include < >" + }, + "#def": { + "prefix": "def", + "body": ["#define $0"], + "description": "Code snippet for #define \" \"" + }, + "Main function template": { + "prefix": "main", + "body": [ + "int main (int argc, char *argv[])", + "{", + "\t$0", + "\treturn 0;", + "}" + ], + "description": "A standard main function for a C++ program" + } +} diff --git a/snippets/css.json b/snippets/css.json new file mode 100644 index 0000000..294af23 --- /dev/null +++ b/snippets/css.json @@ -0,0 +1,651 @@ +{ + "align-items": { + "prefix": "ai", + "body": "align-items: ${1|flex-start,flex-end,center,baseline,stretch,start,end,self-start,self-end|};", + "description": "initial value: stretch" + }, + "align-items: baseline": { + "prefix": "aib", + "body": "align-items: baseline;" + }, + "align-items: center": { + "prefix": "aic", + "body": "align-items: center;" + }, + "align-items: flex-start": { + "prefix": "aifs", + "body": "align-items: flex-start;" + }, + "align-items: flex-end": { + "prefix": "aife", + "body": "align-items: flex-end;" + }, + "align-items: stretch": { + "prefix": "ais", + "body": "align-items: stretch;" + }, + "align-self": { + "prefix": "as", + "body": "align-items: ${1|flex-start,flex-end,center,baseline,stretch,auto|};", + "description": "initial value: auto" + }, + "animation": { + "prefix": "ani", + "body": "animation: ${1:name} ${2:1s} ${3|linear,ease-in-out,ease,ease-in,ease-out,step-start,step-end,steps,cubic-bezier|};", + "description": "animation: name duration timing-function delay direction count fill-mode play-state" + }, + "animation-delay": { + "prefix": "anide", + "body": "animation-delay: ${0:1s};" + }, + "animation-direction": { + "prefix": "anidi", + "body": "animation-direction: ${1|alternate,alternate-reverse,reverse,normal|};", + "description": "initial value: normal" + }, + "animation-duratuion": { + "prefix": "anidu", + "body": "animation-duration: ${0:1s};" + }, + "animation-fill-mode": { + "prefix": "anifm", + "body": "animation-fill-mode: ${1|forwards,backwards,both,none|};", + "description": "initial value: none" + }, + "animation-iteration-count": { + "prefix": "aniic", + "body": "animation-iteration-count: ${0:infinite};", + "description": "initial value: 1" + }, + "animation-name": { + "prefix": "anin", + "body": "animation-name: ${0:name};" + }, + "animation-play-state": { + "prefix": "anips", + "body": "animation-play-state: ${1|paused,running|};", + "description": "initial value: running" + }, + "animation-timing-function": { + "prefix": "anitf", + "body": "animation-timing-function: ${1|linear,ease,ease-in-out,ease-in,ease-out,step-start,step-end,steps,cubic-bezier|};", + "description": "initial value: ease" + }, + "background": { + "prefix": "bg", + "body": "background: ${0:#fff};", + "description": "background: image position/size repeat attachment box box" + }, + "background-attachment": { + "prefix": "bga", + "body": "background-attachment: ${1|fixed,scroll,local|};", + "description": "initial value: scroll" + }, + "background-color": { + "prefix": "bgc", + "body": "background-color: ${0:#fff};" + }, + "background-clip": { + "prefix": "bgcl", + "body": "background-clip: ${1|border-box,padding-box,content-box,text|};", + "description": "initial value: border-box" + }, + "background-image": { + "prefix": "bgi", + "body": "background-image: url('${0:background.jpg}');" + }, + "background-origin": { + "prefix": "bgo", + "body": "background-origin: ${1|border-box,padding-box,content-box|};", + "description": "initial value: padding-box" + }, + "background-position": { + "prefix": "bgp", + "body": "background-position: ${1:left} ${2:top};" + }, + "background-repeat": { + "prefix": "bgr", + "body": "background-repeat: ${1|no-repeat,repeat-x,repeat-y,repeat,space,round|};", + "description": "initial value: repeat" + }, + "background-repeat: repeat": { + "prefix": "bgrr", + "body": "background-repeat: repeat;" + }, + "background-repeat: repeat-x": { + "prefix": "bgrx", + "body": "background-repeat: repeat-x;" + }, + "background-repeat: repeat-y": { + "prefix": "bgry", + "body": "background-repeat: repeat-y;" + }, + "background-repeat: no-repeat": { + "prefix": "bgrn", + "body": "background-repeat: no-repeat;" + }, + "background-size": { + "prefix": "bgs", + "body": "background-size: ${0:cover};" + }, + "border": { + "prefix": "bor", + "body": "border: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" + }, + "border: none": { + "prefix": "born", + "body": "border: none;" + }, + "border-color": { + "prefix": "borc", + "body": "border-color: ${0:#000};" + }, + "border-style": { + "prefix": "bors", + "body": "border-style: ${1|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|};" + }, + "border-width": { + "prefix": "borw", + "body": "border-width: ${0:1px};" + }, + "border-bottom": { + "prefix": "borb", + "body": "border-bottom: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" + }, + "border-left": { + "prefix": "borl", + "body": "border-left: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" + }, + "border-right": { + "prefix": "borr", + "body": "border-right: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" + }, + "border-top": { + "prefix": "bort", + "body": "border-top: ${1:1px} ${2|solid,dashed,dotted,double,groove,ridge,inset,outset,none,hidden|} ${0:#000};" + }, + "border-radius": { + "prefix": "br", + "body": "border-radius: ${0:2px};" + }, + "bottom": { + "prefix": "bot", + "body": "bottom: ${0:0};" + }, + "box-shadow": { + "prefix": "bos", + "body": "box-shadow: ${1:1px} ${2:1px} ${3:1px} ${4:1px} ${0:rgba(0, 0, 0, .5)};", + "description": "box-shadow: x-offset y-offset blur spread color" + }, + "box-sizing": { + "prefix": "boz", + "body": "box-sizing: ${1|border-box,content-box|};", + "description": "initial value: content-box" + }, + "clear": { + "prefix": "clr", + "body": "clear: ${1|both,left,right,none|};" + }, + "color": { + "prefix": "col", + "body": "color: ${0:#000};" + }, + "content": { + "prefix": "con", + "body": "content: '$0';" + }, + "cursor": { + "prefix": "cur", + "body": "cursor: ${1|auto,default,alias,cell,copy,crosshair,context-menu,help,grab,grabbing,move,none,no-drop,not-allowed,pointer,progress,e-resize,all-scroll,text,wait,vertical-text,zoom-in,zoom-out|};", + "description": "initial value: auto" + }, + "cursor: pointer": { + "prefix": "curp", + "body": "cursor: pointer;" + }, + "cursor: default": { + "prefix": "curd", + "body": "cursor: default;" + }, + "display": { + "prefix": "dis", + "body": "display: ${1|none,block,inline,inline-block,flex,inline-flex,list-item,table,inline-table,table-caption,table-cell,table-row,table-row-group,table-column|};" + }, + "display: block": { + "prefix": "disb", + "body": "display: block;" + }, + "display: inline-block": { + "prefix": "disi", + "body": "display: inline-block;" + }, + "display: none": { + "prefix": "disn", + "body": "display: none;" + }, + "display: flex": { + "prefix": "disf", + "body": "display: flex;" + }, + "flex": { + "prefix": "flex", + "body": "flex: ${1:1} ${2:1} ${3:auto};", + "description": "flex: grow shrink basis" + }, + "flex (alt)": { + "prefix": "fle", + "body": "flex: ${1:1} ${2:1} ${3:auto};" + }, + "flex-direction": { + "prefix": "fld", + "body": "flex-direction: ${1|row,row-reverse,column,column-reverse|};", + "description": "initial value: row" + }, + "flex-direction: row": { + "prefix": "fldr", + "body": "flex-direction: row;" + }, + "flex-direction: column": { + "prefix": "fldc", + "body": "flex-direction: column;" + }, + "flex-flow": { + "prefix": "flf", + "body": "flex-flow: ${1|row,row-reverse,column,column-reverse|} ${2|wrap,wrap-reverse,nowrap|};" + }, + "flex-wrap": { + "prefix": "flw", + "body": "flex-wrap: ${1|wrap,wrap-reverse,nowrap|};", + "description": "initial value: nowrap" + }, + "float": { + "prefix": "fl", + "body": "float: ${1|left,right,none|};" + }, + "float: left": { + "prefix": "fll", + "body": "float: left;" + }, + "float: right": { + "prefix": "flr", + "body": "float: right;" + }, + "float: none": { + "prefix": "fln", + "body": "float: none;" + }, + "font-family": { + "prefix": "ff", + "body": "font-family: ${0:arial};" + }, + "font-size": { + "prefix": "fz", + "body": "font-size: ${0:12px};" + }, + "font-style": { + "prefix": "fst", + "body": "font-style: ${1|italic,oblique,normal|};" + }, + "font-style: italic": { + "prefix": "fsti", + "body": "font-style: italic;" + }, + "font-style: normal": { + "prefix": "fstn", + "body": "font-style: normal;" + }, + "font-style: oblique": { + "prefix": "fsto", + "body": "font-style: oblique;" + }, + "font-weight": { + "prefix": "fw", + "body": "font-weight: ${0:bold};" + }, + "font-weight: bold": { + "prefix": "fwb", + "body": "font-weight: bold;" + }, + "font-weight: light": { + "prefix": "fwl", + "body": "font-weight: light;" + }, + "font-weight: normal": { + "prefix": "fwn", + "body": "font-weight: normal;" + }, + "font": { + "prefix": "ft", + "body": "font: ${0:12px/1.5};", + "description": "font: [weight style variant stretch] size/line-height family" + }, + "height": { + "prefix": "hei", + "body": "height: ${0:1px};" + }, + "justify-content": { + "prefix": "jc", + "body": "justify-content: ${1|flex-start,flex-end,center,space-between,space-around|};", + "description": "initial value: flex-start" + }, + "justify-content: flex-start": { + "prefix": "jcfs", + "body": "justify-content: flex-start;" + }, + "justify-content: flex-end": { + "prefix": "jcfe", + "body": "justify-content: flex-end;" + }, + "justify-content: center": { + "prefix": "jcc", + "body": "justify-content: center;" + }, + "justify-content: space-around": { + "prefix": "jcsa", + "body": "justify-content: space-around;" + }, + "justify-content: space-between": { + "prefix": "jcsb", + "body": "justify-content: space-between;" + }, + "list-style": { + "prefix": "lis", + "body": "list-style: ${1|disc,circle,square,decimal,lower-roman,upper-roman,lower-alpha,upper-alpha,none,armenian,cjk-ideographic,georgian,lower-greek,hebrew,hiragana,hiragana-iroha,katakana,katakana-iroha,lower-latin,upper-latin|} ${2|outside,inside|};", + "description": "list-style: type position image" + }, + "list-style-position": { + "prefix": "lisp", + "body": "${1|outside,inside|}", + "description": "initial value: outside" + }, + "list-style-type": { + "prefix": "list", + "body": "list-style-type: ${1|disc,circle,square,decimal,lower-roman,upper-roman,lower-alpha,upper-alpha,none,armenian,cjk-ideographic,georgian,lower-greek,hebrew,hiragana,hiragana-iroha,katakana,katakana-iroha,lower-latin,upper-latin|};", + "description": "initial value: disc" + }, + "list-style-type: circle": { + "prefix": "listc", + "body": "list-style-type: circle;" + }, + "list-style-type: disc": { + "prefix": "listd", + "body": "list-style-type: disc;" + }, + "list-style-type: none": { + "prefix": "listn", + "body": "list-style-type: none;" + }, + "list-style-type: square": { + "prefix": "lists", + "body": "list-style-type: square;" + }, + "list-style-type: lower-roman": { + "prefix": "listlr", + "body": "list-style-type: lower-roman;" + }, + "list-style-type: upper-roman": { + "prefix": "listur", + "body": "list-style-type: upper-roman;" + }, + "left": { + "prefix": "lef", + "body": "left: ${0:0};" + }, + "line-height": { + "prefix": "lh", + "body": "line-height: ${0:1.5};" + }, + "letter-spacing": { + "prefix": "ls", + "body": "letter-spacing: ${0:2px};" + }, + "letter-spacing: normal": { + "prefix": "lsn", + "body": "letter-spacing: normal;" + }, + "margin": { + "prefix": "mar", + "body": "margin: ${0:0};" + }, + "margin-bottom": { + "prefix": "marb", + "body": "margin-bottom: ${0:0};" + }, + "margin-left": { + "prefix": "marl", + "body": "margin-left: ${0:0};" + }, + "margin-right": { + "prefix": "marr", + "body": "margin-right: ${0:0};" + }, + "margin-top": { + "prefix": "mart", + "body": "margin-top: ${0:0};" + }, + "margin: 0 auto": { + "prefix": "mara", + "body": "margin: 0 auto;" + }, + "min-height": { + "prefix": "mih", + "body": "min-height: ${0:1px};" + }, + "min-width": { + "prefix": "miw", + "body": "min-width: ${0:1px};" + }, + "max-height": { + "prefix": "mah", + "body": "max-height: ${0:1px};" + }, + "max-width": { + "prefix": "maw", + "body": "max-width: ${0:1px};" + }, + "opacity": { + "prefix": "opa", + "body": "opacity: ${0:0};" + }, + "overflow": { + "prefix": "ov", + "body": "overflow: ${1|visible,hidden,scroll,auto,clip|};" + }, + "overflow: auto": { + "prefix": "ova", + "body": "overflow: auto;" + }, + "overflow: hidden": { + "prefix": "ovh", + "body": "overflow: hidden;" + }, + "overflow: scroll": { + "prefix": "ovs", + "body": "overflow: scroll;" + }, + "overflow: visible": { + "prefix": "ovv", + "body": "overflow: visible;" + }, + "padding": { + "prefix": "pad", + "body": "padding: ${0:0};" + }, + "padding-bottom": { + "prefix": "padb", + "body": "padding-bottom: ${0:0};" + }, + "padding-left": { + "prefix": "padl", + "body": "padding-left: ${0:0};" + }, + "padding-right": { + "prefix": "padr", + "body": "padding-right: ${0:0};" + }, + "padding-top": { + "prefix": "padt", + "body": "padding-top: ${0:0};" + }, + "position": { + "prefix": "pos", + "body": "position: ${1|relative,absolute,fixed,sticky,static|};" + }, + "position absolute": { + "prefix": "posa", + "body": "position: absolute;" + }, + "position fixed": { + "prefix": "posf", + "body": "position: fixed;" + }, + "position relative": { + "prefix": "posr", + "body": "position: relative;" + }, + "position sticky": { + "prefix": "poss", + "body": "position: sticky;" + }, + "right": { + "prefix": "rig", + "body": "right: ${0:0};" + }, + "text-align": { + "prefix": "ta", + "body": "text-align: ${1|center,left,right,justify,start,end|};" + }, + "text-align: center": { + "prefix": "tac", + "body": "text-align: center;" + }, + "text-align: left": { + "prefix": "tal", + "body": "text-align: left;" + }, + "text-align: right": { + "prefix": "tar", + "body": "text-align: right;" + }, + "text-decoration": { + "prefix": "td", + "body": "text-decoration: ${1|none,underline,overline,line-through|};" + }, + "text-decoration: underline": { + "prefix": "tdu", + "body": "text-decoration: underline;" + }, + "text-decoration: none": { + "prefix": "tdn", + "body": "text-decoration: none;" + }, + "text-decoration: line-through": { + "prefix": "tdl", + "body": "text-decoration: line-through;" + }, + "text-indent": { + "prefix": "ti", + "body": "text-indent: ${0:2em};" + }, + "text-shadow": { + "prefix": "ts", + "body": "text-shadow: ${1:1px} ${2:1px} ${3:1px} ${4:1px} ${0:rgba(0, 0, 0, .5)};", + "description": "text-shadow: x-offset y-offset blur spread color" + }, + "text-transform": { + "prefix": "tt", + "body": "text-transform: ${1|capitalize,uppercase,lowercase,full-width,none|};" + }, + "top": { + "prefix": "top", + "body": "top: ${0:0};" + }, + "vertical-align": { + "prefix": "va", + "body": "vertical-align: ${1|baseline,middle,top,bottom,sub,super,text-top,text-bottom|};" + }, + "vertical-align: bottom": { + "prefix": "vab", + "body": "vertical-align: bottom;" + }, + "vertical-align: middle": { + "prefix": "vam", + "body": "vertical-align: middle;" + }, + "vertical-align: top": { + "prefix": "vat", + "body": "vertical-align: top;" + }, + "visibility": { + "prefix": "vis", + "body": "visibility: ${1|visible,hidden,collapse|};" + }, + "visibility: visible": { + "prefix": "visv", + "body": "visibility: visible;" + }, + "visibility: hidden": { + "prefix": "vish", + "body": "visibility: hidden;" + }, + "word-break": { + "prefix": "wb", + "body": "word-break: ${1|break-all,keep-all,break-word,normal|};" + }, + "width": { + "prefix": "wid", + "body": "width: ${0:0};" + }, + "width: auto": { + "prefix": "wida", + "body": "width: auto;" + }, + "white-space": { + "prefix": "ws", + "body": "white-space: ${1|nowrap,pre,pre-wrap,pre-line,normal|};" + }, + "white-space: nowrap": { + "prefix": "wsn", + "body": "white-space: nowrap;" + }, + "white-space: pre": { + "prefix": "wsp", + "body": "white-space: pre;" + }, + "word-wrap": { + "prefix": "ww", + "body": "word-wrap: ${1|break-word,break-spaces,normal|};" + }, + "z-index": { + "prefix": "zi", + "body": "z-index: ${0:-1};" + }, + "@import": { + "prefix": "imp", + "body": "@import '${0:filename}';" + }, + "@mixin": { + "prefix": "mix", + "body": "@mixin ${1:name} {\n $0\n}" + }, + "@include": { + "prefix": "inc", + "body": "@include ${0:mixin};" + }, + "@keyframes": { + "prefix": "key", + "body": "@keyframes ${1:name} {\n $0\n}" + }, + "@media": { + "prefix": "med", + "body": "@media screen and (${1:max-width: 300px}) {\n $0\n}" + }, + "!important": { + "prefix": "!", + "body": "!important" + }, + "!important (alt)": { + "prefix": "i", + "body": "!important" + } +} diff --git a/snippets/frameworks/django/filetemplates.json b/snippets/frameworks/django/filetemplates.json new file mode 100644 index 0000000..c6561f3 --- /dev/null +++ b/snippets/frameworks/django/filetemplates.json @@ -0,0 +1,35 @@ +{ + "Django URLFile Template":{ + "prefix": "fturl", + "body": [ + "from django.urls import path", + "from . import views as v", + "\n\napp_name = ${1:AppName}", + "urlpatterns = [", + "\t# TODO: Define $1 URLs here", + "\t${0}", + "]" + ], + "description": "Django File-Template Sinppet For ``URL`` File" + }, + "Django FormFile Template":{ + "prefix": "ftform", + "body": [ + "from django import forms", + "from ${1:.models} import ${2}", + "\n\n# TODO: Create your forms here", + "${0}" + ], + "description": "Django File-Template Sinppet For ``Form`` File" + }, + "Django CustomTagsFile Template":{ + "prefix": "ftcutomtags", + "body": [ + "from django import template", + "\nregister = template.Library()", + "\n# TODO: Create your custom tags here", + "${0}" + ], + "description": "Django File-Template Sinppet For ``CustomTags`` File" + } +} diff --git a/snippets/frameworks/django/forms.json b/snippets/frameworks/django/forms.json new file mode 100644 index 0000000..5b2c319 --- /dev/null +++ b/snippets/frameworks/django/forms.json @@ -0,0 +1,168 @@ +{ + "Django Simple Form ":{ + "prefix": "sform", + "body": [ + "class ${1:Name}Form(forms.Form):", + "\t# Define $1Form fields here", + "\t${0}" + ], + "description": "Django Simple Form" + }, + "Django Model Form ":{ + "prefix": "modelform", + "body": [ + "class ${1:ModelName}Form(forms.ModelForm):", + "\tclass Meta:", + "\t\tmodel = ${2:$1}", + "\t\tfields = (${3:\"__all__\"})", + "\t\t${0}" + ], + "description": "Django Model Form" + }, + "Forms BooleanField":{ + "prefix": "fbool", + "body": "${1:FIELDNAME} = forms.BooleanField(${2})", + "description": "Django forms ``BooleanField``" + }, + "Forms CharField":{ + "prefix": "fchar", + "body": "${1:FIELDNAME} = forms.CharField(${2})", + "description": "Django forms ``CharField``" + }, + "Forms ComboField":{ + "prefix": "fcombo", + "body": "${1:FIELDNAME} = forms.ComboField(${2})", + "description": "Django forms ``ComboField``" + }, + "Forms DateField":{ + "prefix": "fdate", + "body": "${1:FIELDNAME} = forms.DateField(${2})", + "description": "Django forms ``DateField``" + }, + "Forms DateTime":{ + "prefix": "fdatetime", + "body": "${1:FIELDNAME} = forms.DateTime(${2})", + "description": "Django forms ``DateTime``" + }, + "Forms DecimalField":{ + "prefix": "fdecimal", + "body": "${1:FIELDNAME} = forms.DecimalField(${2})", + "description": "Django forms ``DecimalField``" + }, + "Forms DurationField":{ + "prefix": "fduration", + "body": "${1:FIELDNAME} = forms.DurationField(${2})", + "description": "Django forms ``DurationField``" + }, + "Forms EmailField":{ + "prefix": "femail", + "body": "${1:FIELDNAME} = forms.EmailField(${2})", + "description": "Django forms ``EmailField``" + }, + "Forms FileField":{ + "prefix": "ffile", + "body": "${1:FIELDNAME} = forms.FileField(${2})", + "description": "Django forms ``FileField``" + }, + "Forms FilePathField":{ + "prefix": "ffilepath", + "body": "${1:FIELDNAME} = forms.FilePathField(${2})", + "description": "Django forms ``FilePathField``" + }, + "Forms FloatField":{ + "prefix": "ffloat", + "body": "${1:FIELDNAME} = forms.FloatField(${2})", + "description": "Django forms ``FloatField``" + }, + "Forms GenericIPAddressField":{ + "prefix": "fgip", + "body": "${1:FIELDNAME} = forms.GenericIPAddressField(${2})", + "description": "Django forms ``GenericIPAddressField``" + }, + "Forms GenericIPAddressField":{ + "prefix": "fgip", + "body": "${1:FIELDNAME} = forms.GenericIPAddressField(${2})", + "description": "Django forms ``GenericIPAddressField``" + }, + "Forms ImageField":{ + "prefix": "fimg", + "body": "${1:FIELDNAME} = forms.ImageField(${2})", + "description": "Django forms ``ImageField``" + }, + "Forms IntegerField":{ + "prefix": "fint", + "body": "${1:FIELDNAME} = forms.IntegerField(${2})", + "description": "Django forms ``IntegerField``" + }, + "Forms IPAddressField":{ + "prefix": "fip", + "body": "${1:FIELDNAME} = forms.IPAddressField(${2})", + "description": "Django forms ``IPAddressField``" + }, + "Forms ModelChoiceField":{ + "prefix": "fmochoice", + "body": "${1:FIELDNAME} = forms.ModelChoiceField(${2})", + "description": "Django forms ``ModelChoiceField``" + }, + "Forms ModelMultipleChoiceField":{ + "prefix": "fmomuchoice", + "body": "${1:FIELDNAME} = forms.ModelMultipleChoiceField(${2})", + "description": "Django forms ``ModelMultipleChoiceField``" + }, + "Forms MultipleChoiceField":{ + "prefix": "fmuchoice", + "body": "${1:FIELDNAME} = forms.MultipleChoiceField(${2})", + "description": "Django forms ``MultipleChoiceField``" + }, + "Forms MultipleValueField":{ + "prefix": "fmuvalue", + "body": "${1:FIELDNAME} = forms.MultipleValueField(${2})", + "description": "Django forms ``MultipleValueField``" + }, + "Forms NullBooleanField":{ + "prefix": "fnullbool", + "body": "${1:FIELDNAME} = forms.NullBooleanField(${2})", + "description": "Django forms ``NullBooleanField``" + }, + "Forms RegexField":{ + "prefix": "fregex", + "body": "${1:FIELDNAME} = forms.RegexField(${2})", + "description": "Django forms ``RegexField``" + }, + "Forms SlugField":{ + "prefix": "fslug", + "body": "${1:FIELDNAME} = forms.SlugField(${2})", + "description": "Django forms ``SlugField``" + }, + "Forms SplitDateTime":{ + "prefix": "fsdatetime", + "body": "${1:FIELDNAME} = forms.SplitDateTime(${2})", + "description": "Django forms ``SplitDateTime`` Field" + }, + "Forms TimeField":{ + "prefix": "ftime", + "body": "${1:FIELDNAME} = forms.TimeField(${2})", + "description": "Django forms ``TimeField``" + }, + "Forms TypedChoiceField":{ + "prefix": "ftchoice", + "body": "${1:FIELDNAME} = forms.TypedChoiceField(${2})", + "description": "Django forms ``TypedChoiceField``" + }, + "Forms TypedMultipleChoiceField":{ + "prefix": "ftmuchoice", + "body": "${1:FIELDNAME} = forms.TypedMultipleChoiceField(${2})", + "description": "Django forms ``TypedMultipleChoiceField``" + }, + "Forms URLField":{ + "prefix": "fulr", + "body": "${1:FIELDNAME} = forms.URLField(${2})", + "description": "Django forms ``URLField``" + }, + "Forms UUIDField":{ + "prefix": "fuuid", + "body": "${1:FIELDNAME} = forms.UUIDField(${2})", + "description": "Django forms ``UUIDField``" + } + +} diff --git a/snippets/frameworks/django/imports.json b/snippets/frameworks/django/imports.json new file mode 100644 index 0000000..d099fb9 --- /dev/null +++ b/snippets/frameworks/django/imports.json @@ -0,0 +1,43 @@ +{ + "Import forms":{ + "prefix": "di-forms", + "body": "from django import forms", + "description": "Import Django ``forms``" + }, + "Import models":{ + "prefix": "di-model", + "body": "from django import models", + "description": "Import Django ``models``" + }, + "Import get_user_model":{ + "prefix": "di-getusermodel", + "body": "from django.contrib.auth import get_user_model", + "description": "Import Django ``get_user_model``" + }, + "Import generic views":{ + "prefix": "di-generic", + "body": "from django.views import generic", + "description": "Import Django ``generic``" + }, + "Import JsonResponse":{ + "prefix": "di-jsonresponse", + "body": "from django.http import JsonResponse", + "description": "Import Django ``JsonResponse``" + }, + "Import reverse":{ + "prefix": "di-reverse", + "body": "from django.urls import reverse", + "description": "Import Django ``reverse``" + }, + "Import reverse_lazy":{ + "prefix": "di-reverse_lazy", + "body": "from django.urls import revers_lazy", + "description": "Import Django ``revers_lazy``" + }, + + "Import messages":{ + "prefix": "di-messages", + "body": "from django.contrib import messages", + "description": "Import Django ``messages``" + } +} diff --git a/snippets/frameworks/django/models.json b/snippets/frameworks/django/models.json new file mode 100644 index 0000000..c0b656c --- /dev/null +++ b/snippets/frameworks/django/models.json @@ -0,0 +1,183 @@ +{ + "Django Simple Model": { + "prefix": "smodel", + "body": [ + "class ${1:ModelName}(models.Model):", + "\t# Define $1 fields here", + "\t${2}", + "\n\tclass Meta:", + "\t\tordering = [\"${3:-pk}\"]", + "\t\tverbose_name = \"${4:$1}\"", + "\t\tverbose_name_plural = \"${5:$1s}\"", + "\n\tdef __str__(self):", + "\t\treturn ${6:super().__str__()}", + "\n\t# Define $1 properties here", + "\t${0}" + ], + "description": "Django Simple Model with properties and attributes" + }, + "Django Full Model": { + "prefix": "model", + "body": [ + "class ${1:ModelName}(models.Model):", + "\t# Define $1 fields here", + "\t${2}", + "\n\tclass Meta:", + "\t\tordering = [\"${3:-pk}\"]", + "\t\tverbose_name = \"${4:$1}\"", + "\t\tverbose_name_plural = \"${5:$1s}\"", + "\n\tdef __str__(self):", + "\t\treturn ${6:super().__str__()}", + "\n\tdef save(self, *args, **kwargs):", + "\t\treturn ${7:super().save(*args, **kwargs)}", + "\n\tdef get_absolute_url(self):", + "\t\treturn reverse('${8:view_or_url_name}', kwargs={${9:'pk'}: ${10: self.pk}})", + "\n\t# Define $1 properties here", + "\t${0}" + ], + "description": "Django Full Model with properties and attributes" + }, + + "Models AutoField":{ + "prefix": "mauto", + "body": "${1:FIELDNAME} = models.AutoField(${2})", + "description": "Django model ``AutoField``" + }, + "Models BigIntegerField":{ + "prefix": "mbigint", + "body": "${1:FIELDNAME} = models.AutoField(${2})", + "description": "Django model ``AutoField``" + }, + "Models BinaryField":{ + "prefix": "mbinary", + "body": "${1:FIELDNAME} = models.BinaryField(${2})", + "description": "Django model ``BinaryField``" + }, + "Models Boolean":{ + "prefix": "mbool", + "body": "${1:FIELDNAME} = models.BooleanField(default=${2:False})", + "description": "Django model ``BooleanField``" + }, + "Models CharField":{ + "prefix": "mchar", + "body": "${1:FieldName} = models.CharField(max_length=${2:32})", + "description": "Django model ``CharField``" + }, + "Models CommaSeparatedIntegerField":{ + "prefix": "mcomma", + "body": "${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2})", + "description": "Django model ``CommaSeparatedIntegerField``" + }, + "Models DateField":{ + "prefix": "mdate", + "body": "${1:FIELDNAME} = models.DateField(auto_now_add=${2:True}, auto_now=${3:False}})", + "description": "Django model ``DateField``" + }, + "Models DateTimeField":{ + "prefix": "mdatetime", + "body": "${1:FIELDNAME} = models.DateTimeField(auto_now_add=${2:True}, auto_now=${3:False})", + "description": "Django model ``DateTimeField``" + }, + "Models DecimalField":{ + "prefix": "mdecimal", + "body": "${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3})", + "description": "Django model ``DecimalField``" + }, + "Models EmailField":{ + "prefix": "memail", + "body": "${1:FIELDNAME} = models.EmailField(${2})", + "description": "Django model ``EmailField``" + }, + "Models FileField":{ + "prefix": "mfile", + "body": "${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload})", + "description": "Django model ``FileField``" + }, + "Models FilePathField":{ + "prefix": "mfilepath", + "body": "${1:FIELDNAME} = models.FilePathField(path=${2:\"/abs/path/to/dir\"}${3:, max_length=100}${4:, match=\"*.ext\"}${4:, recursive=True})", + "description": "Django model ``FilePathField``" + }, + "Models FloatField":{ + "prefix": "mfloat", + "body": "${1:FIELDNAME} = models.FloatField(${2})", + "description": "Django model ``FloatField``" + }, + "Models ImageField":{ + "prefix": "mimg", + "body": "${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100})", + "description": "Django model ``ImageField``" + }, + "Models IntegerField":{ + "prefix": "mint", + "body": "${1:FIELDNAME} = models.IntegerField(${2})", + "description": "Django model ``IntegerField``" + }, + "Models IPAddressField":{ + "prefix": "mip", + "body": "${1:FIELDNAME} = models.IPAddressField(${2})", + "description": "Django model ``IPAddressField``" + }, + "Models NullBooleanField":{ + "prefix": "mnullboolean", + "body": "${1:FIELDNAME} = models.NullBooleanField(${2})", + "description": "Django model ``NullBooleanField``" + }, + "Models PositiveIntegerField":{ + "prefix": "mposint", + "body": "${1:FIELDNAME} = models.PositiveIntegerField(${2})", + "description": "Django model ``PositiveIntegerField``" + }, + "Models PositiveSmallIntegerField":{ + "prefix": "mpossmallint", + "body": "${1:FIELDNAME} = models.PositiveSmallIntegerField(${2})", + "description": "Django model ``PositiveSmallIntegerField``" + }, + "Models SlugField":{ + "prefix": "mslug", + "body": "${1:FIELDNAME} = models.SlugField(${2})", + "description": "Django model ``SlugField``" + }, + "Models SmallIntegerField":{ + "prefix": "msmallint", + "body": "${1:FIELDNAME} = models.SmallIntegerField(${2})", + "description": "Django model ``SmallIntegerField``" + }, + "Models TextField":{ + "prefix": "mtext", + "body": "${1:FIELDNAME} = models.TextField(${2})", + "description": "Django model ``TextField``" + }, + "Models TimeField":{ + "prefix": "mtime", + "body": "${1:FIELDNAME} = models.TimeField(auto_now_add=${2:True}, auto_now=${3:False})", + "description": "Django model ``TimeField``" + }, + "Models URLField":{ + "prefix": "murl", + "body": "${1:FIELDNAME} = models.URLField(verify_exists=${2:False})", + "description": "Django model ``URLField``" + }, + "Models XMLField":{ + "prefix": "mxml", + "body": "${1:FIELDNAME} = models.XMLField(schema_path=${2:None})", + "description": "Django model ``XMLField``" + }, + + "Models ForeignKey":{ + "prefix": "fk", + "body": "${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}, on_delete=models.${3:CASCADE}, related_name=\"${4:RelatedName}\" ${0:, limit_choices_to=})", + "description": "Django model ``ForeignKey``" + }, + "Models ManyToManyField":{ + "prefix": "m2m", + "body": "${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}, related_name=\"${3:RelatedName}\" ${0:, limit_choices_to=})", + "description": "Django model ``ManyToManyField``" + }, + "Models OneToOneField":{ + "prefix": "o2o", + "body": "${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}, related_name=\"${4:RelatedName}\"${0:, to_field=''})", + "description": "Django model ``OneToOneField``" + } +} + diff --git a/snippets/frameworks/django/views.json b/snippets/frameworks/django/views.json new file mode 100644 index 0000000..4faa917 --- /dev/null +++ b/snippets/frameworks/django/views.json @@ -0,0 +1,243 @@ +{ + "Django CreateView":{ + "prefix": "createview", + "body": [ + "class ${1:ModelName}CreateView(generic.CreateView):", + "\tmodel = ${2:$1}", + "\ttemplate_name = \"${3:$1/$1_form.html}\"", + "\tform_class = ${4:forms.$1Form}", + "\tsuccess_url = \"${5:.}\"" + ], + "description": "Django CBV ``CreateView``" + }, + "Django UpdateView":{ + "prefix": "updateview", + "body": [ + "class ${1:ModelName}UpdateView(generic.UpdateView):", + "\tmodel = ${2:$1}", + "\ttemplate_name = \"${3:$1/$1_form.html}\"", + "\tform_class = ${4:forms.$1Form}", + "\tsuccess_url = \"${5:.}\"", + "\n\tdef get_object(self):", + "\t\treturn $1.objects.get(pk=${6:self.kwargs.get(\"pk\")})" + ], + "description": "Django CBV ``UpdateView``" + }, + "Django DeleteView":{ + "prefix": "deleteview", + "body": [ + "class ${1:ModelName}DeleteView(generic.DeleteView):", + "\tmodel = ${2:$1}", + "\n\tdef get_success_url(self):", + "\t\treturn reverse(\"${3:$1:list}\")", + "\n\tdef get(self, request, *args, **kwargs):", + "\t\treturn post(request, *args, **kwargs)" + ], + "description": "Django CBV ``DeleteView``" + }, + "Django DetailView":{ + "prefix": "detailview", + "body": [ + "class ${1:ModelName}DetailView(generic.DetailView):", + "\tmodel = ${2:$1}", + "\ttemplate_name = \"${3:$1/$1_detail.html}\"", + "\n\tdef get_object(self):", + "\t\treturn $1.objects.get(pk=${4:self.kwargs.get(\"pk\")})", + "\n\tdef get_queryset(self):", + "\t\treturn $1.objects.filter(${5})" + ], + "description": "Django CBV ``DetailView``" + }, + "Django ListView":{ + "prefix": "listview", + "body": [ + "class ${1:ModelName}ListView(generic.ListView):", + "\tmodel = ${2:$1}", + "\ttemplate_name = \"${3:$1/$1_list.html}\"", + "\n\tdef get_queryset(self):", + "\t\treturn $1.objects.filter(${4})" + ], + "description": "Django CBV ``ListView``" + }, + "Django TemplateView":{ + "prefix": "templateview", + "body": [ + "class ${1:ModelName}TemplateView(generic.TemplateView):", + "\ttemplate_name = \"${2:$1/$1_list.html}\"", + "\n${3}" + ], + "description": "Django CBV ``TemplateView``" + }, + "Django FormView":{ + "prefix": "formview", + "body": [ + "class ${1:ModelName}FormView(generic.FormView):", + "\tform_class = ${2:forms.$1Form}", + "\ttemplate_name = \"${3}\"" + ], + "description": "Django CBV ``FormView``" + }, + "Django AdminView":{ + "prefix": "adminview", + "body": [ + "@admin.register($1)", + "class ${1:ModelName}Admin(admin.ModelAdmin):", + "\tlist_display = ${2:\"pk\",}", + "\tsearch_fields = ${3:\"pk\",}", + "\tlist_filter = ${4:\"FilterFields\",}" + ], + "description": "Django AdminView for ``admin.py``" + }, + "Django AdminTabularInline":{ + "prefix": "tabularinline", + "body": [ + "class ${1:ModelName}Inline(admin.TabularInline):", + "\tmodel = ${2:$1}", + "\tmin_num = ${4:0}", + "\tmax_num = ${4:8}", + "\textra = ${5:1}" + ], + "description": "Django TabularInline for ``admin.py``" + }, + "Django AdminStackedInline":{ + "prefix": "stackedinline", + "body": [ + "class ${1:ModelName}Inline(admin.StackedInline):", + "\tmodel = ${2:$1}", + "\tmin_num = ${4:0}", + "\tmax_num = ${4:8}", + "\textra = ${5:1}" + ], + "description": "Django StackedInline for ``admin.py``" + }, + + "Django Views get_context_data":{ + "prefix": "getcontextdata", + "body": [ + "def get_context_data(self, *args, **kwargs):", + "\tcontext = super().get_context_data(*args, **kwargs)", + "\treturn context" + ], + "description": "Django Views ``get_context_data`` method" + }, + "Django Views get_success_url":{ + "prefix": "getsuccessurl", + "body": [ + "def get_success_url(self):", + "\treturn reverse(\"${1:ViewName}\", kwargs={${2:\"pk\": self.get_object().pk}})" + ], + "description": "Django Views ``get_success_url`` method" + }, + "Django Views get_queryset":{ + "prefix": "getqueryset", + "body": [ + "def get_queryset(self):", + "\treturn ${1:ModelName}.objects.filter(${2})" + ], + "description": "Django Views ``get_queryset`` method" + }, + "Django Views get_object":{ + "prefix": "getobject", + "body": [ + "def get_object(self):", + "\treturn ${1:ModelName}.objects.get(${2})" + ], + "description": "Django Views ``get_object`` method" + }, + "Django Views form_valid":{ + "prefix": "formvalid", + "body": [ + "def form_valid(self, form):", + "\treturn super().form_valid(form)" + ], + "description": "Django Views ``form_valid`` method" + }, + "Django Views form_invalid":{ + "prefix": "forminvalid", + "body": [ + "def form_invalid(self, form):", + "\treturn super().form_invalid(form)" + ], + "description": "Django Views ``form_invalid`` method" + }, + "Django Views get_form_kwargs":{ + "prefix": "getformkwargs", + "body": [ + "def get_form_kwargs(self, form):", + "\tkwargs = super().get_form_kwargs()", + "\treturn kwargs" + ], + "description": "Django Views ``get_form_kwargs`` method" + }, + "Django Views dispatch":{ + "prefix": "dispatch", + "body": [ + "def dispatch(self, request, *args, **kwargs):", + "\treturn super().dispatch(request, *args, **kwargs)" + ], + "description": "Django Views ``dispatch`` method" + }, + "Django Views get_initial":{ + "prefix": "getinitial", + "body": [ + "def get_initial(self):", + "\tinit = super().get_initial()", + "\treturn init" + ], + "description": "Django Views ``get_initial`` method" + }, + "Django Views post":{ + "prefix": "post", + "body": [ + "def post(self, request, *args, **kwargs):", + "\treturn super().post(request, *args, **kwargs)" + ], + "description": "Django Views ``post`` method" + }, + "Django Views get":{ + "prefix": "get", + "body": [ + "def get(self, request, *args, **kwargs):", + "\treturn super().get(request, *args, **kwargs)" + ], + "description": "Django Views ``post`` method" + }, + + + "Django Forms field_clean":{ + "prefix": "cleanf", + "body": [ + "def clean_${1:FieldName}(self):", + "\t$1 = self.cleaned_data[\"$1\"]", + "\t${0}", + "\treturn $1" + ], + "description": "Django Views ``field_clean`` method" + }, + "Django Forms clean":{ + "prefix": "cleanff", + "body": [ + "def clean(self):", + "\tcleaned_data = super().clean()", + "\t${0}" + ], + "description": "Django Views ``clean`` method" + }, + + + "Django FBV Path":{ + "prefix": "fpath", + "body": "path(\"${1:Path}\", v.${2:View}, name=${0:PathName})", + "description": "Django Path For ``Function Based Views``" + }, + "Django CBV Path":{ + "prefix": "cpath", + "body": "path(\"${1:Path}\", v.${2:View}.as_viewJ(), name=${0:PathName})", + "description": "Django Path For ``Class Based Views``" + }, + "Django Path as Include":{ + "prefix": "ipath", + "body": "path(\"${1:Path}\", include(\"${2}.urls\", namespace=${0:Name})", + "description": "Django Path as ``Include``" + } +} diff --git a/snippets/frameworks/ejs.json b/snippets/frameworks/ejs.json new file mode 100644 index 0000000..477ecf5 --- /dev/null +++ b/snippets/frameworks/ejs.json @@ -0,0 +1,87 @@ +{ + "EJS No Output": { + "prefix": "ejs", + "body": [ + "<% $1 %> $2" + ], + "description": "EJS No Output" + }, + "EJS Output Value": { + "prefix": "ejsout", + "body": [ + "<%= $1 %> $2" + ], + "description": "EJS outputs no value" + }, + "EJS Output Escaped": { + "prefix": "ejsesc", + "body": [ + "<%- $1 %> $2" + ], + "description": "EJS outputs value" + }, + "EJS Comment": { + "prefix": "ejscom", + "body": [ + "<%# $1 %> $2" + ], + "description": "EJS comment tag with no output" + }, + "EJS Literal": { + "prefix": "ejslit", + "body": [ + "<%% $1 %> $2" + ], + "description": "EJS outputs a literal '<%'" + }, + "EJS Include": { + "prefix": "ejsinc", + "body": [ + "<% include $1 %> $2" + ], + "description": "EJS include statement" + }, + "EJS For Loop": { + "prefix": "ejsfor", + "body": [ + "<% for( let ${1:index} = 0; ${1:index} < ${2:array}.length; ${1:index}++ ) { %>", + "$3", + "<% } %>" + ], + "description": "EJS For Loop" + }, + "EJS ForEach": { + "prefix": "ejseach", + "body": [ + "<% ${1:array}.forEach(${2:element} => { %>", + " $3", + "<% }) %>" + ], + "description": "EJS ForEach Loop" + }, + "EJS If Statement": { + "prefix": "ejsif", + "body": [ + "<% if (${1:condition}) { %>", + " $2", + "<% } %>" + ], + "description": "EJS if statement" + }, + "EJS Else Statement": { + "prefix": "ejselse", + "body": [ + "<% } else { %>", + " $1" + ], + "description": "EJS if statement" + }, + "EJS Else If Statement": { + "prefix": "ejselif", + "body": [ + "<% } else if ({$1:condition}) { %>", + " $2" + ], + "description": "EJS if statement" + } +} diff --git a/snippets/frameworks/flutter.json b/snippets/frameworks/flutter.json new file mode 100644 index 0000000..594eeba --- /dev/null +++ b/snippets/frameworks/flutter.json @@ -0,0 +1,498 @@ +{ + "Stateless Widget": { + "prefix": "statelessW", + "body": [ + "class ${1:name} extends StatelessWidget {", + " const ${1:name}({Key? key}) : super(key: key);\n", + " @override", + " Widget build(BuildContext context) {", + " return Container(", + " child: ${2:null},", + " );", + " }", + "}" + ], + "description": "Create a Stateless widget" + }, + "Stateful Widget": { + "prefix": "statefulW", + "body": [ + "class ${1:name} extends StatefulWidget {", + " ${1:name}({Key? key}) : super(key: key);\n", + " @override", + " _${1:WidgetName}State createState() => _${1:WidgetName}State();", + "}\n", + "class _${1:index}State extends State<${1:index}> {", + " @override", + " Widget build(BuildContext context) {", + " return Container(", + " child: ${2:null},", + " );", + " }", + "}" + ], + "description": "Create a Stateful widget" + }, + "Build Method": { + "prefix": "build", + "body": [ + "@override", + "Widget build(BuildContext context) {", + " return ${0:};", + "}" + ], + "description": "Describes the part of the user interface represented by this widget." + }, + "Custom Painter ": { + "prefix": "customPainter", + "body": [ + "class ${0:name}Painter extends CustomPainter {", + "", + " @override", + " void paint(Canvas canvas, Size size) {", + " }", + "", + " @override", + " bool shouldRepaint(${0:name}Painter oldDelegate) => false;", + "", + " @override", + " bool shouldRebuildSemantics(${0:name}Painter oldDelegate) => false;", + "}" + ], + "description": "Used for creating custom paint" + }, + "Custom Clipper ": { + "prefix": "customClipper", + "body": [ + "class ${0:name}Clipper extends CustomClipper {", + "", + " @override", + " Path getClip(Size size) {", + " }", + "", + " @override", + " bool shouldReclip(CustomClipper oldClipper) => false;", + "}" + ], + "description": "Used for creating custom shapes" + }, + "InitState ": { + "prefix": "initS", + "body": [ + "@override", + "void initState() { ", + " super.initState();", + " ${0:}", + "}" + ], + "description": "Called when this object is inserted into the tree. The framework will call this method exactly once for each State object it creates." + }, + "Dispose": { + "prefix": "dis", + "body": [ + "@override", + "void dispose() { ", + " ${0:}", + " super.dispose();", + "}" + ], + "description": "Called when this object is removed from the tree permanently. The framework calls this method when this State object will never build again." + }, + "Reassemble": { + "prefix": "reassemble", + "body": [ + "@override", + "void reassemble(){", + " super.reassemble();", + " ${0:}", + "}" + ], + "description": "Called whenever the application is reassembled during debugging, for example during hot reload." + }, + "didChangeDependencies": { + "prefix": "didChangeD", + "body": [ + "@override", + "void didChangeDependencies() {", + " super.didChangeDependencies();", + " ${0:}", + "}" + ], + "description": "Called when a dependency of this State object changes" + }, + "didUpdateWidget": { + "prefix": "didUpdateW", + "body": [ + "@override", + "void didUpdateWidget (${1:Type} ${2:oldWidget}) {", + " super.didUpdateWidget(${2:oldWidget});", + " ${0:}", + "}" + ], + "description": "Called whenever the widget configuration changes." + }, + "ListView.Builder": { + "prefix": "listViewB", + "body": [ + "ListView.builder(", + " itemCount: ${1:1},", + " itemBuilder: (BuildContext context, int index) {", + " return ${2:};", + " },", + ")," + ], + "description": "Creates a scrollable, linear array of widgets that are created on demand.Providing a non-null `itemCount` improves the ability of the [ListView] to estimate the maximum scroll extent." + }, + "ListView.Separated": { + "prefix": "listViewS", + "body": [ + "ListView.separated(", + " itemCount: ${1:1},", + " separatorBuilder: (BuildContext context, int index) {", + " return ${2:};", + " },", + " itemBuilder: (BuildContext context, int index) {", + " return ${3:};", + " },", + ")," + ], + "description": "Creates a fixed-length scrollable linear array of list 'items' separated by list item 'separators'." + }, + "GridView.Builder": { + "prefix": "gridViewB", + "body": [ + "GridView.builder(", + " gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(", + " crossAxisCount: ${1:2},", + " ),", + " itemCount: ${2:2},", + " itemBuilder: (BuildContext context, int index) {", + " return ${3:};", + " },", + ")," + ], + "description": "Creates a scrollable, 2D array of widgets that are created on demand. Providing a non-null `itemCount` improves the ability of the [GridView] to estimate the maximum scroll extent." + }, + "GridView.Count": { + "prefix": "gridViewC", + "body": [ + "GridView.count(", + " crossAxisSpacing: ${1:1},", + " mainAxisSpacing: ${2:2},", + " crossAxisCount: ${3:2},", + " children: [", + " ${4:}", + " ],", + ")," + ], + "description": "Creates a scrollable, 2D array of widgets with a fixed number of tiles in the cross axis." + }, + "GridView.Extent": { + "prefix": "gridViewE", + "body": [ + "GridView.extent(", + " maxCrossAxisExtent: ${1:2},", + " children: [", + " ${2:}", + " ],", + ")," + ], + "description": "Creates a scrollable, 2D array of widgets with tiles that each have a maximum cross-axis extent." + }, + "Custom Scroll View": { + "prefix": "customScrollV", + "body": [ + "CustomScrollView(", + " slivers: [", + " ${0:}", + " ],", + ")," + ], + "description": "Creates a `ScrollView` that creates custom scroll effects using slivers. If the `primary` argument is true, the `controller` must be null." + }, + "Stream Builder": { + "prefix": "streamBldr", + "body": [ + "StreamBuilder(", + " stream: ${1:stream},", + " initialData: ${2:initialData},", + " builder: (BuildContext context, AsyncSnapshot snapshot) {", + " return Container(", + " child: ${3:child},", + " );", + " },", + ")," + ], + "description": "Creates a new `StreamBuilder` that builds itself based on the latest snapshot of interaction with the specified `stream`" + }, + "Animated Builder": { + "prefix": "animatedBldr", + "body": [ + "AnimatedBuilder(", + " animation: ${1:animation},", + " child: ${2:child},", + " builder: (BuildContext context, Widget child) {", + " return ${3:};", + " },", + ")," + ], + "description": "Creates an Animated Builder. The widget specified to `child` is passed to the `builder` " + }, + "Stateful Builder": { + "prefix": "statefulBldr", + "body": [ + "StatefulBuilder(", + " builder: (BuildContext context, setState) {", + " return ${0:};", + " },", + ")," + ], + "description": "Creates a widget that both has state and delegates its build to a callback. Useful for rebuilding specific sections of the widget tree." + }, + "Orientation Builder": { + "prefix": "orientationBldr", + "body": [ + "OrientationBuilder(", + " builder: (BuildContext context, Orientation orientation) {", + " return Container(", + " child: ${3:child},", + " );", + " },", + ")," + ], + "description": "Creates a builder which allows for the orientation of the device to be specified and referenced" + }, + "Layout Builder": { + "prefix": "layoutBldr", + "body": [ + "LayoutBuilder(", + " builder: (BuildContext context, BoxConstraints constraints) {", + " return ${0:};", + " },", + ")," + ], + "description": "Similar to the Builder widget except that the framework calls the builder function at layout time and provides the parent widget's constraints." + }, + "Single Child ScrollView": { + "prefix": "singleChildSV", + "body": [ + "SingleChildScrollView(", + " controller: ${1:controller,}", + " child: Column(", + " ${0:}", + " ),", + ")," + ], + "description": "Creates a scroll view with a single child" + }, + "Future Builder": { + "prefix": "futureBldr", + "body": [ + "FutureBuilder(", + " future: ${1:Future},", + " initialData: ${2:InitialData},", + " builder: (BuildContext context, AsyncSnapshot snapshot) {", + " return ${3:};", + " },", + ")," + ], + "description": "Creates a Future Builder. This builds itself based on the latest snapshot of interaction with a Future." + }, + "No Such Method": { + "prefix": "nosm", + "body": [ + "@override", + "dynamic noSuchMethod(Invocation invocation) {", + " ${1:}", + "}" + ], + "description": "This method is invoked when a non-existent method or property is accessed." + }, + "Inherited Widget": { + "prefix": "inheritedW", + "body": [ + "class ${1:Name} extends InheritedWidget {", + " ${1:Name}({Key? key, required this.child}) : super(key: key, child: child);", + "", + " final Widget child;", + "", + " static ${1:Name}? of(BuildContext context) {", + " return context.dependOnInheritedWidgetOfExactType<${1:Name}>();", + " }", + "", + " @override", + " bool updateShouldNotify(${1:Name} oldWidget) {", + " return ${2:true};", + " }", + "}" + ], + "description": "Class used to propagate information down the widget tree" + }, + "Mounted": { + "prefix": "mounted", + "body": [ + "@override", + "bool get mounted {", + " ${0:}", + "}" + ], + "description": "Whether this State object is currently in a tree." + }, + "Sink": { + "prefix": "snk", + "body": [ + "Sink<${1:type}> get ${2:name} => _${2:name}Controller.sink;", + "final _${2:name}Controller = StreamController<${1:type}>();" + ], + "description": "A Sink is the input of a stream." + }, + "Stream": { + "prefix": "strm", + "body": [ + "Stream<${1:type}> get ${2:name} => _${2:name}Controller.stream;", + "final _${2:name}Controller = StreamController<${1:type}>();" + ], + "description": "A source of asynchronous data events. A stream can be of any data type " + }, + "Subject": { + "prefix": "subj", + "body": [ + "Stream<${1:type}> get ${2:name} => _${2:name}Subject.stream;", + "final _${2:name}Subject = BehaviorSubject<${1:type}>();" + ], + "description": "A BehaviorSubject is also a broadcast StreamController which returns an Observable rather than a Stream." + }, + "toString": { + "prefix": "toStr", + "body": [ + "@override", + "String toString() {", + "return ${1:toString};", + " }" + ], + "description": "Returns a string representation of this object." + }, + "debugPrint": { + "prefix": "debugP", + "body": [ + "debugPrint(${1:statement});" + ], + "description": "Prints a message to the console, which you can access using the flutter tool's `logs` command (flutter logs)." + }, + "Material Package": { + "prefix": "importM", + "body": "import 'package:flutter/material.dart';", + "description": "Import flutter material package" + }, + "Cupertino Package": { + "prefix": "importC", + "body": "import 'package:flutter/cupertino.dart';", + "description": "Import Flutter Cupertino package" + }, + "flutter_test Package": { + "prefix": "importFT", + "body": "import 'package:flutter_test/flutter_test.dart';", + "description": "Import flutter_test package" + }, + "Material App": { + "prefix": "mateapp", + "description": "Create a MaterialApp", + "body": [ + "import 'package:flutter/material.dart';", + " ", + "void main() => runApp(MyApp());", + " ", + "class MyApp extends StatelessWidget {", + " @override", + " Widget build(BuildContext context) {", + " return MaterialApp(", + " title: 'Material App',", + " home: Scaffold(", + " appBar: AppBar(", + " title: Text('Material App Bar'),", + " ),", + " body: Center(", + " child: Container(", + " child: Text('Hello World'),", + " ),", + " ),", + " ),", + " );", + " }", + "}" + ] + }, + "Cupertino App": { + "prefix": "cupeapp", + "description": "Create a CupertinoApp", + "body": [ + "import 'package:flutter/cupertino.dart';", + " ", + "void main() => runApp(MyApp());", + " ", + "class MyApp extends StatelessWidget {", + " @override", + " Widget build(BuildContext context) {", + " return CupertinoApp(", + " title: 'Cupertino App',", + " home: CupertinoPageScaffold(", + " navigationBar: CupertinoNavigationBar(", + " middle: Text('Cupertino App Bar'),", + " ),", + " child: Center(", + " child: Container(", + " child: Text('Hello World'),", + " ),", + " ),", + " ),", + " );", + " }", + "}" + ] + }, + "Tween Animation Builder": { + "prefix": "tweenAnimationBuilder", + "body": [ + "TweenAnimationBuilder(", + " duration: ${1:const Duration(),}", + " tween: ${2:Tween(),}", + " builder: (BuildContext context, ${3:dynamic} value, Widget? child) {", + " return ${4:Container();}", + " },", + " ), " + ], + "description": "Widget builder that animates a property of a Widget to a target value whenever the target value changes." + }, + "Value Listenable Builder": { + "prefix": "valueListenableBuilder", + "body": [ + "ValueListenableBuilder(", + " valueListenable: ${1: null},", + " builder: (BuildContext context, ${2:dynamic} value, Widget? child) {", + " return ${3: Container();}", + " },", + " )," + ], + "description": "Given a ValueListenable and a builder which builds widgets from concrete values of T, this class will automatically register itself as a listener of the ValueListenable and call the builder with updated values when the value changes." + }, + "Test": { + "prefix": "f-test", + "body": [ + "test(", + " \"${1:test description}\",", + " () {},", + ");" + ], + "description": "Create a test function" + }, + "Test Widgets": { + "prefix": "widgetTest", + "body": [ + "testWidgets(", + " \"${1:test description}\",", + " (WidgetTester tester) async {},", + ");" + ], + "description": "Create a testWidgets function" + } +} \ No newline at end of file diff --git a/snippets/frameworks/jekyll.json b/snippets/frameworks/jekyll.json new file mode 100644 index 0000000..9a11714 --- /dev/null +++ b/snippets/frameworks/jekyll.json @@ -0,0 +1,526 @@ +{ + "Show": { + "prefix": "show", + "description": "Output markup: {{ }}", + "body": "{{ $1 }}" + }, + + "Execute": { + "prefix": "execute", + "description": "Tag markup: {%- -%}", + "body": "{%- $1 -%}" + }, + + "Tag assign": { + "prefix": "assign", + "description": "Variable tag: assign", + "body": [ + "{%- assign ${variable} = ${value} -%}" + ] + }, + + "Tag break": { + "prefix": "break", + "description": "Iteration tag: break", + "body": [ + "{%- break -%}" + ] + }, + + "Tag capture": { + "prefix": "capture", + "description": "Variable tag: capture", + "body": [ + "{%- capture ${variable} -%}${code:}{%- endcapture -%}" + ] + }, + + "Tag case": { + "prefix": "case", + "description": "Control flow tag: case", + "body": [ + "{%- case ${variable} -%}", + "\t{%- when ${condition} -%}", + "\t\t${code1:}", + "\t{%- else -%}", + "\t\t${code2:}", + "{%- endcase -%}" + ] + }, + + "Tag comment": { + "prefix": "comment", + "description": "Control flow tag: case", + "body": [ + "{%- comment -%}${description:}{%- endcomment -%}" + ] + }, + + "Tag context variable": { + "prefix": "convar", + "description": "Context Variable", + "body": [ + "{{ ${variable:} }}" + ] + }, + + "Tag continue": { + "prefix": "continue", + "description": "Iteration tag: continue", + "body": [ + "{%- continue -%}" + ] + }, + + "Tag cycle": { + "prefix": "cycle", + "description": "Iteration tag: cycle", + "body": [ + "{%- cycle '${0:odd}', '${1:even}' -%}" + ] + }, + + "Tag collection directory": { + "prefix": "cdirp", + "description": "The full path to the collection's source direcotry", + "body": [ + "{{ site.${my_collection}.directory }}" + ] + }, + + "Tag collection relative path": { + "prefix": "crelp", + "description": "The path to the document's source file realtive to the site source", + "body": [ + "{{ site.collections.${my_collection}.relative_path }}" + ] + }, + + "Tag decrement": { + "prefix": "decrement", + "description": "Variable tag: decrement", + "body": [ + "{%- decrement ${variable} -%}" + ] + }, + + "Tag for": { + "prefix": "for", + "description": "Iteration tag: for", + "body": [ + "{%- for ${item} in ${collection} -%}", + "\t${code:}", + "{%- endfor -%}" + ] + }, + + "Tag increment": { + "prefix": "increment", + "description": "Variable tag: increment", + "body": [ + "{%- increment ${variable} -%}" + ] + }, + + "Tag if": { + "prefix": "if", + "description": "Control flow tag: if", + "body": [ + "{%- if ${condition} -%}", + "\t${code:}", + "{%- endif -%}" + ] + }, + + "Tag else": { + "prefix": "else", + "description": "Control flow tag: else", + "body": [ + "{%- else -%}" + ] + }, + + "Tag elsif": { + "prefix": "elsif", + "description": "Control flow tag: elsif", + "body": [ + "{%- elsif ${condition} -%}" + ] + }, + + "Tag if else": { + "prefix": "ifelse", + "description": "Control flow tag: if else", + "body": [ + "{%- if ${condition} -%}", + "\t${code1:}", + "{%- else -%}", + "\t${code2:}", + "{%- endif -%}" + ] + }, + + "Tag gist": { + "prefix": "gist", + "description": "Add a gist code block", + "body": [ + "{%- gist ${gist:user/gist-id} -%}" + ] + }, + + "Tag highlight": { + "prefix": "highlight", + "description": "Syntax tag: highlight", + "body": [ + "{%- highlight ${lang:javascript} -%}", + "\t\t${code:}", + "{%- endhighlight -%}" + ] + }, + + "Tag include": { + "prefix": "include", + "description": "Tag: include", + "body": [ + "{%- include ${snippet} -%}" + ] + }, + + "Site Vairable Date": { + "prefix": "date", + "description": "Tag: site.date", + "body": [ + "{{ site.date | date: '${format: %b %d, %Y}' }}" + ] + }, + + "Tag include relative": { + "prefix": "increl", + "description": "Tag: include relative", + "body": [ + "{%- include_relative '${file:}' -%}" + ] + }, + + "Tag Post URL": { + "prefix": "posturl", + "description": "Tag: post_url", + "body": [ + "{%- post_url ${url:} -%}" + ] + }, + + "Tag unless": { + "prefix": "unless", + "description": "Control flow tag: unless", + "body": [ + "{%- unless ${condition} -%}", + "\t${code:}", + "{%- endunless -%}" + ] + }, + + "Tag when": { + "prefix": "when", + "description": "Control flow tag: when", + "body": [ + "{%- when ${condition} -%}", + "${code:}" + ] + }, + + "Tag Option limit": { + "prefix": "limit", + "description": "For loops option", + "body": [ + "limit: ${limit:5}" + ] + }, + + "Tag Option offset": { + "prefix": "offset", + "description": "For loops option", + "body": [ + "offset: ${offset:0}" + ] + }, + + "Tag Option reversed": { + "prefix": "reversed", + "description": "For loops option", + "body": [ + "reversed" + ] + }, + + "Tag raw": { + "prefix": "raw", + "description": "Tag: raw", + "body": [ + "{%- raw -%}${code:}{%- endraw -%}" + ] + }, + + "Tag paginate next or previous page": { + "prefix": "paginate", + "description": "Tag: paginate next or previous page", + "body": [ + "{{ paginator.${next:previous}_page }}" + ] + }, + + "Filter jsonify": { + "prefix": "json", + "description": "Array filter: jsonify", + "body": "| jsonify }}'" + }, + + "Filter join": { + "prefix": "join", + "description": "Array filter: join", + "body": "| join: '${seperator:, }}'" + }, + + "Filter first": { + "prefix": "first", + "description": "Array filter: first", + "body": "| first" + }, + + "Filter last": { + "prefix": "last", + "description": "Array filter: last", + "body": "| last" + }, + + "Filter map": { + "prefix": "map", + "description": "Array filter: map", + "body": "| map: '${key}'" + }, + + "Filter size": { + "prefix": "size", + "description": "Array filter: size", + "body": "| size" + }, + + "Filter sort": { + "prefix": "sort", + "description": "Array filter: sort", + "body": "| sort" + }, + + "Filter uniq": { + "prefix": "uniq", + "description": "Array filter: uniq", + "body": "| uniq" + }, + + "Filter ceil": { + "prefix": "ceil", + "description": "Math filter: ceil", + "body": "| ceil" + }, + + "Filter divided by": { + "prefix": "divided_by", + "description": "Math filter: divided by", + "body": "| divided_by: ${divided_by:2}" + }, + + "Filter floor": { + "prefix": "floor", + "description": "Math filter: floor", + "body": "| floor" + }, + + "Filter minus": { + "prefix": "minus", + "description": "Math filter: minus", + "body": "| minus: ${minus:1}" + }, + + "Filter modulo": { + "prefix": "modulo", + "description": "Math filter: modulo", + "body": "| modulo: ${modulo:2}" + }, + + "Filter plus": { + "prefix": "plus", + "description": "Math filter: plus", + "body": "| plus: ${plus:1}" + }, + + "Filter round": { + "prefix": "round", + "description": "Math filter: round", + "body": "| round: ${round:0}" + }, + + "Filter times": { + "prefix": "times", + "description": "Math filter: times", + "body": "| times: ${times:1}" + }, + + "Filter append": { + "prefix": "append", + "description": "String filter: append", + "body": "| append: '${string}' }}" + }, + + "Filter capitalize": { + "prefix": "capitalize", + "description": "String filter: capitalize", + "body": "| capitalize }}" + }, + + "Filter downcase": { + "prefix": "downcase", + "description": "String filter: downcase", + "body": "| downcase }}" + }, + + "Filter escape": { + "prefix": "escape", + "description": "String filter: escape", + "body": "| escape }}" + }, + + "Filter markdownify": { + "prefix": "markdown", + "description": "String filter: markdownify", + "body": "| markdownify }}" + }, + + "Filter prepend": { + "prefix": "prepend", + "description": "String filter: prepend", + "body": "| prepend: '${string}' }}" + }, + + "Filter remove": { + "prefix": "remove", + "description": "String filter: remove", + "body": "| remove: '${string}' }}" + }, + + "Filter remove first": { + "prefix": "remove_first", + "description": "String filter: remove first", + "body": "| remove_first: '${string}' }}" + }, + + "Filter replace": { + "prefix": "replace", + "description": "String filter: replace", + "body": "| replace: '${target}', '${replace}' }}" + }, + + "Filter replace first": { + "prefix": "replace_first", + "description": "String filter: replace first", + "body": "| replace_first: '${target}', '${replace}' }}" + }, + + "Filter slice": { + "prefix": "slice", + "description": "String filter: slice", + "body": "| slice: ${from:0}, ${to:5} }}" + }, + + "Filter slice single character": { + "prefix": "slice_single", + "description": "String filter: slice with single parameter", + "body": "| slice: ${at} }}" + }, + + "Filter split": { + "prefix": "split", + "description": "String filter: split", + "body": "| split: '${splitter:,}' }}" + }, + + "Filter strip": { + "prefix": "strip", + "description": "String filter: strip", + "body": "| strip }}" + }, + + "Filter lstrip": { + "prefix": "lstrip", + "description": "String filter: lstrip", + "body": "| lstrip }}" + }, + + "Filter rstrip": { + "prefix": "rstrip", + "description": "String filter: rstrip", + "body": "| rstrip }}" + }, + + "Filter strip html": { + "prefix": "strip_html", + "description": "String filter: strip html", + "body": "| strip_html }}" + }, + + "Filter strip newlines": { + "prefix": "strip_newlines", + "description": "String filter: strip newlines", + "body": "| strip_newlines }}" + }, + + "Filter truncate": { + "prefix": "truncate", + "description": "String filter: truncate", + "body": "| truncate: ${length:20}, '${ellipsis:...}' }}" + }, + + "Filter truncatewords": { + "prefix": "truncatewords", + "description": "String filter: truncatewords", + "body": "| truncatewords: ${length:5}, '${ellipsis:...}' }}" + }, + + "Filter upcase": { + "prefix": "upcase", + "description": "String filter: upcase }}", + "body": "| upcase }}" + }, + + "Filter url encode": { + "prefix": "url_encode", + "description": "String filter: url encode", + "body": "| url_encode }}" + }, + + "Filter uri escape": { + "prefix": "uri_escape", + "description": "String filter: uri escape", + "body": "| uri_escape }}" + }, + + "Filter xml escape": { + "prefix": "xml_escape", + "description": "String filter: xml escape", + "body": "| xml_escape }}" + }, + + "Front Matter": { + "prefix": "fm", + "description": "Add front matter", + "body": [ + "---", + "layout: ${layout:default}", + "title: ${title}", + "categories: ${category}", + "permalink: ${path}", + "tags: ${tag}", + "excerpt: ${description}", + "---" + ] + } +} diff --git a/snippets/frameworks/rails.json b/snippets/frameworks/rails.json new file mode 100644 index 0000000..db095a9 --- /dev/null +++ b/snippets/frameworks/rails.json @@ -0,0 +1,294 @@ +{ + "Before action": { + "prefix": "ba", + "body": [ + "before_action :${0:method}" + ], + "description": "before_action" + }, + "Before validation": { + "prefix": "bv", + "body": [ + "before_validation :${0:method}" + ], + "description": "before_validation" + }, + "Before create": { + "prefix": "bc", + "body": [ + "before_create :${0:method}" + ], + "description": "before_create" + }, + "Before update": { + "prefix": "bu", + "body": [ + "before_update :${0:method}" + ], + "description": "before_update" + }, + "Before save": { + "prefix": "bs", + "body": [ + "before_save :${0:method}" + ], + "description": "before_save" + }, + "Before destroy": { + "prefix": "bd", + "body": [ + "before_destroy :${0:method}" + ], + "description": "before_destroy" + }, + "After create": { + "prefix": "ac", + "body": [ + "after_create :${0:method}" + ], + "description": "after_create" + }, + "After validation": { + "prefix": "av", + "body": [ + "after_validation :${0:method}" + ], + "description": "after_validation" + }, + " update": { + "prefix": "au", + "body": [ + "after_update :${0:method}" + ], + "description": "after_update" + }, + " save": { + "prefix": "as", + "body": [ + "after_save :${0:method}" + ], + "description": "after_create" + }, + " destroy": { + "prefix": "ad", + "body": [ + "after_destroy :${0:method}" + ], + "description": "after_destroy" + }, + "Belongs to": { + "prefix": "bt", + "body": [ + "belongs_to :${0:association}" + ], + "description": "belongs_to assocation" + }, + "Belongs to polymorphic": { + "prefix": "btp", + "body": [ + "belongs_to :${0:association}, polymorphic: true" + ], + "description": "belongs_to polymorphic assocation" + }, + "Create action": { + "prefix": "create", + "body": [ + "def create", + "\t@${1:model_class_name} = ${2:ModelClassName}.new($1_params)", + "\trespond_to do |format|", + "\t\tif @$1.save", + "\t\t\tformat.html { redirect_to @$1, notice: '$2 created' }", + "\t\telse", + "\t\t\tformat.html { render :new, status: :unprocessable_entity }", + "\t\tend", + "\tend", + "end" + ], + "description": "def create" + }, + "Destroy action": { + "prefix": "destroy", + "body": [ + "def destroy", + "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", + "\t@$1.destroy!", + "\tredirect_to $1s_path, notice: '$2 removed'", + "end" + ], + "description": "def destroy" + }, + "Edit action": { + "prefix": "edit", + "body": [ + "def edit", + "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", + "end" + ], + "description": "def edit" + }, + "Index action": { + "prefix": "index", + "body": [ + "def index", + "\t@${1:model_class_name} = ${2:ModelClassName}.all", + "end" + ], + "description": "def index" + }, + "New action": { + "prefix": "new", + "body": [ + "def new", + "\t@${1:model_class_name} = ${2:ModelClassName}.new", + "end" + ], + "description": "def new" + }, + "Show action": { + "prefix": "show", + "body": [ + "def show", + "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", + "end" + ], + "description": "def show" + }, + "Update action": { + "prefix": "update", + "body": [ + "def update", + "\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])", + "\trespond_to do |format|", + "\t\tif @$1.update($1_params)", + "\t\t\tformat.html { redirect_to @$1, notice: '$2 updated' }", + "\t\telse", + "\t\t\tformat.html { render :edit, status: :unprocessable_entity }", + "\t\tend", + "\tend", + "end" + ], + "description": "def update" + }, + "Model Params": { + "prefix": "params", + "body": [ + "def ${1:model_class_name}_params", + "\tparams.require(:$1).permit(${2:attributes})", + "end" + ], + "description": "def model_params" + }, + "Getting Params": { + "prefix": "pa", + "body": [ + "params[:${1:id}]" + ], + "description": "getting params using attribute" + }, + "Delegate to": { + "prefix": "dt", + "body": [ + "delegate: :${1:method}, to: :${0:object}" + ], + "description": "delegate to" + }, + "Delegate to with prefix": { + "prefix": "dtp", + "body": [ + "delegate: :${1:method}, to: :${2:object}, prefix: :${3:prefix}, allow_nil: ${0:allow_nil}" + ], + "description": "delegate to" + }, + "Scope": { + "prefix": "scope", + "body": [ + "scope :${1:name}, -> { where(${2:field}: ${0:value}) }" + ], + "description": "AR scope" + }, + "Validate presence": { + "prefix": "vp", + "body": [ + "validates :${1:attribute}, presence: true" + ], + "description": "validates presence" + }, + "Validate uniqueness": { + "prefix": "vu", + "body": [ + "validates :${1:attribute}, uniqueness: true" + ], + "description": "validates presence" + }, + "Migration add column": { + "prefix": "mac", + "body": [ + "add_column :${1:table_name}, :${2:column_name}, :${0:data_type}" + ], + "description": "Migration add column" + }, + "Migration add index": { + "prefix": "mai", + "body": [ + "add_index :${1:table_name}, :${0:column_name}" + ], + "description": "Migration add index" + }, + "Migration remove column": { + "prefix": "mrc", + "body": [ + "remove_column :${1:table_name}, :${0:column_name}" + ], + "description": "Migration remove column" + }, + "Migration rename column": { + "prefix": "mrnc", + "body": [ + "rename_column :${1:table_name}, :${2:old_column_name}, :${0:new_column_name}" + ], + "description": "Migration rename column" + }, + "Migration change column": { + "prefix": "mcc", + "body": [ + "change_column :${1:table_name}, :${2:old_column_name}, :${0:data_type}" + ], + "description": "Migration change column" + }, + "Has many dependent": { + "prefix": "hmd", + "body": [ + "has_many :${1:object}, dependent: :${0:destroy}" + ], + "description": "has_many dependent" + }, + "Has many": { + "prefix": "hm", + "body": [ + "has_many :${0:object}" + ], + "description": "has_many association" + }, + "Has many through": { + "prefix": "hmt", + "body": [ + "has_many :${1:object}, through: :${0:object}" + ], + "description": "has_many through association" + }, + "Has one": { + "prefix": "ho", + "body": [ + "has_one :${0:object}" + ], + "description": "has_one association" + }, + "Has one dependent": { + "prefix": "hod", + "body": [ + "has_one :${1:object}, dependent: :${0:destroy}" + ], + "description": "has_one dependent" + } +} + diff --git a/snippets/frameworks/twig.json b/snippets/frameworks/twig.json new file mode 100644 index 0000000..b9a7469 --- /dev/null +++ b/snippets/frameworks/twig.json @@ -0,0 +1,536 @@ +{ + "asset": { + "prefix": "asset", + "body": + "{% set asset = ${1:entry.assetFieldHandle}.one() %}\n\n{% if asset %}\n\t\"{{\n{% endif %}", + "description": "asset" + }, + "assets": { + "prefix": "assets", + "body": + "{% for image in craft.assets.\n\t.sourceId(\"${1:1}\")\n\t.kind(\"${2:image}\")\n\t.limit(${3:10})\n}).all() %}\n\t\"{{\n{% endfor %}\n$0", + "description": "craft.assets" + }, + "autoescape": { + "prefix": "autoescape", + "body": "{% autoescape \"${1:type}\" %}\n\t$0\n{% endautoescape %}", + "description": "autoescape" + }, + "blockb": { + "prefix": "blockb", + "body": "{% block ${1:name} %}\n\t$0\n{% endblock %}", + "description": "block (block)" + }, + "block": { + "prefix": "block", + "body": "{% block ${1:name} %}$0{% endblock %}", + "description": "block" + }, + "blockf": { + "prefix": "blockf", + "body": "{{ block(\"${1:name}\") }}$0", + "description": "blockf" + }, + "cache": { + "prefix": "cache", + "body": "{% cache %}\n\t$1\n{% endcache %}\n$0", + "description": "cache" + }, + "case": { + "prefix": "case", + "body": "{% case \"${1:value}\" %}\n\t$0", + "description": "case" + }, + "children": { + "prefix": "children", + "body": "{% children %}$0", + "description": "children" + }, + "ceil": { + "prefix": "ceil", + "body": "ceil($1)$0", + "description": "ceil" + }, + "assetso": { + "prefix": "assetso", + "body": + "{% set assets = craft.assets({\n\tsourceId: \"${1:1}\",\n\tkind: \"${2:image}\",\n\tlimit: ${3:10}\n}).all() %}\n\n{% for image in assets %}\n\t\"{{\n{% endfor %}\n$0", + "description": "craft.assets - object syntax" + }, + "categorieso": { + "prefix": "categorieso", + "body": + "{% set categories = craft.categories({\n\tgroup: \"${1:categoryGroupHandle}\",\n\tlimit: \"${2:11}\"\n}).all() %}\n\n
    \n\t{% nav category in categories %}\n\t\t
  • \n\t\t\t{{ category.title }}\n\t\t\t{% ifchildren %}\n\t\t\t\t
      \n\t\t\t\t\t{% children %}\n\t\t\t\t
    \n\t\t\t{% endifchildren %}\n\t\t
  • \n\t{% endnav %}\n
", + "description": "craft.categories - object syntax" + }, + "categories": { + "prefix": "categories", + "body": + "
    \n\t{% nav category in craft.categories\n\t\t.group(\"${1:categoryGroupHandle}\")\n\t\t.limit(${2:11})\n\t\t.all()\n\t%}\n\t\t
  • \n\t\t\t{{ category.title }}\n\t\t\t{% ifchildren %}\n\t\t\t\t
      \n\t\t\t\t\t{% children %}\n\t\t\t\t
    \n\t\t\t{% endifchildren %}\n\t\t
  • \n\t{% endnav %}\n
", + "description": "craft.categories" + }, + "entrieso": { + "prefix": "entrieso", + "body": + "{% set entries = craft.entries({\n\tsection: \"${1:sectionName}\",\n\tlimit: \"${2:10}\"\n}).all() %}\n\n{% for entry in entries %}\n\t{{ entry.title }}\n{% endfor %}\n$0", + "description": "craft.entries - object syntax" + }, + "entries": { + "prefix": "entries", + "body": + "{% for entry in craft.entries\n\t.section(\"${1:sectionName}\")\n\t.limit(${2:10})\n\t.all()\n%}\n\t{{ entry.title }}\n{% endfor %}\n$0", + "description": "craft.entries" + }, + "t": { + "prefix": "t", + "body": "{{ $1 | t }}$0", + "description": "translate with | t" + }, + "replace": { + "prefix": "replace", + "body": "{{ ${1:$TM_SELECTED_TEXT} | replace(\"search\", \"replace\") }}$0", + "description": "replace with | replace(\"search\", \"replace\")" + }, + "replacex": { + "prefix": "replacex", + "body": + "{{ ${1:$TM_SELECTED_TEXT} | replace(\"/(search)/i\", \"replace\") }}$0", + "description": "replace regex with | replace(\"/(search)/i\", \"replace\")" + }, + "split": { + "prefix": "split", + "body": "{{ ${1:$TM_SELECTED_TEXT} | split(\"\\n\") }}$0", + "description": "split on | split (\"\\n\")" + }, + "tagso": { + "prefix": "tagso", + "body": + "{% set tags = craft.tags({\n\tgroup: \"${1:tagGroupHandle}\"\n}).all() %}\n\n
    \n\t{% for tag in tags %}\n\t\t
  • {{ tag }}
  • \n\t{% endfor %}\n
\n$0", + "description": "craft.tags - object syntax" + }, + "tags": { + "prefix": "tags", + "body": + "
    \n\t{% for tag in craft.tags.group(\"${1:tagGroupHandle}\").all() %}\n\t\t
  • {{ tag }}
  • \n\t{% endfor %}\n
\n$0", + "description": "craft.tags" + }, + "userso": { + "prefix": "userso", + "body": + "{% set users = craft.users({\n\tgroup: \"${1:userGroupHandle}\"\n}).all() %}\n\n{% for user in users %}\n\t{{ user.firstName }} {{ user.lastName }}\n{% endfor %}\n$0", + "description": "craft.users - object syntax" + }, + "users": { + "prefix": "users", + "body": + "{% for user in craft.users.group(\"${1:userGroupHandle}\").all() %}\n\t{{ user.firstName }} {{ user.lastName }}\n{% endfor %}\n$0", + "description": "craft.users" + }, + "csrf": { + "prefix": "csrf", + "body": "{{ csrfInput() }}\n$0", + "description": "csrf" + }, + "dd": { + "prefix": "dd", + "body": "
\n\t{{ dump($1) }}\n
\n{% exit %}$0", + "description": "dump and die" + }, + "do": { + "prefix": "do", + "body": "{% do $1 %}$0", + "description": "do" + }, + "dojs": { + "prefix": "dojs", + "body": "{% do view.registerJsFile \"${1:url}\" %}$0", + "description": "do js" + }, + "docss": { + "prefix": "docss", + "body": "{% do view.registerCssFile \"${1:url}\" %}$0", + "description": "do css" + }, + "dump": { + "prefix": "dump", + "body": "
\n\t{{ dump($1) }}\n
", + "description": "dump" + }, + "else": { + "prefix": "else", + "body": "{% else %}\n\t$0", + "description": "else" + }, + "embed": { + "prefix": "embed", + "body": "{% embed \"${1:template}\" %}\n\t$0\n{% endembed %}", + "description": "embed" + }, + "endautoescape": { + "prefix": "endautoescape", + "body": "{% endautoescape %}$0", + "description": "endautoescape" + }, + "endblock": { + "prefix": "endblock", + "body": "{% endblock %}$0", + "description": "endblock" + }, + "endcache": { + "prefix": "endcache", + "body": "{% endcache %}$0", + "description": "endcache" + }, + "endembed": { + "prefix": "endembed", + "body": "{% endembed %}$0", + "description": "endembed" + }, + "endfilter": { + "prefix": "endfilter", + "body": "{% endfilter %}$0", + "description": "endfilter" + }, + "endfor": { + "prefix": "endfor", + "body": "{% endfor %}$0", + "description": "endfor" + }, + "endif": { + "prefix": "endif", + "body": "{% endif %}$0", + "description": "endif" + }, + "endifchildren": { + "prefix": "endifchildren", + "body": "{% endifchildren %}$0", + "description": "endifchildren" + }, + "endcss": { + "prefix": "endcss", + "body": "{% endcss %}$0", + "description": "endcss" + }, + "endjs": { + "prefix": "endjs", + "body": "{% endjs %}$0", + "description": "endjs" + }, + "endmacro": { + "prefix": "endmacro", + "body": "{% endmacro %}$0", + "description": "endmacro" + }, + "endnav": { + "prefix": "endnav", + "body": "{% endnav %}$0", + "description": "endnav" + }, + "endset": { + "prefix": "endset", + "body": "{% endset %}$0", + "description": "endset" + }, + "endspaceless": { + "prefix": "endspaceless", + "body": "{% endspaceless %}$0", + "description": "endspaceless" + }, + "endswitch": { + "prefix": "endswitch", + "body": "{% endswitch %}$0", + "description": "endswitch" + }, + "endtrans": { + "prefix": "endtrans", + "body": "{% endtrans %}$0", + "description": "endtrans" + }, + "endverbatim": { + "prefix": "endverbatim", + "body": "{% endverbatim %}$0", + "description": "endverbatim" + }, + "exit": { + "prefix": "exit", + "body": "{% exit ${1:404} %}", + "description": "exit" + }, + "extends": { + "prefix": "extends", + "body": "{% extends \"${1:template}\" %}$0", + "description": "extends" + }, + "filterb": { + "prefix": "filterb", + "body": "{% filter ${1:name} %}\n\t$0\n{% endfilter %}", + "description": "filter (block)" + }, + "filter": { + "prefix": "filter", + "body": "{% filter ${1:name} %}$0{% endfilter %}", + "description": "filter" + }, + "floor": { + "prefix": "floor", + "body": "floor($1)$0", + "description": "floor" + }, + "fore": { + "prefix": "fore", + "body": + "{% for ${1:item} in ${2:items} %}\n\t$3\n{% else %}\n\t$0\n{% endfor %}", + "description": "for ... else" + }, + "for": { + "prefix": "for", + "body": "{% for ${1:item} in ${2:items} %}\n\t$0\n{% endfor %}", + "description": "for" + }, + "from": { + "prefix": "from", + "body": "{% from \"${1:template}\" import \"${2:macro}\" %}$0", + "description": "from" + }, + "endbody": { + "prefix": "endbody", + "body": "{{ endBody() }}\n$0", + "description": "endBody" + }, + "head": { + "prefix": "head", + "body": "{{ head() }}\n$0", + "description": "head" + }, + "if": { + "prefix": "if", + "body": "{% if ${1:condition} %}$2{% endif %}\n$0", + "description": "if" + }, + "ifb": { + "prefix": "ifb", + "body": "{% if ${1:condition} %}\n\t$0\n{% endif %}", + "description": "if (block)" + }, + "ife": { + "prefix": "ife", + "body": "{% if ${1:condition} %}\n\t$2\n{% else %}\n\t$0\n{% endif %}", + "description": "if ... else" + }, + "if1": { + "prefix": "if", + "body": "{% if ${1:condition} %}$0{% endif %}", + "description": "if" + }, + "ifchildren": { + "prefix": "ifchildren", + "body": "{% ifchildren %}\n\t$1\n{% endifchildren %}\n$0", + "description": "ifchildren" + }, + "import": { + "prefix": "import", + "body": "{% import \"${1:template}\" as ${2:name} %}$0", + "description": "import" + }, + "importself": { + "prefix": "importself", + "body": "{% import _self as ${1:name} %}$0", + "description": "importself" + }, + "inckv": { + "prefix": "inckv", + "body": + "{% include \"${1:template}\" with {\n\t${2:key}: ${3:\"${4:value}\"}\n} %}\n$0", + "description": "include w/ key/value" + }, + "include": { + "prefix": "include", + "body": "{% include \"${1:template}\" %}$0", + "description": "include" + }, + "inc": { + "prefix": "inc", + "body": "{% include \"${1:template}\" %}$0", + "description": "inc" + }, + "incp": { + "prefix": "incp", + "body": "{% include \"${1:template}\"${2: with ${3:params} }%}$0", + "description": "include w/ params" + }, + "css1": { + "prefix": "css", + "body": "{% do view.registerCssFile(\"${1:/resources/css/global.css}\") %}\n$0", + "description": "registerCssFile" + }, + "js": { + "prefix": "js", + "body": "{% js %}\n\t$1\n{% endjs %}\n$0", + "description": "js" + }, + "js1": { + "prefix": "js", + "body": "{% do view.registerJsFile(\"${1:/resources/js/global.js}\") %}\n$0", + "description": "registerJsFile" + }, + "css": { + "prefix": "css", + "body": "{% css %}\n\t$1\n{% endcss %}\n$0", + "description": "css" + }, + "macro": { + "prefix": "macro", + "body": "{% macro ${1:name}(${2:params}) %}\n\t$0\n{% endmacro %}", + "description": "macro" + }, + "matrix": { + "prefix": "matrix", + "body": + "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% if block.type == \"${2:blockHandle}\" %}\n\t\t{{ block.${3:fieldHandle} }}\n\t{% endif %}\n\n\t{% if block.type == \"${4:blockHandle}\" %}\n\t\t{{ block.${5:fieldHandle} }}\n\t{% endif %}\n\n{% endfor %}\n$0", + "description": "matrix" + }, + "matrixif": { + "prefix": "matrixif", + "body": + "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% if block.type == \"${2:blockHandle}\" %}\n\t\t{{ block.${3:fieldHandle} }}\n\t{% endif %}\n\n\t{% if block.type == \"${4:blockHandle}\" %}\n\t\t{{ block.${5:fieldHandle} }}\n\t{% endif %}\n\n{% endfor %}\n$0", + "description": "matrixif" + }, + "matrixifelse": { + "prefix": "matrixifelse", + "body": + "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% if block.type == \"${2:blockHandle}\" %}\n\n\t\t{{ block.${3:fieldHandle} }}\n\n\t{% elseif block.type == \"${4:blockHandle}\" %}\n\n\t\t$0\n\t\n\t{% endif %}\n\n{% endfor %}", + "description": "matrixifelse" + }, + "matrixswitch": { + "prefix": "matrixswitch", + "body": + "{% for block in ${1:entry.matrixFieldHandle}.all() %}\n\n\t{% switch block.type %}\n\n\t\t{% case \"${2:blockHandle}\" %}\n\n\t\t\t{{ block.${3:fieldHandle} }}\n\n\t\t{% case \"${4:blockHandle}\" %}\n\n\t\t\t$0\n\n\t{% endswitch %}\n\n{% endfor %}", + "description": "matrixswitch" + }, + "max": { + "prefix": "max", + "body": "max(${1:$2, $3})$0", + "description": "max" + }, + "min": { + "prefix": "min", + "body": "min(${1:$2, $3})$0", + "description": "min" + }, + "nav": { + "prefix": "nav", + "body": "{% nav ${1:item} in ${2:items} %}\n\t$3\n{% endnav %}\n$0", + "description": "nav" + }, + "paginate": { + "prefix": "paginate", + "body": + "{% paginate ${1:elements} as ${2:pageInfo}, ${3:pageEntries} %}\n\n{% for item in ${3:pageEntries} %}\n\t$0\n{% endfor %}\n\n{% if ${2:pageInfo}.prevUrl %}Previous Page{% endif %}\n{% if ${2:pageInfo}.nextUrl %}Next Page{% endif %}", + "description": "paginate simple" + }, + "paginate1": { + "prefix": "paginate", + "body": + "{# PAGINATION\n\t\t\nFor this pagination to work properly, we need to be sure to set\nthe paginateBase variable in the template we are including the \npagination in.\n\n{% set paginateBase = \"/blog/p\" %}\n#}\n\n{% if pageInfo.totalPages > 1 %}\n
    \n\t{% if pageInfo.currentPage != \"1\" %}\n\t\t
  • First Page
  • \n\t{% endif %}\n\n\t{% if pageInfo.prevUrl %}\n\t\t
  • Previous Page
  • \n\t{% endif %}\n\n\t{% for pageNumber in 1..pageInfo.totalPages %}\n\t\t
  • \n\t\t\t{{ pageNumber }}\n\t\t
  • \n\t{% endfor %}\n\n\t{% if pageInfo.nextUrl %}\n\t\t
  • Next Page
  • \n\t{% endif %}\n\n\t{% if pageInfo.currentPage != pageInfo.total %}\n\t\t
  • Last Page
  • \n\t{% endif %}\n
\n{% endif %}\n$0", + "description": "paginate advanced" + }, + "redirect": { + "prefix": "redirect", + "body": + "{% redirect \"${1:template/path or http://straightupcraft.com}\" %}\n$0", + "description": "redirect" + }, + "getparam": { + "prefix": "getparam", + "body": + "craft.app.request.getParam(${1:\"Query String or Post Variable Name\"})\n$0", + "description": "request getParam" + }, + "getbodyparam": { + "prefix": "getbodyparam", + "body": "craft.app.request.getBodyParam(${1:\"postVariableName\"})\n$0", + "description": "request getBodyParam" + }, + "getqueryparam": { + "prefix": "getqueryparam", + "body": "craft.app.request.getQueryParam(${1:\"queryStringName\"})\n$0", + "description": "request getQueryParam" + }, + "getsegment": { + "prefix": "getsegment", + "body": "craft.app.request.getSegment(${1:2})\n$0", + "description": "request getSegment" + }, + "requirelogin": { + "prefix": "requirelogin", + "body": "{% requireLogin %}\n$0", + "description": "requireLogin" + }, + "requirepermission": { + "prefix": "requirepermission", + "body": "{% requirePermission \"${1:spendTheNight}\" %}\n$0", + "description": "requirePermission" + }, + "round": { + "prefix": "round", + "body": "{{ $1 | round(1, 'floor') }}$0", + "description": "round" + }, + "setb": { + "prefix": "setb", + "body": "{% set ${1:var} %}\n\t$0\n{% endset %}", + "description": "set (block)" + }, + "set": { + "prefix": "set", + "body": "{% set ${1:var} = ${2:value} %}$0", + "description": "set" + }, + "shuffle": { + "prefix": "shuffle", + "body": "shuffle($1)$0", + "description": "shuffle" + }, + "random": { + "prefix": "random", + "body": "random($1)$0", + "description": "random" + }, + "spaceless": { + "prefix": "spaceless", + "body": "{% spaceless %}\n\t$0\n{% endspaceless %}", + "description": "spaceless" + }, + "switch": { + "prefix": "switch", + "body": + "{% switch ${1:variable} %}\n\n\t{% case \"${2:value1}\" %}\n\t\n\n\t{% case \"${3:value2}\" %}\n\t\n\n\t{% default %}\n\t\n\n{% endswitch %}\n$0", + "description": "switch" + }, + "trans": { + "prefix": "trans", + "body": "{% trans %}$0{% endtrans %}", + "description": "trans" + }, + "urla": { + "prefix": "urla", + "body": + "url(\"${1:path}\", ${2:{foo:\"1\", bar:\"2\"\\}}, ${3:\"http\"}, ${4:false})$0", + "description": "url w/ arguments" + }, + "url": { + "prefix": "url", + "body": "url(\"${1:path}\")$0", + "description": "url" + }, + "use": { + "prefix": "use", + "body": "{% use \"${1:template}\" %}$0", + "description": "use" + }, + "verbatim": { + "prefix": "verbatim", + "body": "{% verbatim %}\n\t$0\n{% endverbatim %}", + "description": "verbatim" + } +} diff --git a/snippets/frameworks/vue/html.json b/snippets/frameworks/vue/html.json new file mode 100644 index 0000000..9cb50ff --- /dev/null +++ b/snippets/frameworks/vue/html.json @@ -0,0 +1,397 @@ +{ + "template": { + "prefix": "template", + "body": [ + "" + ], + "description": "template element" + }, + "v-text": { + "prefix": "vText", + "body": [ + "v-text=\"${1:msg}\"" + ], + "description": "Expects: string. Updates the element’s textContent." + }, + "v-html": { + "prefix": "vHtml", + "body": [ + "v-html=\"${1:html}\"" + ], + "description": "Expects: string. Updates the element’s innerHTML." + }, + "v-show": { + "prefix": "vShow", + "body": [ + "v-show=\"${1:condition}\"" + ], + "description": "Expects: any" + }, + "v-if": { + "prefix": "vIf", + "body": [ + "v-if=\"${1:condition}\"" + ], + "description": "Expects: any" + }, + "v-else": { + "prefix": "vElse", + "body": [ + "v-else" + ], + "description": "Does not expect expression. previous sibling element must have v-if or v-else-if." + }, + "v-else-if": { + "prefix": "vElseIf", + "body": [ + "v-else-if=\"${1:condition}\"" + ], + "description": "Expects: any. previous sibling element must have v-if or v-else-if." + }, + "v-for-without-key": { + "prefix": "vForWithoutKey", + "body": [ + "v-for=\"${1:item} in ${2:items}\"" + ], + "description": "Expects: Array | Object | number | string" + }, + "v-for": { + "prefix": "vFor", + "body": [ + "v-for=\"(${1:item}, ${2:index}) in ${3:items}\" :key=\"${4:index}\"" + ], + "description": "Expects: Array | Object | number | string" + }, + "v-on": { + "prefix": "vOn", + "body": [ + "v-on:${1:event}=\"${2:handle}\"" + ], + "description": "Expects: Function | Inline Statement" + }, + "v-bind": { + "prefix": "vBind", + "body": [ + "v-bind$1=\"${2}\"" + ], + "description": "Expects: any (with argument) | Object (without argument)" + }, + "v-model": { + "prefix": "vModel", + "body": [ + "v-model=\"${1:something}\"" + ], + "description": "Expects: varies based on value of form inputs element or output of components" + }, + "v-slot": { + "prefix": "vSlot", + "body": [ + "v-slot$1=\"${2}\"" + ], + "description": "Expects: JavaScript expression that is valid in a function argument position (supports destructuring in supported environments). Optional - only needed if expecting props to be passed to the slot." + }, + "v-pre": { + "prefix": "vPre", + "body": [ + "v-pre" + ], + "description": "Does not expect expression" + }, + "v-cloak": { + "prefix": "vCloak", + "body": [ + "v-cloak" + ], + "description": "Does not expect expression" + }, + "v-once": { + "prefix": "vOnce", + "body": [ + "v-once" + ], + "description": "Does not expect expression" + }, + "key": { + "prefix": "key", + "body": [ + ":key=\"${1:key}\"" + ], + "description": "Expects: string. Children of the same common parent must have unique keys. Duplicate keys will cause render errors." + }, + "ref": { + "prefix": "ref", + "body": [ + "ref=\"${1:reference}\"$0" + ], + "description": "Expects: string. ref is used to register a reference to an element or a child component. The reference will be registered under the parent component’s $refs object. If used on a plain DOM element, the reference will be that element; if used on a child component, the reference will be component instance." + }, + "slotA": { + "prefix": "slotA", + "body": [ + "slot=\"$1\"$0" + ], + "description": "slot=''. Expects: string. Used on content inserted into child components to indicate which named slot the content belongs to." + }, + "slotE": { + "prefix": "slotE", + "body": [ + "$2$0" + ], + "description": ". Expects: string. Used on content inserted into child components to indicate which named slot the content belongs to." + }, + "slotScope": { + "prefix": "slotScope", + "body": [ + "slot-scope=\"$1\"$0" + ], + "description": "Used to denote an element or component as a scoped slot. The attribute’s value should be a valid JavaScript expression that can appear in the argument position of a function signature. This means in supported environments you can also use ES2015 destructuring in the expression. Serves as a replacement for scope in 2.5.0+." + }, + "scope": { + "prefix": "scope", + "body": [ + "scope=\"${1:this api replaced by slot-scope in 2.5.0+}\"$0" + ], + "description": "Used to denote a