added config
This commit is contained in:
commit
c921edcf81
266
lua/custom/.plugins.lua
Normal file
266
lua/custom/.plugins.lua
Normal file
|
@ -0,0 +1,266 @@
|
|||
-- {
|
||||
-- "mg979/vim-visual-multi",
|
||||
-- -- cmd = { "MCstart", "MCvisual", "MCclear", "MCpattern", "MCvisualPattern", "MCunderCursor" },
|
||||
-- keys = {
|
||||
-- {
|
||||
-- mode = { "v", "n" },
|
||||
-- "<C-x>",
|
||||
-- "<cmd>MCstart<cr>", -- invalid
|
||||
-- desc = "Multi Cursors",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- Using TreeSJ now.
|
||||
-- { -- Opposite of vim's J (Join like)
|
||||
-- "AckslD/nvim-trevJ.lua",
|
||||
-- config = function()
|
||||
-- require("trevj").setup {
|
||||
-- containers = {
|
||||
-- lua = {
|
||||
-- table_constructor = { final_separator = ",", final_end_line = true },
|
||||
-- arguments = { final_separator = false, final_end_line = true },
|
||||
-- parameters = { final_separator = false, final_end_line = true },
|
||||
-- },
|
||||
-- -- ... -- other filetypes
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
--
|
||||
-- keys = {
|
||||
-- { "<leader>jo", "<cmd>lua require('trevj').format_at_cursor()<cr>", mode = "n", desc = "Format" },
|
||||
-- -- { "<leader>jo", "<cmd>lua require('trevj').format_at_cursor()<cr>", mode = "v", desc = "Format" },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- { -- Use builtin `:sort` instead
|
||||
-- "sQVe/sort.nvim",
|
||||
--
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>sq",
|
||||
-- "<cmd> Sort<CR>",
|
||||
-- mode = "v",
|
||||
-- desc = "Sort Selection",
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- config = function(_, opts)
|
||||
-- require("sort").setup {
|
||||
-- opts,
|
||||
-- }
|
||||
-- end,
|
||||
--
|
||||
-- opts = {
|
||||
-- -- Config
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- { -- Pretty buggy (and inperformant I think) but cool
|
||||
-- "nvim-treesitter",
|
||||
-- dependencies = {
|
||||
-- "filNaj/tree-setter",
|
||||
-- },
|
||||
--
|
||||
-- -- Override default config (By appending)
|
||||
-- opts = {
|
||||
-- tree_setter = {
|
||||
-- enable = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- -- Old toggle case plugin
|
||||
-- "johmsalas/text-case.nvim",
|
||||
--
|
||||
-- keys = {
|
||||
-- { "<leader>sq", "<cmd>lua require('textcase').toggle()<cr>", mode = "n", desc = "Toggle Case" },
|
||||
-- { "<leader>sq", "<cmd>lua require('textcase').toggle()<cr>", mode = "v", desc = "Toggle Case" },
|
||||
-- },
|
||||
--
|
||||
-- config = function()
|
||||
-- require("textcase").setup {
|
||||
-- prefix = "<leader>s",
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- { -- COC-like virtual text type annotations
|
||||
-- -- Didn't work though :(
|
||||
-- -- Used with nvim_lsp which I don't
|
||||
-- "jubnzv/virtual-types.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- },
|
||||
|
||||
-- { -- I don't like it
|
||||
-- "HiPhish/rainbow-delimiters.nvim",
|
||||
--
|
||||
-- event = "VeryLazy",
|
||||
--
|
||||
-- config = function(_, opts)
|
||||
-- require "rainbow-delimiters.setup" { opts }
|
||||
-- end,
|
||||
--
|
||||
-- opts = { -- Erroneous
|
||||
-- -- strategy = {
|
||||
-- -- [""] = require("rainbow_delimiters").strategy["global"],
|
||||
-- -- commonlisp = require("rainbow_delimiters").strategy["local"],
|
||||
-- -- },
|
||||
-- -- query = {
|
||||
-- -- [""] = "rainbow-delimiters",
|
||||
-- -- latex = "rainbow-blocks",
|
||||
-- -- },
|
||||
-- -- highlight = {
|
||||
-- -- "RainbowDelimiterRed",
|
||||
-- -- "RainbowDelimiterYellow",
|
||||
-- -- "RainbowDelimiterBlue",
|
||||
-- -- "RainbowDelimiterOrange",
|
||||
-- -- "RainbowDelimiterGreen",
|
||||
-- -- "RainbowDelimiterViolet",
|
||||
-- -- "RainbowDelimiterCyan",
|
||||
-- -- },
|
||||
-- -- blacklist = { "c", "cpp" },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- { -- custom w, e, b motions to navigate TextWritten_like_THIS
|
||||
-- "chrisgrieser/nvim-spider",
|
||||
-- keys = {
|
||||
-- { "w", "<cmd>lua require('spider').motion('w')<CR>", mode = { "n", "o", "x" }, desc = "Spider-w" },
|
||||
-- { "e", "<cmd>lua require('spider').motion('e')<CR>", mode = { "n", "o", "x" }, desc = "Spider-e" },
|
||||
-- { "b", "<cmd>lua require('spider').motion('b')<CR>", mode = { "n", "o", "x" }, desc = "Spider-b" },
|
||||
-- { "ge", "<cmd>lua require('spider').motion('ge')<CR>", mode = { "n", "o", "x" }, desc = "Spider-ge" },
|
||||
--
|
||||
-- config = function(_, opts)
|
||||
-- require("spider").setup(opts)
|
||||
-- end,
|
||||
--
|
||||
-- opts = {
|
||||
-- skipInsignificantPunctuation = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- To make a plugin not be loaded
|
||||
-- {
|
||||
-- "NvChad/nvim-colorizer.lua",
|
||||
-- enabled = false
|
||||
-- f
|
||||
-- },
|
||||
|
||||
-- All NvChad plugins are lazy-loaded by default
|
||||
-- For a plugin to be loaded, you will need to set either `ft`, `cmd`, `keys`, `event`, or set `lazy = false`
|
||||
-- If you want a plugin to load on startup, add `lazy = false` to a plugin spec, for example
|
||||
-- {
|
||||
-- "mg979/vim-visual-multi",
|
||||
-- lazy = false,
|
||||
-- }
|
||||
|
||||
-- DELETETHIS
|
||||
local M = {
|
||||
"L3MON4D3/LuaSnip",
|
||||
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets",
|
||||
-- "molleweide/LuaSnip-snippets.nvim",
|
||||
},
|
||||
|
||||
keys = {
|
||||
{
|
||||
"<C-s>",
|
||||
function()
|
||||
local ls = require "luasnip"
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end,
|
||||
|
||||
mode = { "i", "s" },
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
-- opts = {
|
||||
-- history = true,
|
||||
-- updateevents = "TextChanged,TextChangedI",
|
||||
--
|
||||
-- leave = function()
|
||||
-- local snip = require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
-- if snip and snip.generate_doc == true then
|
||||
-- require("neogen").generate()
|
||||
-- end
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- init = function()
|
||||
-- vim.api.nvim_create_autocmd("User", {
|
||||
-- pattern = "LuaSnipPostExpand",
|
||||
-- -- command = "echo 'LuaSnipPostExpand'",
|
||||
-- callback = function()
|
||||
-- require("neogen").generate()
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd("User", {
|
||||
-- pattern = "LuasnipPreExpand",
|
||||
-- callback = function()
|
||||
-- vim.cmd [[echo "LuasnipInsertNodeEnter"]]
|
||||
-- -- local snip = require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
-- -- if snip and snip.generate_doc == true then
|
||||
-- require("neogen").generate()
|
||||
-- -- end
|
||||
-- end,
|
||||
-- })
|
||||
-- end,
|
||||
|
||||
config = function(opts)
|
||||
-- require("plugins.configs.others").luasnip(opts)
|
||||
require("luasnip").config.set_config(opts)
|
||||
|
||||
-- vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
-- callback = function()
|
||||
-- require("neogen").generate()
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- vim.api.nvim_create_autocmd("User", {
|
||||
-- pattern = "LuasnipPreExpand",
|
||||
-- callback = function()
|
||||
-- -- get event-parameters from `session`.
|
||||
-- local snippet = require("luasnip").session.event_node
|
||||
-- local expand_position = require("luasnip").session.event_args.expand_pos
|
||||
--
|
||||
-- print(
|
||||
-- string.format(
|
||||
-- "expanding snippet %s at %s:%s",
|
||||
-- table.concat(snippet:get_docstring(), "\n"),
|
||||
-- expand_position[1],
|
||||
-- expand_position[2]
|
||||
-- )
|
||||
-- )
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- vscode format
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
|
||||
|
||||
-- snipmate format
|
||||
require("luasnip.loaders.from_snipmate").load()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
|
||||
|
||||
-- lua format
|
||||
require("luasnip.loaders.from_lua").load()
|
||||
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
|
||||
|
||||
vim.api.nvim_create_autocmd("InsertLeave", {
|
||||
callback = function()
|
||||
if
|
||||
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
and not require("luasnip").session.jump_active
|
||||
then
|
||||
require("luasnip").unlink_current()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
609
lua/custom/chadrc.lua
Normal file
609
lua/custom/chadrc.lua
Normal file
|
@ -0,0 +1,609 @@
|
|||
---@type ChadrcConfig
|
||||
local M = {}
|
||||
|
||||
local round = { left = "", right = "" }
|
||||
local block = { left = "█", right = "█" }
|
||||
local arrow = { left = "", right = "" }
|
||||
local angle = { left = "", right = "" }
|
||||
local slant = { left = "", right = "" }
|
||||
local group_margin = " "
|
||||
|
||||
local status = require("custom.utils").status
|
||||
|
||||
-- Path to overriding theme and highlights files
|
||||
local highlights = require "custom.highlights"
|
||||
|
||||
M.ui = {
|
||||
theme = "yoru",
|
||||
theme_toggle = { "yoru", "yoru" },
|
||||
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens
|
||||
|
||||
cmp = {
|
||||
style = "default", -- flatt_dark | flat_light | default | atom | atom_colored
|
||||
selected_item_bg = "colored",
|
||||
},
|
||||
|
||||
-- transparency = true,
|
||||
|
||||
hl_override = highlights.override,
|
||||
hl_add = highlights.add,
|
||||
|
||||
statusline = {
|
||||
-- theme = "vscode_colored", -- default/vscode/*vscode_colored*/minimal
|
||||
-- separator_style = "round", -- default/*round*/*block*/arrow
|
||||
-- modules arg here is the default table of modules
|
||||
overriden_modules = function(modules)
|
||||
table.insert( -- Right
|
||||
modules,
|
||||
3,
|
||||
(function()
|
||||
local hl = "%#StEncoding#"
|
||||
local encoding = vim.bo.fileencoding or vim.bo.encoding
|
||||
return hl .. encoding .. " "
|
||||
end)()
|
||||
)
|
||||
|
||||
-------------------------------------------------------
|
||||
-- ICONS START --
|
||||
-------------------------------------------------------
|
||||
-- table.insert(
|
||||
-- modules,
|
||||
-- 8,
|
||||
-- (function()
|
||||
-- local hl = "%#StGroup#"
|
||||
-- return hl .. round.right
|
||||
-- end)()
|
||||
-- )
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StBg#"
|
||||
return hl .. " "
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StKernel#"
|
||||
local icon = "" --
|
||||
return hl .. icon--[[ .. " " ]]
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StDebug#"
|
||||
local icon = ""
|
||||
if status.debug then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
-- -- If in ~/
|
||||
-- table.insert(
|
||||
-- modules,
|
||||
-- 8,
|
||||
-- (function()
|
||||
-- local hl = "%#StHome#"
|
||||
-- local icon = ""
|
||||
-- local cwd = vim.fn.getcwd()
|
||||
-- local homedir = vim.loop.os_homedir()
|
||||
-- if cwd == homedir then
|
||||
-- icon = hl .. "" .. group_margin
|
||||
-- end
|
||||
-- return icon
|
||||
-- end)()
|
||||
-- )
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StWorld#"
|
||||
local icon = "" --
|
||||
if status.worldmap then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StReddit#"
|
||||
local icon = ""
|
||||
if status.reddit then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StGames#"
|
||||
local icon = ""
|
||||
if status.games then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StHN#"
|
||||
local icon = ""
|
||||
if status.hn then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StWhatsapp#"
|
||||
local icon = ""
|
||||
if status.whatsapp then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StStackOverflow#"
|
||||
local icon = ""
|
||||
if status.stackoverflow then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StDiscord#"
|
||||
local icon = ""
|
||||
if status.discord then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StIRC#"
|
||||
local icon = ""
|
||||
if status.irc then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StGit#"
|
||||
local icon = ""
|
||||
if status.git then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StMail#"
|
||||
local icon = "" --
|
||||
if status.mail then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StBrowser#"
|
||||
local icon = ""
|
||||
if status.browser then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StGithub#"
|
||||
local icon = ""
|
||||
if status.github then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StTranslate#"
|
||||
local icon = ""
|
||||
if status.translate then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert(
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local hl = "%#StCody#"
|
||||
local icon = "" --
|
||||
|
||||
if status.cody then
|
||||
icon = hl .. "" .. group_margin
|
||||
end
|
||||
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
table.insert( -- Right
|
||||
modules,
|
||||
8,
|
||||
(function()
|
||||
local icon = ""
|
||||
local hl = "%#StCopilot#"
|
||||
|
||||
if status.copilot == true then
|
||||
icon = hl .. "" .. group_margin -- |
|
||||
-- else
|
||||
-- icon = " " .. ""
|
||||
end
|
||||
|
||||
return icon
|
||||
end)()
|
||||
)
|
||||
|
||||
-- table.insert(
|
||||
-- modules,
|
||||
-- 8,
|
||||
-- (function()
|
||||
-- local hl = "%#StBg#"
|
||||
-- return hl .. " "
|
||||
-- end)()
|
||||
-- )
|
||||
|
||||
-- table.insert(
|
||||
-- modules,
|
||||
-- 8,
|
||||
-- (function()
|
||||
-- local hl = "%#StGroup#"
|
||||
-- return hl .. round.left
|
||||
-- end)()
|
||||
-- )
|
||||
end,
|
||||
|
||||
-----------------------------------------------------
|
||||
-- ICONS END --
|
||||
-----------------------------------------------------
|
||||
},
|
||||
|
||||
nvdash = {
|
||||
load_on_startup = true,
|
||||
header = {
|
||||
|
||||
-- Useful: https://emojicombos.com/
|
||||
|
||||
-- " ___ ___ ",
|
||||
-- " ./ .-' '-. \\. ",
|
||||
-- " .' '/ \\' '. ",
|
||||
-- " |.-../ o o \\..-.| ",
|
||||
-- " (| | / _\\ /_ \\ | |) ",
|
||||
-- " \\\\\\ (_.'.'\"'.'._) /// ",
|
||||
-- " \\\\'._(..: :..)_.'// ",
|
||||
-- " \\'.__\\ .:-:. /__.'/ ",
|
||||
-- " '---->.___.<----' ",
|
||||
-- " .'.-'/.=^=.\\'-.'. ",
|
||||
-- " /.' // \\\\ `.\\ ",
|
||||
-- " || || || || ",
|
||||
-- " \\) || || (/ ",
|
||||
-- " \\) (/ ",
|
||||
|
||||
-- F_P
|
||||
-- " ,--'\\ ",
|
||||
-- " .-/__ / \\.-\\ .--. ",
|
||||
-- " \\/ / _/ .-''-./ .'\\ ",
|
||||
-- " (\\__.-') \\ | /-'|.'- \\ ",
|
||||
-- " \\/ \\--' | _/| | | ",
|
||||
-- " /.. / .-' |-' / | | ",
|
||||
-- " \\__/ / / | \\ ",
|
||||
-- " \\__/-'' . .' ' \\ \\ ",
|
||||
-- " |.'\\- / . \\ ",
|
||||
-- " /, - / \\_.' | ",
|
||||
-- " |\\/-' | | ",
|
||||
-- " | / / \\ ",
|
||||
-- " .| | / |",
|
||||
-- " / | ______.--' __.'",
|
||||
-- " | \\ __/ /---'' `-.---'-' ",
|
||||
-- " \\__/ / / ",
|
||||
-- " `--..-' ",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢦⠙⢿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⢯⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢃⠛⢿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⢧⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡕⠂⠈⢻⣿⣿⣿⣿",
|
||||
-- "⣿⣿⡅⣻⡿⢿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠿⢿⣿⡇⠀⠀⠈⣿⣿⣿⣿",
|
||||
-- "⣿⣿⠀⠀⠀⠘⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⠀⠀⠀⣹⣿⣿⣿",
|
||||
-- "⣿⣿⠀⠀⠀⠀⣿⣿⡿⠿⠛⠻⣿⣿⣿⣿⡿⠟⠁⠈⠀⠉⠻⡆⠀⠀⠀⣿⣿⣿",
|
||||
-- "⣿⣯⠄⠂⠀⠀⣿⡋⠀⢀⠀⠀⠀⠉⣿⣿⡀⠀⠀⠘⠓⣠⣶⣿⡀⠀⠀⠘⣿⣿",
|
||||
-- "⣿⣫⡆⠀⠀⢀⣿⣷⣶⣄⠀⢀⣤⣴⣿⣿⣿⣶⣄⠀⣴⣿⣿⣿⠁⠀⠀⠀⠘⣿",
|
||||
-- "⣿⣿⠁⠀⠀⡤⠙⢿⣿⣿⣷⣾⣿⡿⣿⣿⢿⠿⣿⣧⣿⣿⡿⢣⠀⠀⠀⠀⢠⣿",
|
||||
-- "⣷⣌⠈⠀⠀⠀⠀⣆⠈⡉⢹⣿⣿⣆⡀⠀⠀⢠⣿⣿⣿⡿⢃⣼⠀⠀⠀⠀⣸⣿",
|
||||
-- "⣿⣿⡇⠀⠀⠀⠀⠙⢿⣿⣆⠈⠛⠛⠛⠀⠀⠈⠉⠁⠀⢠⣿⠇⠀⠀⠀⠹⢿⡇",
|
||||
-- "⣿⡫⠀⠀⠁⠀⠀⠀⠈⠻⣿⢢⣄⠀⠀⠀⠀⠀⣀⣠⣾⡾⠋⠀⠀⠀⠀⢀⠴⠋",
|
||||
-- "⣿⣁⠄⠀⠀⠀⣀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⠿⡿⠋⠀⠀⠀⠀⠀⣀⠬⠆⢀",
|
||||
-- "⣿⣿⣧⣄⠀⠀⠉⠀⠀⠀⠀⠀⠀⠈⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠁⠠⠙",
|
||||
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠊⠉⠉⢉⠏⠻⣍⠑⢲⠢⠤⣄⣀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⣻⣿⢟⣽⠿⠯⠛⡸⢹⠀⢹⠒⣊⡡⠜⠓⠢⣄⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⢀⡜⣿⣷⣽⠓⠀⢠⢂⣣⠋⠂⣾⠼⢌⠳⢄⢀⡠⠜⣣⡀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⢠⢻⢱⣭⠷⠤⢅⠴⣡⡻⠃⠀⢠⠁⠀⢀⡱⠜⠍⢔⠊⠀⠹⡄⠀",
|
||||
-- "⠀⠀⠀⠀⢀⣷⠌⠚⠷⠆⠠⠶⠭⢒⣁⠀⣤⠃⣀⢔⢋⡤⠊⠑⣄⠳⣄⠀⣧⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠑⠦⣀⡤⣄⠄⢄⣀⣠⣒⢦⡄⠩⠷⠦⠊⠀⠀⠀⠈⠣⡏⠢⣿⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⣸⢫⠟⣝⠞⣼⢲⡞⣞⠋⠋⠉⠋⠓⡄⠀⠀⠀⠀⠀⣨⠂⢸⡅",
|
||||
-- "⠀⠀⠀⠀⠀⣰⠃⡨⠊⢀⡠⡌⢘⢇⠞⠀⠀⠀⠀⠂⠡⡄⠀⠀⢀⠞⢁⠔⢹⡇",
|
||||
-- "⠀⠀⠀⠀⣰⣣⠞⢀⠔⢡⢢⠇⡘⠌⠀⠀⠀⠀⠀⠀⠠⡌⠢⡔⢁⡴⠁⠀⢸⠃",
|
||||
-- "⠀⠀⠀⢠⠟⠁⠠⢊⠔⣡⢸⠀⠃⠁⠀⠀⠀⠀⠀⠀⠀⣯⠂⡀⢪⡀⠀⠀⢸⠀",
|
||||
-- "⠀⢀⠔⣁⠐⠨⠀⠀⠈⠀⢄⠘⡀⠀⠈⢆⠀⠀⠀⠀⡠⢁⠜⠙⢦⠙⣦⠀⢸⠀",
|
||||
-- "⡴⠁⠘⡁⣀⡡⠀⠀⠴⠒⠗⠋⠉⠉⡆⠀⠆⠄⠄⠘⠀⡎⠀⠀⠀⠑⢅⠑⢼⡀",
|
||||
-- "⢯⣉⣓⠒⠒⠤⠤⣄⣀⣀⣀⣀⡀⠐⠁⠀⠀⠀⠒⠀⢀⡀⠀⠀⠀⠀⠀⠑⣌⣇",
|
||||
-- "⠀⠈⢳⠄⠈⠀⠤⢄⣀⠀⢈⣉⡹⠯⡟⠁⠀⠀⠀⠀⢸⠀⠀⠂⠀⠀⡠⠚⣡⡿",
|
||||
-- "⠀⢠⣋⣀⣀⣀⣀⠤⠭⢛⡩⠄⠒⠩⠂⢀⠄⠀⠀⠀⠈⢢⡀⠀⡠⠋⡩⠋⠀⢳",
|
||||
-- "⠀⢹⠤⠬⠤⠬⠭⣉⣉⢃⠀⠀⣀⣀⠀⠁⠀⠀⠀⠀⡞⢺⡈⠋⡢⠊⠀⠀⠀⢸",
|
||||
-- "⠀⠈⡆⠁⢀⠀⠀⠀⠉⠋⠉⠓⠂⠤⣀⡀⠀⠀⠀⠀⡧⠊⡠⠦⡈⠳⢄⠀⠀⠈",
|
||||
-- "⠀⠀⢹⡜⠀⠁⠀⠀⠒⢤⡄⠤⠔⠶⠒⠛⠧⠀⠀⡼⡠⠊⠀⠀⠙⢦⡈⠳⡄⠀",
|
||||
-- "⠀⠀⢸⠆⠀⠈⠀⠠⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⡜⢸⠀⠀⠀⠀⠀⠀⠑⢄⠈⢲",
|
||||
-- "⠀⠀⢸⢀⠇⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⡄⠊⢠⠃⠀⠀⠀⠀⠀⠀⠀⠈⡢⣸",
|
||||
-- "⠀⠀⠈⠳⣤⣄⡀⠀⠀⠀⠈⠉⠉⠁⠒⠁⠀⠠⣏⠀⠀⠀⠀⠀⠀⢀⣔⠾⡿⠃",
|
||||
-- "⠀⠀⠀⠀⠀⠉⠙⠛⠒⠤⠤⣤⣄⣀⣀⣀⣔⣢⣀⣉⣂⣀⣀⣠⠴⠿⠛⠋⠀ ",
|
||||
|
||||
-- "⠀⠀⢀⣤⣶⣶⣤⣄⡀ ",
|
||||
-- "⠀⢀⣿⣿⣿⣿⣿⣿⣿⡆ ",
|
||||
-- "⠀⠸⣿⣿⣿⣿⣿⡟⡟⡗ ⣿⠉⣿⠉⣿⡏⠹⡏⢹⡏⢹⣿⣿⠉⣿⠉⣿⡟⢋⠛⣿⠉⡟⢉⡏⠹⠏⣹⣿",
|
||||
-- "⠀⠀⠙⠏⠯⠛⣉⢲⣧⠟ ⣿⠄⣿⠄⣿⡇⡄⠁⢸⡇⢸⣿⣿⠄⣿⠄⣿⠄⣿⣿⣿⠄⡀⢻⣿⡄⢠⣿⣿",
|
||||
-- "⠀⠀⠠⢭⣝⣾⠿⣴⣿⠇ ⣿⣦⣤⣴⣿⣧⣿⣤⣼⣧⣬⣭⣿⣦⣤⣴⣿⣧⣤⣤⣿⣤⣷⣤⣿⣧⣼⣿⣿",
|
||||
-- "⠀⠀⢐⣺⡿⠁⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀ ",
|
||||
-- "⠀⠀⣚⣿⠃ ",
|
||||
-- "⢀⣿⣿⣿⣷⢒⣢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣶⣶⣄⠄ ",
|
||||
-- "⢰⣿⣿⡿⣿⣦⠬⢝⡄⠀⠀⠀⠀⠀⠀⢠⣿⠿⠿⠟⠛⠋⠁ ",
|
||||
-- "⠠⢿⣿⣷⠺⣿⣗⠒⠜⡄⠀⠀⠀⠀⣴⠟⠁ ",
|
||||
-- "⠀⣰⣿⣷⣍⡛⣯⣯⣙⡁⠀⠀⣠⡾⠁ ",
|
||||
-- "⠀⠨⢽⣿⣷⢍⣛⣶⢷⣼⣠⣾⠋ ",
|
||||
-- "⠀⠀⠘⢿⣿⣖⠬⣹⣶⣿⠟⠁ ",
|
||||
-- "⠀⠀⠀⠚⠿⠿⡒⠨⠛⠋ ",
|
||||
-- "⠀⠀⠀⠐⢒⣛⣷ ",
|
||||
-- "⠀⠀⠀⢘⣻⣭⣭ ",
|
||||
-- "⠀⠀⠀⡰⢚⣺⣿ ",
|
||||
-- "⠀⠀⢠⣿⣿⣿⣿⣦⡄ ",
|
||||
-- "⠀⠀⢸⡿⢿⣿⢿⡿⠃ ",
|
||||
-- "⠀⠀⠘⡇⣸⣿⣿⣿⣆ ",
|
||||
-- "⠀⠀⠀⠀⠸⣿⡿⠉⠁ ",
|
||||
-- "⠀⠀⠀⠀⠀⢿⡟ ",
|
||||
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⢀⣴⠟⠉⠀⠀⠀⠈⠻⣦⡀⠀⠀⠀⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣷⣀⢀⣾⠿⠻⢶⣄⠀⠀⣠⣶⡿⠶⣄⣠⣾⣿⠗⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⢻⣿⣿⡿⣿⠿⣿⡿⢼⣿⣿⡿⣿⣎⡟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡟⠉⠛⢛⣛⡉⠀⠀⠙⠛⠻⠛⠑⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣧⣤⣴⠿⠿⣷⣤⡤⠴⠖⠳⣄⣀⣹⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⣀⣟⠻⢦⣀⡀⠀⠀⠀⠀⣀⡈⠻⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⡿⠉⡇⠀⠀⠛⠛⠛⠋⠉⠉⠀⠀⠀⠹⢧⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⡟⠀⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⠈⠑⠪⠷⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⣿⣿⣿⣦⣼⠛⢦⣤⣄⡀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠢⡀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠲⠖⠛⠻⣿⡿⠛⠉⠉⠻⠷⣦⣽⠿⠿⠒⠚⠋⠉⠁⡞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢦⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⢀⣾⠛⠁⠀⠀⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠤⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢣⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⣰⡿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣑⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⡇⠀⠀",
|
||||
-- "⠀⠀⠀⣰⣿⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣧⣄⠀⠀⠀⠀⠀⠀⢳⡀⠀",
|
||||
-- "⠀⠀⠀⣿⡾⢿⣀⢀⣀⣦⣾⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡰⣫⣿⡿⠟⠻⠶⠀⠀⠀⠀⠀⢳⠀",
|
||||
-- "⠀⠀⢀⣿⣧⡾⣿⣿⣿⣿⣿⡷⣶⣤⡀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢿⣿⣧⠀⡀⠀⢀⣀⣀⢒⣤⣶⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇",
|
||||
-- "⠀⠀⡾⠁⠙⣿⡈⠉⠙⣿⣿⣷⣬⡛⢿⣶⣶⣴⣶⣶⣶⣤⣤⠤⠾⣿⣿⣿⡿⠿⣿⠿⢿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇",
|
||||
-- "⠀⣸⠃⠀⠀⢸⠃⠀⠀⢸⣿⣿⣿⣿⣿⣿⣷⣾⣿⣿⠟⡉⠀⠀⠀⠈⠙⠛⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡇",
|
||||
-- "⠀⣿⠀⠀⢀⡏⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⠿⠿⠛⠛⠉⠁⠀⠀⠀⠀⠀⠉⠠⠿⠟⠻⠟⠋⠉⢿⣿⣦⡀⢰⡀⠀⠀⠀⠀⠀⠀⠁",
|
||||
-- "⢀⣿⡆⢀⡾⠀⠀⠀⠀⣾⠏⢿⣿⣿⣿⣯⣙⢷⡄⠀⠀⠀⠀⠀⢸⡄⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣿⣻⢿⣷⣀⣷⣄⠀⠀⠀⠀⢸⠀",
|
||||
-- "⢸⠃⠠⣼⠃⠀⠀⣠⣾⡟⠀⠈⢿⣿⡿⠿⣿⣿⡿⠿⠿⠿⠷⣄⠈⠿⠛⠻⠶⢶⣄⣀⣀⡠⠈⢛⡿⠃⠈⢿⣿⣿⡿⠀⠀⠀⠀⠀⡀",
|
||||
-- "⠟⠀⠀⢻⣶⣶⣾⣿⡟⠁⠀⠀⢸⣿⢅⠀⠈⣿⡇⠀⠀⠀⠀⠀⣷⠂⠀⠀⠀⠀⠐⠋⠉⠉⠀⢸⠁⠀⠀⠀⢻⣿⠛⠀⠀⠀⠀⢀⠇",
|
||||
-- "⠀⠀⠀⠀⠹⣿⣿⠋⠀⠀⠀⠀⢸⣧⠀⠰⡀⢸⣷⣤⣤⡄⠀⠀⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⡾⠀⠀⠀⠀⠀⠀⢼⡇",
|
||||
-- "⠀⠀⠀⠀⠀⠙⢻⠄⠀⠀⠀⠀⣿⠉⠀⠀⠈⠓⢯⡉⠉⠉⢱⣶⠏⠙⠛⠚⠁⠀⠀⠀⠀⠀⣼⠇⠀⠀⠀⢀⡇⠀⠀⠀⠀⠀⠀⠀⡇",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠻⠄⠀⠀⠀⢀⣿⠀⢠⡄⠀⠀⠀⣁⠁⡀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⢀⣐⡟⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⢠⡇",
|
||||
|
||||
-- "⠀⢀⣀⣀⣀⣀⣠⣤⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⣿⣿⣿⣏⠉⠈⣿⣿⣿⢦⣀⠀⠀⠀⠀⠀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⢿⠋⠻⣿⣷⣄⡙⠛⠋⠀⠈⠹⣷⠚⠛⣟⠽⣯⠝⠋⠙⣶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠉⠉⠙⢿⠲⠤⣼⡿⡆⠀⢢⠀⠉⠲⠏⠀⠀⠀⣇⢻⠙⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⢸⡇⢀⡼⠁⠀⠀⢸⠟⠉⠉⠛⢦⠀⠀⢿⡼⠿⡚⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⢀⣠⣶⡶⠿⢿⡿⣿⠟⢁⣀⣠⠔⠋⠀⠀⠀⠀⠈⡇⠀⠀⠀⠀⠉⢻⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⢀⣾⡞⠁⢀⣴⡯⠞⣡⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⣰⠃⠀⠀⠀⣠⠄⣸⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠈⠙⠀⠀⢿⣤⠤⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⢀⡼⠃⢰⡖⠒⢤⣧⣤⣼⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠖⠋⠀⠀⠈⡧⠀⣏⠁⢰⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠋⠁⠀⠀⠀⠀⠀⠈⠓⢦⣷⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠚⠁⠀⠀⢴⠒⠒⠢⡀⠀⠀⢠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⣠⠶⠋⠀⠀⠀⠀⠀⡼⢀⡶⠆⢳⣤⠔⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⢀⡴⠋⠀⠀⠀⠀⠀⠀⠸⡀⠹⣀⣸⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⡼⠁⠀⠀⠀⠀⠀⠀⠀⠀⠉⡶⠛⠁⠀⠀⠀⠀⠀⠀⠀⢀⣠⠴⠒⢿⡉⠛⢍⠛⠒⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⢰⠃⠀⠀⠀⠀⢠⡤⢤⣀⣠⠎⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢯⡀⠀⠀⠀⢹⡆⠻⠦⠴⠃⢈⣣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⣼⠀⠀⠀⠀⢀⣼⣀⡖⣾⠃⠀⠀⠀⠀⠀⠀⠀⠀⢠⡾⢅⣸⠁⠀⠀⠀⠸⡦⠖⠤⣀⠜⠁⠈⢷⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⡟⠀⠀⠀⠀⡏⠹⡗⢺⢻⡀⠀⠀⠀⠀⠀⠀⠀⣠⠿⠖⣉⣀⣱⠀⣀⡤⠤⢤⣄⠀⠀⠀⢀⣀⣸⠀⠀⠀⠐⠻⣗⠲⣄⠀",
|
||||
-- "⠀⠀⠀⠀⣿⠀⠀⠀⠀⠈⠉⠉⢹⠚⢷⣀⠀⠀⠀⠀⣀⡴⠛⠒⠊⠀⠀⣠⠎⠁⠀⠀⠀⠈⢳⡀⠀⣿⣸⡿⠀⠀⠀⠀⠀⠈⣇⠘⡆",
|
||||
-- "⠀⠀⠀⠀⢸⡄⠀⠀⠀⠀⠀⠀⠸⡇⢸⠙⡟⠲⡖⠋⣯⠀⠀⠀⠀⠀⣼⠁⠀⠀⠀⠀⠀⠀⠀⡧⣎⣈⣿⠃⠀⠀⠀⠀⠀⠀⣼⣆⢻",
|
||||
-- "⠀⠀⠀⠀⠀⢷⠀⠀⠀⠀⠀⠀⠀⠀⠈⡇⢼⡤⠃⡔⠁⠀⠀⠀⠀⣸⠃⠀⠀⠀⠀⠀⠀⠀⢰⡇⠀⠀⣯⠀⠀⠀⠀⠀⠀⢠⠷⠼⢺",
|
||||
-- "⠀⠀⠀⠀⠀⠈⢳⣄⠀⠀⠀⠀⠀⠀⠐⠖⠚⠒⠞⠀⠀⠀⠀⠀⣰⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⢷⠀⠸⠽⠷⣄⣀⣀⣠⡶⠋⠀⢠⡟",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠉⠳⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⣄⠀⠀⢯⡛⡷⠚⠁⢀⡴⠋⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠒⠒⠦⠤⠤⠤⠴⠖⠚⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠒⠲⠿⠷⠒⠛⠉⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
-- "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
|
||||
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⠀⠰⠛⠻⢿⣿⠿⠿⠟⡿⠿⢿⣿⠿⠿⣿⠃⠀⠟⠛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⣴⡄⠀⠘⡇⠀⣤⣤⡇⠀⣼⣿⠀⢠⡏⠀⢠⣦⠀⠀⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠀⠀⠛⠃⠀⡼⠀⠀⣿⣿⠀⠀⠛⠃⠀⢸⠁⠀⣼⡏⠀⢠⡟⠉⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣾⣷⣶⣾⣿⣿⣷⣶⣶⣶⣶⣿⣶⣶⣿⣷⣶⣾⣷⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
-- "⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿",
|
||||
|
||||
"⠀⠀⠀⠀⣀⣀⣤⣤⣶⣶⣶⣶⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⡄⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠛⠛⢿⣿⡇⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⣿⡟⠡⠂⠀⢹⣿⣿⣿⣿⣿⣿⡇⠘⠁⠀⠀⣿⡇⠀⢠⣄⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⢸⣗⢴⣶⣷⣷⣿⣿⣿⣿⣿⣿⣷⣤⣤⣤⣴⣿⣗⣄⣼⣷⣶⡄⠀⠀",
|
||||
"⠀⠀⠀⢀⣾⣿⡅⠐⣶⣦⣶⠀⢰⣶⣴⣦⣦⣶⠴⠀⢠⣿⣿⣿⣿⣿⣿⡇⠀⠀",
|
||||
"⠀⠀⢀⣾⣿⣿⣷⣬⡛⠷⣿⣿⣿⣿⣿⣿⣿⠿⠿⣠⣿⣿⣿⣿⣿⠿⠛⠀⠀⠀",
|
||||
"⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣶⣦⣭⣭⣥⣭⣵⣶⣿⣿⣿⣿⡟⠉⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠙⠇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣛⠛⠛⠛⠛⠛⢛⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀",
|
||||
"⠀⠀⠀⠀⠀⠿⣿⣿⣿⠿⠿⠀⠀⠀⠀⠀⠸⣿⣿⣿⣿⠿⠇⠀ ⠀⠀⠀⠀",
|
||||
" ",
|
||||
" There is no place like ~/ ",
|
||||
|
||||
-- " ",
|
||||
-- " ⣴⣶⣤⡤⠦⣤⣀⣤⠆ ⣈⣭⣭⣿⣶⣿⣦⣼⣆ ",
|
||||
-- " ⠉⠻⢿⣿⠿⣿⣿⣶⣦⠤⠄⡠⢾⣿⣿⡿⠋⠉⠉⠻⣿⣿⡛⣦ ",
|
||||
-- " ⠈⢿⣿⣟⠦ ⣾⣿⣿⣷ ⠻⠿⢿⣿⣧⣄ ",
|
||||
-- " ⣸⣿⣿⢧ ⢻⠻⣿⣿⣷⣄⣀ ⠢⣀⡀⠈⠙⠿⠄ ",
|
||||
-- " ⢠⣿⣿⣿⠈ ⠡⠌⣻⣿⣿⣿⣿⣿⣿⣿⣛⣳⣤⣀⣀ ",
|
||||
-- " ⢠⣧⣶⣥⡤⢄ ⣸⣿⣿⠘⠄ ⢀⣴⣿⣿⡿⠛⣿⣿⣧⠈⢿⠿⠟⠛⠻⠿⠄ ",
|
||||
-- " ⣰⣿⣿⠛⠻⣿⣿⡦⢹⣿⣷ ⢊⣿⣿⡏ ⢸⣿⣿⡇ ⢀⣠⣄⣾⠄ ",
|
||||
-- " ⣠⣿⠿⠛⠄⢀⣿⣿⣷⠘⢿⣿⣦⡀ ⢸⢿⣿⣿⣄ ⣸⣿⣿⡇⣪⣿⡿⠿⣿⣷⡄ ",
|
||||
-- " ⠙⠃ ⣼⣿⡟ ⠈⠻⣿⣿⣦⣌⡇⠻⣿⣿⣷⣿⣿⣿ ⣿⣿⡇⠄⠛⠻⢷⣄ ",
|
||||
-- " ⢻⣿⣿⣄ ⠈⠻⣿⣿⣿⣷⣿⣿⣿⣿⣿⡟ ⠫⢿⣿⡆ ",
|
||||
-- " ⠻⣿⣿⣿⣿⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⡟⢀⣀⣤⣾⡿⠃ ",
|
||||
},
|
||||
|
||||
buttons = {
|
||||
{
|
||||
" New Project",
|
||||
"Spc n n",
|
||||
"ProjectNew",
|
||||
},
|
||||
{
|
||||
" Restore Session",
|
||||
"Spc q l",
|
||||
function()
|
||||
require("persistence").load { last = true }
|
||||
end,
|
||||
},
|
||||
{
|
||||
" File Manager",
|
||||
"Spc .",
|
||||
"Telescope file_browser path=%:p:h select_buffer=true",
|
||||
-- FIXME cmd doesn't work with lazy loading!
|
||||
},
|
||||
{
|
||||
" Find File",
|
||||
"Spc f f",
|
||||
"Telescope find_files",
|
||||
},
|
||||
{
|
||||
" Find Project",
|
||||
"Spc f p",
|
||||
"lua require('telescope').extensions.project.project({display_type = 'full'})",
|
||||
},
|
||||
{
|
||||
" Find Command",
|
||||
"Spc f c",
|
||||
"Telescope builtin",
|
||||
},
|
||||
{
|
||||
" Recent Files",
|
||||
"Spc f r",
|
||||
"Telescope oldfiles",
|
||||
},
|
||||
{
|
||||
" Find Word",
|
||||
"Spc f w",
|
||||
"Telescope live_grep",
|
||||
},
|
||||
{
|
||||
" Bookmarks",
|
||||
"Spc m a",
|
||||
"Telescope marks",
|
||||
},
|
||||
{
|
||||
" Themes",
|
||||
"Spc h t",
|
||||
"Telescope themes",
|
||||
},
|
||||
{
|
||||
" Config",
|
||||
"Spc o c",
|
||||
"next ~/.config/nvim/lua/custom/*.lua",
|
||||
},
|
||||
{
|
||||
" Mappings",
|
||||
"Spc c h",
|
||||
"NvCheatsheet",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
lsp = {
|
||||
-- show function signatures i.e args as you type
|
||||
signature = {
|
||||
disabled = false,
|
||||
silent = true, -- silences 'no signature help available' message from appearing
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.plugins = "custom.plugins"
|
||||
|
||||
-- check core.mappings for table structure
|
||||
M.mappings = require "custom.mappings"
|
||||
|
||||
return M
|
85
lua/custom/configs/.automaton.lua
Normal file
85
lua/custom/configs/.automaton.lua
Normal file
|
@ -0,0 +1,85 @@
|
|||
-- This file is going to get deprecated soon
|
||||
-- And replaced with Overseer.nvim
|
||||
|
||||
M = {}
|
||||
|
||||
M.opts = {
|
||||
debug = false,
|
||||
saveall = true,
|
||||
ignore_ft = {},
|
||||
|
||||
terminal = {
|
||||
position = "botright",
|
||||
size = 10,
|
||||
},
|
||||
|
||||
integrations = {
|
||||
luasnip = false,
|
||||
cmp = false,
|
||||
},
|
||||
|
||||
icons = {
|
||||
buffer = "",
|
||||
close = "",
|
||||
launch = "",
|
||||
task = "",
|
||||
workspace = "",
|
||||
},
|
||||
|
||||
events = {
|
||||
workspacechanged = function(ws)
|
||||
-- "ws" is the current workspace object (can be nil)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
{ "<F5>", "<CMD>Automaton launch default<CR>", mode = "n", desc = "Exec Default Launcher" },
|
||||
{ "<F6>", "<CMD>Automaton debug default<CR>", mode = "n", desc = "Debug Default Launcher" },
|
||||
{ "<F8>", "<CMD>Automaton tasks default<CR>", mode = "n", desc = "Exec Default Task" },
|
||||
|
||||
{ "<leader>iC", "<CMD>Automaton create<CR>", mode = "n", desc = "Create New Workspace" },
|
||||
{ "<leader>iI", "<CMD>Automaton init<CR>", mode = "n", desc = "Init Workspace" },
|
||||
{ "<leader>iL", "<CMD>Automaton load<CR>", mode = "n", desc = "Load CWD Workspace" },
|
||||
|
||||
{ "<leader>ic", "<CMD>Automaton config<CR>", mode = "n", desc = "Edit Workspace Settings" },
|
||||
{ "<leader>ir", "<CMD>Automaton recents<CR>", mode = "n", desc = "Recent Workspaces" },
|
||||
{ "<leader>iw", "<CMD>Automaton workspaces<CR>", mode = "n", desc = "Manage Loaded Workspaces" },
|
||||
{ "<leader>ij", "<CMD>Automaton jobs<CR>", mode = "n", desc = "Manage Running Tasks" },
|
||||
{ "<leader>il", "<CMD>Automaton launch<CR>", mode = "n", desc = "Exec Launcher" },
|
||||
{ "<leader>id", "<CMD>Automaton debug<CR>", mode = "n", desc = "Debug Launcher" },
|
||||
{ "<leader>it", "<CMD>Automaton tasks<CR>", mode = "n", desc = "Exec Task" },
|
||||
|
||||
{ "<leader>iol", "<CMD>Automaton open launch<CR>", mode = "n", desc = "Open launch.json" },
|
||||
{ "<leader>iov", "<CMD>Automaton open variables<CR>", mode = "n", desc = "Open tasks.json" },
|
||||
{ "<leader>iot", "<CMD>Automaton open tasks<CR>", mode = "n", desc = "Open variables.json" },
|
||||
{ "<leader>ioc", "<CMD>Automaton open config<CR>", mode = "n", desc = "Open config.json" },
|
||||
|
||||
-- -- Visual Mode
|
||||
-- { "<F5>", "<CMD><C-U>Automaton launch default<CR>", mode = "v", desc = "Exec Default Launcher" },
|
||||
-- { "<F6>", "<CMD><C-U>Automaton debug default<CR>", mode = "v", desc = "Debug Default Launcher" },
|
||||
-- { "<F8>", "<CMD><C-U>Automaton tasks default<CR>", mode = "v", desc = "Exec Default Task" },
|
||||
-- { "<leader>il", "<CMD><C-U>Automaton launch<CR>", mode = "v", desc = "" },
|
||||
-- { "<leader>id", "<CMD><C-U>Automaton debug<CR>", mode = "v", desc = "" },
|
||||
-- { "<leader>it", "<CMD><C-U>Automaton tasks<CR>", mode = "v", desc = "" },
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
-- :Automaton create -- Create a new workspace
|
||||
-- recents -- Shows recent workspaces
|
||||
-- init -- Initializes a workspace in "cwd"
|
||||
-- load -- Loads a workspace in "cwd"
|
||||
-- workspaces -- Manage loaded workspaces
|
||||
-- jobs -- Shows running tasks/launch (can be killed too)
|
||||
-- config -- Show/Edit workspace settings
|
||||
-- tasks default -- Exec default task
|
||||
-- tasks -- Select and exec task
|
||||
-- launch default -- Exec default launch configuration
|
||||
-- launch -- Select and exec a launch configuration
|
||||
-- debug default -- Debug default launch configuration
|
||||
-- debug -- Select and debug a launch configuration
|
||||
-- open launch -- Open workspace's launch.json
|
||||
-- open tasks -- Open workspace's tasks.json
|
||||
-- open variables -- Open workspace's variables.json
|
||||
-- open config -- Open workspace's config.json
|
122
lua/custom/configs/cmp-utils.lua
Normal file
122
lua/custom/configs/cmp-utils.lua
Normal file
|
@ -0,0 +1,122 @@
|
|||
function cmp()
|
||||
local cmp = require "cmp"
|
||||
|
||||
dofile(vim.g.base46_cache .. "cmp")
|
||||
|
||||
local cmp_ui = require("core.utils").load_config().ui.cmp
|
||||
local cmp_style = cmp_ui.style
|
||||
|
||||
local field_arrangement = {
|
||||
atom = { "kind", "abbr", "menu" },
|
||||
atom_colored = { "kind", "abbr", "menu" },
|
||||
}
|
||||
|
||||
local formatting_style = {
|
||||
-- default fields order i.e completion word + item.kind + item.kind icons
|
||||
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
|
||||
|
||||
format = function(_, item)
|
||||
local icons = require "nvchad.icons.lspkind"
|
||||
local icon = (cmp_ui.icons and icons[item.kind]) or ""
|
||||
|
||||
if cmp_style == "atom" or cmp_style == "atom_colored" then
|
||||
icon = " " .. icon .. " "
|
||||
item.menu = cmp_ui.lspkind_text and " (" .. item.kind .. ")" or ""
|
||||
item.kind = icon
|
||||
else
|
||||
icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon
|
||||
item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "")
|
||||
end
|
||||
|
||||
return item
|
||||
end,
|
||||
}
|
||||
|
||||
local function border(hl_name)
|
||||
return {
|
||||
{ "╭", hl_name },
|
||||
{ "─", hl_name },
|
||||
{ "╮", hl_name },
|
||||
{ "│", hl_name },
|
||||
{ "╯", hl_name },
|
||||
{ "─", hl_name },
|
||||
{ "╰", hl_name },
|
||||
{ "│", hl_name },
|
||||
}
|
||||
end
|
||||
|
||||
local options = {
|
||||
completion = {
|
||||
completeopt = "menu,menuone",
|
||||
},
|
||||
|
||||
window = {
|
||||
completion = {
|
||||
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
|
||||
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel",
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
border = border "CmpDocBorder",
|
||||
winhighlight = "Normal:CmpDoc",
|
||||
},
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
|
||||
formatting = formatting_style,
|
||||
|
||||
mapping = {
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.close(),
|
||||
["<CR>"] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Insert,
|
||||
select = true,
|
||||
},
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
},
|
||||
}
|
||||
|
||||
if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then
|
||||
options.window.completion.border = border "CmpBorder"
|
||||
end
|
||||
|
||||
return options
|
||||
end
|
157
lua/custom/configs/cmp.lua
Normal file
157
lua/custom/configs/cmp.lua
Normal file
|
@ -0,0 +1,157 @@
|
|||
local M = {}
|
||||
|
||||
M.dependencies = {
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
disable_filetype = { "TelescopePrompt", "vim" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-autopairs").setup(opts)
|
||||
|
||||
-- setup cmp for autopairs
|
||||
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
|
||||
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
-- snippet plugin
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = "rafamadriz/friendly-snippets",
|
||||
opts = {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
},
|
||||
|
||||
keys = {
|
||||
{
|
||||
"<C-s>",
|
||||
function()
|
||||
local ls = require "luasnip"
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end,
|
||||
|
||||
mode = { "i", "s" },
|
||||
silent = true,
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require("plugins.configs.others").luasnip(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- -- These integrates with nvim-cmp with both Github Copilot and Tabnine AI
|
||||
-- -- I find it uncomfortable to use, so I disabled them
|
||||
-- -- >>> If you want to enable them don't forget to turn on them in `sources` too! <<<
|
||||
-- { -- Tabnine
|
||||
-- "tzachar/cmp-tabnine",
|
||||
--
|
||||
-- build = "./install.sh",
|
||||
-- dependencies = "hrsh7th/nvim-cmp",
|
||||
--
|
||||
-- config = function(_, opts)
|
||||
-- local tabnine = require "cmp_tabnine.config"
|
||||
-- tabnine:setup(opts)
|
||||
-- end,
|
||||
--
|
||||
-- opts = {
|
||||
-- max_lines = 1000,
|
||||
-- max_num_results = 20,
|
||||
-- sort = true,
|
||||
-- run_on_every_keystroke = true,
|
||||
-- snippet_placeholder = "..",
|
||||
-- ignored_file_types = {
|
||||
-- -- default is not to ignore
|
||||
-- -- uncomment to ignore in lua:
|
||||
-- -- lua = true
|
||||
-- },
|
||||
-- show_prediction_strength = false,
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- { -- Copilot
|
||||
-- "zbirenbaum/copilot-cmp",
|
||||
--
|
||||
-- dependencies = {
|
||||
-- "zbirenbaum/copilot.lua",
|
||||
--
|
||||
-- opts = {
|
||||
-- suggestion = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
--
|
||||
-- panel = {
|
||||
-- enabled = false,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
--
|
||||
-- config = function()
|
||||
-- require("copilot_cmp").setup()
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- cmp sources plugins
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
} -- END NV-CMP DEPENDENCIES
|
||||
|
||||
-- ALL OPTS GET MERGED WITH DEFAULTS IN LAZY.nvim
|
||||
M.opts = {
|
||||
mapping = {
|
||||
-- Disable <TAB> for autocompletion to not go crazy!!!
|
||||
["<Tab>"] = require("cmp").mapping(function(fallback)
|
||||
if require("luasnip").expand_or_jumpable() then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
|
||||
["<S-Tab>"] = require("cmp").mapping(function(fallback)
|
||||
if require("luasnip").jumpable(-1) then
|
||||
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
},
|
||||
|
||||
sources = {
|
||||
-- -- AI
|
||||
-- Copilot
|
||||
-- { name = "copilot" },
|
||||
-- Tabnine
|
||||
-- { name = "cmp_tabnine" },
|
||||
|
||||
-- Other Sources
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "path" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
|
||||
-- Cargo.toml
|
||||
{ name = "crates" },
|
||||
|
||||
-- Other
|
||||
{ name = "orgmode" },
|
||||
-- { name = "calc" },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
47
lua/custom/configs/copilot.lua
Normal file
47
lua/custom/configs/copilot.lua
Normal file
|
@ -0,0 +1,47 @@
|
|||
local M = {}
|
||||
|
||||
M.opts = {
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = true, -- Refresh panel when typing to the buffer
|
||||
keymap = {
|
||||
jump_prev = "[[",
|
||||
jump_next = "]]",
|
||||
accept = "<CR>",
|
||||
refresh = "gr",
|
||||
open = "<M-CR>",
|
||||
},
|
||||
layout = {
|
||||
position = "right", -- | top | left | right
|
||||
ratio = 0.4,
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
accept = "<M-Tab>",
|
||||
accept_word = false,
|
||||
accept_line = false,
|
||||
next = "<C-l>",
|
||||
prev = "<C-h>",
|
||||
dismiss = "<C-q>",
|
||||
},
|
||||
},
|
||||
filetypes = {
|
||||
yaml = false,
|
||||
-- markdown = false,
|
||||
help = false,
|
||||
-- gitcommit = false,
|
||||
gitrebase = false,
|
||||
hgcommit = false,
|
||||
svn = false,
|
||||
cvs = false,
|
||||
["."] = false,
|
||||
},
|
||||
copilot_node_command = "node", -- Node.js version must be > 16.x
|
||||
server_opts_overrides = {},
|
||||
}
|
||||
|
||||
return M
|
34
lua/custom/configs/cpp.lua
Normal file
34
lua/custom/configs/cpp.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
local M = {}
|
||||
|
||||
-- "Badhi/nvim-treesitter-cpp-tools",
|
||||
-- C++ development
|
||||
-- Nice but limited cpp codegen features which I'll (probably) not use (if you want create keymapps)
|
||||
M.treesitter = {}
|
||||
M.treesitter.keys = {
|
||||
{ "<leader>cpl", ":TSCppDefineClassFunc<CR>", mode = "n", desc = "Define Class function" },
|
||||
{ "<leader>cpm", ":TSCppMakeConcreteClass<CR>", mode = "n", desc = "Make Concrete Class" },
|
||||
{ "<leader>cpo", ":TSCppRuleOf3<CR>", mode = "n", desc = "Rule of 3" },
|
||||
{ "<leader>cpp", ":TSCppRuleOf5<CR>", mode = "n", desc = "Rule of 5" },
|
||||
|
||||
{ "<leader>cpl", ":TSCppDefineClassFunc<CR>", mode = "v", desc = "Define Class function" },
|
||||
{ "<leader>cpm", ":TSCppMakeConcreteClass<CR>", mode = "v", desc = "Make Concrete Class" },
|
||||
{ "<leader>cpo", ":TSCppRuleOf3<CR>", mode = "v", desc = "Rule of 3" },
|
||||
{ "<leader>cpp", ":TSCppRuleOf5<CR>", mode = "v", desc = "Rule of 5" },
|
||||
}
|
||||
|
||||
M.treesitter.opts = {
|
||||
preview = {
|
||||
quit = "q", -- optional keymapping for quit preview
|
||||
accept = "<tab>", -- optional keymapping for accept preview
|
||||
},
|
||||
--[[
|
||||
<your impl function custom command name> = {
|
||||
output_handle = function (str, context)
|
||||
-- string contains the class implementation
|
||||
-- do whatever you want to do with it
|
||||
end
|
||||
}
|
||||
]]
|
||||
}
|
||||
|
||||
return M
|
1
lua/custom/configs/cspell.json
Normal file
1
lua/custom/configs/cspell.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":"0.2","words":["codespell"],"flagWords":[],"language":"en"}
|
296
lua/custom/configs/flash.lua
Normal file
296
lua/custom/configs/flash.lua
Normal file
|
@ -0,0 +1,296 @@
|
|||
local M = {}
|
||||
M.keys = {
|
||||
{
|
||||
"s",
|
||||
mode = { "n", "x", "o" },
|
||||
function()
|
||||
require("flash").jump()
|
||||
end,
|
||||
desc = "Flash",
|
||||
},
|
||||
{
|
||||
"S",
|
||||
mode = { "n", "o", "x" },
|
||||
function()
|
||||
require("flash").treesitter()
|
||||
end,
|
||||
desc = "Flash Treesitter",
|
||||
},
|
||||
{
|
||||
"r",
|
||||
mode = "o",
|
||||
function()
|
||||
require("flash").remote()
|
||||
end,
|
||||
desc = "Remote Flash",
|
||||
},
|
||||
{
|
||||
"R",
|
||||
mode = { "o", "x" },
|
||||
function()
|
||||
require("flash").treesitter_search()
|
||||
end,
|
||||
desc = "Treesitter Search",
|
||||
},
|
||||
{
|
||||
"<c-s>",
|
||||
mode = { "c" },
|
||||
function()
|
||||
require("flash").toggle()
|
||||
end,
|
||||
desc = "Toggle Flash Search",
|
||||
},
|
||||
-- Searching loads flash lazily
|
||||
"/",
|
||||
"?",
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
-- labels = "abcdefghijklmnopqrstuvwxyz",
|
||||
labels = "asdfghjklqwertyuiopzxcvbnm",
|
||||
search = {
|
||||
-- search/jump in all windows
|
||||
multi_window = true,
|
||||
-- search direction
|
||||
forward = true,
|
||||
-- when `false`, find only matches in the given direction
|
||||
wrap = true,
|
||||
---@type Flash.Pattern.Mode
|
||||
-- Each mode will take ignorecase and smartcase into account.
|
||||
-- * exact: exact match
|
||||
-- * search: regular search
|
||||
-- * fuzzy: fuzzy search
|
||||
-- * fun(str): custom function that returns a pattern
|
||||
-- For example, to only match at the beginning of a word:
|
||||
-- mode = function(str)
|
||||
-- return "\\<" .. str
|
||||
-- end,
|
||||
mode = "exact",
|
||||
-- behave like `incsearch`
|
||||
incremental = false,
|
||||
-- Excluded filetypes and custom window filters
|
||||
---@type (string|fun(win:window))[]
|
||||
exclude = {
|
||||
"notify",
|
||||
"cmp_menu",
|
||||
"noice",
|
||||
"flash_prompt",
|
||||
function(win)
|
||||
-- exclude non-focusable windows
|
||||
return not vim.api.nvim_win_get_config(win).focusable
|
||||
end,
|
||||
},
|
||||
-- Optional trigger character that needs to be typed before
|
||||
-- a jump label can be used. It's NOT recommended to set this,
|
||||
-- unless you know what you're doing
|
||||
trigger = "",
|
||||
-- max pattern length. If the pattern length is equal to this
|
||||
-- labels will no longer be skipped. When it exceeds this length
|
||||
-- it will either end in a jump or terminate the search
|
||||
max_length = false, ---@type number|false
|
||||
},
|
||||
jump = {
|
||||
-- save location in the jumplist
|
||||
jumplist = true,
|
||||
-- jump position
|
||||
pos = "start", ---@type "start" | "end" | "range"
|
||||
-- add pattern to search history
|
||||
history = false,
|
||||
-- add pattern to search register
|
||||
register = false,
|
||||
-- clear highlight after jump
|
||||
nohlsearch = false,
|
||||
-- automatically jump when there is only one match
|
||||
autojump = false,
|
||||
-- You can force inclusive/exclusive jumps by setting the
|
||||
-- `inclusive` option. By default it will be automatically
|
||||
-- set based on the mode.
|
||||
inclusive = nil, ---@type boolean?
|
||||
-- jump position offset. Not used for range jumps.
|
||||
-- 0: default
|
||||
-- 1: when pos == "end" and pos < current position
|
||||
offset = nil, ---@type number
|
||||
},
|
||||
label = {
|
||||
-- allow uppercase labels
|
||||
uppercase = true,
|
||||
-- add any labels with the correct case here, that you want to exclude
|
||||
exclude = "",
|
||||
-- add a label for the first match in the current window.
|
||||
-- you can always jump to the first match with `<CR>`
|
||||
current = true,
|
||||
-- show the label after the match
|
||||
after = true, ---@type boolean|number[]
|
||||
-- show the label before the match
|
||||
before = false, ---@type boolean|number[]
|
||||
-- position of the label extmark
|
||||
style = "overlay", ---@type "eol" | "overlay" | "right_align" | "inline"
|
||||
-- flash tries to re-use labels that were already assigned to a position,
|
||||
-- when typing more characters. By default only lower-case labels are re-used.
|
||||
reuse = "lowercase", ---@type "lowercase" | "all" | "none"
|
||||
-- for the current window, label targets closer to the cursor first
|
||||
distance = true,
|
||||
-- minimum pattern length to show labels
|
||||
-- Ignored for custom labelers.
|
||||
min_pattern_length = 0,
|
||||
-- Enable this to use rainbow colors to highlight labels
|
||||
-- Can be useful for visualizing Treesitter ranges.
|
||||
rainbow = {
|
||||
enabled = false,
|
||||
-- number between 1 and 9
|
||||
shade = 5,
|
||||
},
|
||||
-- With `format`, you can change how the label is rendered.
|
||||
-- Should return a list of `[text, highlight]` tuples.
|
||||
---@class Flash.Format
|
||||
---@field state Flash.State
|
||||
---@field match Flash.Match
|
||||
---@field hl_group string
|
||||
---@field after boolean
|
||||
---@type fun(opts:Flash.Format): string[][]
|
||||
format = function(opts)
|
||||
return { { opts.match.label, opts.hl_group } }
|
||||
end,
|
||||
},
|
||||
|
||||
highlight = {
|
||||
-- show a backdrop with hl FlashBackdrop
|
||||
backdrop = true,
|
||||
-- Highlight the search matches
|
||||
matches = true,
|
||||
-- extmark priority
|
||||
priority = 5000,
|
||||
groups = {
|
||||
match = "FlashMatch",
|
||||
current = "FlashCurrent",
|
||||
backdrop = "FlashBackdrop",
|
||||
label = "FlashLabel",
|
||||
},
|
||||
},
|
||||
-- action to perform when picking a label.
|
||||
-- defaults to the jumping logic depending on the mode.
|
||||
---@type fun(match:Flash.Match, state:Flash.State)|nil
|
||||
action = nil,
|
||||
-- initial pattern to use when opening flash
|
||||
pattern = "",
|
||||
-- When `true`, flash will try to continue the last search
|
||||
continue = false,
|
||||
-- Set config to a function to dynamically change the config
|
||||
config = nil, ---@type fun(opts:Flash.Config)|nil
|
||||
-- You can override the default options for a specific mode.
|
||||
-- Use it with `require("flash").jump({mode = "forward"})`
|
||||
---@type table<string, Flash.Config>
|
||||
modes = {
|
||||
-- options used when flash is activated through
|
||||
-- a regular search with `/` or `?`
|
||||
search = {
|
||||
-- when `true`, flash will be activated during regular search by default.
|
||||
-- You can always toggle when searching with `require("flash").toggle()`
|
||||
enabled = true,
|
||||
highlight = { backdrop = false },
|
||||
jump = { history = true, register = true, nohlsearch = true },
|
||||
search = {
|
||||
-- `forward` will be automatically set to the search direction
|
||||
-- `mode` is always set to `search`
|
||||
-- `incremental` is set to `true` when `incsearch` is enabled
|
||||
},
|
||||
},
|
||||
-- options used when flash is activated through
|
||||
-- `f`, `F`, `t`, `T`, `;` and `,` motions
|
||||
char = {
|
||||
enabled = true,
|
||||
-- dynamic configuration for ftFT motions
|
||||
config = function(opts)
|
||||
-- autohide flash when in operator-pending mode
|
||||
opts.autohide = vim.fn.mode(true):find "no" and vim.v.operator == "y"
|
||||
|
||||
-- disable jump labels when enabled and when using a count
|
||||
opts.jump_labels = opts.jump_labels and vim.v.count == 0
|
||||
|
||||
-- Show jump labels only in operator-pending mode
|
||||
-- opts.jump_labels = vim.v.count == 0 and vim.fn.mode(true):find("o")
|
||||
end,
|
||||
-- hide after jump when not using jump labels
|
||||
autohide = false,
|
||||
-- show jump labels
|
||||
jump_labels = false,
|
||||
-- set to `false` to use the current line only
|
||||
multi_line = true,
|
||||
-- When using jump labels, don't use these keys
|
||||
-- This allows using those keys directly after the motion
|
||||
label = { exclude = "hjkliardc" },
|
||||
-- by default all keymaps are enabled, but you can disable some of them,
|
||||
-- by removing them from the list.
|
||||
-- If you rather use another key, you can map them
|
||||
-- to something else, e.g., { [";"] = "L", [","] = H }
|
||||
keys = { "f", "F", "t", "T", ";", "," },
|
||||
---@alias Flash.CharActions table<string, "next" | "prev" | "right" | "left">
|
||||
-- The direction for `prev` and `next` is determined by the motion.
|
||||
-- `left` and `right` are always left and right.
|
||||
char_actions = function(motion)
|
||||
return {
|
||||
[";"] = "next", -- set to `right` to always go right
|
||||
[","] = "prev", -- set to `left` to always go left
|
||||
-- clever-f style
|
||||
[motion:lower()] = "next",
|
||||
[motion:upper()] = "prev",
|
||||
-- jump2d style: same case goes next, opposite case goes prev
|
||||
-- [motion] = "next",
|
||||
-- [motion:match("%l") and motion:upper() or motion:lower()] = "prev",
|
||||
}
|
||||
end,
|
||||
search = { wrap = false },
|
||||
highlight = { backdrop = true },
|
||||
jump = { register = false },
|
||||
},
|
||||
-- options used for treesitter selections
|
||||
-- `require("flash").treesitter()`
|
||||
treesitter = {
|
||||
labels = "abcdefghijklmnopqrstuvwxyz",
|
||||
jump = { pos = "range" },
|
||||
search = { incremental = false },
|
||||
label = { before = true, after = true, style = "inline" },
|
||||
highlight = {
|
||||
backdrop = false,
|
||||
matches = false,
|
||||
},
|
||||
},
|
||||
treesitter_search = {
|
||||
jump = { pos = "range" },
|
||||
search = { multi_window = true, wrap = true, incremental = false },
|
||||
remote_op = { restore = true },
|
||||
label = { before = true, after = true, style = "inline" },
|
||||
},
|
||||
-- options used for remote flash
|
||||
remote = {
|
||||
remote_op = { restore = true, motion = true },
|
||||
},
|
||||
},
|
||||
-- options for the floating window that shows the prompt,
|
||||
-- for regular jumps
|
||||
prompt = {
|
||||
enabled = true,
|
||||
prefix = { { "⚡", "FlashPromptIcon" } },
|
||||
win_config = {
|
||||
relative = "editor",
|
||||
width = 1, -- when <=1 it's a percentage of the editor width
|
||||
height = 1,
|
||||
row = -1, -- when negative it's an offset from the bottom
|
||||
col = 0, -- when negative it's an offset from the right
|
||||
zindex = 1000,
|
||||
},
|
||||
},
|
||||
-- options for remote operator pending mode
|
||||
remote_op = {
|
||||
-- restore window views and cursor position
|
||||
-- after doing a remote operation
|
||||
restore = false,
|
||||
-- For `jump.pos = "range"`, this setting is ignored.
|
||||
-- `true`: always enter a new motion when doing a remote operation
|
||||
-- `false`: use the window's cursor position and jump target
|
||||
-- `nil`: act as `true` for remote windows, `false` for the current window
|
||||
motion = false,
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
101
lua/custom/configs/gh.lua
Normal file
101
lua/custom/configs/gh.lua
Normal file
|
@ -0,0 +1,101 @@
|
|||
local M = {}
|
||||
M.opts = {
|
||||
-- deprecated, around for compatibility for now.
|
||||
jump_mode = "invoking",
|
||||
-- remap the arrow keys to resize any litee.nvim windows.
|
||||
map_resize_keys = false,
|
||||
-- do not map any keys inside any gh.nvim buffers.
|
||||
disable_keymaps = false,
|
||||
-- the icon set to use.
|
||||
icon_set = "default",
|
||||
-- any custom icons to use.
|
||||
icon_set_custom = nil,
|
||||
-- whether to register the @username and #issue_number omnifunc completion
|
||||
-- in buffers which start with .git/
|
||||
git_buffer_completion = true,
|
||||
-- defines keymaps in gh.nvim buffers.
|
||||
keymaps = {
|
||||
-- when inside a gh.nvim panel, this key will open a node if it has
|
||||
-- any futher functionality. for example, hitting <CR> on a commit node
|
||||
-- will open the commit's changed files in a new gh.nvim panel.
|
||||
open = "<CR>",
|
||||
-- when inside a gh.nvim panel, expand a collapsed node
|
||||
expand = "zo",
|
||||
-- when inside a gh.nvim panel, collpased and expanded node
|
||||
collapse = "zc",
|
||||
-- when cursor is over a "#1234" formatted issue or PR, open its details
|
||||
-- and comments in a new tab.
|
||||
goto_issue = "gd",
|
||||
-- show any details about a node, typically, this reveals commit messages
|
||||
-- and submitted review bodys.
|
||||
details = "d",
|
||||
-- inside a convo buffer, submit a comment
|
||||
submit_comment = "<C-s>",
|
||||
-- inside a convo buffer, when your cursor is ontop of a comment, open
|
||||
-- up a set of actions that can be performed.
|
||||
actions = "<C-a>",
|
||||
-- inside a thread convo buffer, resolve the thread.
|
||||
resolve_thread = "<C-r>",
|
||||
-- inside a gh.nvim panel, if possible, open the node's web URL in your
|
||||
-- browser. useful particularily for digging into external failed CI
|
||||
-- checks.
|
||||
goto_web = "gx",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
-- local wk = require "which-key"
|
||||
-- wk.register({
|
||||
-- g = {
|
||||
-- name = "+Git",
|
||||
-- h = {
|
||||
-- name = "+Github",
|
||||
-- c = {
|
||||
-- name = "+Commits",
|
||||
-- c = { "<cmd>GHCloseCommit<cr>", "Close" },
|
||||
-- e = { "<cmd>GHExpandCommit<cr>", "Expand" },
|
||||
-- o = { "<cmd>GHOpenToCommit<cr>", "Open To" },
|
||||
-- p = { "<cmd>GHPopOutCommit<cr>", "Pop Out" },
|
||||
-- z = { "<cmd>GHCollapseCommit<cr>", "Collapse" },
|
||||
-- },
|
||||
-- i = {
|
||||
-- name = "+Issues",
|
||||
-- p = { "<cmd>GHPreviewIssue<cr>", "Preview" },
|
||||
-- },
|
||||
-- l = {
|
||||
-- name = "+Litee",
|
||||
-- t = { "<cmd>LTPanel<cr>", "Toggle Panel" },
|
||||
-- },
|
||||
-- r = {
|
||||
-- name = "+Review",
|
||||
-- b = { "<cmd>GHStartReview<cr>", "Begin" },
|
||||
-- c = { "<cmd>GHCloseReview<cr>", "Close" },
|
||||
-- d = { "<cmd>GHDeleteReview<cr>", "Delete" },
|
||||
-- e = { "<cmd>GHExpandReview<cr>", "Expand" },
|
||||
-- s = { "<cmd>GHSubmitReview<cr>", "Submit" },
|
||||
-- z = { "<cmd>GHCollapseReview<cr>", "Collapse" },
|
||||
-- },
|
||||
-- p = {
|
||||
-- name = "+Pull Request",
|
||||
-- c = { "<cmd>GHClosePR<cr>", "Close" },
|
||||
-- d = { "<cmd>GHPRDetails<cr>", "Details" },
|
||||
-- e = { "<cmd>GHExpandPR<cr>", "Expand" },
|
||||
-- o = { "<cmd>GHOpenPR<cr>", "Open" },
|
||||
-- p = { "<cmd>GHPopOutPR<cr>", "PopOut" },
|
||||
-- r = { "<cmd>GHRefreshPR<cr>", "Refresh" },
|
||||
-- t = { "<cmd>GHOpenToPR<cr>", "Open To" },
|
||||
-- z = { "<cmd>GHCollapsePR<cr>", "Collapse" },
|
||||
-- },
|
||||
-- t = {
|
||||
-- name = "+Threads",
|
||||
-- c = { "<cmd>GHCreateThread<cr>", "Create" },
|
||||
-- n = { "<cmd>GHNextThread<cr>", "Next" },
|
||||
-- t = { "<cmd>GHToggleThread<cr>", "Toggle" },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }, { prefix = "<leader>" })
|
||||
|
||||
|
||||
|
||||
return M
|
23
lua/custom/configs/git-conflict.lua
Normal file
23
lua/custom/configs/git-conflict.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
local M = {}
|
||||
M.cmd = {
|
||||
"GitConflictChooseOurs",
|
||||
"GitConflictChooseTheirs",
|
||||
"GitConflictChooseBoth",
|
||||
"GitConflictChooseNone",
|
||||
"GitConflictNextConflict",
|
||||
"GitConflictPrevConflict",
|
||||
"GitConflictListQf",
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
default_mappings = true, -- disable buffer local mapping created by this plugin
|
||||
default_commands = true, -- disable commands created by this plugin
|
||||
disable_diagnostics = false, -- This will disable the diagnostics in a buffer whilst it is conflicted
|
||||
list_opener = "copen", -- command or function to open the conflicts list
|
||||
highlights = { -- They must have background color, otherwise the default color will be used
|
||||
incoming = "DiffAdd",
|
||||
current = "DiffText",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
15
lua/custom/configs/lspconfig.lua
Normal file
15
lua/custom/configs/lspconfig.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
-- if you just want default config for the servers then put them in a table
|
||||
local servers = { "cssls", "clangd", "rust_analyzer", "cmake" }
|
||||
-- ^^^^^^^^^^^^^^^^-- TODO: Set up with rust-tools.nvim
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
40
lua/custom/configs/mdeval.lua
Normal file
40
lua/custom/configs/mdeval.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
local M = {}
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>cmd", -- TODO: refactor this to use <leader>c prefix
|
||||
"<cmd> MdEval<cr>",
|
||||
mode = "n",
|
||||
desc = "Eval Code Snip",
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require("mdeval").setup(opts)
|
||||
end,
|
||||
|
||||
opts = {
|
||||
-- Don't ask before executing code blocks
|
||||
require_confirmation = false,
|
||||
-- Change code blocks evaluation options.
|
||||
eval_options = {
|
||||
-- Set custom configuration for C++
|
||||
cpp = {
|
||||
command = { "clang++", "-std=c++20", "-O0" },
|
||||
default_header = [[
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
]],
|
||||
},
|
||||
-- Add new configuration for Racket
|
||||
racket = {
|
||||
command = { "racket" }, -- Command to run interpreter
|
||||
language_code = "racket", -- Markdown language code
|
||||
exec_type = "interpreted", -- compiled or interpreted
|
||||
extension = "rkt", -- File extension for temporary files
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
106
lua/custom/configs/neoproj.lua
Normal file
106
lua/custom/configs/neoproj.lua
Normal file
|
@ -0,0 +1,106 @@
|
|||
local M = {}
|
||||
|
||||
M.opts = function()
|
||||
return {
|
||||
setup = {
|
||||
-- Directory which contains all of your projects
|
||||
project_path = "~/Github/repos", -- TODO: Ask for user input + migrate to init.lua
|
||||
},
|
||||
|
||||
templates = {
|
||||
{
|
||||
name = "Kotlin (Android)",
|
||||
repo = "nekocode/create-android-kotlin-app",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Java",
|
||||
repo = "pascalpoizat/template-java-project",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Swift",
|
||||
repo = "vapor/template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "TypeScript (React + Next.js)",
|
||||
repo = "cruip/open-react-template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "C# (.NET)",
|
||||
repo = "Dotnet-Boxed/Templates",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Go (Kratos)",
|
||||
repo = "go-kratos/kratos-layout",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Go (Makefile)",
|
||||
repo = "thockin/go-build-template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "R",
|
||||
repo = "KentonWhite/ProjectTemplate",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Markdown",
|
||||
repo = "othneildrew/Best-README-Template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "Python",
|
||||
repo = "rochacbruno/python-project-template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name = "Python (Tensorflow)",
|
||||
repo = "MrGemy95/Tensorflow-Project-Template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name = "Rust",
|
||||
expand = "cargo init",
|
||||
},
|
||||
|
||||
{
|
||||
name = "C++",
|
||||
repo = "UTFeight/Cpp-Cmake-Template",
|
||||
opts = {
|
||||
pull = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
81
lua/custom/configs/null-ls.lua
Normal file
81
lua/custom/configs/null-ls.lua
Normal file
|
@ -0,0 +1,81 @@
|
|||
local present, null_ls = pcall(require, "null-ls")
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local b = null_ls.builtins
|
||||
|
||||
local sources = {
|
||||
|
||||
-- Generally<F11>
|
||||
b.code_actions.refactoring,
|
||||
|
||||
-- All
|
||||
b.diagnostics.codespell, -- Smart spell checker, Does not check code, checks text. (comment only probably)
|
||||
-- b.completion.spell, -- txt LSP
|
||||
b.diagnostics.todo_comments, -- TODO: viewer
|
||||
b.diagnostics.trail_space,
|
||||
-- b.diagnostics.cspell, -- A bit too annoting. In programming it is common to use acronyms
|
||||
b.code_actions.cspell,
|
||||
|
||||
-- Git
|
||||
b.diagnostics.gitlint,
|
||||
-- b.diagnostics.commitlint, -- look at https://ec.europa.eu/component-library/v1.15.0/eu/docs/conventions/git/ don't use a linter for this
|
||||
|
||||
-- Markdown + Text
|
||||
b.formatting.deno_fmt, -- Markdown + Typescript + Javascript
|
||||
-- b.formatting.prettier, --[[ .with { filetypes = { "html", "markdown", "css" } } ]] -- so prettier works only on these filetypes
|
||||
b.diagnostics.alex,
|
||||
b.diagnostics.write_good,
|
||||
b.diagnostics.textidote, -- LaTeX + Markdown | Grammar + Style
|
||||
b.diagnostics.textlint, -- Txt + Markdown | Grammar + Style
|
||||
b.diagnostics.markdownlint, -- Markdown | Style
|
||||
b.code_actions.proselint,
|
||||
b.diagnostics.proselint, -- LaTeX + Markdown | Grammar + Style
|
||||
-- b.formatting.remark,
|
||||
|
||||
-- Json
|
||||
b.formatting.fixjson,
|
||||
|
||||
-- TOML
|
||||
b.formatting.taplo,
|
||||
|
||||
-- Lua
|
||||
b.formatting.stylua,
|
||||
|
||||
-- Shell
|
||||
b.formatting.shfmt,
|
||||
b.code_actions.shellcheck,
|
||||
b.diagnostics.shellcheck.with { diagnostics_format = "#{m} [#{c}]" },
|
||||
|
||||
-- Cpp
|
||||
b.formatting.clang_format,
|
||||
-- b.diagnostics.clang_check,
|
||||
-- b.diagnostics.clazy, -- Too much?
|
||||
b.diagnostics.cppcheck,
|
||||
|
||||
-- Cmake
|
||||
b.formatting.cmake_format,
|
||||
b.diagnostics.cmake_lint,
|
||||
-- gccdiag is not needed because of NvChad <3
|
||||
|
||||
-- Rust
|
||||
b.formatting.rustfmt, -- CHECKMEOUT: rust-tools.nvim does all for me!
|
||||
|
||||
-- Python
|
||||
b.diagnostics.ruff,
|
||||
b.formatting.black, -- Note: flake8
|
||||
|
||||
-- TreeSitter
|
||||
-- AWESOME THING!
|
||||
b.code_actions.ts_node_action,
|
||||
|
||||
-- dictionary
|
||||
b.hover.dictionary
|
||||
}
|
||||
|
||||
null_ls.setup {
|
||||
debug = true,
|
||||
sources = sources,
|
||||
}
|
99
lua/custom/configs/nvim-bqf.lua
Normal file
99
lua/custom/configs/nvim-bqf.lua
Normal file
|
@ -0,0 +1,99 @@
|
|||
local M = {}
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>lq",
|
||||
[[ <cmd> vimgrep /\w\+/j % | copen<CR> ]],
|
||||
mode = "n",
|
||||
desc = "QuickFix Window",--[[ { noremap = true, silent = true } ]]
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>li",
|
||||
function()
|
||||
vim.diagnostic.setloclist()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Diagnostic SetLocList",--[[ { noremap = true, silent = true } ]]
|
||||
},
|
||||
|
||||
-- -- FIXME: Doesn't work
|
||||
-- {
|
||||
-- "gr",
|
||||
-- function()
|
||||
-- vim.lsp.buf.references()
|
||||
-- end,
|
||||
-- mode = "n",
|
||||
-- desc = "LSP references",
|
||||
-- },
|
||||
--
|
||||
-- {
|
||||
-- "gi",
|
||||
-- function()
|
||||
-- vim.lsp.buf.implementation()
|
||||
-- end,
|
||||
-- mode = "n",
|
||||
-- desc = "LSP implementation",
|
||||
-- },
|
||||
--
|
||||
-- {
|
||||
-- "gd",
|
||||
-- function()
|
||||
-- vim.lsp.buf.definition()
|
||||
-- end,
|
||||
-- mode = "n",
|
||||
-- desc = "LSP definition",
|
||||
-- },
|
||||
--
|
||||
-- {
|
||||
-- "gD",
|
||||
-- function()
|
||||
-- vim.lsp.buf.declaration()
|
||||
-- end,
|
||||
-- mode = "n",
|
||||
-- desc = "LSP declaration",
|
||||
-- },
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
auto_enable = true,
|
||||
auto_resize_height = true, -- highly recommended enable
|
||||
preview = {
|
||||
win_height = 12,
|
||||
win_vheight = 12,
|
||||
delay_syntax = 80,
|
||||
border = { "┏", "━", "┓", "┃", "┛", "━", "┗", "┃" },
|
||||
show_title = false,
|
||||
should_preview_cb = function(bufnr, qwinid)
|
||||
local ret = true
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
local fsize = vim.fn.getfsize(bufname)
|
||||
if fsize > 100 * 1024 then
|
||||
-- skip file size greater than 102k
|
||||
ret = false
|
||||
elseif bufname:match "^fugitive://" then
|
||||
-- skip fugitive buffer
|
||||
ret = false
|
||||
end
|
||||
return ret
|
||||
end,
|
||||
},
|
||||
-- make `drop` and `tab drop` to become preferred
|
||||
func_map = {
|
||||
drop = "o",
|
||||
openc = "O",
|
||||
split = "<C-s>",
|
||||
tabdrop = "<C-t>",
|
||||
-- set to empty string to disable
|
||||
tabc = "",
|
||||
ptogglemode = "z,",
|
||||
},
|
||||
filter = {
|
||||
fzf = {
|
||||
action_for = { ["ctrl-s"] = "split", ["ctrl-t"] = "tab drop" },
|
||||
extra_opts = { "--bind", "ctrl-o:toggle-all", "--prompt", "> " },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
159
lua/custom/configs/nvim-dap.lua
Normal file
159
lua/custom/configs/nvim-dap.lua
Normal file
|
@ -0,0 +1,159 @@
|
|||
-- TODO: There's a lot to do, (:h dap after lazy loading the plugin)
|
||||
local utils = require "custom.utils"
|
||||
local M = {}
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>dc",
|
||||
"<cmd>lua require('dap').continue()<CR>",
|
||||
mode = "n",
|
||||
desc = "Continue",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>ds",
|
||||
"<cmd>lua require('dap').step_over()<CR>",
|
||||
mode = "n",
|
||||
desc = "Step Over",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>di",
|
||||
"<cmd>lua require('dap').step_into()<CR>",
|
||||
mode = "n",
|
||||
desc = "Step Into",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>do",
|
||||
"<cmd>lua require('dap').step_out()<CR>",
|
||||
mode = "n",
|
||||
desc = "Step Out",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>db",
|
||||
function()
|
||||
-- require("persistent-breakpoints.api").toggle_breakpoint()
|
||||
require("dap").toggle_breakpoint()
|
||||
utils.store_breakpoints(false)
|
||||
end, -- Persist the breakpoints
|
||||
mode = "n",
|
||||
desc = "Toggle Breakpoint",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dB",
|
||||
function()
|
||||
-- require("persistent-breakpoints.api").set_conditional_breakpoint() -- Persist
|
||||
require("dap").toggle_breakpoint(vim.fn.input "Log: ")
|
||||
utils.store_breakpoints(false)
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Set Conditional Breakpoint",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dL",
|
||||
function()
|
||||
require("dap").toggle_breakpoint(nil, nil, vim.fn.input "Log point message: ")
|
||||
utils.store_breakpoints(false)
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Log Point",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dl",
|
||||
"<cmd>lua require('dap').run_last()<CR>",
|
||||
mode = "n",
|
||||
desc = "Run Last",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dr",
|
||||
"<cmd>lua require('dap').repl.open()<CR>",
|
||||
mode = "n",
|
||||
desc = "Open REPL",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dd",
|
||||
"<cmd>lua require('dapui').toggle()<CR>",
|
||||
mode = "n",
|
||||
desc = "Toggle UI",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>da",
|
||||
"<cmd>lua require('dapui').eval()<CR>",
|
||||
mode = "n",
|
||||
desc = "Evaluate",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>du",
|
||||
"<cmd>lua require('dapui').scopes()<CR>",
|
||||
mode = "n",
|
||||
desc = "Scopes",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dv",
|
||||
"<cmd>lua require('dapui').variables()<CR>",
|
||||
mode = "n",
|
||||
desc = "Variables",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dw",
|
||||
"<cmd>lua require('dapui').watches()<CR>",
|
||||
mode = "n",
|
||||
desc = "Watches",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>de",
|
||||
"<cmd>lua require('dapui').set_exception_breakpoints()<CR>",
|
||||
mode = "n",
|
||||
desc = "Exception Breakpoints",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>di",
|
||||
"<cmd>lua require('dapui').pick_one()<CR>",
|
||||
mode = "n",
|
||||
desc = "Pick One",
|
||||
},
|
||||
|
||||
{ -- NOTE: Log Points are not persistent right now.
|
||||
"<leader>dj",
|
||||
function()
|
||||
require("dap").toggle_breakpoint(vim.fn.input "Log: ")
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Set Log Point",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dx",
|
||||
function()
|
||||
-- require("persistent-breakpoints.api").clear_all_breakpoints()
|
||||
require("dap").clear_breakpoints()
|
||||
utils.store_breakpoints(true)
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Clear Breakpoints",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>dg",
|
||||
function()
|
||||
require("dap").list_breakpoints(0)
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Set REPL Highlight",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
283
lua/custom/configs/octo.lua
Normal file
283
lua/custom/configs/octo.lua
Normal file
|
@ -0,0 +1,283 @@
|
|||
local M = {}
|
||||
|
||||
M.dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
}
|
||||
|
||||
M.cmd = {
|
||||
"Octo",
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
|
||||
--[[
|
||||
gh -> github
|
||||
ghl -> label
|
||||
-- gha -> actions
|
||||
gho -> assignee
|
||||
ghc -> card
|
||||
ghi -> issue
|
||||
ghj -> comment
|
||||
-- gho -> reviewer
|
||||
ghp -> pr
|
||||
ghp -> repo
|
||||
ghr -> review
|
||||
ghs -> search
|
||||
ght -> thread
|
||||
ghu -> react
|
||||
-- ghg -> Gist
|
||||
--]]
|
||||
|
||||
-- stylua: ignore start
|
||||
-- Gist
|
||||
{"<leader>ghg", "<cmd> Octo gist list<CR>", mode = "n", desc = "List Gists" },
|
||||
|
||||
-- Actions (list)
|
||||
{"<leader>gha", "<cmd> Octo actions<CR>", mode = "n", desc = "List Actions" },
|
||||
|
||||
-- Repo
|
||||
{"<leader>ghpl", "<cmd> Octo repo list<CR>", mode = "n", desc = "List Repo" },
|
||||
{"<leader>ghpf", "<cmd> Octo repo fork<CR>", mode = "n", desc = "Fork Repo" },
|
||||
{"<leader>ghpu", "<cmd> Octo repo url<CR>", mode = "n", desc = "Url Repo" },
|
||||
{"<leader>ghpv", "<cmd> Octo repo view<CR>", mode = "n", desc = "View Repo" },
|
||||
{"<leader>ghpb", "<cmd> Octo repo browser<CR>", mode = "n", desc = "Browser Repo" },
|
||||
|
||||
-- React
|
||||
{"<leader>ghuh", "<cmd> Octo reaction heart<CR>", mode = "n", desc = "React with heart" },
|
||||
{"<leader>ghur", "<cmd> Octo reaction rocket<CR>", mode = "n", desc = "React with rocket" },
|
||||
{"<leader>ghut", "<cmd> Octo reaction tada<CR>", mode = "n", desc = "React with tada" },
|
||||
{"<leader>ghup", "<cmd> Octo reaction party<CR>", mode = "n", desc = "React with party" },
|
||||
{"<leader>ghuo", "<cmd> Octo reaction hooray<CR>", mode = "n", desc = "React with hooray" },
|
||||
{"<leader>ghuc", "<cmd> Octo reaction confused<CR>", mode = "n", desc = "React with confused" },
|
||||
{"<leader>ghul", "<cmd> Octo reaction laugh<CR>", mode = "n", desc = "React with laugh" },
|
||||
{"<leader>ghue", "<cmd> Octo reaction eyes<CR>", mode = "n", desc = "React with eyes" },
|
||||
{"<leader>ghum", "<cmd> Octo reaction -1<CR>", mode = "n", desc = "Upvote" },
|
||||
{"<leader>ghup", "<cmd> Octo reaction +1<CR>", mode = "n", desc = "Downvote" },
|
||||
{"<leader>ghud", "<cmd> Octo reaction thumbs_down<CR>", mode = "n", desc = "React with thumbs_down" },
|
||||
{"<leader>ghuu", "<cmd> Octo reaction thumbs_up<CR>", mode = "n", desc = "React with thumbs_up" },
|
||||
|
||||
-- Comment
|
||||
{"<leader>ghja", "<cmd> Octo comment add<CR>", mode = "n", desc = "Add Comment" },
|
||||
{"<leader>ghjd", "<cmd> Octo comment delete<CR>", mode = "n", desc = "Delete Comment" },
|
||||
|
||||
-- Card
|
||||
{"<leader>ghcm", "<cmd> Octo card move<CR>", mode = "n", desc = "Move Card" },
|
||||
{"<leader>ghcr", "<cmd> Octo card remove<CR>", mode = "n", desc = "Remove Card" },
|
||||
{"<leader>ghca", "<cmd> Octo card add<CR>", mode = "n", desc = "Add Card" },
|
||||
|
||||
-- Review
|
||||
{"<leader>ghrc", "<cmd> Octo review close<CR>", mode = "n", desc = "Close Review" },
|
||||
{"<leader>ghrs", "<cmd> Octo review start<CR>", mode = "n", desc = "Start Review" },
|
||||
{"<leader>ghrd", "<cmd> Octo review discard<CR>", mode = "n", desc = "Discard Review" },
|
||||
{"<leader>ghrr", "<cmd> Octo review resume<CR>", mode = "n", desc = "Resume Review" },
|
||||
{"<leader>ghrs", "<cmd> Octo review submit<CR>", mode = "n", desc = "Submit Review" },
|
||||
{"<leader>ghrc", "<cmd> Octo review commit<CR>", mode = "n", desc = "Commit Review" },
|
||||
{"<leader>ghra", "<cmd> Octo review comments<CR>", mode = "n", desc = "comments Review" },
|
||||
|
||||
-- Thread
|
||||
{"<leader>ght", "<cmd> Octo thread resolve<CR>", mode = "n", desc = "Resolve Thread" },
|
||||
{"<leader>ght", "<cmd> Octo thread unresolve<CR>", mode = "n", desc = "Unresolve Thread" },
|
||||
|
||||
-- PR
|
||||
{"<leader>ghnu", "<cmd> Octo pr url<CR>", mode = "n", desc = "PR Url" },
|
||||
{"<leader>ghne", "<cmd> Octo pr edit<CR>", mode = "n", desc = "Edit PR" },
|
||||
{"<leader>ghnr", "<cmd> Octo pr reopen<CR>", mode = "n", desc = "Reopen PR " },
|
||||
{"<leader>ghns", "<cmd> Octo pr search<CR>", mode = "n", desc = "Search PR" },
|
||||
{"<leader>ghnc", "<cmd> Octo pr commits<CR>", mode = "n", desc = "Check PR Commits" },
|
||||
{"<leader>ghnh", "<cmd> Octo pr checks<CR>", mode = "n", desc = "PR Checks" },
|
||||
{"<leader>ghnl", "<cmd> Octo pr reload<CR>", mode = "n", desc = "Reload PR" },
|
||||
{"<leader>ghnb", "<cmd> Octo pr browser<CR>", mode = "n", desc = "Open PR in Browser" },
|
||||
{"<leader>ghnm", "<cmd> Octo pr merge<CR>", mode = "n", desc = "Merge PR" },
|
||||
{"<leader>ghnn", "<cmd> Octo pr create<CR>", mode = "n", desc = "Create PR" },
|
||||
{"<leader>ghno", "<cmd> Octo pr checkout<CR>", mode = "n", desc = "Checkout PR" },
|
||||
{"<leader>ghnt", "<cmd> Octo pr close<CR>", mode = "n", desc = "Close PR" },
|
||||
{"<leader>ghnq", "<cmd> Octo pr list<CR>", mode = "n", desc = "List PR" },
|
||||
{"<leader>ghnd", "<cmd> Octo pr diff<CR>", mode = "n", desc = "PR Diff" },
|
||||
{"<leader>ghnz", "<cmd> Octo pr changes<CR>", mode = "n", desc = "PR Changes" },
|
||||
{"<leader>ghnp", "<cmd> Octo pr ready<CR>", mode = "n", desc = "Ready PR" },
|
||||
|
||||
-- Search
|
||||
{"<leader>ghs", "<cmd> Octo search<CR>", mode = "n", desc = "Search Github" },
|
||||
|
||||
-- Assignee
|
||||
{"<leader>ghoa", "<cmd> Octo assignee add<CR>", mode = "n", desc = "Add Assignee" },
|
||||
{"<leader>ghor", "<cmd> Octo assignee remove<CR>", mode = "n", desc = "Remove Assignee" },
|
||||
|
||||
-- Reviewer
|
||||
{"<leader>ghk", "<cmd> Octo reviewer add<CR>", mode = "n", desc = "Add Code Reviewer" },
|
||||
|
||||
-- Issue
|
||||
{"<leader>ghib", "<cmd> Octo issue browser<CR>", mode = "n", desc = "Issue Browser" },
|
||||
{"<leader>ghir", "<cmd> Octo issue reopen<CR>", mode = "n", desc = "Reopen Issue" },
|
||||
{"<leader>ghic", "<cmd> Octo issue create<CR>", mode = "n", desc = "Create Issue" },
|
||||
{"<leader>ghis", "<cmd> Octo issue search<CR>", mode = "n", desc = "Search Issue" },
|
||||
{"<leader>ghiu", "<cmd> Octo issue url<CR>", mode = "n", desc = "Url of Issue" },
|
||||
{"<leader>ghil", "<cmd> Octo issue list<CR>", mode = "n", desc = "List Issue" },
|
||||
{"<leader>ghie", "<cmd> Octo issue edit<CR>", mode = "n", desc = "Edit Issue" },
|
||||
{"<leader>ghix", "<cmd> Octo issue close<CR>", mode = "n", desc = "Close Issue" },
|
||||
{"<leader>ghid", "<cmd> Octo issue reload<CR>", mode = "n", desc = "Reload Issue" },
|
||||
|
||||
|
||||
-- Label
|
||||
{"<leader>ghlc", "<cmd> Octo label create<CR>", mode = "n", desc = "Create Label" },
|
||||
{"<leader>ghla", "<cmd> Octo label add<CR>", mode = "n", desc = "Add Label" },
|
||||
{"<leader>ghlr", "<cmd> Octo label remove<CR>", mode = "n", desc = "Remove Label" },
|
||||
|
||||
-- {"<leader>gh", "<cmd> Octo<CR>", mode = "n", desc = "Github" },
|
||||
|
||||
-- stylua: ignore end
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
use_local_fs = false, -- use local files on right side of reviews
|
||||
enable_builtin = false, -- shows a list of builtin actions when no action is provided
|
||||
default_remote = { "upstream", "origin" }, -- order to try remotes
|
||||
ssh_aliases = {}, -- SSH aliases. e.g. `ssh_aliases = {["github.com-work"] = "github.com"}`
|
||||
reaction_viewer_hint_icon = "", -- marker for user reactions
|
||||
user_icon = " ", -- user icon
|
||||
timeline_marker = "", -- timeline marker
|
||||
timeline_indent = "2", -- timeline indentation
|
||||
right_bubble_delimiter = "", -- bubble delimiter
|
||||
left_bubble_delimiter = "", -- bubble delimiter
|
||||
github_hostname = "", -- GitHub Enterprise host
|
||||
snippet_context_lines = 4, -- number or lines around commented lines
|
||||
gh_env = {}, -- extra environment variables to pass on to GitHub CLI, can be a table or function returning a table
|
||||
timeout = 5000, -- timeout for requests between the remote server
|
||||
ui = {
|
||||
use_signcolumn = true, -- show "modified" marks on the sign column
|
||||
},
|
||||
issues = {
|
||||
order_by = { -- criteria to sort results of `Octo issue list`
|
||||
field = "CREATED_AT", -- either COMMENTS, CREATED_AT or UPDATED_AT (https://docs.github.com/en/graphql/reference/enums#issueorderfield)
|
||||
direction = "DESC", -- either DESC or ASC (https://docs.github.com/en/graphql/reference/enums#orderdirection)
|
||||
},
|
||||
},
|
||||
pull_requests = {
|
||||
order_by = { -- criteria to sort the results of `Octo pr list`
|
||||
field = "CREATED_AT", -- either COMMENTS, CREATED_AT or UPDATED_AT (https://docs.github.com/en/graphql/reference/enums#issueorderfield)
|
||||
direction = "DESC", -- either DESC or ASC (https://docs.github.com/en/graphql/reference/enums#orderdirection)
|
||||
},
|
||||
always_select_remote_on_create = "false", -- always give prompt to select base remote repo when creating PRs
|
||||
},
|
||||
file_panel = {
|
||||
size = 10, -- changed files panel rows
|
||||
use_icons = true, -- use web-devicons in file panel (if false, nvim-web-devicons does not need to be installed)
|
||||
},
|
||||
mappings = {
|
||||
-- issue = {
|
||||
-- close_issue = { lhs = "<space>ic", desc = "close issue" },
|
||||
-- reopen_issue = { lhs = "<space>io", desc = "reopen issue" },
|
||||
-- list_issues = { lhs = "<space>il", desc = "list open issues on same repo" },
|
||||
-- reload = { lhs = "<C-r>", desc = "reload issue" },
|
||||
-- open_in_browser = { lhs = "<C-b>", desc = "open issue in browser" },
|
||||
-- copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
|
||||
-- add_assignee = { lhs = "<space>aa", desc = "add assignee" },
|
||||
-- remove_assignee = { lhs = "<space>ad", desc = "remove assignee" },
|
||||
-- create_label = { lhs = "<space>lc", desc = "create label" },
|
||||
-- add_label = { lhs = "<space>la", desc = "add label" },
|
||||
-- remove_label = { lhs = "<space>ld", desc = "remove label" },
|
||||
-- goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
|
||||
-- add_comment = { lhs = "<space>ca", desc = "add comment" },
|
||||
-- delete_comment = { lhs = "<space>cd", desc = "delete comment" },
|
||||
-- next_comment = { lhs = "]c", desc = "go to next comment" },
|
||||
-- prev_comment = { lhs = "[c", desc = "go to previous comment" },
|
||||
-- react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
|
||||
-- react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
|
||||
-- react_eyes = { lhs = "<space>re", desc = "add/remove 👀 reaction" },
|
||||
-- react_thumbs_up = { lhs = "<space>r+", desc = "add/remove 👍 reaction" },
|
||||
-- react_thumbs_down = { lhs = "<space>r-", desc = "add/remove 👎 reaction" },
|
||||
-- react_rocket = { lhs = "<space>rr", desc = "add/remove 🚀 reaction" },
|
||||
-- react_laugh = { lhs = "<space>rl", desc = "add/remove 😄 reaction" },
|
||||
-- react_confused = { lhs = "<space>rc", desc = "add/remove 😕 reaction" },
|
||||
-- },
|
||||
-- pull_request = {
|
||||
-- checkout_pr = { lhs = "<space>po", desc = "checkout PR" },
|
||||
-- merge_pr = { lhs = "<space>pm", desc = "merge commit PR" },
|
||||
-- squash_and_merge_pr = { lhs = "<space>psm", desc = "squash and merge PR" },
|
||||
-- list_commits = { lhs = "<space>pc", desc = "list PR commits" },
|
||||
-- list_changed_files = { lhs = "<space>pf", desc = "list PR changed files" },
|
||||
-- show_pr_diff = { lhs = "<space>pd", desc = "show PR diff" },
|
||||
-- add_reviewer = { lhs = "<space>va", desc = "add reviewer" },
|
||||
-- remove_reviewer = { lhs = "<space>vd", desc = "remove reviewer request" },
|
||||
-- close_issue = { lhs = "<space>ic", desc = "close PR" },
|
||||
-- reopen_issue = { lhs = "<space>io", desc = "reopen PR" },
|
||||
-- list_issues = { lhs = "<space>il", desc = "list open issues on same repo" },
|
||||
-- reload = { lhs = "<C-r>", desc = "reload PR" },
|
||||
-- open_in_browser = { lhs = "<C-b>", desc = "open PR in browser" },
|
||||
-- copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
|
||||
-- goto_file = { lhs = "gf", desc = "go to file" },
|
||||
-- add_assignee = { lhs = "<space>aa", desc = "add assignee" },
|
||||
-- remove_assignee = { lhs = "<space>ad", desc = "remove assignee" },
|
||||
-- create_label = { lhs = "<space>lc", desc = "create label" },
|
||||
-- add_label = { lhs = "<space>la", desc = "add label" },
|
||||
-- remove_label = { lhs = "<space>ld", desc = "remove label" },
|
||||
-- goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
|
||||
-- add_comment = { lhs = "<space>ca", desc = "add comment" },
|
||||
-- delete_comment = { lhs = "<space>cd", desc = "delete comment" },
|
||||
-- next_comment = { lhs = "]c", desc = "go to next comment" },
|
||||
-- prev_comment = { lhs = "[c", desc = "go to previous comment" },
|
||||
-- react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
|
||||
-- react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
|
||||
-- react_eyes = { lhs = "<space>re", desc = "add/remove 👀 reaction" },
|
||||
-- react_thumbs_up = { lhs = "<space>r+", desc = "add/remove 👍 reaction" },
|
||||
-- react_thumbs_down = { lhs = "<space>r-", desc = "add/remove 👎 reaction" },
|
||||
-- react_rocket = { lhs = "<space>rr", desc = "add/remove 🚀 reaction" },
|
||||
-- react_laugh = { lhs = "<space>rl", desc = "add/remove 😄 reaction" },
|
||||
-- react_confused = { lhs = "<space>rc", desc = "add/remove 😕 reaction" },
|
||||
-- },
|
||||
-- review_thread = {
|
||||
-- goto_issue = { lhs = "<space>gi", desc = "navigate to a local repo issue" },
|
||||
-- add_comment = { lhs = "<space>ca", desc = "add comment" },
|
||||
-- add_suggestion = { lhs = "<space>sa", desc = "add suggestion" },
|
||||
-- delete_comment = { lhs = "<space>cd", desc = "delete comment" },
|
||||
-- next_comment = { lhs = "]c", desc = "go to next comment" },
|
||||
-- prev_comment = { lhs = "[c", desc = "go to previous comment" },
|
||||
-- select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
|
||||
-- select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
|
||||
-- close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
-- react_hooray = { lhs = "<space>rp", desc = "add/remove 🎉 reaction" },
|
||||
-- react_heart = { lhs = "<space>rh", desc = "add/remove ❤️ reaction" },
|
||||
-- react_eyes = { lhs = "<space>re", desc = "add/remove 👀 reaction" },
|
||||
-- react_thumbs_up = { lhs = "<space>r+", desc = "add/remove 👍 reaction" },
|
||||
-- react_thumbs_down = { lhs = "<space>r-", desc = "add/remove 👎 reaction" },
|
||||
-- react_rocket = { lhs = "<space>rr", desc = "add/remove 🚀 reaction" },
|
||||
-- react_laugh = { lhs = "<space>rl", desc = "add/remove 😄 reaction" },
|
||||
-- react_confused = { lhs = "<space>rc", desc = "add/remove 😕 reaction" },
|
||||
-- },
|
||||
-- submit_win = {
|
||||
-- approve_review = { lhs = "<C-a>", desc = "approve review" },
|
||||
-- comment_review = { lhs = "<C-m>", desc = "comment review" },
|
||||
-- request_changes = { lhs = "<C-r>", desc = "request changes review" },
|
||||
-- close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
-- },
|
||||
-- review_diff = {
|
||||
-- add_review_comment = { lhs = "<space>ca", desc = "add a new review comment" },
|
||||
-- add_review_suggestion = { lhs = "<space>sa", desc = "add a new review suggestion" },
|
||||
-- focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
|
||||
-- toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
|
||||
-- next_thread = { lhs = "]t", desc = "move to next thread" },
|
||||
-- prev_thread = { lhs = "[t", desc = "move to previous thread" },
|
||||
-- select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
|
||||
-- select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
|
||||
-- close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
-- toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
|
||||
-- goto_file = { lhs = "gf", desc = "go to file" },
|
||||
-- },
|
||||
-- file_panel = {
|
||||
-- next_entry = { lhs = "j", desc = "move to next changed file" },
|
||||
-- prev_entry = { lhs = "k", desc = "move to previous changed file" },
|
||||
-- select_entry = { lhs = "<cr>", desc = "show selected changed file diffs" },
|
||||
-- refresh_files = { lhs = "R", desc = "refresh changed files panel" },
|
||||
-- focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
|
||||
-- toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
|
||||
-- select_next_entry = { lhs = "]q", desc = "move to previous changed file" },
|
||||
-- select_prev_entry = { lhs = "[q", desc = "move to next changed file" },
|
||||
-- close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
|
||||
-- toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
73
lua/custom/configs/overrides.lua
Normal file
73
lua/custom/configs/overrides.lua
Normal file
|
@ -0,0 +1,73 @@
|
|||
local M = {}
|
||||
|
||||
M.treesitter = {
|
||||
ensure_installed = {
|
||||
"vim",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"c",
|
||||
"rust",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
-- disable = {
|
||||
-- "python"
|
||||
-- },
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
install_root_dir = os.getenv "HOME" .. "/.local/share/nvim/mason/bin",
|
||||
ensure_installed = {
|
||||
-- lua stuff
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev stuff
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"typescript-language-server",
|
||||
"deno",
|
||||
"prettier",
|
||||
|
||||
-- c/cpp stuff
|
||||
"clangd",
|
||||
"clang-format",
|
||||
|
||||
-- Rust stuff
|
||||
"rust-analyzer",
|
||||
|
||||
-- Shell stuff
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
|
||||
-- Python
|
||||
-- TODO: Remove mason-dap-install plugin and use the default
|
||||
"black",
|
||||
"debugpy",
|
||||
},
|
||||
}
|
||||
|
||||
-- git support in nvimtree
|
||||
M.nvimtree = {
|
||||
git = {
|
||||
enable = true,
|
||||
},
|
||||
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
icons = {
|
||||
show = {
|
||||
git = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
167
lua/custom/configs/perfanno.lua
Normal file
167
lua/custom/configs/perfanno.lua
Normal file
|
@ -0,0 +1,167 @@
|
|||
local M = {}
|
||||
|
||||
M.keys = { -- TODO: p -> Profiling | pl -> Load
|
||||
{
|
||||
"<leader>plf",
|
||||
":PerfLoadFlat<CR>",
|
||||
mode = "n",
|
||||
desc = "Load perf.data",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>plg",
|
||||
":PerfLoadCallGraph<CR>",
|
||||
mode = "n",
|
||||
desc = "Load Full Call Graph",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>plo",
|
||||
":PerfLoadFlameGraph<CR>",
|
||||
mode = "n",
|
||||
desc = "Load perf.log",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pe",
|
||||
":PerfPickEvent<CR>", -- switch between cpu cycles, branch mispredictions, and cache misses
|
||||
mode = "n",
|
||||
desc = "Cycle Profile Mode",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pi",
|
||||
":PerfCycleFormat<CR>", -- toggle percentage & absolute counts ( configurable! )
|
||||
mode = "n",
|
||||
desc = "Cycle Count Mode",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pa",
|
||||
":PerfAnnotate<CR>",
|
||||
mode = "n",
|
||||
desc = "Annotate All Buffers",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pf",
|
||||
":PerfAnnotateFunction<CR>",
|
||||
mode = "n",
|
||||
desc = "Annotate Function",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pa",
|
||||
":PerfAnnotateSelection<CR>",
|
||||
mode = "v",
|
||||
desc = "Anotate Selection",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pt",
|
||||
":PerfToggleAnnotations<CR>",
|
||||
mode = "n",
|
||||
desc = "Toggle All Buffers Annotations",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>ph",
|
||||
":PerfHottestLines<CR>",
|
||||
mode = "n",
|
||||
desc = "Hottest Lines",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>ps",
|
||||
":PerfHottestSymbols<CR>",
|
||||
mode = "n",
|
||||
desc = "Hottest Symbols",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pc",
|
||||
":PerfHottestCallersFunction<CR>",
|
||||
mode = "n",
|
||||
desc = "Hottest Symbols from Selection",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pc",
|
||||
":PerfHottestCallersSelection<CR>",
|
||||
mode = "v",
|
||||
desc = "Hottest Lines from Selection",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pn",
|
||||
"<cmd> PerfLuaProfileStart<CR>",
|
||||
mode = "n",
|
||||
desc = "Start Profiling Lua",
|
||||
},
|
||||
|
||||
{
|
||||
"<LEADER>pk",
|
||||
"<cmd> PerfLuaProfileStop<CR>",
|
||||
mode = "n",
|
||||
desc = "Stop Profiling Lua",
|
||||
},
|
||||
|
||||
--[[
|
||||
:PerfCacheSave <name> saves the currently loaded callgraph in the cache under the given name.
|
||||
:PerfCacheLoad <name> loads the callgraph in the cache of the given name. Automatically annotates all buffers if annotate_after_load is set. If an empty name is supplied, the most recently cached callgraph is loaded.
|
||||
:PerfCacheDelete <name> deletes the callgraph in the cache of the given name.
|
||||
]]
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
-- List of highlights that will be used to highlight hot lines (or nil to disable highlighting)
|
||||
-- line_highlights = require("perfanno.util").make_bg_highlights(bgcolor, "#CC3300", 10),
|
||||
-- Highlight used for virtual text annotations (or nil to disable virtual text)
|
||||
-- vt_highlight = require("perfanno.util").make_fg_highlight("#CC3300"),
|
||||
|
||||
-- Annotation formats that can be cycled between via :PerfCycleFormat
|
||||
-- "percent" controls whether percentages or absolute counts should be displayed
|
||||
-- "format" is the format string that will be used to display counts / percentages
|
||||
-- "minimum" is the minimum value below which lines will not be annotated
|
||||
-- Note: this also controls what shows up in the telescope finders
|
||||
formats = {
|
||||
{
|
||||
percent = true,
|
||||
format = "%.2f%%",
|
||||
minimum = 0.5,
|
||||
},
|
||||
{
|
||||
percent = false,
|
||||
format = "%d",
|
||||
minimum = 1,
|
||||
},
|
||||
},
|
||||
|
||||
-- Automatically annotate files after :PerfLoadFlat and :PerfLoadCallGraph
|
||||
annotate_after_load = true,
|
||||
-- Automatically annotate newly opened buffers if information is available
|
||||
annotate_on_open = true,
|
||||
|
||||
-- Options for telescope-based hottest line finders
|
||||
telescope = {
|
||||
-- Enable if possible, otherwise the plugin will fall back to vim.ui.select
|
||||
enabled = pcall(require, "telescope"),
|
||||
-- Annotate inside of the preview window
|
||||
annotate = true,
|
||||
},
|
||||
|
||||
-- Node type patterns used to find the function that surrounds the cursor
|
||||
ts_function_patterns = {
|
||||
-- These should work for most languages (at least those used with perf)
|
||||
default = {
|
||||
"function",
|
||||
"method",
|
||||
},
|
||||
-- Otherwise you can add patterns for specific languages like:
|
||||
-- weirdlang = {
|
||||
-- "weirdfunc",
|
||||
-- }
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
37
lua/custom/configs/refactoring.lua
Normal file
37
lua/custom/configs/refactoring.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
local M = {}
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>cr",
|
||||
function()
|
||||
require("refactoring").select_refactor()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "List Refactorings",
|
||||
},
|
||||
-- { -- Unneded when dressing.nvim is a thing
|
||||
-- "<leader>ct",
|
||||
-- function()
|
||||
-- require("telescope").extensions.refactoring.refactors()
|
||||
-- end,
|
||||
-- mode = { "n", "v" },
|
||||
-- desc = "Telescope Refactorings",
|
||||
-- },
|
||||
{ "<leader>ce", ":Refactor extract<CR>", mode = "n", desc = "Extract To Function" },
|
||||
{ "<leader>cv", ":Refactor extract_var<CR>", mode = "n", desc = "Extract To Variable" },
|
||||
{ "<leader>cb", ":Refactor extract_block<CR>", mode = "n", desc = "Extract To Block" },
|
||||
{ "<leader>cg", ":Refactor extract_block_to_file<CR>", mode = "n", desc = "Extract Block To File" },
|
||||
{ "<leader>cn", ":Refactor refactor_names<CR>", mode = "n", desc = "Refactor names" },
|
||||
{ "<leader>cf", ":Refactor extract_to_file<CR>", mode = "n", desc = "Extract to file" },
|
||||
{ "<leader>ci", ":Refactor inline_var<CR>", mode = "n", desc = "Inline Variable" },
|
||||
|
||||
{ "<leader>ce", ":Refactor extract<CR>", mode = "v", desc = "Extract To Function" },
|
||||
{ "<leader>cv", ":Refactor extract_var<CR>", mode = "v", desc = "Extract To Variable" },
|
||||
{ "<leader>cb", ":Refactor extract_block<CR>", mode = "v", desc = "Extract To Block" },
|
||||
{ "<leader>cg", ":Refactor extract_block_to_file<CR>", mode = "v", desc = "Extract Block To File" },
|
||||
{ "<leader>cn", ":Refactor refactor_names<CR>", mode = "v", desc = "Refactor names" },
|
||||
{ "<leader>cf", ":Refactor extract_to_file<CR>", mode = "v", desc = "Extract to file" },
|
||||
{ "<leader>ci", ":Refactor inline_var<CR>", mode = "v", desc = "Inline Variable" },
|
||||
}
|
||||
|
||||
return M
|
182
lua/custom/configs/rust.lua
Normal file
182
lua/custom/configs/rust.lua
Normal file
|
@ -0,0 +1,182 @@
|
|||
local M = {}
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>cxt",
|
||||
function()
|
||||
require("crates").toggle()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Toggle UI elements",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxr",
|
||||
function()
|
||||
require("crates").reload()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Reload",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxv",
|
||||
function()
|
||||
require("crates").show_versions_popup()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Show Version",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxf",
|
||||
function()
|
||||
require("crates").show_features_popup()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Show Feature",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxd",
|
||||
function()
|
||||
require("crates").show_dependencies_popup()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Show Dependencies",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxu",
|
||||
function()
|
||||
require("crates").update_crate()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Update Crate",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxu",
|
||||
function()
|
||||
require("crates").update_crates()
|
||||
end,
|
||||
mode = "v",
|
||||
desc = "Update Selected Crates",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxa",
|
||||
function()
|
||||
require("crates").update_all_crates()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Update All Crates",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxU",
|
||||
function()
|
||||
require("crates").upgrade_crate()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Upgrade Crate",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxU",
|
||||
function()
|
||||
require("crates").upgrade_crates()
|
||||
end,
|
||||
mode = "v",
|
||||
desc = "Upgrade Selected Crates",
|
||||
},
|
||||
{
|
||||
"<leader>cxA",
|
||||
function()
|
||||
require("crates").upgrade_all_crates()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Upgrade All Crates",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxe",
|
||||
function()
|
||||
require("crates").expand_plain_crate_to_inline_table()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Inline Crate to Table",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxE",
|
||||
function()
|
||||
require("crates").extract_crate_into_table()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Extract Crate to table",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxH",
|
||||
function()
|
||||
require("crates").open_homepage()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Open Crate Home Page",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxR",
|
||||
function()
|
||||
require("crates").open_repository()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Open Crate Repository",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxD",
|
||||
function()
|
||||
require("crates").open_documentation()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Open Crate Documentation",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxC",
|
||||
function()
|
||||
require("crates").open_crates_io()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Open Crate on crates.io",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>cxK",
|
||||
function()
|
||||
local filetype = vim.bo.filetype
|
||||
if vim.tbl_contains({ "vim", "help" }, filetype) then
|
||||
vim.cmd("h " .. vim.fn.expand "<cword>")
|
||||
elseif vim.tbl_contains({ "man" }, filetype) then
|
||||
vim.cmd("Man " .. vim.fn.expand "<cword>")
|
||||
elseif vim.fn.expand "%:t" == "Cargo.toml" and require("crates").popup_available() then
|
||||
require("crates").show_popup()
|
||||
else
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Open Crate Documentation in a PopUp",
|
||||
},
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
null_ls = {
|
||||
enabled = true,
|
||||
name = "crates.nvim",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
123
lua/custom/configs/sg.lua
Normal file
123
lua/custom/configs/sg.lua
Normal file
|
@ -0,0 +1,123 @@
|
|||
local M = {}
|
||||
M.opts = {
|
||||
-- ... other configuration options ...
|
||||
|
||||
-- Disable LSP suggestions
|
||||
on_attach = function(client)
|
||||
local buffer_name = vim.fn.expand "%:t"
|
||||
if buffer_name ~= "COMMIT_EDITMSG" then
|
||||
if client.supports_method "textDocument/formatting" then
|
||||
vim.api.nvim_clear_autocmds { group = augroup, buffer = bufnr }
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { bufnr = bufnr }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
if client.resolved_capabilities.document_highlight then
|
||||
vim.api.nvim_exec(
|
||||
[[
|
||||
augroup lsp_document_highlight
|
||||
autocmd! * <buffer>
|
||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
||||
augroup END
|
||||
]],
|
||||
false
|
||||
)
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
|
||||
{
|
||||
"<leader>ai",
|
||||
":CodyChat<CR>",
|
||||
mode = "n",
|
||||
desc = "AI Assistant",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>ad",
|
||||
function()
|
||||
local line = vim.fn.getline "."
|
||||
local start = vim.fn.col "."
|
||||
local finish = vim.fn.col "$"
|
||||
local text = line:sub(start, finish)
|
||||
vim.fn.setreg('"', text)
|
||||
vim.cmd [[CodyTask 'Write document for current context']]
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Generate Document with AI",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>ac",
|
||||
':CodyTask ""<Left>',
|
||||
mode = "n",
|
||||
desc = "Let AI Write Code",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>aa",
|
||||
":CodyTaskAccept<CR>",
|
||||
mode = "n",
|
||||
desc = "Confirm AI work",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>as",
|
||||
"<cmd> lua require('sg.extensions.telescope').fuzzy_search_results()<CR>",
|
||||
mode = "n",
|
||||
desc = "AI Search",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>ai",
|
||||
"y:CodyChat<CR><ESC>pG$a<CR>",
|
||||
mode = "v",
|
||||
desc = "Chat Selected Code",
|
||||
},
|
||||
|
||||
-- {
|
||||
-- "<leader>ad",
|
||||
-- "{:CodyTask 'Write document for current context<CR>'",
|
||||
-- mode = "n",
|
||||
-- desc = "Generate Document with AI",
|
||||
-- },
|
||||
|
||||
{
|
||||
"<leader>ar",
|
||||
"y:CodyChat<CR>refactor following code:<CR><ESC>p<CR>",
|
||||
mode = "v",
|
||||
desc = "Request Refactoring",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>ae",
|
||||
"y:CodyChat<CR>explain following code:<CR><ESC>p<CR>",
|
||||
mode = "v",
|
||||
desc = "Request Explanation",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>af",
|
||||
"y:CodyChat<CR>find potential vulnerabilities from following code:<CR><ESC>p<CR>",
|
||||
mode = "v",
|
||||
desc = "Request Potential Vulnerabilities",
|
||||
},
|
||||
|
||||
{
|
||||
"<leader>at",
|
||||
"y:CodyChat<CR>rewrite following code more idiomatically:<CR><ESC>p<CR>",
|
||||
mode = "v",
|
||||
desc = "Request Idiomatic Rewrite",
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
141
lua/custom/configs/sniprun.lua
Normal file
141
lua/custom/configs/sniprun.lua
Normal file
|
@ -0,0 +1,141 @@
|
|||
local M = {}
|
||||
|
||||
-- lua require’sniprun’.run()
|
||||
-- lua require’sniprun’.run(‘n’)
|
||||
-- lua require’sniprun’.run(‘v’)
|
||||
-- lua require’sniprun’.info()
|
||||
-- lua require’sniprun’.reset()
|
||||
-- lua require’sniprun’.clear_repl()
|
||||
-- lua require’sniprun.display’.close_all()
|
||||
-- lua require’sniprun.live_mode’.toggle()
|
||||
-- lua require’sniprun.api’.run_range(..)
|
||||
-- lua require’sniprun.api’.run_string(..)
|
||||
|
||||
M.keys = {
|
||||
-- {
|
||||
-- "<leader>sr",
|
||||
-- function()
|
||||
-- require("sniprun").run "n"
|
||||
-- end,
|
||||
-- mode = "n",
|
||||
-- desc = "Sniprun",
|
||||
-- },
|
||||
{
|
||||
"<leader>ir",
|
||||
"<cmd> SnipRun<CR>",
|
||||
mode = { "n", "v" },
|
||||
desc = "Run Snippet",
|
||||
},
|
||||
{
|
||||
"<leader>ii",
|
||||
function()
|
||||
require("sniprun").info()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Info",
|
||||
},
|
||||
{
|
||||
"<leader>ie",
|
||||
function()
|
||||
require("sniprun").reset()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Reset",
|
||||
},
|
||||
{
|
||||
"<leader>ic",
|
||||
function()
|
||||
require("sniprun").clear_rlepl()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Clear REPL",
|
||||
},
|
||||
{
|
||||
"<leader>ix",
|
||||
function()
|
||||
require("sniprun.display").close_all()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Close All",
|
||||
},
|
||||
{
|
||||
"<leader>il",
|
||||
function()
|
||||
require("sniprun.live_mode").toggle()
|
||||
end,
|
||||
mode = "n",
|
||||
desc = "Toggle Live Mode",
|
||||
},
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
selected_interpreters = {}, --# use those instead of the default for the current filetype
|
||||
repl_enable = {}, --# enable REPL-like behavior for the given interpreters
|
||||
repl_disable = {}, --# disable REPL-like behavior for the given interpreters
|
||||
|
||||
interpreter_options = { --# interpreter-specific options, see doc / :SnipInfo <name>
|
||||
|
||||
--# use the interpreter name as key
|
||||
GFM_original = {
|
||||
use_on_filetypes = { "markdown.pandoc" }, --# the 'use_on_filetypes' configuration key is
|
||||
--# available for every interpreter
|
||||
},
|
||||
Python3_original = {
|
||||
error_truncate = "auto", --# Truncate runtime errors 'long', 'short' or 'auto'
|
||||
--# the hint is available for every interpreter
|
||||
--# but may not be always respected
|
||||
},
|
||||
},
|
||||
|
||||
--# you can combo different display modes as desired and with the 'Ok' or 'Err' suffix
|
||||
--# to filter only sucessful runs (or errored-out runs respectively)
|
||||
display = {
|
||||
"Classic", --# display results in the command-line area
|
||||
"VirtualTextOk", --# display ok results as virtual text (multiline is shortened)
|
||||
|
||||
-- "VirtualText", --# display results as virtual text
|
||||
-- "TempFloatingWindow", --# display results in a floating window
|
||||
-- "LongTempFloatingWindow", --# same as above, but only long results. To use with VirtualText[Ok/Err]
|
||||
-- "Terminal", --# display results in a vertical split
|
||||
-- "TerminalWithCode", --# display results and code history in a vertical split
|
||||
-- "NvimNotify", --# display with the nvim-notify plugin
|
||||
-- "Api" --# return output to a programming interface
|
||||
},
|
||||
|
||||
live_display = { "VirtualTextOk" }, --# display mode used in live_mode
|
||||
|
||||
display_options = {
|
||||
terminal_scrollback = vim.o.scrollback, --# change terminal display scrollback lines
|
||||
terminal_line_number = false, --# whether show line number in terminal window
|
||||
terminal_signcolumn = false, --# whether show signcolumn in terminal window
|
||||
terminal_persistence = true, --# always keep the terminal open (true) or close it at every occasion (false)
|
||||
terminal_width = 45, --# change the terminal display option width
|
||||
notification_timeout = 5, --# timeout for nvim_notify output
|
||||
},
|
||||
|
||||
--# You can use the same keys to customize whether a sniprun producing
|
||||
--# no output should display nothing or '(no output)'
|
||||
show_no_output = {
|
||||
"Classic",
|
||||
"TempFloatingWindow", --# implies LongTempFloatingWindow, which has no effect on its own
|
||||
},
|
||||
|
||||
--# customize highlight groups (setting this overrides colorscheme)
|
||||
snipruncolors = { -- TODO: add hlgroups
|
||||
SniprunVirtualTextOk = { bg = "#66eeff", fg = "#000000", ctermbg = "Cyan", cterfg = "Black" },
|
||||
SniprunFloatingWinOk = { fg = "#66eeff", ctermfg = "Cyan" },
|
||||
SniprunVirtualTextErr = { bg = "#881515", fg = "#000000", ctermbg = "DarkRed", cterfg = "Black" },
|
||||
SniprunFloatingWinErr = { fg = "#881515", ctermfg = "DarkRed" },
|
||||
},
|
||||
|
||||
live_mode_toggle = "off", --# live mode toggle, see Usage - Running for more info
|
||||
|
||||
--# miscellaneous compatibility/adjustement settings
|
||||
inline_messages = false, --# boolean toggle for a one-line way to display messages
|
||||
--# to workaround sniprun not being able to display anything
|
||||
|
||||
borders = "single", --# display borders around floating windows
|
||||
--# possible values are 'none', 'single', 'double', or 'shadow'
|
||||
}
|
||||
|
||||
return M
|
44
lua/custom/configs/sudoku.lua
Normal file
44
lua/custom/configs/sudoku.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
local M = {}
|
||||
|
||||
M.opts = {
|
||||
persist_settings = true, -- safe the settings under vim.fn.stdpath("data"), usually ~/.local/share/nvim,
|
||||
persist_games = true, -- persist a history of all played games
|
||||
default_mappings = true, -- if set to false you need to set your own, like the following:
|
||||
mappings = {
|
||||
{ key = "x", action = "clear_cell" },
|
||||
{ key = "r1", action = "insert=1" },
|
||||
{ key = "r2", action = "insert=2" },
|
||||
{ key = "r3", action = "insert=3" },
|
||||
-- ...
|
||||
{ key = "r9", action = "insert=9" },
|
||||
{ key = "gn", action = "new_game" },
|
||||
{ key = "gr", action = "reset_game" },
|
||||
{ key = "gs", action = "view=settings" },
|
||||
{ key = "gt", action = "view=tip" },
|
||||
{ key = "gz", action = "view=zen" },
|
||||
{ key = "gh", action = "view=help" },
|
||||
{ key = "u", action = "undo" },
|
||||
{ key = "<C-r>", action = "redo" },
|
||||
{ key = "+", action = "increment" },
|
||||
{ key = "-", action = "decrement" },
|
||||
},
|
||||
custom_highlights = {
|
||||
board = { fg = "#7d7d7d" },
|
||||
number = { fg = "white", bg = "black" },
|
||||
active_menu = { fg = "white", bg = "black", gui = "bold" },
|
||||
hint_cell = { fg = "white", bg = "yellow" },
|
||||
square = { bg = "#292b35", fg = "white" },
|
||||
column = { bg = "#14151a", fg = "#d5d5d5" },
|
||||
row = { bg = "#14151a", fg = "#d5d5d5" },
|
||||
settings_disabled = { fg = "#8e8e8e", gui = "italic" },
|
||||
same_number = { fg = "white", gui = "bold" },
|
||||
set_number = { fg = "white", gui = "italic" },
|
||||
error = { fg = "white", bg = "#843434" },
|
||||
},
|
||||
}
|
||||
|
||||
M.keys = {
|
||||
{ "<leader>vs", "<cmd> Sudoku<CR>", mode = "n", desc = "Play Sudoku" },
|
||||
}
|
||||
|
||||
return M
|
116
lua/custom/configs/ts.lua
Normal file
116
lua/custom/configs/ts.lua
Normal file
|
@ -0,0 +1,116 @@
|
|||
local M = {}
|
||||
|
||||
--- Debug Node
|
||||
---@param node TSNode
|
||||
local function D(node)
|
||||
print(vim.inspect(getmetatable(node)))
|
||||
end
|
||||
|
||||
--- Node to String
|
||||
---@param node TSNode
|
||||
---@return string
|
||||
local function S(node)
|
||||
return require("ts-node-action.helpers").node_text(node)
|
||||
end
|
||||
|
||||
--- Prints the node
|
||||
---@param node node TSNode
|
||||
local function print_node(node)
|
||||
vim.print(S(node))
|
||||
end
|
||||
|
||||
local function CCat(text_buf)
|
||||
-- if type is table:
|
||||
if type(text_buf) == "table" then
|
||||
return table.concat(text_buf, "\n")
|
||||
end
|
||||
return text_buf
|
||||
end
|
||||
|
||||
-- fn abc = -> { blah blah } <-
|
||||
---@param node TSNode
|
||||
---@return string
|
||||
local function till_first_brace(node)
|
||||
local text = CCat(S(node))
|
||||
local first_brace = string.find(text, "{")
|
||||
local till_curly = string.sub(text, 1, first_brace - 1)
|
||||
local trimmed = string.gsub(till_curly, "%s*$", "")
|
||||
return trimmed
|
||||
end
|
||||
|
||||
local function cpp_extract_block(node)
|
||||
local node_type_parent = "function_definition"
|
||||
-- If we are on a type of a function, we need to go up one level
|
||||
-- recurse
|
||||
local type = S(node)
|
||||
vim.print(type)
|
||||
while node:type() ~= node_type_parent do
|
||||
-- NOTE: node is not a function
|
||||
node = node:parent()
|
||||
if node == nil then
|
||||
vim.print("No parent function found")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if node:type() == node_type_parent then
|
||||
local replacement = {}
|
||||
|
||||
table.insert(replacement, till_first_brace(node) .. ";")
|
||||
-- a table line represents a \n
|
||||
table.insert(replacement, type)
|
||||
return replacement
|
||||
end
|
||||
local signature = till_first_brace(node)
|
||||
return signature .. ";"
|
||||
end
|
||||
|
||||
local function rust_extract_braced(node)
|
||||
D(node)
|
||||
local signature = till_first_brace(node)
|
||||
return signature .. ";"
|
||||
end
|
||||
|
||||
-- TODO: Add ts-node-action.actions to actions
|
||||
M.lang = {}
|
||||
M.lang.rust = function()
|
||||
return {
|
||||
["block"] = { { rust_extract_braced, name = "Extract" } },
|
||||
["function_item"] = { { rust_extract_braced, name = "Extract Function" } },
|
||||
}
|
||||
end
|
||||
|
||||
M.lang.cpp = function()
|
||||
return {
|
||||
["compound_statement"] = { { cpp_extract_block, name = "Extract" } },
|
||||
["function_definition"] = { { cpp_extract_block, name = "Extract Function" } },
|
||||
["type_identifier"] = { { cpp_extract_block, name = "Extract Function" } },
|
||||
["primitive_type"] = { { cpp_extract_block, name = "Extract Function" } },
|
||||
["auto"] = { { cpp_extract_block, name = "Extract Function" } },
|
||||
["namespace_identifier"] = { { cpp_extract_block, name = "Extract Function" } },
|
||||
}
|
||||
end
|
||||
|
||||
M.opts = {
|
||||
|
||||
cpp = M.lang.cpp(),
|
||||
rust = M.lang.rust(),
|
||||
|
||||
-- ["*"] = { -- Global table is checked for all langs
|
||||
-- ["node_type"] = fn,
|
||||
-- ...,
|
||||
-- },
|
||||
-- lang = {
|
||||
-- ["node_type"] = fn,
|
||||
-- ...,
|
||||
-- },
|
||||
-- ...,
|
||||
}
|
||||
|
||||
-- NOTE: To Debug the tsnode:
|
||||
-- print(vim.inspect(getmetatable(node)))
|
||||
|
||||
-- NOTE: To Debug the text:
|
||||
-- vim.print(text)
|
||||
|
||||
return M
|
104
lua/custom/configs/ufo.lua
Normal file
104
lua/custom/configs/ufo.lua
Normal file
|
@ -0,0 +1,104 @@
|
|||
-- https://github.com/kevinhwang91/nvim-ufo
|
||||
|
||||
local M = {}
|
||||
|
||||
M.keys = {
|
||||
{
|
||||
"<leader>mu",
|
||||
mode = "n",
|
||||
desc = "UFO Mode",
|
||||
},
|
||||
}
|
||||
|
||||
M.dependencies = {
|
||||
{ "kevinhwang91/promise-async" },
|
||||
{ -- Folds
|
||||
"yaocccc/nvim-foldsign",
|
||||
|
||||
-- event = "CursorHold",
|
||||
|
||||
config = function(_, opts)
|
||||
require("nvim-foldsign").setup(opts)
|
||||
end,
|
||||
|
||||
opts = {
|
||||
offset = -3,
|
||||
foldsigns = {
|
||||
open = "", -- mark the beginning of a fold
|
||||
close = "", -- ↪ show a closed fold
|
||||
seps = {
|
||||
"▏",
|
||||
"▎",
|
||||
"▍",
|
||||
"▌",
|
||||
"▋",
|
||||
"▊",
|
||||
"▉",
|
||||
"█",
|
||||
}, -- open fold middle marker -- TODO: ADD MORE
|
||||
-- List of all vertical unicode characters: https://en.wikipedia.org/wiki/Box-drawing_character
|
||||
-- "█", "▉", "▊", "▋", "▌", "▍", "▎", "▏",
|
||||
-- "│", "║", "┃", "▌", "█"
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.opts = {
|
||||
-- enable_get_fold_virt_text = true, -- More info on https://github.com/kevinhwang91/nvim-ufo#setup-and-description
|
||||
open_fold_hl_timeout = 150,
|
||||
-- close_fold_kinds = { "imports", "comment" },
|
||||
preview = {
|
||||
win_config = {
|
||||
border = { "", "─", "", "", "", "─", "", "" },
|
||||
winhighlight = "Normal:Folded",
|
||||
winblend = 0,
|
||||
},
|
||||
mappings = {
|
||||
scrollU = "<C-u>",
|
||||
scrollD = "<C-d>",
|
||||
jumpTop = "[",
|
||||
jumpBot = "]",
|
||||
},
|
||||
},
|
||||
|
||||
provider_selector = function(bufnr, filetype, buftype)
|
||||
local ft_options = {
|
||||
norg = "", -- Neorg had the same issue
|
||||
org = "", -- We "disable" ufo in org files by giving back an empty provider to UFO
|
||||
}
|
||||
return ft_options[filetype] or { "treesitter", "indent" }
|
||||
end,
|
||||
|
||||
fold_virt_text_handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
-- local suffix = (" %d "):format(endLnum - lnum)
|
||||
local suffix = (" %d "):format(endLnum - lnum) -- … ⤵ ⤴ ⤶ ⤷ ⤸ ⤹ ⤺ ⤻ ⤼ ⤽ ⤾ ⤿
|
||||
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end,
|
||||
}
|
||||
|
||||
return M
|
76
lua/custom/configs/which-key.lua
Normal file
76
lua/custom/configs/which-key.lua
Normal file
|
@ -0,0 +1,76 @@
|
|||
local M = {}
|
||||
|
||||
local wk = require "which-key"
|
||||
|
||||
M.prefixes = function()
|
||||
-- TODO: Rewise this frequently
|
||||
-- WhichKey prefixes:
|
||||
wk.register {
|
||||
["<leader>"] = {
|
||||
|
||||
-- stylua: ignore start
|
||||
[" "] = { name = " Quick" },
|
||||
a = { name = " AI" }, --
|
||||
b = { name = " Buffer" },
|
||||
c = { name = " Code" },
|
||||
cl = { name = " LeetCode" },
|
||||
cm = { name = " Markdown" },
|
||||
cp = { name = " Cpp" }, --
|
||||
cs = { name = " Surf" },
|
||||
cx = { name = " Cargo.toml" },
|
||||
cz = { name = " Snippet" },
|
||||
d = { name = " Debug" },
|
||||
e = { name = " Edit" }, -- TODO: Move these to their groups
|
||||
f = { name = " Find" },
|
||||
fu = { name = " URL" },
|
||||
g = { name = " Git" },
|
||||
gh = { name = " GitHub" },
|
||||
ghc = { name = " Card" },
|
||||
ghi = { name = " Issue" },
|
||||
ghj = { name = " Comment" },
|
||||
gho = { name = " Assignee" },
|
||||
ghp = { name = " Repo" },
|
||||
ghn = { name = " PR" },
|
||||
ghr = { name = " Review" },
|
||||
ghl = { name = " Label" },
|
||||
ght = { name = " Thread" },
|
||||
ghu = { name = " React" },
|
||||
h = { name = " Harpoon" },
|
||||
-- i = { name = " Automation" },
|
||||
i = { name = " Sniprun" },
|
||||
io = { name = " Open" },
|
||||
j = { name = " Join" },
|
||||
k = { name = " Color" },
|
||||
l = { name = " Lists" },
|
||||
lt = { name = " TODO" },
|
||||
m = { name = " Modes" },
|
||||
ml = { name = " Lush" },
|
||||
mk = { name = " Table" },
|
||||
n = { name = " Compiler Explorer" }, --
|
||||
nt = { name = " TreeSitter" },
|
||||
o = { name = " Open" },
|
||||
p = { name = " Profile" }, --
|
||||
pl = { name = " Load" },
|
||||
q = { name = " Quit" },
|
||||
r = { name = " Run" },
|
||||
rq = { name = " LeetCode" },
|
||||
s = { name = " LSP" },
|
||||
t = { name = " Test" },
|
||||
u = { name = " Update" },
|
||||
v = { name = " Games" },
|
||||
w = { name = " Workspace" },
|
||||
x = { name = " External" },
|
||||
y = { name = " Neoclip" },
|
||||
z = { name = " Neorg" },
|
||||
-- stylua: ignore end
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
M.opts = {
|
||||
icons = {
|
||||
group = "", -- disable + to make Nerf fonts usable
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
291
lua/custom/highlights.lua
Normal file
291
lua/custom/highlights.lua
Normal file
|
@ -0,0 +1,291 @@
|
|||
-- To find any highlight groups: "<cmd> Telescope highlights"
|
||||
-- Each highlight group can take a table with variables fg, bg, bold, italic, etc
|
||||
-- base30 variable names can also be used as colors
|
||||
|
||||
local M = {}
|
||||
|
||||
---@type Base46HLGroupsList
|
||||
M.override = {
|
||||
Comment = {
|
||||
italic = false,
|
||||
},
|
||||
|
||||
NvDashAscii = {
|
||||
bg = "none",
|
||||
fg = "orange",
|
||||
},
|
||||
|
||||
NvDashButtons = {
|
||||
fg = "light_grey",
|
||||
bg = "none",
|
||||
},
|
||||
}
|
||||
|
||||
---@type HLTable
|
||||
M.add = {
|
||||
NvimTreeOpenedFolderName = { fg = "green", bold = true },
|
||||
|
||||
-- modicator.nvim
|
||||
-- stylua: ignore start
|
||||
NormalMode = { fg = "blue", bold = true },
|
||||
InsertMode = { fg = "purple", bold = true },
|
||||
VisualMode = { fg = "cyan", bold = true },
|
||||
CommandMode = { fg = "vibrant_green", bold = true },
|
||||
ReplaceMode = { fg = "orange", bold = true },
|
||||
SelectMode = { fg = "nord_blue", bold = true },
|
||||
TerminalMode = { fg = "green", bold = true },
|
||||
TerminalNormalMode = { fg = "sun", bold = true },
|
||||
-- stylua: ignore end
|
||||
-- end modicator.nvim
|
||||
|
||||
-- harpoon FIXME: None of these actually work
|
||||
-- stylua: ignore start
|
||||
HarpoonInactive = { fg = "purple", bold = true },
|
||||
HarpoonActive = { fg = "white", bold = true },
|
||||
HarpoonNumberActive = { fg = "blue", bold = true },
|
||||
HarpoonNumberInactive = { fg = "blue", bold = true },
|
||||
TabLineFill = { fg = "white", bold = true },
|
||||
-- stylua: ignore end
|
||||
-- end harpoon
|
||||
|
||||
-- nvim-biscuits
|
||||
BiscuitColor = { fg = "sun" }, -- TODO: make it more sense
|
||||
-- end nvim-biscuits
|
||||
|
||||
-- Stutusline
|
||||
-- stylua: ignore start
|
||||
StBg = { bg = "statusline_bg" },
|
||||
StGroup = { --[[ fg = "grey",]] bg = "statusline_bg" },
|
||||
StEncoding = { fg = "white", bg = "statusline_bg" },
|
||||
StBrowser = { fg = "blue", bg = "statusline_bg" },
|
||||
StCody = { fg = "green", bg = "statusline_bg" },
|
||||
StCopilot = { fg = "yellow", bg = "statusline_bg" },
|
||||
StDebug = { fg = "red", bg = "statusline_bg" },
|
||||
StDiscord = { fg = "nord_blue", bg = "statusline_bg" },
|
||||
StGit = { fg = "orange", bg = "statusline_bg" },
|
||||
StGithub = { fg = "white", bg = "statusline_bg" },
|
||||
StHome = { fg = "yellow", bg = "statusline_bg" },
|
||||
StIRC = { fg = "white", bg = "statusline_bg" },
|
||||
StKernel = { fg = "white", bg = "statusline_bg" },
|
||||
StMail = { fg = "yellow", bg = "statusline_bg" },
|
||||
StReddit = { fg = "white", bg = "statusline_bg" },
|
||||
StStackOverflow = { fg = "orange", bg = "statusline_bg" },
|
||||
StHN = { fg = "orange", bg = "statusline_bg" },
|
||||
StGames = { fg = "white", bg = "statusline_bg" },
|
||||
StTranslate = { fg = "nord_blue", bg = "statusline_bg" },
|
||||
StWhatsapp = { fg = "vibrant_green", bg = "statusline_bg" },
|
||||
StWorld = { fg = "nord_blue", bg = "statusline_bg" },
|
||||
-- stylua: ignore end
|
||||
-- end Statusline
|
||||
|
||||
-- neotest
|
||||
-- stylua: ignore start
|
||||
NeotestAdapterName = { fg = "red" },
|
||||
NeotestBorder = { fg = "purple" },
|
||||
NeotestDir = { fg = "teal" },
|
||||
NeotestFailed = { fg = "red" },
|
||||
NeotestFile = { fg = "white" },
|
||||
NeotestFocused = { fg = "green" },
|
||||
NeotestExpandMarker = { fg = "sun" },
|
||||
NeotestIndent = { fg = "sun" },
|
||||
NeotestMarked = { fg = "red" },
|
||||
NeotestNamespace = { fg = "purple" },
|
||||
NeotestPassed = { fg = "green" },
|
||||
NeotestRunning = { fg = "grey" },
|
||||
NeotestWinSelect = { fg = "baby_pink" },
|
||||
NeotestSkipped = { fg = "grey_fg2" },
|
||||
NeotestTarget = { fg = "vibrant_green" },
|
||||
NeotestTest = { fg = "dark_purple" },
|
||||
NeotestUnknown = { fg = "grey" },
|
||||
NeotestWatching = { fg = "light_grey" },
|
||||
-- stylua: ignore end
|
||||
-- end neotest
|
||||
|
||||
-- neogit
|
||||
-- PR: NEEDED
|
||||
-- stylua: ignore start
|
||||
-- NeogitRemote = { fg = "white" },
|
||||
-- NeogitObjectId = { fg = "white" },
|
||||
-- NeogitStash = { fg = "white" },
|
||||
-- NeogitFold = { fg = "white" },
|
||||
-- NeogitRebaseDone = { fg = "white" },
|
||||
-- NeogitTagName = { fg = "white" },
|
||||
-- NeogitTagDistance = { fg = "white" },
|
||||
-- NeogitSectionHeader = { fg = "white" },
|
||||
-- NeogitUnpushedTo = { fg = "white" },
|
||||
-- NeogitUnmergedInto = { fg = "white" },
|
||||
-- NeogitUnpulledFrom = { fg = "white" },
|
||||
-- NeogitUntrackedfiles = { fg = "white" },
|
||||
-- NeogitUnstagedchanges = { fg = "white" },
|
||||
-- NeogitUnmergedchanges = { fg = "white" },
|
||||
-- NeogitUnpulledchanges = { fg = "white" },
|
||||
-- NeogitRecentcommits = { fg = "white" },
|
||||
-- NeogitStagedchanges = { fg = "white" },
|
||||
-- NeogitStashes = { fg = "white" },
|
||||
-- NeogitRebasing = { fg = "white" },
|
||||
-- NeogitReverting = { fg = "white" },
|
||||
-- NeogitPicking = { fg = "white" },
|
||||
-- NeogitChangeModified = { fg = "white" },
|
||||
NeogitChangeAdded = { fg = "green", bg = "NONE" },
|
||||
NeogitChangeDeleted = { fg = "red", bg = "NONE" },
|
||||
-- NeogitChangeRenamed = { fg = "white" },
|
||||
-- NeogitChangeUpdated = { fg = "white" },
|
||||
-- NeogitChangeCopied = { fg = "white" },
|
||||
-- NeogitChangeBothModified = { fg = "white" },
|
||||
-- NeogitChangeNewFile = { fg = "white" },
|
||||
-- NeogitHunkHeader = { fg = "white" },
|
||||
-- NeogitDiffContext = { fg = "sun" },
|
||||
NeogitDiffAdd = { fg = "green", bg = "NONE" }, -- bg = "#004717" },
|
||||
NeogitDiffDelete = { fg = "red", bg = "NONE" }, -- bg = "#611300" },
|
||||
-- NeogitDiffHeader = { fg = "grey_fg2" },
|
||||
-- NeogitHunkHeaderHighlight = { fg = "grey_fg2" },
|
||||
-- NeogitDiffContextHighlight = { fg = "grey_fg" },
|
||||
NeogitDiffAddHighlight = { fg = "green", bg = "NONE" },
|
||||
NeogitDiffDeleteHighlight = { fg = "red", bg = "NONE" },
|
||||
-- NeogitDiffHeaderHighlight = { fg = "grey_fg2" },
|
||||
-- NeogitCursorLine = { fg = "white" },
|
||||
-- NeogitFilePath = { fg = "white" },
|
||||
-- NeogitCommitViewHeader = { fg = "white" },
|
||||
-- NeogitGraphBlack = { fg = "black" },
|
||||
-- NeogitGraphBlackBold = { fg = "black2" },
|
||||
-- NeogitGraphRed = { fg = "red" },
|
||||
-- NeogitGraphRedBold = { fg = "red" },
|
||||
-- NeogitGraphGreen = { fg = "green" },
|
||||
-- NeogitGraphGreenBold = { fg = "vibrant_green" },
|
||||
-- NeogitGraphYellow = { fg = "yellow" },
|
||||
-- NeogitGraphYellowBold = { fg = "sun" },
|
||||
-- NeogitGraphBlue = { fg = "blue" },
|
||||
-- NeogitGraphBlueBold = { fg = "nord_blue" },
|
||||
-- NeogitGraphPurple = { fg = "purple" },
|
||||
-- NeogitGraphPurpleBold = { fg = "dark_purple" },
|
||||
-- NeogitGraphCyan = { fg = "cyan" },
|
||||
-- NeogitGraphCyanBold = { fg = "teal" },
|
||||
-- NeogitGraphWhite = { fg = "white" },
|
||||
-- NeogitGraphWhiteBold = { fg = "light_grey" },
|
||||
-- NeogitGraphGray = { fg = "grey" },
|
||||
-- NeogitGraphBoldGray = { fg = "grey_fg" },
|
||||
-- NeogitGraphOrange = { fg = "orange" },
|
||||
-- NeogitSignatureGood = { fg = "green" },
|
||||
-- NeogitSignatureBad = { fg = "red" },
|
||||
-- NeogitSignatureMissing = { fg = "grey" },
|
||||
-- NeogitSignatureNone = { fg = "grey_fg2" },
|
||||
-- NeogitSignatureGoodUnknown = { fg = "white" },
|
||||
-- NeogitSignatureGoodExpired = { fg = "white" },
|
||||
-- NeogitSignatureGoodExpiredKey = { fg = "white" },
|
||||
-- NeogitSignatureGoodRevokedKey = { fg = "white" },
|
||||
-- NeogitPopupSectionTitle = { fg = "white" },
|
||||
-- NeogitPopupBranchName = { fg = "white" },
|
||||
-- NeogitPopupBold = { fg = "white" },
|
||||
-- NeogitPopupSwitchKey = { fg = "white" },
|
||||
-- NeogitPopupSwitchEnabled = { fg = "white" },
|
||||
-- NeogitPopupSwitchDisabled = { fg = "white" },
|
||||
-- NeogitPopupOptionKey = { fg = "white" },
|
||||
-- NeogitPopupOptionEnabled = { fg = "white" },
|
||||
-- NeogitPopupOptionDisabled = { fg = "white" },
|
||||
-- NeogitPopupConfigKey = { fg = "white" },
|
||||
-- NeogitPopupConfigEnabled = { fg = "white" },
|
||||
-- NeogitPopupConfigDisabled = { fg = "white" },
|
||||
-- NeogitPopupActionKey = { fg = "white" },
|
||||
-- NeogitPopupActionDisabled = { fg = "white" },
|
||||
-- NeogitNotificationInfo = { fg = "white" },
|
||||
-- NeogitNotificationWarning = { fg = "white" },
|
||||
-- NeogitNotificationError = { fg = "white" },
|
||||
-- NeogitCommandText = { fg = "white" },
|
||||
-- NeogitCommandTime = { fg = "white" },
|
||||
-- NeogitCommandCodeNormal = { fg = "white" },
|
||||
-- NeogitCommandCodeError = { fg = "white" },
|
||||
-- stylua: ignore end
|
||||
-- end neogit
|
||||
|
||||
-- stylua: ignore start
|
||||
BqfPreviewBorder = { fg = "grey_fg2" },
|
||||
BqfPreviewTitle = { fg = "white" },
|
||||
BqfPreviewThumb = { fg = "white" },
|
||||
BqfPreviewRange = { fg = "white" },
|
||||
-- stylua: ignore end
|
||||
|
||||
-- orgmode
|
||||
-- stylua: ignore start
|
||||
Headline1 = { bg = "#114319" },
|
||||
Headline2 = { bg = "#424311" },
|
||||
Headline3 = { bg = "#432111" },
|
||||
Headline4 = { bg = "#114331" },
|
||||
Headline5 = { bg = "#113143" },
|
||||
CodeBlock = { fg = "sun" },
|
||||
Dash = { fg = "grey_fg2", bold = true },
|
||||
Quote = { fg = "grey", bold = true },
|
||||
-- stylua: ignore end
|
||||
-- end orgmode
|
||||
|
||||
-- pqf
|
||||
-- stylua: ignore start
|
||||
qfPath = { fg = "yellow" },
|
||||
qfPosition = { fg = "green" },
|
||||
qfError = { fg = "red" },
|
||||
qfWarning = { fg = "orange" },
|
||||
qfInfo = { fg = "nord_blue" },
|
||||
qfHint = { fg = "purple" },
|
||||
-- stylua: ignore end
|
||||
-- end pqf
|
||||
|
||||
-- marks
|
||||
-- stylua: ignore start
|
||||
MarkSignHL = { fg = "orange" },
|
||||
MarkSignNumHL = { fg = "green" },
|
||||
MarkVirtTextHL = { fg = "sun" },
|
||||
-- stylua: ignore end
|
||||
-- end marks
|
||||
|
||||
-- dap
|
||||
-- stylua: ignore start
|
||||
DapBreakpoint = { fg = "red" },
|
||||
DapBreakpointCondition = { fg = "vibrant_green" },
|
||||
DapBreakpointRejected = { fg = "grey_fg2" },
|
||||
-- DapBreakpointNum = { fg = "red" },
|
||||
-- DapBreakpointLine = { bg = "red" },
|
||||
|
||||
DapLogPoint = { fg = "blue" },
|
||||
-- DapLogPointNum = { fg = "nord_blue" },
|
||||
-- DapLogPointLine = { bg = "nord_blue" },
|
||||
|
||||
DapStopped = { fg = "sun" },
|
||||
-- DapStoppedNum = { fg = "sun" },
|
||||
DapStoppedLine = { bg = "one_bg" },
|
||||
|
||||
-- DAP UI
|
||||
DapUIBreakpointsCurrentLine = { fg = "sun" },
|
||||
DapUIBreakpointsPath = { fg = "red" },
|
||||
DapUICurrentFrameName = { fg = "orange" },
|
||||
DapUIDecoration = { fg = "grey" },
|
||||
DapUIFrameName = { fg = "sun" },
|
||||
DapUILineNumber = { fg = "white" },
|
||||
DapUIModifiedValue = { fg = "orange" },
|
||||
DapUIScope = { fg = "red" },
|
||||
DapUISource = { fg = "green" },
|
||||
DapUIStoppedThread = { fg = "cyan" },
|
||||
DapUIType = { fg = "nord_blue" },
|
||||
|
||||
DapUIStepOut = { fg = "yellow" },
|
||||
DapUIStepOver = { fg = "nord_blue" },
|
||||
DapUIPlayPause = { fg = "vibrant_green" },
|
||||
DapUIRestart = { fg = "pink" },
|
||||
DapUIStepBack = { fg = "nord_blue" },
|
||||
DapUIStepInto = { fg = "yellow" },
|
||||
DapUIStop = { fg = "red" },
|
||||
|
||||
-- DapUI = { fg = "nord_blue" },
|
||||
-- DapUI = { fg = "nord_blue" },
|
||||
DapUIVariable = { fg = "vibrant_green" },
|
||||
DapUIWatchesEmpty = { fg = "red" },
|
||||
|
||||
-- stylua: ignore end
|
||||
-- end dap
|
||||
|
||||
-- stylua: ignore start
|
||||
-- Vim Visual Multi
|
||||
VM_Cursor = { fg = "grey_fg" },
|
||||
-- stylua: ignore end
|
||||
-- end dap
|
||||
}
|
||||
|
||||
return M
|
13
lua/custom/info.lua
Normal file
13
lua/custom/info.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
-- TODO: Use these in, snippets, plugins, statusline like this -> <25-09-23, utfeight>
|
||||
-- or this -> COPYRIGHT © 2021, utfeight
|
||||
|
||||
local M = {}
|
||||
|
||||
-- stylua: ignore start
|
||||
M.real_name = "Orhan KARAMAN" -- Real Name
|
||||
M.email = "utfeightt@gmail.com" -- Email
|
||||
M.github = "utfeight" -- Github username
|
||||
M.username = M.github -- Other Sites
|
||||
-- stylua: ignore end
|
||||
|
||||
return M
|
99
lua/custom/init.lua
Normal file
99
lua/custom/init.lua
Normal file
|
@ -0,0 +1,99 @@
|
|||
-- Auto resize panes when resizing nvim window
|
||||
-- autocmd("VimResized", {
|
||||
-- pattern = "*",
|
||||
-- command = "tabdo wincmd =",
|
||||
-- })
|
||||
|
||||
-- -- Conceal Settings
|
||||
-- -- in json files, conceal the quotes
|
||||
-- -- In org-mode conceal the links
|
||||
-- -- Markdown links can get concealed with this also.
|
||||
-- -- NOTE: Moved to org-mode config
|
||||
-- vim.opt.conceallevel = 2
|
||||
-- vim.opt.concealcursor = "nc"
|
||||
|
||||
-- Folding Settings
|
||||
-- These are used for the ufo plugin
|
||||
-- + org-mode
|
||||
-- vim.o.foldcolumn = "1" -- '0' is not bad
|
||||
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
|
||||
-- Snippet paths
|
||||
vim.g.vscode_snippets_path = "~/.config/nvim/lua/custom/snippets/json"
|
||||
vim.g.lua_snippets_path = "~/.config/nvim/lua/custom/snippets/lua"
|
||||
vim.g.snipmate_snippets_path = "~/.config/nvim/lua/custom/snippets/snipmate"
|
||||
|
||||
-- -- Remove terminal padding when inside nvim:
|
||||
---- For st:
|
||||
-- function Sed(from, to, fname)
|
||||
-- vim.cmd(string.format("silent !sed -i 's/%s/%s/g' %s", from, to, fname))
|
||||
-- end
|
||||
--
|
||||
-- function Reload()
|
||||
-- vim.cmd(
|
||||
-- string.format "silent !xrdb merge ~/.Xresources && kill -USR1 $(xprop -id $(xdotool getwindowfocus) | grep '_NET_WM_PID' | grep -oE '[[:digit:]]*$')"
|
||||
-- )
|
||||
-- end
|
||||
--
|
||||
-- function DecreasePadding()
|
||||
-- Sed("st.borderpx: 20", "st.borderpx: 0", "~/.Xresources")
|
||||
-- Reload()
|
||||
-- Sed("st.borderpx: 0", "st.borderpx: 20", "~/.Xresources")
|
||||
-- end
|
||||
--
|
||||
-- function IncreasePadding()
|
||||
-- Reload()
|
||||
-- end
|
||||
--
|
||||
-- vim.cmd [[
|
||||
-- augroup ChangeStPadding
|
||||
-- au!
|
||||
-- au VimEnter * lua DecreasePadding()
|
||||
-- au VimLeavePre * lua IncreasePadding()
|
||||
-- augroup END
|
||||
-- ]]
|
||||
--
|
||||
-- -- Change Cwd to current file (AWESOME)
|
||||
-- vim.cmd [[
|
||||
-- set autochdir
|
||||
-- ]]
|
||||
|
||||
---- For alacritty:
|
||||
-- local function sed(from, to)
|
||||
-- vim.cmd(string.format("silent !sed -i 's/%s/%s/g' %s", from, to, "~/.config/alacritty/alacritty.yml"))
|
||||
-- end
|
||||
--
|
||||
-- local autocmd = vim.api.nvim_create_autocmd
|
||||
--
|
||||
-- autocmd("VimEnter", {
|
||||
-- callback = function()
|
||||
-- sed("x: 25", "x: 0")
|
||||
-- sed("y: 25", "y: 0")
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- autocmd("VimLeavePre", {
|
||||
-- callback = function()
|
||||
-- sed("x: 0", "x: 25")
|
||||
-- sed("y: 0", "y: 25")
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- TODO: Check wheter this is needed
|
||||
-- -- Improves startup time
|
||||
-- vim.loader.enable()
|
||||
|
||||
-- Stack Overflow Wrapper:
|
||||
-- Define the Lua function to execute the Soq command
|
||||
function run_soq(query)
|
||||
local cmd = "so " .. query
|
||||
require("custom.utils").extern(cmd, "vertical")
|
||||
end
|
||||
|
||||
-- Create the Soq command using nvim_create_user_command
|
||||
vim.api.nvim_create_user_command("Soq", "lua run_soq(<q-args>)", {
|
||||
nargs = "*",
|
||||
-- complete = "shellcmd",
|
||||
})
|
436
lua/custom/mappings.lua
Normal file
436
lua/custom/mappings.lua
Normal file
|
@ -0,0 +1,436 @@
|
|||
---@type MappingsTable
|
||||
local M = {}
|
||||
local extern = require("custom.utils").extern
|
||||
|
||||
local status = require("custom.utils").status
|
||||
|
||||
M.general = {
|
||||
n = {
|
||||
["<leader>ww"] = { "<cmd> w<cr>", "Save Changes", opts = { nowait = true } },
|
||||
["<leader>qq"] = { "<cmd> qa<cr>", "Quit Editor", opts = { nowait = true } },
|
||||
["<leader>fq"] = { "<cmd> qa!<cr>", "Force Quit Editor", opts = { nowait = true } },
|
||||
["<leader>wq"] = { "<cmd> wq<cr>", "Write Quit Editor", opts = { nowait = true } },
|
||||
["<leader>ip"] = { "<cmd> Inspect<cr>", "HL Group Under Cursor" },
|
||||
},
|
||||
}
|
||||
|
||||
M.disabled = {
|
||||
n = {
|
||||
|
||||
-- LSP
|
||||
-- NOTE: All of these mappings are remapped
|
||||
-- to a compatible keybind. There are all nice
|
||||
--
|
||||
-- diagnostics
|
||||
["<leader>f"] = "",
|
||||
-- loclist
|
||||
["<leader>q"] = "",
|
||||
|
||||
-- Terminal
|
||||
["<leader>v"] = "",
|
||||
["<leader>h"] = "",
|
||||
|
||||
-- Buffer
|
||||
["<leader>x"] = "",
|
||||
["<leader>b"] = "",
|
||||
|
||||
["<C-s>"] = "",
|
||||
|
||||
-- NvimTree
|
||||
["<C-n>"] = "",
|
||||
["<leader>e"] = "",
|
||||
|
||||
-- Comment
|
||||
["<leader>/"] = "",
|
||||
|
||||
-- Git
|
||||
["<leader>cm"] = "", -- Commits
|
||||
["<leader>ph"] = "", -- Preview hunk
|
||||
|
||||
-- Editor
|
||||
["<leader>n"] = "", -- linenr
|
||||
|
||||
-- Terminal
|
||||
["<leader>pt"] = "",
|
||||
|
||||
-- LSP
|
||||
["<leader>ls"] = "",
|
||||
|
||||
-- NvChad
|
||||
["<leader>th"] = "",
|
||||
["<leader>ra"] = "",
|
||||
["<leader>fo"] = "", -- moved: <leader>fr
|
||||
},
|
||||
}
|
||||
|
||||
M.themes = {
|
||||
n = {
|
||||
["<leader>ht"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
|
||||
},
|
||||
}
|
||||
|
||||
M.terms = {
|
||||
n = {
|
||||
["<leader>ft"] = {
|
||||
"<cmd> Telescope terms <CR>",
|
||||
"Pick hidden term",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.treesitter = {
|
||||
n = {
|
||||
["<leader>nts"] = { "<cmd> Inspect<CR>", "HL groups Under Cursor" },
|
||||
["<leader>ntt"] = { "<cmd> InspectTree<CR>", "Parsed Syntax Tree" },
|
||||
["<leader>ntq"] = { "<cmd> PreviewQuery<CR>", "Query Editor" },
|
||||
},
|
||||
}
|
||||
|
||||
-- Toggling Conceal
|
||||
local toggled = false
|
||||
M.buffer = {
|
||||
n = {
|
||||
["<leader>bf"] = {
|
||||
function()
|
||||
vim.opt.concealcursor = "nc"
|
||||
if toggled then
|
||||
vim.opt.conceallevel = 0
|
||||
toggled = false
|
||||
else
|
||||
vim.opt.conceallevel = 2
|
||||
toggled = true
|
||||
end
|
||||
end,
|
||||
"Toggle Conceal",
|
||||
},
|
||||
["<leader>bn"] = { "<cmd> enew <CR>", "New buffer" },
|
||||
|
||||
-- quit buffer
|
||||
["<leader>bd"] = {
|
||||
"<cmd> q<CR>",
|
||||
"Close buffer", -- Terminals are hidden
|
||||
},
|
||||
|
||||
-- close buffer + hide terminal buffer
|
||||
["<leader>bk"] = {
|
||||
function()
|
||||
require("nvchad.tabufline").close_buffer()
|
||||
end,
|
||||
"Close buffer", -- Terminals are hidden
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.sort = {
|
||||
v = {
|
||||
-- <cmd> breaks visual mode selection sorting
|
||||
-- and sorts the whole buffer instead
|
||||
["<leader>sq"] = { ":sort<CR>", "Sort Selection" },
|
||||
},
|
||||
}
|
||||
|
||||
M.nvterm = {
|
||||
n = {
|
||||
["<leader>hh"] = {
|
||||
function()
|
||||
require("nvterm.terminal").new("horizontal")
|
||||
end,
|
||||
"New horizontal term",
|
||||
},
|
||||
|
||||
["<leader>vv"] = {
|
||||
function()
|
||||
require("nvterm.terminal").new("vertical")
|
||||
end,
|
||||
"New vertical term",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.selection = {
|
||||
n = {
|
||||
["<C-M-a>"] = { "gg0vG$", mode = "n", desc = "Select Whole Buffer" },
|
||||
},
|
||||
}
|
||||
|
||||
M.nvimtree = {
|
||||
n = {
|
||||
["<leader>ee"] = { "<cmd> NvimTreeFocus<CR>", "Toggle NvimTree" },
|
||||
["<leader>et"] = { ":NvimTreeToggle<CR>", "Toggle NvimTree" },
|
||||
["<leader>er"] = { ":NvimTreeRefresh<CR>", "Refresh NvimTree" },
|
||||
["<leader>ef"] = { ":NvimTreeFindFile<CR>", "Find File in NvimTree" },
|
||||
},
|
||||
}
|
||||
|
||||
M.snippets = {
|
||||
n = {
|
||||
["<leader>es"] = { ":lua require('luasnip.loaders').edit_snippet_files()<CR>", "Edit Snippets" },
|
||||
},
|
||||
}
|
||||
|
||||
M.resize = {
|
||||
n = {
|
||||
-- Conflicts with moveline
|
||||
-- ["C-M-j"] = { ":resize -2<CR>", "Resize Window -2" },
|
||||
-- ["C-M-k"] = { ":resize +2<CR>", "Resize Window +2" },
|
||||
["H"] = { ":vertical resize +2<cr>", "resize window -2" },
|
||||
["L"] = { ":vertical resize -2<cr>", "resize window +2" },
|
||||
},
|
||||
}
|
||||
|
||||
M.config = {
|
||||
n = {
|
||||
["<leader>oc"] = { ":next ~/.config/nvim/lua/custom/*.lua<CR>", "Open Editor Configuration" },
|
||||
},
|
||||
}
|
||||
|
||||
-- VIMSCRIPT:
|
||||
-- function! ZathuraOpenPdf()
|
||||
-- let fullPath = expand("%:p")
|
||||
-- let pdfFile = substitute(fullPath, ".tex", ".pdf", "")
|
||||
-- execute "silent !zathura '" . pdfFile . "' &"
|
||||
-- endfunction
|
||||
-- END
|
||||
--
|
||||
-- M.zathura = {
|
||||
-- n = {
|
||||
-- ["<leader>oz"] = { ":next ~/.config/nvim/lua/custom/*.lua<CR>", "Open in Zathura" },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
M.telescope = {
|
||||
n = {
|
||||
["<leader>fc"] = { ":Telescope builtin<CR>", "Find Editor Command" },
|
||||
["<leader>fr"] = { "<cmd> Telescope oldfiles<CR>", "Recent Files" },
|
||||
},
|
||||
}
|
||||
|
||||
M.update = {
|
||||
n = {
|
||||
["<leader>uu"] = { ":NvChadUpdate<CR>", "Update NvChad UI" },
|
||||
},
|
||||
}
|
||||
|
||||
M.lazy = {
|
||||
n = {
|
||||
["<leader>ll"] = { ":Lazy<CR>", "Open Plugin Manager" },
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
n = {
|
||||
["<leader>om"] = { ":Mason<CR>", "Open LSP Installer" },
|
||||
},
|
||||
}
|
||||
|
||||
M.git = {
|
||||
n = {
|
||||
["<leader>gc"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
|
||||
},
|
||||
}
|
||||
|
||||
M.code = {
|
||||
v = {
|
||||
["<leader>cz"] = {
|
||||
":Telescope lsp_range_code_actions",
|
||||
"Code actions for refactoring",
|
||||
},
|
||||
|
||||
["<leader>ca"] = {
|
||||
function()
|
||||
vim.lsp.buf.code_action()
|
||||
end,
|
||||
"LSP Code Action",
|
||||
},
|
||||
},
|
||||
|
||||
n = {
|
||||
["<leader>sr"] = {
|
||||
function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end,
|
||||
"LSP Signature Help",
|
||||
},
|
||||
|
||||
["<leader>sa"] = {
|
||||
function()
|
||||
require("nvchad.renamer").open()
|
||||
end,
|
||||
"LSP rename",
|
||||
},
|
||||
|
||||
-- now lazy loads nvim-bqf
|
||||
-- ["<leader>li"] = {
|
||||
-- function()
|
||||
-- vim.diagnostic.setloclist()
|
||||
-- end,
|
||||
-- "Diagnostic setloclist",
|
||||
-- },
|
||||
|
||||
["<leader>ss"] = { -- in v mode it sorts
|
||||
function()
|
||||
vim.diagnostic.open_float({ border = "rounded" })
|
||||
end,
|
||||
"Floating diagnostic",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.other = {
|
||||
n = {
|
||||
["<leader>bl"] = { "<cmd> set nu!<cr>", "Toggle line number", opts = { nowait = true } },
|
||||
["<leader>br"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
|
||||
},
|
||||
}
|
||||
|
||||
M.dashboard = {
|
||||
n = {
|
||||
["<leader>bi"] = { "<cmd> Nvdash<CR>", "Open Dashboard" },
|
||||
},
|
||||
}
|
||||
|
||||
M.irc = {
|
||||
n = {
|
||||
["<leader>xi"] = {
|
||||
function()
|
||||
extern("weechat", "vertical")
|
||||
status.irc = true
|
||||
end,
|
||||
"IRC Client",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.hn = {
|
||||
n = {
|
||||
["<leader>xh"] = {
|
||||
function()
|
||||
extern("hackernews_tui", "vertical")
|
||||
status.hn = true
|
||||
end,
|
||||
"Hacker News",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.discord = {
|
||||
n = {
|
||||
["<leader>xd"] = {
|
||||
function()
|
||||
extern("discordo", "vertical")
|
||||
status.discord = true
|
||||
end,
|
||||
"Discord",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.map = {
|
||||
n = {
|
||||
["<leader>xm"] = {
|
||||
function()
|
||||
extern("mapscii", "vertical")
|
||||
status.worldmap = true
|
||||
end,
|
||||
"Open World Map",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.browser = {
|
||||
n = {
|
||||
["<leader>xb"] = {
|
||||
function()
|
||||
extern("browsh", "vertical")
|
||||
status.browser = true
|
||||
end,
|
||||
"Open Browsher",
|
||||
},
|
||||
|
||||
["<leader>xl"] = {
|
||||
function()
|
||||
extern("lynx", "vertical")
|
||||
end,
|
||||
"Open Lynx",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.reddit = {
|
||||
n = {
|
||||
["<leader>xr"] = {
|
||||
function()
|
||||
extern("tuir", "vertical")
|
||||
status.reddit = true
|
||||
end,
|
||||
"Reddit Client",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.stackoverflow = {
|
||||
n = {
|
||||
["<leader>xs"] = {
|
||||
function()
|
||||
local q = vim.fn.input("Query: ")
|
||||
extern("so " .. q, "vertical")
|
||||
status.stackoverflow = true
|
||||
end,
|
||||
"Query StackOverflow",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.mail = {
|
||||
n = {
|
||||
["<leader>xq"] = {
|
||||
function()
|
||||
extern("mutt", "vertical")
|
||||
status.mail = true
|
||||
end,
|
||||
"Email Client",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.ncmpcpp = {
|
||||
n = {
|
||||
["<leader>xa"] = {
|
||||
function()
|
||||
extern("ncmpcpp", "vertical")
|
||||
end,
|
||||
"Music Player",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.whatsapp = {
|
||||
n = {
|
||||
["<leader>xw"] = {
|
||||
function()
|
||||
extern("nchat", "vertical")
|
||||
status.whatsapp = true
|
||||
end,
|
||||
"WhatsApp Client",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- M. = {
|
||||
-- n = {
|
||||
-- [""] = { "", "" },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- Github Copilot Bindings
|
||||
-----------------------------------------------------------
|
||||
-- M.copilot = {
|
||||
-- mode_opts = { expr = true },
|
||||
-- i = {
|
||||
-- ["<C-h>"] = { 'copilot#Accept("<Left>")', " copilot accept" },
|
||||
-- },
|
||||
-- }
|
||||
-- more keybinds!
|
||||
|
||||
return M
|
4766
lua/custom/plugins.lua
Normal file
4766
lua/custom/plugins.lua
Normal file
File diff suppressed because it is too large
Load diff
26
lua/custom/snippets/all.json
Normal file
26
lua/custom/snippets/all.json
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"mit": {
|
||||
"prefix": "mitl",
|
||||
"body": [
|
||||
" Copyright ${1:<YEAR>} ${2:<COPYRIGHT HOLDER>} ",
|
||||
"",
|
||||
"Permission is hereby granted, free of charge, to any person obtaining a",
|
||||
"copy of this software and associated documentation files (the \"Software\"),",
|
||||
"to deal in the Software without restriction, including without limitation",
|
||||
"the rights to use, copy, modify, merge, publish, distribute, sublicense,",
|
||||
"and/or sell copies of the Software, and to permit persons to whom the",
|
||||
"Software is furnished to do so, subject to the following conditions:",
|
||||
"",
|
||||
"The above copyright notice and this permission notice shall be included in",
|
||||
"all copies or substantial portions of the Software.",
|
||||
"",
|
||||
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
|
||||
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
|
||||
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL",
|
||||
"THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
|
||||
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING",
|
||||
"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER",
|
||||
"DEALINGS IN THE SOFTWARE."
|
||||
]
|
||||
}
|
||||
}
|
17
lua/custom/snippets/cpp.json
Normal file
17
lua/custom/snippets/cpp.json
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"C++ function": {
|
||||
"prefix": "fn",
|
||||
"body": [
|
||||
"/**",
|
||||
" * @brief ",
|
||||
" *",
|
||||
" * @return $5",
|
||||
" */",
|
||||
"${5:type} ${6:name}(${2:args}) {",
|
||||
" $0",
|
||||
"}"
|
||||
],
|
||||
"description": "Function with Doxygen",
|
||||
"scope": "c,cpp"
|
||||
}
|
||||
}
|
9
lua/custom/snippets/json/all.json
Normal file
9
lua/custom/snippets/json/all.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"base": {
|
||||
"prefix": "trig",
|
||||
"body": [
|
||||
""
|
||||
],
|
||||
"description": "Creates a new trigger"
|
||||
}
|
||||
}
|
12
lua/custom/snippets/json/cpp.json
Normal file
12
lua/custom/snippets/json/cpp.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"C++ function": {
|
||||
"prefix": "fn",
|
||||
"body": [
|
||||
"${5:type} ${6:name}(${2:args}) {",
|
||||
" $0",
|
||||
"}"
|
||||
],
|
||||
"description": "Function with Doxygen",
|
||||
"scope": "c,cpp"
|
||||
}
|
||||
}
|
38
lua/custom/snippets/json/json.json
Normal file
38
lua/custom/snippets/json/json.json
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"Task": {
|
||||
"prefix": "task",
|
||||
"body": [
|
||||
"{",
|
||||
" \"type\": \"${1:process}\",",
|
||||
" \"label\": \"${2:name}\",",
|
||||
" \"group\": \"${3:test}\",",
|
||||
" \"command\": \"${4:./run_tests.sh}\",",
|
||||
" \"args\": [",
|
||||
" \"${5:--verbose}\"",
|
||||
" ]",
|
||||
"}"
|
||||
],
|
||||
"description": "Task Template"
|
||||
},
|
||||
|
||||
"Overseer": {
|
||||
"prefix": "overseer",
|
||||
"body": [
|
||||
"{",
|
||||
" \"version\": \"0.1.0\",",
|
||||
" \"tasks\": [",
|
||||
" {",
|
||||
" \"type\": \"${1:process}\",",
|
||||
" \"label\": \"${2:name}\",",
|
||||
" \"group\": \"${3:test}\",",
|
||||
" \"command\": \"${4:./run_tests.sh}\",",
|
||||
" \"args\": [",
|
||||
" \"${5:--verbose}\"",
|
||||
" ]",
|
||||
" }",
|
||||
" ]",
|
||||
"}"
|
||||
],
|
||||
"description": "Task Template"
|
||||
}
|
||||
}
|
8
lua/custom/snippets/json/lua.json
Normal file
8
lua/custom/snippets/json/lua.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"snip1": {
|
||||
"prefix": "lua",
|
||||
"body": [
|
||||
"lualualua"
|
||||
]
|
||||
}
|
||||
}
|
9
lua/custom/snippets/json/org.json
Normal file
9
lua/custom/snippets/json/org.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"Org Title": {
|
||||
"prefix": "title",
|
||||
"body": [
|
||||
"#+TITLE: ${1:DEMO}"
|
||||
],
|
||||
"description": "org-mode title"
|
||||
}
|
||||
}
|
49
lua/custom/snippets/json/package.json
Normal file
49
lua/custom/snippets/json/package.json
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
"name": "example-snippets",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": [
|
||||
"all"
|
||||
],
|
||||
"path": "./all.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"python"
|
||||
],
|
||||
"path": "./python.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"lua"
|
||||
],
|
||||
"path": "./lua.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"cpp"
|
||||
],
|
||||
"path": "./cpp.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"org"
|
||||
],
|
||||
"path": "./org.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"json"
|
||||
],
|
||||
"path": "./json.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"rust"
|
||||
],
|
||||
"path": "./rust.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
0
lua/custom/snippets/json/python.json
Normal file
0
lua/custom/snippets/json/python.json
Normal file
0
lua/custom/snippets/json/rust.json
Normal file
0
lua/custom/snippets/json/rust.json
Normal file
8
lua/custom/snippets/lua.json
Normal file
8
lua/custom/snippets/lua.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"snip1": {
|
||||
"prefix": "lua",
|
||||
"body": [
|
||||
"lualualua"
|
||||
]
|
||||
}
|
||||
}
|
205
lua/custom/snippets/lua/all.lua
Normal file
205
lua/custom/snippets/lua/all.lua
Normal file
|
@ -0,0 +1,205 @@
|
|||
local info = require "custom.info"
|
||||
|
||||
local luasnip = require "luasnip"
|
||||
local ls = require "luasnip"
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require "luasnip.util.events"
|
||||
local ai = require "luasnip.nodes.absolute_indexer"
|
||||
local extras = require "luasnip.extras"
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require "luasnip.extras.expand_conditions"
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require "luasnip.util.types"
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require("luasnip.nodes.key_indexer").new_key
|
||||
|
||||
local calculate_comment_string = require("Comment.ft").calculate
|
||||
local utils = require "Comment.utils"
|
||||
|
||||
--------------------------------
|
||||
-- BOX COMMENTS --
|
||||
--------------------------------
|
||||
|
||||
--- Get the comment string {beg,end} table
|
||||
---@param ctype integer 1 for `line`-comment and 2 for `block`-comment
|
||||
---@return table comment_strings {begcstring, endcstring}
|
||||
local get_cstring = function(ctype)
|
||||
-- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`)
|
||||
local cstring = calculate_comment_string { ctype = ctype, range = utils.get_region() } or vim.bo.commentstring
|
||||
-- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side
|
||||
local left, right = utils.unwrap_cstr(cstring)
|
||||
-- create a `{left, right}` table for it
|
||||
return { left, right }
|
||||
end
|
||||
|
||||
local function create_box(opts)
|
||||
local pl = opts.padding_length or 4
|
||||
local function pick_comment_start_and_end()
|
||||
-- because lua block comment is unlike other language's,
|
||||
-- so handle lua ctype
|
||||
local ctype = 2
|
||||
if vim.opt.ft:get() == "lua" then
|
||||
ctype = 1
|
||||
end
|
||||
local cs = get_cstring(ctype)[1]
|
||||
local ce = get_cstring(ctype)[2]
|
||||
if ce == "" or ce == nil then
|
||||
ce = cs
|
||||
end
|
||||
return cs, ce
|
||||
end
|
||||
return {
|
||||
-- top line
|
||||
f(function(args)
|
||||
local cs, ce = pick_comment_start_and_end()
|
||||
return cs .. string.rep(string.sub(cs, #cs, #cs), string.len(args[1][1]) + 2 * pl) .. ce
|
||||
end, { 1 }),
|
||||
t { "", "" },
|
||||
f(function()
|
||||
local cs = pick_comment_start_and_end()
|
||||
return cs .. string.rep(" ", pl)
|
||||
end),
|
||||
i(1, "box"),
|
||||
f(function()
|
||||
local cs, ce = pick_comment_start_and_end()
|
||||
return string.rep(" ", pl) .. ce
|
||||
end),
|
||||
t { "", "" },
|
||||
-- bottom line
|
||||
f(function(args)
|
||||
local cs, ce = pick_comment_start_and_end()
|
||||
return cs .. string.rep(string.sub(ce, 1, 1), string.len(args[1][1]) + 2 * pl) .. ce
|
||||
end, { 1 }),
|
||||
}
|
||||
end
|
||||
-----------------------
|
||||
-- END --
|
||||
-----------------------
|
||||
|
||||
---------------------------------
|
||||
-- TODO COMMENTS --
|
||||
---------------------------------
|
||||
--- Options for marks to be used in a TODO comment
|
||||
local marks = {
|
||||
signature = function()
|
||||
return fmt("<{}>", i(1, info.username))
|
||||
end,
|
||||
signature_with_email = function()
|
||||
return fmt("<{}{}>", { i(1, info.username), i(2, " " .. info.email) })
|
||||
end,
|
||||
date_signature_with_email = function()
|
||||
return fmt("<{}{}{}>", { i(1, os.date "%d-%m-%y"), i(2, ", " .. info.username), i(3, " " .. info.email) })
|
||||
end,
|
||||
date_signature = function()
|
||||
return fmt("<{}{}>", { i(1, os.date "%d-%m-%y"), i(2, ", " .. info.username) })
|
||||
end,
|
||||
date = function()
|
||||
return fmt("<{}>", i(1, os.date "%d-%m-%y"))
|
||||
end,
|
||||
empty = function()
|
||||
return t ""
|
||||
end,
|
||||
}
|
||||
|
||||
local todo_snippet_nodes = function(aliases, opts)
|
||||
local aliases_nodes = vim.tbl_map(function(alias)
|
||||
return i(nil, alias) -- generate choices for [name-of-comment]
|
||||
end, aliases)
|
||||
local sigmark_nodes = {} -- choices for [comment-mark]
|
||||
for _, mark in pairs(marks) do
|
||||
table.insert(sigmark_nodes, mark())
|
||||
end
|
||||
-- format them into the actual snippet
|
||||
local comment_node = fmta("<> <>: <> <> <><>", {
|
||||
f(function()
|
||||
return get_cstring(opts.ctype)[1] -- get <comment-string[1]>
|
||||
end),
|
||||
c(1, aliases_nodes), -- [name-of-comment]
|
||||
i(3), -- {comment-text}
|
||||
i(2, sigmark_nodes), -- [comment-mark]
|
||||
f(function()
|
||||
return get_cstring(opts.ctype)[2] -- get <comment-string[2]>
|
||||
end),
|
||||
i(0),
|
||||
})
|
||||
return comment_node
|
||||
end
|
||||
|
||||
--- Generate a TODO comment snippet with an automatic description and docstring
|
||||
---@param context table merged with the generated context table `trig` must be specified
|
||||
---@param aliases string[]|string of aliases for the todo comment (ex.: {FIX, ISSUE, FIXIT, BUG})
|
||||
---@param opts table merged with the snippet opts table
|
||||
local todo_snippet = function(context, aliases, opts)
|
||||
opts = opts or {}
|
||||
aliases = type(aliases) == "string" and { aliases } or aliases -- if we do not have aliases, be smart about the function parameters
|
||||
context = context or {}
|
||||
if not context.trig then
|
||||
return error("context doesn't include a `trig` key which is mandatory", 2) -- all we need from the context is the trigger
|
||||
end
|
||||
opts.ctype = opts.ctype or 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined
|
||||
local alias_string = table.concat(aliases, "|") -- `choice_node` documentation
|
||||
context.name = context.name or (alias_string .. " comment") -- generate the `name` of the snippet if not defined
|
||||
context.dscr = context.dscr or (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined
|
||||
context.docstring = context.docstring or (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined
|
||||
local comment_node = todo_snippet_nodes(aliases, opts) -- nodes from the previously defined function for their generation
|
||||
return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters
|
||||
end
|
||||
|
||||
local todo_snippet_specs = {
|
||||
{ { trig = "todo" }, "TODO" },
|
||||
{ { trig = "fix" }, { "FIX", "BUG", "ISSUE", "FIXIT" } },
|
||||
{ { trig = "hack" }, "HACK" },
|
||||
{ { trig = "warn" }, { "WARN", "WARNING", "XXX" } },
|
||||
{ { trig = "perf" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" } },
|
||||
{ { trig = "note" }, { "NOTE", "INFO" } },
|
||||
-- NOTE: Block commented todo-comments <kunzaatko>
|
||||
{ { trig = "todob" }, "TODO", { ctype = 2 } },
|
||||
{ { trig = "fixb" }, { "FIX", "BUG", "ISSUE", "FIXIT" }, { ctype = 2 } },
|
||||
{ { trig = "hackb" }, "HACK", { ctype = 2 } },
|
||||
{ { trig = "warnb" }, { "WARN", "WARNING", "XXX" }, { ctype = 2 } },
|
||||
{ { trig = "perfb" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" }, { ctype = 2 } },
|
||||
{ { trig = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } },
|
||||
}
|
||||
|
||||
local todo_comment_snippets = {}
|
||||
for _, v in ipairs(todo_snippet_specs) do
|
||||
-- NOTE: 3rd argument accepts nil
|
||||
table.insert(todo_comment_snippets, todo_snippet(v[1], v[2], v[3]))
|
||||
end
|
||||
|
||||
ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" })
|
||||
|
||||
-----------------------
|
||||
-- END --
|
||||
-----------------------
|
||||
|
||||
-- COPYRIGHT (C) 2023, utfeight snippet HERE:
|
||||
|
||||
return {
|
||||
s({ trig = "box" }, create_box { padding_length = 8 }),
|
||||
s({ trig = "bbox" }, create_box { padding_length = 20 }),
|
||||
|
||||
-- s("COPYRIGHT", { -- FIXME
|
||||
-- t "COPYRIGHT (C) ",
|
||||
-- i(1, os.date "%Y"),
|
||||
-- t ", ",
|
||||
-- i(2, info.username),
|
||||
-- c(3, sigmark_nodes), -- [comment-mark]
|
||||
-- }),
|
||||
}
|
230
lua/custom/snippets/lua/c.lua
Normal file
230
lua/custom/snippets/lua/c.lua
Normal file
|
@ -0,0 +1,230 @@
|
|||
local luasnip = require "luasnip"
|
||||
local ls = require "luasnip"
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require "luasnip.util.events"
|
||||
local ai = require "luasnip.nodes.absolute_indexer"
|
||||
local extras = require "luasnip.extras"
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require "luasnip.extras.expand_conditions"
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require "luasnip.util.types"
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require("luasnip.nodes.key_indexer").new_key
|
||||
-- local utils = require "luasnip_snippets.utils"
|
||||
|
||||
return {
|
||||
c = {
|
||||
s("INCLUDE", {
|
||||
d(1, function(args, snip)
|
||||
-- Create a table of nodes that will go into the header choice_node
|
||||
local headers_to_load_into_choice_node = {}
|
||||
|
||||
-- Step 1: get companion .h file if the current file is a .c or .cpp file excluding main.c
|
||||
local extension = vim.fn.expand "%:e"
|
||||
local is_main = vim.fn.expand("%"):match "main%.cp?p?" ~= nil
|
||||
if (extension == "c" or extension == "cpp") and not is_main then
|
||||
local matching_h_file = vim.fn.expand("%:t"):gsub("%.c", ".h")
|
||||
local companion_header_file = string.format('#include "%s"', matching_h_file)
|
||||
table.insert(headers_to_load_into_choice_node, t(companion_header_file))
|
||||
end
|
||||
|
||||
-- Step 2: get all the local headers in current directory and below
|
||||
local current_file_directory = vim.fn.expand "%:h"
|
||||
local local_header_files = require("plenary.scandir").scan_dir(
|
||||
current_file_directory,
|
||||
{ respect_gitignore = true, search_pattern = ".*%.h$" }
|
||||
)
|
||||
|
||||
-- Clean up and insert the detected local header files
|
||||
for _, local_header_name in ipairs(local_header_files) do
|
||||
-- Trim down path to be a true relative path to the current file
|
||||
local shortened_header_path = local_header_name:gsub(current_file_directory, "")
|
||||
-- Replace '\' with '/'
|
||||
shortened_header_path = shortened_header_path:gsub([[\+]], "/")
|
||||
-- Remove leading forward slash
|
||||
shortened_header_path = shortened_header_path:gsub("^/", "")
|
||||
local new_header = t(string.format('#include "%s"', shortened_header_path))
|
||||
table.insert(headers_to_load_into_choice_node, new_header)
|
||||
end
|
||||
|
||||
-- Step 3: allow for custom insert_nodes for local and system headers
|
||||
local custom_insert_nodes = {
|
||||
sn(
|
||||
nil,
|
||||
fmt(
|
||||
[[
|
||||
#include "{}"
|
||||
]],
|
||||
{
|
||||
i(1, "custom_insert.h"),
|
||||
}
|
||||
)
|
||||
),
|
||||
sn(
|
||||
nil,
|
||||
fmt(
|
||||
[[
|
||||
#include <{}>
|
||||
]],
|
||||
{
|
||||
i(1, "custom_system_insert.h"),
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
||||
-- Add the custom insert_nodes for adding custom local (wrapped in "") or system (wrapped in <>) headers
|
||||
for _, custom_insert_node in ipairs(custom_insert_nodes) do
|
||||
table.insert(headers_to_load_into_choice_node, custom_insert_node)
|
||||
end
|
||||
|
||||
-- Step 4: finally last priority is the system headers
|
||||
local system_headers = {
|
||||
t "#include <assert.h>",
|
||||
t "#include <complex.h>",
|
||||
t "#include <ctype.h>",
|
||||
t "#include <errno.h>",
|
||||
t "#include <fenv.h>",
|
||||
t "#include <float.h>",
|
||||
t "#include <inttypes.h>",
|
||||
t "#include <iso646.h>",
|
||||
t "#include <limits.h>",
|
||||
t "#include <locale.h>",
|
||||
t "#include <math.h>",
|
||||
t "#include <setjmp.h>",
|
||||
t "#include <signal.h>",
|
||||
t "#include <stdalign.h>",
|
||||
t "#include <stdarg.h>",
|
||||
t "#include <stdatomic.h>",
|
||||
t "#include <stdbit.h>",
|
||||
t "#include <stdbool.h>",
|
||||
t "#include <stdckdint.h>",
|
||||
t "#include <stddef.h>",
|
||||
t "#include <stdint.h>",
|
||||
t "#include <stdio.h>",
|
||||
t "#include <stdlib.h>",
|
||||
t "#include <stdnoreturn.h>",
|
||||
t "#include <string.h>",
|
||||
t "#include <tgmath.h>",
|
||||
t "#include <threads.h>",
|
||||
t "#include <time.h>",
|
||||
t "#include <uchar.h>",
|
||||
t "#include <wchar.h>",
|
||||
t "#include <wctype.h>",
|
||||
}
|
||||
for _, header_snippet in ipairs(system_headers) do
|
||||
table.insert(headers_to_load_into_choice_node, header_snippet)
|
||||
end
|
||||
|
||||
return sn(1, c(1, headers_to_load_into_choice_node))
|
||||
end, {}),
|
||||
}),
|
||||
|
||||
-- s("all fn", {
|
||||
-- -- Simple static text.
|
||||
-- t "//Parameters: ",
|
||||
-- -- function, first parameter is the function, second the Placeholders
|
||||
-- -- whose text it gets as input.
|
||||
-- f(utils.copy, 2),
|
||||
-- t { "", "function " },
|
||||
-- -- Placeholder/Insert.
|
||||
-- i(1),
|
||||
-- t "(",
|
||||
-- -- Placeholder with initial text.
|
||||
-- i(2, "int foo"),
|
||||
-- -- Linebreak
|
||||
-- t { ") {", "\t" },
|
||||
-- -- Last Placeholder, exit Point of the snippet. EVERY 'outer' SNIPPET NEEDS Placeholder 0.
|
||||
-- i(0),
|
||||
-- t { "", "}" },
|
||||
-- }),
|
||||
|
||||
s("class", {
|
||||
-- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes.
|
||||
c(1, {
|
||||
t "public ",
|
||||
t "private ",
|
||||
}),
|
||||
t "class ",
|
||||
i(2),
|
||||
t " ",
|
||||
c(3, {
|
||||
t "{",
|
||||
-- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!!
|
||||
-- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to.
|
||||
sn(nil, {
|
||||
t "extends ",
|
||||
i(1),
|
||||
t " {",
|
||||
}),
|
||||
sn(nil, {
|
||||
t "implements ",
|
||||
i(1),
|
||||
t " {",
|
||||
}),
|
||||
}),
|
||||
t { "", "\t" },
|
||||
i(0),
|
||||
t { "", "}" },
|
||||
}),
|
||||
|
||||
-- s({ trig = "fn" }, { -- Specific to a repo
|
||||
-- d(6, utils.jdocsnip, { 2, 4, 5 }),
|
||||
-- t { "", "" },
|
||||
-- c(1, {
|
||||
-- t { "public " },
|
||||
-- t { "private " },
|
||||
-- }),
|
||||
-- c(2, {
|
||||
-- t { "void" },
|
||||
-- i(nil, { "" }),
|
||||
-- t { "String" },
|
||||
-- t { "char" },
|
||||
-- t { "int" },
|
||||
-- t { "double" },
|
||||
-- t { "boolean" },
|
||||
-- }),
|
||||
-- t { " " },
|
||||
-- i(3, { "myFunc" }),
|
||||
-- t { "(" },
|
||||
-- i(4),
|
||||
-- t { ")" },
|
||||
-- c(5, {
|
||||
-- t { "" },
|
||||
-- sn(nil, {
|
||||
-- t { "", " throws " },
|
||||
-- i(1),
|
||||
-- }),
|
||||
-- }),
|
||||
-- t { " {", "\t" },
|
||||
-- i(0),
|
||||
-- t { "", "}" },
|
||||
-- }),
|
||||
|
||||
s("#if", {
|
||||
t "#if ",
|
||||
i(1, "1"),
|
||||
t { "", "" },
|
||||
i(0),
|
||||
t { "", "#endif // " },
|
||||
f(function(args)
|
||||
return args[1]
|
||||
end, 1),
|
||||
}),
|
||||
},
|
||||
}
|
436
lua/custom/snippets/lua/cpp.lua
Normal file
436
lua/custom/snippets/lua/cpp.lua
Normal file
|
@ -0,0 +1,436 @@
|
|||
local luasnip = require "luasnip"
|
||||
local ls = require "luasnip"
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require "luasnip.util.events"
|
||||
local ai = require "luasnip.nodes.absolute_indexer"
|
||||
local extras = require "luasnip.extras"
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require "luasnip.extras.expand_conditions"
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require "luasnip.util.types"
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require("luasnip.nodes.key_indexer").new_key
|
||||
--- Provides snippets for C++.
|
||||
|
||||
local ts_utils = require "nvim-treesitter.ts_utils"
|
||||
|
||||
local cpp_classes = vim.treesitter.query.parse(
|
||||
"cpp",
|
||||
[[
|
||||
[
|
||||
(struct_specifier name: [((type_identifier) @name) (template_type name: (type_identifier) @name)])
|
||||
(class_specifier name: [((type_identifier) @name) (template_type name: (type_identifier) @name)])
|
||||
] @class
|
||||
]]
|
||||
)
|
||||
|
||||
--- Returns list of all C++ classes or structs in the language tree that contains a given line.
|
||||
-- @param linenr Line number that will be used to get the language tree.
|
||||
-- @return List of tuples (line begin, line end, class name). Lines use inclusive 1-indexing.
|
||||
local function list_classes(linenr)
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
local root = ts_utils.get_root_for_position(linenr - 1, 0)
|
||||
if not root then
|
||||
return {}
|
||||
end
|
||||
|
||||
local result = {}
|
||||
|
||||
for _, captures, _ in cpp_classes:iter_matches(root, bufnr) do
|
||||
local lbegin, _, lend, _ = ts_utils.get_vim_range { captures[2]:range() }
|
||||
local name = vim.treesitter.get_node_text(captures[1], bufnr)
|
||||
table.insert(result, { lbegin, lend, name })
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
--- Gets name of the surrounding C++ class.
|
||||
-- @param linenr Line number to use.
|
||||
-- @return Name of the surrounding class or nil if none was found.
|
||||
local function get_surrounding_class(linenr)
|
||||
local classes = list_classes(linenr)
|
||||
local min_range
|
||||
local min_name
|
||||
|
||||
for _, class_info in pairs(classes) do
|
||||
local lbegin, lend, name = unpack(class_info)
|
||||
|
||||
if lbegin <= linenr and lend >= linenr and (not min_range or lend - lbegin < min_range) then
|
||||
min_range = lend - lbegin
|
||||
min_name = name
|
||||
end
|
||||
end
|
||||
|
||||
return min_name
|
||||
end
|
||||
|
||||
local function gen_doc(_, _, _)
|
||||
require("neogen").generate()
|
||||
return "some"
|
||||
end
|
||||
|
||||
-- FIXME: Initialization of once happens only when snippets load.
|
||||
-- This will lead to non generating of docs on second run.
|
||||
local once = true
|
||||
local function count(_, _, old_state)
|
||||
if not old_state then
|
||||
print "No old state!"
|
||||
else
|
||||
if once then
|
||||
once = false
|
||||
require("neogen").setup {
|
||||
enabled = true, --if you want to disable Neogen
|
||||
input_after_comment = false, -- (default: true) automatic jump (with insert mode) on inserted annotation
|
||||
}
|
||||
gen_doc()
|
||||
end
|
||||
end
|
||||
|
||||
old_state = old_state or {
|
||||
updates = 0,
|
||||
}
|
||||
|
||||
old_state.updates = old_state.updates + 1
|
||||
|
||||
local snip = sn(nil, {
|
||||
t(tostring ""),
|
||||
})
|
||||
|
||||
snip.old_state = old_state
|
||||
|
||||
return snip
|
||||
end
|
||||
|
||||
ls.add_snippets("cpp", {
|
||||
-- Toggle TODO
|
||||
s("cody", {
|
||||
t { "// Cody DEMO:", "" },
|
||||
|
||||
i(0),
|
||||
c(1, {
|
||||
t 'std::cout << "<AI CODEGEN DEMO>" << std::endl;',
|
||||
t "",
|
||||
}),
|
||||
}),
|
||||
|
||||
s("stff", {
|
||||
t "auto ",
|
||||
i(1, "change to update"),
|
||||
d(2, count, { 1 }),
|
||||
}),
|
||||
|
||||
s("dfn", {
|
||||
t "auto ",
|
||||
i(1, "name"),
|
||||
t "(",
|
||||
i(2),
|
||||
t ")",
|
||||
c(3, {
|
||||
t "",
|
||||
t " const",
|
||||
t " override",
|
||||
t " noexcept",
|
||||
}),
|
||||
t { "", "{", "\t" },
|
||||
i(4),
|
||||
d(5, count, { 4 }),
|
||||
t { "", "}" },
|
||||
}),
|
||||
|
||||
s("for", {
|
||||
t "for (",
|
||||
c(1, {
|
||||
sn(nil, { t "const auto& ", r(1, "elem"), t " : ", r(2, "range") }),
|
||||
sn(nil, { t "auto& ", r(1, "elem"), t " : ", r(2, "range") }),
|
||||
sn(nil, {
|
||||
t "std::size_t ",
|
||||
i(1, "i"),
|
||||
t " = ",
|
||||
i(2, "0"),
|
||||
t "; ",
|
||||
rep(1),
|
||||
t " < ",
|
||||
i(3, "n"),
|
||||
t "; ++",
|
||||
rep(1),
|
||||
}),
|
||||
}),
|
||||
t { ") {", "\t" },
|
||||
i(0),
|
||||
t { "", "}" },
|
||||
}, { stored = { elem = i(1, "elem"), range = i(2, "range") } }),
|
||||
parse("while", "while (${1:cond}) {\n\t$0\n}"),
|
||||
parse("do", "do {\n\t$0\n} while (${1:cond});"),
|
||||
s("if", {
|
||||
t "if (",
|
||||
c(1, {
|
||||
r(1, "cond"),
|
||||
sn(nil, { i(1, "init"), t "; ", r(2, "cond") }),
|
||||
}),
|
||||
t { ") {", "\t" },
|
||||
i(0),
|
||||
t { "", "}" },
|
||||
}, { stored = { cond = i(1, "cond") } }),
|
||||
s("ifc", {
|
||||
t "if constexpr (",
|
||||
c(1, {
|
||||
r(1, "cond"),
|
||||
sn(nil, { i(1, "init"), t "; ", r(2, "cond") }),
|
||||
}),
|
||||
t { ") {", "\t" },
|
||||
i(0),
|
||||
t { "", "}" },
|
||||
}, { stored = { cond = i(1, "cond") } }),
|
||||
parse("e", "else {\n\t$0\n}"),
|
||||
parse("ei", "else if ($1) {\n\t$0\n}"),
|
||||
parse("eic", "else if constexpr ($1) {\n\t$0\n}"),
|
||||
|
||||
-- Standard library types / containers
|
||||
parse("vec", "std::vector<${1:T}>"),
|
||||
parse("map", "std::unordered_map<${1:Key}, ${2:Value}>"),
|
||||
parse("imap", "std::map<${1:Key}, ${2:Value}>"),
|
||||
parse("str", "std::string"),
|
||||
parse("up", "std:unique_ptr<${1:T}>"),
|
||||
parse("sp", "std:shared_ptr<${1:T}>"),
|
||||
|
||||
-- Attributes
|
||||
parse("nd", "[[nodiscard]]"),
|
||||
|
||||
-- Special member declarations
|
||||
s("consd", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
assert(cname, "Could not get surrounding class!")
|
||||
return sn(nil, { t(cname), t "(", i(1), t ");" })
|
||||
end),
|
||||
}),
|
||||
s("cconsd", {
|
||||
f(function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
assert(cname, "Could not get surrounding class!")
|
||||
return cname .. "(" .. cname .. " const& other);"
|
||||
end),
|
||||
}),
|
||||
s("mconsd", {
|
||||
f(function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
assert(cname, "Could not get surrounding class!")
|
||||
return cname .. "(" .. cname .. "&& other) noexcept;"
|
||||
end),
|
||||
}),
|
||||
s("cassd", {
|
||||
f(function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
assert(cname, "Could not get surrounding class!")
|
||||
return cname .. "& operator=(" .. cname .. " const& other);"
|
||||
end),
|
||||
}),
|
||||
s("massd", {
|
||||
f(function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
assert(cname, "Could not get surrounding class!")
|
||||
return cname .. "& operator=(" .. cname .. "&& other) noexcept;"
|
||||
end),
|
||||
}),
|
||||
s("desd", {
|
||||
f(function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
assert(cname, "Could not get surrounding class!")
|
||||
return "~" .. cname .. "();"
|
||||
end),
|
||||
}),
|
||||
|
||||
-- Special member definitions
|
||||
s("consi", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
|
||||
if cname then
|
||||
return sn(nil, {
|
||||
t(cname .. "("),
|
||||
i(1),
|
||||
t ")",
|
||||
n(2, " : "),
|
||||
i(2),
|
||||
t { " {", "\t" },
|
||||
i(3),
|
||||
t { "", "}" },
|
||||
})
|
||||
else
|
||||
return sn(nil, {
|
||||
i(1, "Class"),
|
||||
t "::",
|
||||
rep(1),
|
||||
t "(",
|
||||
i(2),
|
||||
t ")",
|
||||
n(3, " : "),
|
||||
i(3),
|
||||
t { " {", "\t" },
|
||||
i(4),
|
||||
t { "", "}" },
|
||||
})
|
||||
end
|
||||
end),
|
||||
}),
|
||||
s("cconsi", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
|
||||
if cname then
|
||||
return sn(nil, {
|
||||
t { cname .. "(" .. cname .. " const& other) {", "\t" },
|
||||
i(1),
|
||||
t { "", "}" },
|
||||
})
|
||||
else
|
||||
return sn(nil, {
|
||||
i(1, "Class"),
|
||||
t "::",
|
||||
l(l._1:match "([^<]*)", 1),
|
||||
t "(",
|
||||
l(l._1:match "([^<]*)", 1),
|
||||
t { " const& other) {", "\t" },
|
||||
i(2),
|
||||
t { "", "}" },
|
||||
})
|
||||
end
|
||||
end),
|
||||
}),
|
||||
s("mconsi", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
|
||||
if cname then
|
||||
return sn(nil, {
|
||||
t { cname .. "(" .. cname .. "&& other) noexcept {", "\t" },
|
||||
i(1),
|
||||
t { "", "}" },
|
||||
})
|
||||
else
|
||||
return sn(nil, {
|
||||
i(1, "Class"),
|
||||
t "::",
|
||||
l(l._1:match "([^<]*)", 1),
|
||||
t "(",
|
||||
l(l._1:match "([^<]*)", 1),
|
||||
t { "&& other) noexcept {", "\t" },
|
||||
i(2),
|
||||
t { "", "}" },
|
||||
})
|
||||
end
|
||||
end),
|
||||
}),
|
||||
s("cassi", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
|
||||
if cname then
|
||||
return sn(nil, {
|
||||
t { cname .. "& operator=(" .. cname .. " const& other) {", "\t" },
|
||||
i(1),
|
||||
t { "", "\treturn *this;", "}" },
|
||||
})
|
||||
else
|
||||
return sn(nil, {
|
||||
i(1, "Class"),
|
||||
t "& ",
|
||||
rep(1),
|
||||
t "::operator=(",
|
||||
l(l._1:match "([^<*])", 1),
|
||||
t { " const& other) {", "\t" },
|
||||
i(2),
|
||||
t { "", "\treturn *this;", "}" },
|
||||
})
|
||||
end
|
||||
end),
|
||||
}),
|
||||
s("massi", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
|
||||
if cname then
|
||||
return sn(nil, {
|
||||
t { cname .. "& operator=(" .. cname .. "&& other) noexcept {", "\t" },
|
||||
i(1),
|
||||
t { "", "\treturn *this;", "}" },
|
||||
})
|
||||
else
|
||||
return sn(nil, {
|
||||
i(1, "Class"),
|
||||
t "& ",
|
||||
rep(1),
|
||||
t "::operator=(",
|
||||
l(l._1:match "([^<]*)", 1),
|
||||
t { "&& other) noexcept {", "\t" },
|
||||
i(2),
|
||||
t { "", "\treturn *this;", "}" },
|
||||
})
|
||||
end
|
||||
end),
|
||||
}),
|
||||
s("desi", {
|
||||
d(1, function(_, snip)
|
||||
local cname = get_surrounding_class(tonumber(snip.env.TM_LINE_NUMBER))
|
||||
|
||||
if cname then
|
||||
return sn(nil, { t { "~" .. cname .. "() {", "\t" }, i(1), t { "", "}" } })
|
||||
else
|
||||
return sn(nil, {
|
||||
i(1, "Class"),
|
||||
t "::~",
|
||||
l(l._1:match "([^<]*)", 1),
|
||||
t { "() {", "\t" },
|
||||
i(2),
|
||||
t { "", "}" },
|
||||
})
|
||||
end
|
||||
end),
|
||||
}),
|
||||
|
||||
-- Other
|
||||
parse("ip", "${1:range}.begin(), $1.end()"),
|
||||
parse("print", "std::cout << $1 << '\\n';"),
|
||||
s("bind", {
|
||||
c(1, {
|
||||
sn(nil, { t "auto const& [", r(1, "bindings"), t "] = ", r(2, "value"), t ";" }),
|
||||
sn(nil, { t "auto&& [", r(1, "bindings"), t "] = ", r(2, "value"), t ";" }),
|
||||
}),
|
||||
}, { stored = { bindings = i(1, "bindings"), value = i(2, "value") } }),
|
||||
s("main", {
|
||||
t "int main(",
|
||||
c(1, {
|
||||
t "",
|
||||
t "int const argc, char const* const* const argv",
|
||||
}),
|
||||
t { ") {", "\t" },
|
||||
i(0),
|
||||
t { "", "}" },
|
||||
}),
|
||||
s("inc", {
|
||||
t "#include ",
|
||||
c(1, {
|
||||
sn(nil, { t "<", r(1, "header"), t ">" }),
|
||||
sn(nil, { t '"', r(1, "header"), t '"' }),
|
||||
}),
|
||||
}, { stored = { header = i(1, "header") } }),
|
||||
parse("cinit", "auto const $1 = [&] {\n\t$0\n}();"),
|
||||
})
|
341
lua/custom/snippets/lua/go.lua
Normal file
341
lua/custom/snippets/lua/go.lua
Normal file
|
@ -0,0 +1,341 @@
|
|||
-- Requires {{{
|
||||
local ls = require("luasnip")
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local rep = require("luasnip.extras").rep
|
||||
local util = require("settings.luasnip.util")
|
||||
local ai = require("luasnip.nodes.absolute_indexer")
|
||||
local partial = require("luasnip.extras").partial
|
||||
--}}}
|
||||
|
||||
-- Conditions {{{
|
||||
local function not_in_function()
|
||||
return not util.is_in_function()
|
||||
end
|
||||
|
||||
local in_test_func = {
|
||||
show_condition = util.is_in_test_function,
|
||||
condition = util.is_in_test_function,
|
||||
}
|
||||
|
||||
local in_test_file = {
|
||||
show_condition = util.is_in_test_file,
|
||||
condition = util.is_in_test_file,
|
||||
}
|
||||
|
||||
local in_func = {
|
||||
show_condition = util.is_in_function,
|
||||
condition = util.is_in_function,
|
||||
}
|
||||
|
||||
local not_in_func = {
|
||||
show_condition = not_in_function,
|
||||
condition = not_in_function,
|
||||
}
|
||||
--}}}
|
||||
|
||||
return {
|
||||
-- Main {{{
|
||||
ls.s(
|
||||
{ trig = "main", name = "Main", dscr = "Create a main function" },
|
||||
fmta("func main() {\n\t<>\n}", ls.i(0)),
|
||||
not_in_func
|
||||
), --}}}
|
||||
|
||||
-- If call error {{{
|
||||
ls.s(
|
||||
{ trig = "ifcall", name = "IF CALL", dscr = "Call a function and check the error" },
|
||||
fmt(
|
||||
[[
|
||||
{}, {} := {}({})
|
||||
if {} != nil {{
|
||||
return {}
|
||||
}}
|
||||
{}
|
||||
]],
|
||||
{
|
||||
ls.i(1, { "val" }),
|
||||
ls.i(2, { "err" }),
|
||||
ls.i(3, { "Func" }),
|
||||
ls.i(4),
|
||||
rep(2),
|
||||
ls.d(5, util.make_return_nodes, { 2 }),
|
||||
ls.i(0),
|
||||
}
|
||||
),
|
||||
in_func
|
||||
), --}}}
|
||||
|
||||
-- Function {{{
|
||||
ls.s(
|
||||
{ trig = "fn", name = "Function", dscr = "Create a function or a method" },
|
||||
fmt(
|
||||
[[
|
||||
// {} {}
|
||||
func {}{}({}) {} {{
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
rep(2),
|
||||
ls.i(5, "description"),
|
||||
ls.c(1, {
|
||||
ls.t(""),
|
||||
ls.sn(
|
||||
nil,
|
||||
fmt("({} {}) ", {
|
||||
ls.i(1, "r"),
|
||||
ls.i(2, "receiver"),
|
||||
})
|
||||
),
|
||||
}),
|
||||
ls.i(2, "Name"),
|
||||
ls.i(3),
|
||||
ls.c(4, {
|
||||
ls.i(1, "error"),
|
||||
ls.sn(
|
||||
nil,
|
||||
fmt("({}, {}) ", {
|
||||
ls.i(1, "ret"),
|
||||
ls.i(2, "error"),
|
||||
})
|
||||
),
|
||||
}),
|
||||
ls.i(0),
|
||||
}
|
||||
),
|
||||
not_in_func
|
||||
), --}}}
|
||||
|
||||
-- If error {{{
|
||||
ls.s(
|
||||
{ trig = "ife", name = "If error", dscr = "If error, return wrapped" },
|
||||
fmt("if {} != nil {{\n\treturn {}\n}}\n{}", {
|
||||
ls.i(1, "err"),
|
||||
ls.d(2, util.make_return_nodes, { 1 }),
|
||||
ls.i(0),
|
||||
}),
|
||||
in_func
|
||||
), --}}}
|
||||
|
||||
-- gRPC Error{{{
|
||||
ls.s(
|
||||
{ trig = "gerr", dscr = "Return an instrumented gRPC error" },
|
||||
fmt('internal.GrpcError({},\n\tcodes.{}, "{}", "{}", {})', {
|
||||
ls.i(1, "err"),
|
||||
ls.i(2, "Internal"),
|
||||
ls.i(3, "Description"),
|
||||
ls.i(4, "Field"),
|
||||
ls.i(5, "fields"),
|
||||
}),
|
||||
in_func
|
||||
), --}}}
|
||||
|
||||
-- Mockery {{{
|
||||
ls.s(
|
||||
{ trig = "mockery", name = "Mockery", dscr = "Create an interface for making mocks" },
|
||||
fmt(
|
||||
[[
|
||||
// {} mocks {} interface for testing purposes.
|
||||
//go:generate mockery --name {} --filename {}_mock.go
|
||||
type {} interface {{
|
||||
{}
|
||||
}}
|
||||
]],
|
||||
{
|
||||
rep(1),
|
||||
rep(2),
|
||||
rep(1),
|
||||
ls.f(function(args)
|
||||
return util.snake_case(args[1][1])
|
||||
end, { 1 }),
|
||||
ls.i(1, "Client"),
|
||||
ls.i(2, "pkg.Interface"),
|
||||
}
|
||||
)
|
||||
), --}}}
|
||||
|
||||
-- Nolint {{{
|
||||
ls.s(
|
||||
{ trig = "nolint", dscr = "ignore linter" },
|
||||
fmt([[// nolint:{} // {}]], {
|
||||
ls.i(1, "names"),
|
||||
ls.i(2, "explaination"),
|
||||
})
|
||||
), --}}}
|
||||
|
||||
-- Allocate Slices and Maps {{{
|
||||
ls.s(
|
||||
{ trig = "make", name = "Make", dscr = "Allocate map or slice" },
|
||||
fmt("{} {}= make({})\n{}", {
|
||||
ls.i(1, "name"),
|
||||
ls.i(2),
|
||||
ls.c(3, {
|
||||
fmt("[]{}, {}", { ls.i(1, "type"), ls.i(2, "len") }),
|
||||
fmt("[]{}, 0, {}", { ls.i(1, "type"), ls.i(2, "len") }),
|
||||
fmt("map[{}]{}, {}", { ls.i(1, "keys"), ls.i(2, "values"), ls.i(3, "len") }),
|
||||
}),
|
||||
ls.i(0),
|
||||
}),
|
||||
in_func
|
||||
), --}}}
|
||||
|
||||
-- Test Cases {{{
|
||||
ls.s(
|
||||
{ trig = "tcs", dscr = "create test cases for testing" },
|
||||
fmta(
|
||||
[[
|
||||
tcs := map[string]struct {
|
||||
<>
|
||||
} {
|
||||
// Test cases here
|
||||
}
|
||||
for name, tc := range tcs {
|
||||
tc := tc
|
||||
t.Run(name, func(t *testing.T) {
|
||||
<>
|
||||
})
|
||||
}
|
||||
]],
|
||||
{ ls.i(1), ls.i(2) }
|
||||
),
|
||||
in_test_func
|
||||
), --}}}
|
||||
|
||||
-- Go CMP {{{
|
||||
ls.s(
|
||||
{ trig = "gocmp", dscr = "cmp.Diff" },
|
||||
fmt(
|
||||
[[
|
||||
if diff := cmp.Diff({}, {}); diff != "" {{
|
||||
t.Errorf("(-want +got):\\n%s", diff)
|
||||
}}
|
||||
]],
|
||||
{
|
||||
ls.i(1, "want"),
|
||||
ls.i(2, "got"),
|
||||
}
|
||||
),
|
||||
in_test_func
|
||||
), --}}}
|
||||
|
||||
-- Create Mocks {{{
|
||||
ls.s(
|
||||
{ trig = "mock", name = "Mocks", dscr = "Create a mock with defering assertion" },
|
||||
fmt("{} := &mocks.{}{{}}\ndefer {}.AssertExpectations(t)\n{}", {
|
||||
ls.i(1, "m"),
|
||||
ls.i(2, "Mocked"),
|
||||
rep(1),
|
||||
ls.i(0),
|
||||
}),
|
||||
in_test_func
|
||||
), --}}}
|
||||
|
||||
-- Require NoError {{{
|
||||
ls.s(
|
||||
{ trig = "noerr", name = "Require No Error", dscr = "Add a require.NoError call" },
|
||||
ls.c(1, {
|
||||
ls.sn(nil, fmt("require.NoError(t, {})", { ls.i(1, "err") })),
|
||||
ls.sn(nil, fmt('require.NoError(t, {}, "{}")', { ls.i(1, "err"), ls.i(2) })),
|
||||
ls.sn(nil, fmt('require.NoErrorf(t, {}, "{}", {})', { ls.i(1, "err"), ls.i(2), ls.i(3) })),
|
||||
}),
|
||||
in_test_func
|
||||
), --}}}
|
||||
|
||||
-- Subtests {{{
|
||||
ls.s(
|
||||
{ trig = "Test", name = "Test/Subtest", dscr = "Create subtests" },
|
||||
fmta("func <>(t *testing.T) {\n<>\n}\n\n <>", {
|
||||
ls.i(1),
|
||||
ls.d(2, util.create_t_run, ai({ 1 })),
|
||||
ls.d(3, util.mirror_t_run_funcs, ai({ 2 })),
|
||||
}),
|
||||
in_test_file
|
||||
), --}}}
|
||||
|
||||
-- Stringer {{{
|
||||
ls.s(
|
||||
{ trig = "strigner", name = "Stringer", dscr = "Create a stringer go:generate" },
|
||||
fmt("//go:generate stringer -type={} -output={}_string.go", {
|
||||
ls.i(1, "Type"),
|
||||
partial(vim.fn.expand, "%:t:r"),
|
||||
})
|
||||
), --}}}
|
||||
|
||||
-- Query Database {{{
|
||||
ls.s(
|
||||
{ trig = "queryrows", name = "Query Rows", dscr = "Query rows from database" },
|
||||
fmta(
|
||||
[[
|
||||
const <> = `<>`
|
||||
<> := make([]<>, 0, <>)
|
||||
|
||||
<> := <>.Do(func() error {
|
||||
<>, <> := <>.Query(<>, <>, <>)
|
||||
if errors.Is(<>, pgx.ErrNoRows) {
|
||||
return &retry.StopError{Err: <>}
|
||||
}
|
||||
if <> != nil {
|
||||
return errors.Wrap(<>, "making query")
|
||||
}
|
||||
defer <>.Close()
|
||||
|
||||
<> = <>[:0]
|
||||
for <>.Next() {
|
||||
var <> <>
|
||||
<> := <>.Scan(<>)
|
||||
if <> != nil {
|
||||
return errors.Wrap(<>, "scanning row")
|
||||
}
|
||||
|
||||
<>
|
||||
<> = append(<>, <>)
|
||||
}
|
||||
|
||||
return errors.Wrap(<>.Err(), "iterating rows")
|
||||
})
|
||||
return <>, <>
|
||||
]],
|
||||
{
|
||||
ls.i(1, "query"),
|
||||
ls.i(2, "SELECT 1"),
|
||||
ls.i(3, "ret"),
|
||||
ls.i(4, "Type"),
|
||||
ls.i(5, "cap"),
|
||||
ls.i(6, "err"),
|
||||
ls.i(7, "retrier"),
|
||||
ls.i(8, "rows"),
|
||||
ls.i(9, "err"),
|
||||
ls.i(10, "db"),
|
||||
ls.i(11, "ctx"),
|
||||
rep(1), --query
|
||||
ls.i(12, "args"),
|
||||
rep(9), -- pgx.ErrNoRows
|
||||
rep(9), -- pgx.ErrNoRows
|
||||
rep(9), -- other errors
|
||||
rep(9), -- other errors
|
||||
rep(8), -- rows close
|
||||
rep(3), -- ret
|
||||
rep(3), -- ret
|
||||
rep(8), -- rows next
|
||||
ls.i(13, "doc"),
|
||||
rep(4), -- type
|
||||
ls.i(14, "err"),
|
||||
rep(8), -- rows
|
||||
ls.i(15, "&val"),
|
||||
rep(14), -- err
|
||||
rep(14), -- err
|
||||
ls.i(0),
|
||||
rep(3), -- ret
|
||||
rep(3), -- ret
|
||||
rep(13), -- doc
|
||||
rep(8), -- rows error
|
||||
rep(3), -- ret
|
||||
rep(6), -- error
|
||||
}
|
||||
)
|
||||
),
|
||||
-- }}}
|
||||
}
|
||||
|
||||
-- vim: fdm=marker fdl=0
|
89
lua/custom/snippets/lua/lua.lua
Normal file
89
lua/custom/snippets/lua/lua.lua
Normal file
|
@ -0,0 +1,89 @@
|
|||
-- local luasnip = require "luasnip"
|
||||
-- local ls = require "luasnip"
|
||||
-- local s = ls.snippet
|
||||
-- local sn = ls.snippet_node
|
||||
-- local isn = ls.indent_snippet_node
|
||||
-- local t = ls.text_node
|
||||
-- local i = ls.insert_node
|
||||
-- local f = ls.function_node
|
||||
-- local c = ls.choice_node
|
||||
-- local d = ls.dynamic_node
|
||||
-- local r = ls.restore_node
|
||||
-- local events = require "luasnip.util.events"
|
||||
-- local ai = require "luasnip.nodes.absolute_indexer"
|
||||
-- local extras = require "luasnip.extras"
|
||||
-- local l = extras.lambda
|
||||
-- local rep = extras.rep
|
||||
-- local p = extras.partial
|
||||
-- local m = extras.match
|
||||
-- local n = extras.nonempty
|
||||
-- local dl = extras.dynamic_lambda
|
||||
-- local fmt = require("luasnip.extras.fmt").fmt
|
||||
-- local fmta = require("luasnip.extras.fmt").fmta
|
||||
-- local conds = require "luasnip.extras.expand_conditions"
|
||||
-- local postfix = require("luasnip.extras.postfix").postfix
|
||||
-- local types = require "luasnip.util.types"
|
||||
-- local parse = require("luasnip.util.parser").parse_snippet
|
||||
-- local ms = ls.multi_snippet
|
||||
-- local k = require("luasnip.nodes.key_indexer").new_key
|
||||
--
|
||||
-- local calculate_comment_string = require("Comment.ft").calculate
|
||||
-- local utils = require "Comment.utils"
|
||||
--
|
||||
-- --- Get the comment string {beg,end} table
|
||||
-- ---@param ctype integer 1 for `line`-comment and 2 for `block`-comment
|
||||
-- ---@return table comment_strings {begcstring, endcstring}
|
||||
-- local get_cstring = function(ctype)
|
||||
-- -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`)
|
||||
-- local cstring = calculate_comment_string { ctype = ctype, range = utils.get_region() } or vim.bo.commentstring
|
||||
-- -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side
|
||||
-- local left, right = utils.unwrap_cstr(cstring)
|
||||
-- -- create a `{left, right}` table for it
|
||||
-- return { left, right }
|
||||
-- end
|
||||
--
|
||||
-- local function create_box(opts)
|
||||
-- local pl = opts.padding_length or 4
|
||||
-- local function pick_comment_start_and_end()
|
||||
-- -- because lua block comment is unlike other language's,
|
||||
-- -- so handle lua ctype
|
||||
-- local ctype = 2
|
||||
-- if vim.opt.ft:get() == "lua" then
|
||||
-- ctype = 1
|
||||
-- end
|
||||
-- local cs = get_cstring(ctype)[1]
|
||||
-- local ce = get_cstring(ctype)[2]
|
||||
-- if ce == "" or ce == nil then
|
||||
-- ce = cs
|
||||
-- end
|
||||
-- return cs, ce
|
||||
-- end
|
||||
-- return {
|
||||
-- -- top line
|
||||
-- f(function(args)
|
||||
-- local cs, ce = pick_comment_start_and_end()
|
||||
-- return cs .. string.rep(string.sub(cs, #cs, #cs), string.len(args[1][1]) + 2 * pl) .. ce
|
||||
-- end, { 1 }),
|
||||
-- t { "", "" },
|
||||
-- f(function()
|
||||
-- local cs = pick_comment_start_and_end()
|
||||
-- return cs .. string.rep(" ", pl)
|
||||
-- end),
|
||||
-- i(1, "box"),
|
||||
-- f(function()
|
||||
-- local cs, ce = pick_comment_start_and_end()
|
||||
-- return string.rep(" ", pl) .. ce
|
||||
-- end),
|
||||
-- t { "", "" },
|
||||
-- -- bottom line
|
||||
-- f(function(args)
|
||||
-- local cs, ce = pick_comment_start_and_end()
|
||||
-- return cs .. string.rep(string.sub(ce, 1, 1), string.len(args[1][1]) + 2 * pl) .. ce
|
||||
-- end, { 1 }),
|
||||
-- }
|
||||
-- end
|
||||
--
|
||||
-- return {
|
||||
-- s({ trig = "box" }, create_box { padding_length = 8 }),
|
||||
-- s({ trig = "bbox" }, create_box { padding_length = 20 }),
|
||||
-- }
|
13
lua/custom/snippets/lua/markdown.lua
Normal file
13
lua/custom/snippets/lua/markdown.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local ls = require "luasnip"
|
||||
|
||||
local s = ls.s
|
||||
local i = ls.insert_node
|
||||
local t = ls.text_node
|
||||
local c = ls.choice_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
-- local rep = require("luasnip.extras").rep
|
||||
|
||||
ls.add_snippets("markdown", {
|
||||
s("t", fmt("- [{}] {}", { c(2, { t " ", t "-", t "x" }), i(1, "task") })),
|
||||
})
|
||||
|
137
lua/custom/snippets/lua/php.lua
Normal file
137
lua/custom/snippets/lua/php.lua
Normal file
|
@ -0,0 +1,137 @@
|
|||
local q = require "vim.treesitter.query"
|
||||
|
||||
local ls = require "luasnip"
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require "luasnip.util.events"
|
||||
local ai = require "luasnip.nodes.absolute_indexer"
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local m = require("luasnip.extras").m
|
||||
local lambda = require("luasnip.extras").l
|
||||
local rep = require("luasnip.extras").rep
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
|
||||
local visibility_modifiers = {
|
||||
t "public",
|
||||
t "private",
|
||||
t "protected",
|
||||
}
|
||||
|
||||
local query_constructor_args = q.parse(
|
||||
"php",
|
||||
[[
|
||||
(method_declaration
|
||||
name: (name) @method_name (#eq? @method_name "__construct")
|
||||
parameters:
|
||||
(formal_parameters
|
||||
(simple_parameter name: (variable_name (name) @arg_name ))
|
||||
))
|
||||
]]
|
||||
)
|
||||
|
||||
return {
|
||||
s("myclass", {
|
||||
fmt(
|
||||
[[
|
||||
/**
|
||||
* {} {}
|
||||
*
|
||||
*/
|
||||
|
||||
{}
|
||||
|
||||
class {} {{
|
||||
|
||||
{}
|
||||
|
||||
{} function __construct(
|
||||
{}
|
||||
) {{
|
||||
{}
|
||||
|
||||
}}
|
||||
|
||||
}}
|
||||
]],
|
||||
{
|
||||
i(1, "Class description"),
|
||||
i(2, "Classname"),
|
||||
f(function(args, snip, user_arg)
|
||||
-- TODO: generate namespace using parent directories
|
||||
return "namespace " .. args[1][1] .. ";"
|
||||
end, { 2 }),
|
||||
rep(2),
|
||||
f(function(args, snip, user_arg)
|
||||
local parser = vim.treesitter.get_parser(0, "php")
|
||||
local syntax_tree = parser:parse()
|
||||
local root = syntax_tree[1]:root()
|
||||
|
||||
local text = ""
|
||||
local fields = { "" }
|
||||
|
||||
for _, match, _ in query_constructor_args:iter_matches(root, 0) do
|
||||
for id, node in pairs(match) do
|
||||
local name = query_constructor_args.captures[id]
|
||||
if name == "arg_name" then
|
||||
text = q.get_node_text(node, 0)
|
||||
fields[#fields + 1] = "private $_" .. text .. ";"
|
||||
end
|
||||
end
|
||||
end
|
||||
return fields
|
||||
end, 4),
|
||||
c(3, visibility_modifiers),
|
||||
i(4, "//Constructor parameters"),
|
||||
f(function()
|
||||
local fields = { "" }
|
||||
local parser = vim.treesitter.get_parser(0, "php")
|
||||
local syntax_tree = parser:parse()
|
||||
local root = syntax_tree[1]:root()
|
||||
|
||||
local text = ""
|
||||
local fields = { "" }
|
||||
|
||||
for _, match, _ in query_constructor_args:iter_matches(root, 0) do
|
||||
for id, node in pairs(match) do
|
||||
local name = query_constructor_args.captures[id]
|
||||
if name == "arg_name" then
|
||||
text = q.get_node_text(node, 0)
|
||||
fields[#fields + 1] = "$this->_" .. text .. "= $" .. text .. ";"
|
||||
end
|
||||
end
|
||||
end
|
||||
return fields
|
||||
end, { 4 }),
|
||||
}
|
||||
),
|
||||
}),
|
||||
s(
|
||||
{
|
||||
trig = "addmethod",
|
||||
},
|
||||
fmt(
|
||||
[[
|
||||
Cacca
|
||||
]],
|
||||
{}
|
||||
)
|
||||
),
|
||||
s(
|
||||
{
|
||||
trig = "addfield",
|
||||
},
|
||||
fmt(
|
||||
[[
|
||||
Cacca
|
||||
]],
|
||||
{}
|
||||
)
|
||||
),
|
||||
}, {}
|
96
lua/custom/snippets/lua/python.lua
Normal file
96
lua/custom/snippets/lua/python.lua
Normal file
|
@ -0,0 +1,96 @@
|
|||
local ls = require('luasnip')
|
||||
local s = ls.snippet
|
||||
local i = ls.insert_node
|
||||
local t = ls.text_node
|
||||
local c = ls.choice_node
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local fmt = require('luasnip.extras.fmt').fmt
|
||||
local types = require("luasnip.util.types")
|
||||
|
||||
local function node_with_virtual_text(pos, node, text)
|
||||
local nodes
|
||||
if node.type == types.textNode then
|
||||
node.pos = 2
|
||||
nodes = {i(1), node}
|
||||
else
|
||||
node.pos = 1
|
||||
nodes = {node}
|
||||
end
|
||||
return sn(pos, nodes, {
|
||||
node_ext_opts = {
|
||||
active = {
|
||||
-- override highlight here ("GruvboxOrange").
|
||||
virt_text = {{text, "GruvboxOrange"}}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
local function nodes_with_virtual_text(nodes, opts)
|
||||
if opts == nil then
|
||||
opts = {}
|
||||
end
|
||||
local new_nodes = {}
|
||||
for pos, node in ipairs(nodes) do
|
||||
if opts.texts[pos] ~= nil then
|
||||
node = node_with_virtual_text(pos, node, opts.texts[pos])
|
||||
end
|
||||
table.insert(new_nodes, node)
|
||||
end
|
||||
return new_nodes
|
||||
end
|
||||
|
||||
local function choice_text_node(pos, choices, opts)
|
||||
choices = nodes_with_virtual_text(choices, opts)
|
||||
return c(pos, choices, opts)
|
||||
end
|
||||
|
||||
local ct = choice_text_node
|
||||
|
||||
ls.add_snippets("python", {
|
||||
s('d', fmt([[
|
||||
def {func}({args}){ret}:
|
||||
{doc}{body}
|
||||
]], {
|
||||
func = i(1),
|
||||
args = i(2),
|
||||
ret = c(3, {
|
||||
t(''),
|
||||
sn(nil, {
|
||||
t(' -> '),
|
||||
i(1),
|
||||
}),
|
||||
}),
|
||||
doc = isn(4, {ct(1, {
|
||||
t(''),
|
||||
-- NOTE we need to surround the `fmt` with `sn` to make this work
|
||||
sn(1, fmt([[
|
||||
"""{desc}"""
|
||||
|
||||
]], {desc = i(1)})),
|
||||
sn(2, fmt([[
|
||||
"""{desc}
|
||||
|
||||
Args:
|
||||
{args}
|
||||
|
||||
Returns:
|
||||
{returns}
|
||||
"""
|
||||
|
||||
]], {
|
||||
desc = i(1),
|
||||
args = i(2), -- TODO should read from the args in the function
|
||||
returns = i(3),
|
||||
})),
|
||||
}, {
|
||||
texts = {
|
||||
"(no docstring)",
|
||||
"(single line docstring)",
|
||||
"(full docstring)",
|
||||
}
|
||||
})}, "$PARENT_INDENT\t"),
|
||||
body = i(0),
|
||||
}))
|
||||
})
|
117
lua/custom/snippets/lua/rust.lua
Normal file
117
lua/custom/snippets/lua/rust.lua
Normal file
|
@ -0,0 +1,117 @@
|
|||
local luasnip = require "luasnip"
|
||||
local ls = require "luasnip"
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local isn = ls.indent_snippet_node
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local r = ls.restore_node
|
||||
local events = require "luasnip.util.events"
|
||||
local ai = require "luasnip.nodes.absolute_indexer"
|
||||
local extras = require "luasnip.extras"
|
||||
local l = extras.lambda
|
||||
local rep = extras.rep
|
||||
local p = extras.partial
|
||||
local m = extras.match
|
||||
local n = extras.nonempty
|
||||
local dl = extras.dynamic_lambda
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local fmta = require("luasnip.extras.fmt").fmta
|
||||
local conds = require "luasnip.extras.expand_conditions"
|
||||
local postfix = require("luasnip.extras.postfix").postfix
|
||||
local types = require "luasnip.util.types"
|
||||
local parse = require("luasnip.util.parser").parse_snippet
|
||||
local ms = ls.multi_snippet
|
||||
local k = require("luasnip.nodes.key_indexer").new_key
|
||||
|
||||
luasnip.add_snippets("rust", {
|
||||
|
||||
s("derivedebug", t "#[derive(Debug)]"),
|
||||
s("deadcode", t "#[allow(dead_code)]"),
|
||||
s("allowfreedom", t "#![allow(clippy::disallowed_names, unused_variables, dead_code)]"),
|
||||
|
||||
s("clippypedantic", t "#![warn(clippy::all, clippy::pedantic)]"),
|
||||
|
||||
s(":turbofish", { t { "::<" }, i(0), t { ">" } }),
|
||||
|
||||
s("print", {
|
||||
-- t {'println!("'}, i(1), t {' {:?}", '}, i(0), t {');'}}),
|
||||
t { 'println!("' },
|
||||
i(1),
|
||||
t { " {" },
|
||||
i(0),
|
||||
t { ':?}");' },
|
||||
}),
|
||||
|
||||
s("for", {
|
||||
t { "for " },
|
||||
i(1),
|
||||
t { " in " },
|
||||
i(2),
|
||||
t { " {", "" },
|
||||
i(0),
|
||||
t { "}", "" },
|
||||
}),
|
||||
|
||||
s("struct", {
|
||||
t { "#[derive(Debug)]", "" },
|
||||
t { "struct " },
|
||||
i(1),
|
||||
t { " {", "" },
|
||||
i(0),
|
||||
t { "}", "" },
|
||||
}),
|
||||
|
||||
s("test", {
|
||||
t { "#[test]", "" },
|
||||
t { "fn " },
|
||||
i(1),
|
||||
t { "() {", "" },
|
||||
t { " assert" },
|
||||
i(0),
|
||||
t { "", "" },
|
||||
t { "}" },
|
||||
}),
|
||||
|
||||
s("testcfg", {
|
||||
t { "#[cfg(test)]", "" },
|
||||
t { "mod " },
|
||||
i(1),
|
||||
t { " {", "" },
|
||||
t { " #[test]", "" },
|
||||
t { " fn " },
|
||||
i(2),
|
||||
t { "() {", "" },
|
||||
t { " assert" },
|
||||
i(0),
|
||||
t { "", "" },
|
||||
t { " }", "" },
|
||||
t { "}" },
|
||||
}),
|
||||
|
||||
s("if", {
|
||||
t { "if " },
|
||||
i(1),
|
||||
t { " {", "" },
|
||||
i(0),
|
||||
t { "}" },
|
||||
}),
|
||||
|
||||
s("mo", {
|
||||
i(1, "macro"),
|
||||
t "!",
|
||||
c(2, {
|
||||
sn(nil, { t "(", r(1, "content"), t ")" }),
|
||||
sn(nil, { t "[", r(1, "content"), t "]" }),
|
||||
sn(nil, { t "{", r(1, "content"), t "}" }),
|
||||
}),
|
||||
}, {
|
||||
stored = {
|
||||
-- key passed to restoreNodes.
|
||||
["content"] = i(1, "/* content */"),
|
||||
},
|
||||
}),
|
||||
})
|
269
lua/custom/snippets/lua/typescript.lua
Normal file
269
lua/custom/snippets/lua/typescript.lua
Normal file
|
@ -0,0 +1,269 @@
|
|||
local success, ls = pcall(require, "luasnip")
|
||||
if not success then
|
||||
return
|
||||
end
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local i = ls.insert_node
|
||||
local t = ls.text_node
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local r = ls.restore_node
|
||||
local f = ls.function_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local types = require "luasnip.util.types"
|
||||
|
||||
---#Config
|
||||
ls.config.set_config {
|
||||
-- Edit the snippet even after I exit it
|
||||
history = true,
|
||||
-- Update snippet text in _real time_
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
enable_autosnippets = true,
|
||||
-- Show virtual text hints for node types
|
||||
ext_opts = {
|
||||
[types.insertNode] = {
|
||||
active = {
|
||||
virt_text = { { "●", "Operator" } },
|
||||
},
|
||||
},
|
||||
[types.choiceNode] = {
|
||||
active = {
|
||||
virt_text = { { "●", "Constant" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
-- load vscode style snippets from other plugins
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
---#Mappings
|
||||
-- Previous snippet region
|
||||
vim.keymap.set({ "i", "s" }, "<C-k>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
-- Expand snippet, or go to next snippet region
|
||||
vim.keymap.set({ "i", "s" }, "<C-j>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
-- Cycle "choices" for current snippet region
|
||||
vim.keymap.set({ "i", "s" }, "<C-l>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
||||
|
||||
-- DEBUG: reload snippets
|
||||
-- vim.keymap.set("n", "<leader><leader>s", function()
|
||||
-- ls.cleanup()
|
||||
-- vim.cmd("source ~/.config/nvim/lua/ag/plugin-conf/luasnip.lua")
|
||||
-- end)
|
||||
|
||||
--[[
|
||||
--#Snippets
|
||||
--]]
|
||||
---#Typescript
|
||||
local ts_function_fmt = [[
|
||||
{doc}
|
||||
{type} {async}{name}({params}): {ret} {{
|
||||
{body}
|
||||
}}
|
||||
]]
|
||||
local ts_function_snippet = function(type)
|
||||
return fmt(ts_function_fmt, {
|
||||
-- function is called every time the function parameters ({params} in `fmt`) are updated
|
||||
doc = d(1, function(args)
|
||||
-- params_str = "param1: string, param2: other string, @Param('param3') param3: string"
|
||||
local params_str = args[1][1]
|
||||
|
||||
local nodes = { t { "/**", " * " }, r(1, "description", i(nil)) }
|
||||
-- after `nodes`: [[
|
||||
-- /**
|
||||
-- * |
|
||||
-- ]]
|
||||
for _, param in ipairs(vim.split(params_str, ",", true)) do
|
||||
local name = param:match "([%a%d_-]+) ?:"
|
||||
if name then
|
||||
local str = " * @param " .. name
|
||||
table.insert(nodes, t { "", str })
|
||||
end
|
||||
end
|
||||
-- after inserting `params_str`: [[
|
||||
-- /**
|
||||
-- * inserted `description` here
|
||||
-- * @param param1
|
||||
-- * @param param2
|
||||
-- * @param param3
|
||||
-- ]]
|
||||
|
||||
-- use restore_node to remember choice as params are added
|
||||
local return_str = r(
|
||||
2,
|
||||
"return_choice",
|
||||
c(nil, {
|
||||
sn(nil, {
|
||||
t { "", " * @returns " },
|
||||
r(1, "return_description", i(nil)),
|
||||
}),
|
||||
t "",
|
||||
})
|
||||
)
|
||||
-- after return_str:
|
||||
-- choice 1: [[
|
||||
--
|
||||
-- /**
|
||||
-- * inserted `description` here
|
||||
-- * @param param1
|
||||
-- * @param param2
|
||||
-- * @param param3
|
||||
-- * @returns |
|
||||
-- ]]
|
||||
--
|
||||
-- choice 2: [[
|
||||
--
|
||||
-- /**
|
||||
-- * inserted `description` here
|
||||
-- * @param param1
|
||||
-- * @param param2
|
||||
-- * @param param3|
|
||||
-- ]]
|
||||
local end_comment = t { "", " */" }
|
||||
vim.list_extend(nodes, { return_str, end_comment })
|
||||
-- final: [[
|
||||
--
|
||||
-- /**
|
||||
-- * inserted `description` here
|
||||
-- * @param param1
|
||||
-- * @param param2
|
||||
-- * @param param3
|
||||
-- * @returns inserted `return_description` here
|
||||
-- */
|
||||
--
|
||||
-- OR
|
||||
--
|
||||
-- /**
|
||||
-- * inserted `description` here
|
||||
-- * @param param1
|
||||
-- * @param param2
|
||||
-- * @param param3
|
||||
-- */
|
||||
-- ]]
|
||||
return sn(nil, nodes)
|
||||
end, { 4 }),
|
||||
type = t(type),
|
||||
async = c(2, { t "async ", t "" }),
|
||||
name = i(3, "funcName"),
|
||||
params = i(4),
|
||||
ret = d(5, function(args)
|
||||
local async = string.match(args[1][1], "async")
|
||||
if async == nil then
|
||||
return sn(nil, {
|
||||
r(1, "return_type", i(nil, "void")),
|
||||
})
|
||||
end
|
||||
return sn(nil, {
|
||||
t "Promise<",
|
||||
r(1, "return_type", i(nil, "void")),
|
||||
t ">",
|
||||
})
|
||||
end, { 2 }),
|
||||
body = i(0),
|
||||
}, {
|
||||
stored = {
|
||||
["return_type"] = i(nil, "void"),
|
||||
["description"] = i(nil, "description"),
|
||||
["return_description"] = i(nil, ""),
|
||||
["return_choice"] = i(nil, ""),
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
local ts_loop_fmt = [[
|
||||
.{type}({async}({item}) => {{
|
||||
{body}
|
||||
}})
|
||||
]]
|
||||
local ts_loop_snippet = function(type)
|
||||
return fmt(ts_loop_fmt, {
|
||||
type = t(type),
|
||||
async = c(1, { t "", t "async " }),
|
||||
item = c(2, { i(1, "item"), sn(nil, { t "{ ", i(1, "field"), t " }" }) }),
|
||||
body = i(0),
|
||||
})
|
||||
end
|
||||
ls.add_snippets("typescript", {
|
||||
-- methods
|
||||
s("public", ts_function_snippet "public"),
|
||||
s("private", ts_function_snippet "private"),
|
||||
-- array methods
|
||||
s({ trig = ".map", wordTrig = false }, ts_loop_snippet "map"),
|
||||
s({ trig = ".filter", wordTrig = false }, ts_loop_snippet "filter"),
|
||||
s({ trig = ".forEach", wordTrig = false }, ts_loop_snippet "forEach"),
|
||||
s({ trig = ".find", wordTrig = false }, ts_loop_snippet "find"),
|
||||
s({ trig = ".some", wordTrig = false }, ts_loop_snippet "some"),
|
||||
s({ trig = ".every", wordTrig = false }, ts_loop_snippet "every"),
|
||||
-- tests
|
||||
s(
|
||||
"describe",
|
||||
fmt(
|
||||
[[
|
||||
describe('{suite}', () => {{
|
||||
{body}
|
||||
}});
|
||||
]],
|
||||
{
|
||||
suite = i(1, "function or module"),
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
s(
|
||||
"it",
|
||||
fmt(
|
||||
[[
|
||||
it('{test_case}', {async}() => {{
|
||||
{body}
|
||||
}});
|
||||
]],
|
||||
{
|
||||
test_case = i(1, "does something"),
|
||||
async = c(2, { t "async ", t "" }),
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
---#Vue
|
||||
ls.add_snippets("vue", {
|
||||
s(
|
||||
"defineComponent",
|
||||
fmt(
|
||||
[[
|
||||
defineComponent({{
|
||||
name: '{name}',
|
||||
{props}
|
||||
setup({props_arg}{ctx}) {{
|
||||
{body}
|
||||
}}
|
||||
}})
|
||||
]],
|
||||
{
|
||||
name = f(function(args, parent)
|
||||
local env = parent.snippet.env
|
||||
return env.TM_FILENAME:match "^(.+)%..+$"
|
||||
end, {}),
|
||||
props = c(1, { sn(nil, { t { "props: {", "" }, i(1), t { "", "}," } }), t "" }),
|
||||
props_arg = c(2, { t "props", t "" }),
|
||||
ctx = c(3, { t ", ctx", t "" }),
|
||||
body = i(0),
|
||||
}
|
||||
)
|
||||
),
|
||||
})
|
37
lua/custom/snippets/package.json
Normal file
37
lua/custom/snippets/package.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"name": "example-snippets",
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": [
|
||||
"all"
|
||||
],
|
||||
"path": "./all.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"python"
|
||||
],
|
||||
"path": "./python.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"lua"
|
||||
],
|
||||
"path": "./lua.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"cpp"
|
||||
],
|
||||
"path": "./cpp.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"rust"
|
||||
],
|
||||
"path": "./rust.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
0
lua/custom/snippets/python.json
Normal file
0
lua/custom/snippets/python.json
Normal file
0
lua/custom/snippets/rust.json
Normal file
0
lua/custom/snippets/rust.json
Normal file
288
lua/custom/snippets/snipmate/_.snippets
Normal file
288
lua/custom/snippets/snipmate/_.snippets
Normal file
|
@ -0,0 +1,288 @@
|
|||
# Global snippets
|
||||
|
||||
# (c) holds no legal value ;)
|
||||
snippet c)
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${1:`g:snips_author`}. All Rights Reserved.
|
||||
snippet date
|
||||
`strftime("%Y-%m-%d")`
|
||||
snippet ddate
|
||||
`strftime("%B %d, %Y")`
|
||||
snippet diso
|
||||
`strftime("%Y-%m-%dT%H:%M:%S")`
|
||||
snippet time
|
||||
`strftime("%H:%M")`
|
||||
snippet datetime
|
||||
`strftime("%Y-%m-%d %H:%M")`
|
||||
snippet lorem
|
||||
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
||||
snippet GPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet LGPL2
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet GPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet LGPL3
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet AGPL3
|
||||
${1:one line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
${0}
|
||||
snippet GMGPL linking exception
|
||||
As a special exception, if other files instantiate generics from
|
||||
this unit, or you link this unit with other files to produce an
|
||||
executable, this unit does not by itself cause the resulting
|
||||
executable to be covered by the GNU General Public License.
|
||||
This exception does not however invalidate any other reasons why the
|
||||
executable file might be covered by the GNU Public License.
|
||||
|
||||
${0}
|
||||
snippet BSD2
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation
|
||||
are those of the authors and should not be interpreted as representing
|
||||
official policies, either expressed or implied, of $2.
|
||||
${0}
|
||||
snippet BSD3
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the ${3:organization} nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
${0}
|
||||
snippet BSD4
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. All advertising materials mentioning features or use of this software
|
||||
must display the following acknowledgement:
|
||||
This product includes software developed by the ${3:organization}.
|
||||
4. Neither the name of the $3 nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY $2 ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL $2 BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
${0}
|
||||
snippet MIT
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
${0}
|
||||
snippet APACHE
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
${0}
|
||||
snippet BEERWARE
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
Licensed under the "THE BEER-WARE LICENSE" (Revision 42):
|
||||
$2 wrote this file. As long as you retain this notice you
|
||||
can do whatever you want with this stuff. If we meet some day, and you think
|
||||
this stuff is worth it, you can buy me a beer or coffee in return
|
||||
${0}
|
||||
snippet WTFPL
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
Version 2, December 2004
|
||||
|
||||
Copyright `strftime("%Y")` ${0:`g:snips_author`}
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim or modified
|
||||
copies of this license document, and changing it is allowed as long
|
||||
as the name is changed.
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||
|
||||
${0}
|
||||
snippet MPL2
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
${0}
|
||||
snippet AGPL
|
||||
${1:One line to give the program's name and a brief description.}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")` ${2:`g:snips_author`}
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
published by the Free Software Foundation, either version 3 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
snippet ISC
|
||||
${1:one line to give the program's name and a brief description}
|
||||
Copyright `&enc[:2] == "utf" ? "©" : "(c)"` `strftime("%Y")`, ${2:`g:snips_author`}
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
${0}
|
152
lua/custom/snippets/snipmate/actionscript.snippets
Normal file
152
lua/custom/snippets/snipmate/actionscript.snippets
Normal file
|
@ -0,0 +1,152 @@
|
|||
snippet main
|
||||
package {
|
||||
import flash.display.*;
|
||||
import flash.Events.*;
|
||||
|
||||
public class Main extends Sprite {
|
||||
public function Main ( ) {
|
||||
trace("start");
|
||||
stage.scaleMode = StageScaleMode.NO_SCALE;
|
||||
stage.addEventListener(Event.RESIZE, resizeListener);
|
||||
}
|
||||
|
||||
private function resizeListener (e:Event):void {
|
||||
trace("The application window changed size!");
|
||||
trace("New width: " + stage.stageWidth);
|
||||
trace("New height: " + stage.stageHeight);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
snippet class
|
||||
${1:public|internal} class ${2:name} ${0:extends } {
|
||||
public function $2 ( ) {
|
||||
("start");
|
||||
}
|
||||
}
|
||||
snippet all
|
||||
package name {
|
||||
|
||||
${1:public|internal|final} class ${2:name} ${0:extends } {
|
||||
private|public| static const FOO = "abc";
|
||||
private|public| static var BAR = "abc";
|
||||
|
||||
// class initializer - no JIT !! one time setup
|
||||
if Cababilities.os == "Linux|MacOS" {
|
||||
FOO = "other";
|
||||
}
|
||||
|
||||
// constructor:
|
||||
public function $2 ( ){
|
||||
super2();
|
||||
trace("start");
|
||||
}
|
||||
public function name (a, b...){
|
||||
super.name(..);
|
||||
lable:break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function A(){
|
||||
// A can only be accessed within this file
|
||||
}
|
||||
snippet switch
|
||||
switch(${1}){
|
||||
case ${2}:
|
||||
${0}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
snippet case
|
||||
case ${1}:
|
||||
${0}
|
||||
break;
|
||||
snippet package
|
||||
package ${1:package}{
|
||||
${0}
|
||||
}
|
||||
snippet wh
|
||||
while ${1:cond}{
|
||||
${0}
|
||||
}
|
||||
snippet do
|
||||
do {
|
||||
${0}
|
||||
} while (${1:cond})
|
||||
snippet for enumerate names
|
||||
for (${1:var} in ${2:object}){
|
||||
${0}
|
||||
}
|
||||
snippet for enumerate values
|
||||
for each (${1:var} in ${2:object}){
|
||||
${0}
|
||||
}
|
||||
snippet get_set
|
||||
function get ${1:name} {
|
||||
return ${2}
|
||||
}
|
||||
function set $1 (newValue) {
|
||||
${0}
|
||||
}
|
||||
snippet interface
|
||||
interface name {
|
||||
function method(${1}):${0:returntype};
|
||||
}
|
||||
snippet try
|
||||
try {
|
||||
${1:${VISUAL}}
|
||||
} catch (error:ErrorType) {
|
||||
${2}
|
||||
} finally {
|
||||
${0}
|
||||
}
|
||||
# For Loop (same as c.snippet)
|
||||
snippet for for (..) {..}
|
||||
for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${0}
|
||||
}
|
||||
# Custom For Loop
|
||||
snippet forr
|
||||
for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${0}
|
||||
}
|
||||
# If Condition
|
||||
snippet if
|
||||
if ($1) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet el
|
||||
else {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# Ternary conditional
|
||||
snippet t Ternary: `condition ? true : false`
|
||||
$1 ? $2 : $0
|
||||
snippet fun
|
||||
function ${1:function_name}(${2})${3}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# FlxSprite (usefull when using the flixel library)
|
||||
snippet FlxSprite
|
||||
package
|
||||
{
|
||||
import org.flixel.*
|
||||
|
||||
public class ${1:ClassName} extends ${2:FlxSprite}
|
||||
{
|
||||
public function $1(${3: X:Number, Y:Number}):void
|
||||
{
|
||||
super(X,Y);
|
||||
${4}
|
||||
}
|
||||
|
||||
override public function update():void
|
||||
{
|
||||
super.update();
|
||||
${0}
|
||||
}
|
||||
}
|
||||
}
|
217
lua/custom/snippets/snipmate/ada.snippets
Normal file
217
lua/custom/snippets/snipmate/ada.snippets
Normal file
|
@ -0,0 +1,217 @@
|
|||
snippet wi with
|
||||
with ${1};${0}
|
||||
|
||||
snippet pac package
|
||||
package ${1} is
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet pacb package body
|
||||
package body ${1} is
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet ent entry ... when
|
||||
entry ${1}(${2}) when ${3} is
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet task task
|
||||
task ${1} is
|
||||
entry ${0}
|
||||
end $1;
|
||||
|
||||
snippet taskb task body
|
||||
task body ${1} is
|
||||
${2}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet acc accept
|
||||
accept ${1}(${2}) do
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet prot protected type
|
||||
protected type ${1}(${2}) is
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet prob protected body
|
||||
protected body ${1} is
|
||||
${2}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet gen generic type
|
||||
generic
|
||||
type ${1} is ${2};${0}
|
||||
|
||||
snippet ty type
|
||||
type ${1} is ${2};${0}
|
||||
|
||||
snippet tyd type with default value
|
||||
type ${1} is ${2}
|
||||
with Default_Value => ${3};${0}
|
||||
|
||||
snippet subty subtype
|
||||
subtype ${1} is ${2};${0}
|
||||
|
||||
snippet dec declare block
|
||||
declare
|
||||
${1}
|
||||
begin
|
||||
${0}
|
||||
end;
|
||||
|
||||
snippet decn declare named block
|
||||
${1}:
|
||||
declare
|
||||
${2}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet ifex if expression
|
||||
if ${1} then ${2} else ${0}
|
||||
|
||||
snippet casex case expression
|
||||
case ${1} is
|
||||
when ${2} => ${3},${0}
|
||||
|
||||
snippet fora for all
|
||||
for all ${1} ${2:in} ${3} => ${0}
|
||||
|
||||
snippet fors for some
|
||||
for some ${1} ${2:in} ${3} => ${0}
|
||||
|
||||
snippet if if
|
||||
if ${1} then
|
||||
${0:${VISUAL}}
|
||||
end if;
|
||||
|
||||
snippet ife if ... else
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end if;
|
||||
|
||||
snippet el else
|
||||
else
|
||||
${0:${VISUAL}}
|
||||
|
||||
snippet eif elsif
|
||||
elsif ${1} then
|
||||
${0}
|
||||
|
||||
snippet wh while
|
||||
while ${1} loop
|
||||
${0:${VISUAL}}
|
||||
end loop;
|
||||
|
||||
snippet nwh named while
|
||||
${1}:
|
||||
while ${2} loop
|
||||
${0:${VISUAL}}
|
||||
end loop $1;
|
||||
|
||||
snippet for for
|
||||
for ${1:I} in ${2} loop
|
||||
${0}
|
||||
end loop;
|
||||
|
||||
snippet fore for each
|
||||
for ${1} of ${2} loop
|
||||
${0}
|
||||
end loop;
|
||||
|
||||
snippet nfor named for
|
||||
${1}:
|
||||
for ${2:I} in ${3} loop
|
||||
${0}
|
||||
end loop $1;
|
||||
|
||||
snippet nfore named for each
|
||||
${1}:
|
||||
for ${2} of ${3} loop
|
||||
${0}
|
||||
end loop $1;
|
||||
|
||||
snippet proc procedure
|
||||
procedure ${1}(${2}) is
|
||||
${3}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet procd procedure declaration
|
||||
procedure ${1};${0}
|
||||
|
||||
snippet fun function
|
||||
function ${1}(${2}) return ${3} is
|
||||
${4}
|
||||
begin
|
||||
${0}
|
||||
end $1;
|
||||
|
||||
snippet fune expression function
|
||||
function ${1} return ${2} is
|
||||
(${3});${0}
|
||||
|
||||
snippet fund function declaration
|
||||
function ${1} return ${2};${0}
|
||||
|
||||
snippet ret extended return
|
||||
return ${1} do
|
||||
${0}
|
||||
end return;
|
||||
|
||||
snippet rec record
|
||||
record
|
||||
${0}
|
||||
end record;
|
||||
|
||||
snippet case case
|
||||
case ${1} is
|
||||
when ${2} => ${3};${0}
|
||||
end case;
|
||||
|
||||
snippet whe when
|
||||
when ${1} => ${2};${0}
|
||||
|
||||
snippet wheo when others
|
||||
when others => ${1};${0}
|
||||
|
||||
snippet lo loop
|
||||
loop
|
||||
${0}
|
||||
end loop;
|
||||
|
||||
snippet nlo named loop
|
||||
${1}:
|
||||
loop
|
||||
${0}
|
||||
end loop $1;
|
||||
|
||||
snippet ex exit when
|
||||
exit when ${1};${0}
|
||||
|
||||
snippet put Ada.Text_IO.Put
|
||||
Ada.Text_IO.Put(${1});${0}
|
||||
|
||||
snippet putl Ada.Text_IO.Put_Line
|
||||
Ada.Text_IO.Put_Line(${1});${0}
|
||||
|
||||
snippet get Ada.Text_IO.Get
|
||||
Ada.Text_IO.Get(${1});${0}
|
||||
|
||||
snippet getl Ada.Text_IO.Get_Line
|
||||
Ada.Text_IO.Get_Line(${1});${0}
|
||||
|
||||
snippet newline Ada.Text_IO.New_Line
|
||||
Ada.Text_IO.New_Line(${1:1});${0}
|
||||
|
1
lua/custom/snippets/snipmate/all.snippets
Normal file
1
lua/custom/snippets/snipmate/all.snippets
Normal file
|
@ -0,0 +1 @@
|
|||
extends _
|
38
lua/custom/snippets/snipmate/alpaca.snippets
Normal file
38
lua/custom/snippets/snipmate/alpaca.snippets
Normal file
|
@ -0,0 +1,38 @@
|
|||
snippet mod
|
||||
module ${0:`expand('%:t:r')`}
|
||||
snippet imp
|
||||
import ${0:http}
|
||||
snippet impt
|
||||
import type ${0:option.option}
|
||||
snippet exp
|
||||
export ${0}
|
||||
snippet expt
|
||||
export ${0}
|
||||
snippet fn
|
||||
val ${1:fn} ${2}: fn ${3:'a} -> ${4:'a}
|
||||
let $1 ${5} =
|
||||
${0:${VISUAL}}
|
||||
snippet mat
|
||||
match ${1} with
|
||||
| ${2} -> ${0}
|
||||
snippet -
|
||||
| ${1} -> ${0}
|
||||
snippet let
|
||||
let ${1} = ${2:${VISUAL}} in
|
||||
${0}
|
||||
snippet letf
|
||||
let ${1} =
|
||||
${0:${VISUAL}}
|
||||
snippet ty
|
||||
type ${1:msg}
|
||||
= ${0}
|
||||
snippet test
|
||||
test "${1}" =
|
||||
${0:${VISUAL}}
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet ae
|
||||
assert.equal ${0}
|
35
lua/custom/snippets/snipmate/apache.snippets
Normal file
35
lua/custom/snippets/snipmate/apache.snippets
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Snippets for code blocks used oftenly in Apache files.
|
||||
# <Directory>
|
||||
snippet dir
|
||||
<Directory ${1:/}>
|
||||
DirectoryIndex ${0:index.html}
|
||||
Order Deny,Allow
|
||||
Deny from All
|
||||
</Directory>
|
||||
# <FilesMatch>
|
||||
snippet filesmatch
|
||||
<FilesMatch "${1:regex}">
|
||||
${0:${VISUAL}}
|
||||
</FilesMatch>
|
||||
# <IfModule>
|
||||
snippet ifmodule
|
||||
<IfModule ${1:mod_example.c}>
|
||||
${0:${VISUAL}}
|
||||
</IfModule>
|
||||
# <LimitExcept>
|
||||
snippet limitexcept
|
||||
<LimitExcept ${1:POST GET}>
|
||||
${0:${VISUAL}}
|
||||
</LimitExcept>
|
||||
# <Proxy>
|
||||
snippet proxy
|
||||
<Proxy ${1:*}>
|
||||
${0:${VISUAL}}
|
||||
</Proxy>
|
||||
# <VirtualHost>
|
||||
snippet virtualhost
|
||||
<VirtualHost ${1:*}:${2:80}>
|
||||
ServerAdmin ${3:webmaster@example.com}
|
||||
DocumentRoot ${4:/www/example.com}
|
||||
ServerName ${0:www.example.com}
|
||||
</VirtualHost>
|
124
lua/custom/snippets/snipmate/arduino.snippets
Normal file
124
lua/custom/snippets/snipmate/arduino.snippets
Normal file
|
@ -0,0 +1,124 @@
|
|||
snippet setup
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(${1:9600});
|
||||
${2}
|
||||
}
|
||||
|
||||
snippet loop
|
||||
void loop()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet inc
|
||||
#include <${1}.h>
|
||||
|
||||
snippet def
|
||||
#define ${1}
|
||||
|
||||
# if
|
||||
snippet if
|
||||
if ($1) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if ($1) {
|
||||
${2}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if ($1) ${2};
|
||||
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
default:
|
||||
${6}
|
||||
}
|
||||
|
||||
snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
|
||||
# for
|
||||
snippet for
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while ($1) {
|
||||
${2}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${2}
|
||||
} while ($1);
|
||||
##
|
||||
## Functions
|
||||
# function definition
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
|
||||
## IO
|
||||
# pinMode OUTPUT
|
||||
snippet pinout
|
||||
pinMode(${1}, OUTPUT);
|
||||
# pinMode INPUT
|
||||
snippet pinin
|
||||
pinMode(${1}, INPUT);
|
||||
# digitalWrite HIGH
|
||||
snippet dwHigh
|
||||
digitalWrite(${1}, HIGH);
|
||||
# digitalWrite LOW
|
||||
snippet dwLow
|
||||
digitalWrite(${1}, LOW);
|
||||
# digitalRead
|
||||
snippet dr
|
||||
digitalRead(${1});
|
||||
# analogRead
|
||||
snippet ar
|
||||
analogRead(${1});
|
||||
# analogWrite
|
||||
snippet aw
|
||||
analogWrite(${1});
|
||||
# serialRead
|
||||
snippet sr
|
||||
Serial.read();
|
||||
# serialWrite
|
||||
snippet sw
|
||||
Serial.write();
|
||||
# serial.print
|
||||
snippet sp
|
||||
Serial.print(${1});
|
||||
# serial.println
|
||||
snippet sl
|
||||
Serial.println(${1});
|
||||
|
||||
|
||||
# delay
|
||||
snippet dl
|
||||
delay(${1});
|
||||
# millis
|
||||
snippet ml
|
||||
millis();
|
195
lua/custom/snippets/snipmate/asm.snippets
Normal file
195
lua/custom/snippets/snipmate/asm.snippets
Normal file
|
@ -0,0 +1,195 @@
|
|||
snippet scode Start basic code for assembly
|
||||
.data
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
.global main
|
||||
|
||||
|
||||
main:
|
||||
|
||||
|
||||
snippet scodes Start basic code for assembly with _start label
|
||||
.data
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
.globl _start
|
||||
|
||||
|
||||
_start:
|
||||
|
||||
|
||||
snippet lo Long
|
||||
$1: .long $2
|
||||
snippet wo Word
|
||||
$1: .word $2
|
||||
snippet by Byte
|
||||
$1: .byte $2
|
||||
snippet sp Space
|
||||
$1: .space $2
|
||||
snippet ai Ascii
|
||||
$1: .ascii "$2"
|
||||
snippet az Asciz
|
||||
$1: .asciz "$2"
|
||||
snippet ze Zero
|
||||
$1: .zero "$2"
|
||||
snippet qu Quad
|
||||
$1: .quad "$2"
|
||||
snippet si Single
|
||||
$1: .single "$2"
|
||||
snippet do Double
|
||||
$1: .single "$2"
|
||||
snippet fl Float
|
||||
$1: .single "$2"
|
||||
snippet oc Octa
|
||||
$1: .single "$2"
|
||||
snippet sh Short
|
||||
$1: .single "$2"
|
||||
snippet exit0 Exit without error
|
||||
movl \$1, %eax
|
||||
xorl %ebx, %ebx
|
||||
int \$0x80
|
||||
|
||||
snippet exit Exit with error
|
||||
mov \$1, %eax
|
||||
mov $1, %ebx
|
||||
int \$0x80
|
||||
|
||||
snippet readfstdin Read fixed length text from stdin
|
||||
mov \$3, %eax
|
||||
mov \$2, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet writestdout Write text to stdout
|
||||
mov \$4, %eax
|
||||
mov \$1, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet writestderr Write text to stderr
|
||||
mov \$4, %eax
|
||||
mov \$2, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet * Multiplication
|
||||
mov $1, %eax
|
||||
mul $2
|
||||
|
||||
snippet / Division
|
||||
mov $1, %eax
|
||||
div $2
|
||||
|
||||
snippet jmpl Conditional lower jump
|
||||
cmp $1, $2
|
||||
jl $3
|
||||
|
||||
snippet jmple Conditional lower or equal jump
|
||||
cmp $1, $2
|
||||
jle $3
|
||||
|
||||
snippet jmpe Conditional equal jump
|
||||
cmp $1, $2
|
||||
je $3
|
||||
|
||||
snippet jmpn Conditional not equal jump
|
||||
cmp $1, $2
|
||||
jn $3
|
||||
|
||||
snippet jmpg Conditional greater jump
|
||||
cmp $1, $2
|
||||
jg $3
|
||||
|
||||
snippet jmpge Conditional greater or equal jump
|
||||
cmp $1, $2
|
||||
je $3
|
||||
|
||||
snippet loopn Loop n times
|
||||
mov $1, %ecx
|
||||
|
||||
et_for:
|
||||
$2
|
||||
|
||||
loop et_for
|
||||
|
||||
snippet loopnn Loop n-1 times
|
||||
mov $1, %ecx
|
||||
dec %ecx
|
||||
|
||||
et_for:
|
||||
$2
|
||||
|
||||
loop et_for
|
||||
|
||||
snippet loopv Loop through a vector
|
||||
lea $1, %edi
|
||||
xor %ecx, %ecx
|
||||
|
||||
et_for:
|
||||
cmp %ecx, $2
|
||||
je $3
|
||||
|
||||
$4
|
||||
|
||||
inc %ecx
|
||||
jmp et_for
|
||||
|
||||
snippet mul Multiply
|
||||
xor %edx, %edx
|
||||
mov $1, %eax
|
||||
mul $2
|
||||
snippet mul64 Multiply numbers greater than 2^32
|
||||
mov $1, %edx
|
||||
mov $2, %eax
|
||||
mul $3
|
||||
snippet div Divide
|
||||
xor %edx, %edx
|
||||
mov $1, %eax
|
||||
div $2
|
||||
snippet div64 Divide numbers greater than 2^32
|
||||
mov $1, %edx
|
||||
mov $2, %eax
|
||||
div $3
|
||||
snippet pr Call printf
|
||||
pushl $1
|
||||
call printf
|
||||
popl $2
|
||||
snippet sc Call scanf
|
||||
pushl $1
|
||||
call scanf
|
||||
popl $2
|
||||
snippet mindex Current index from a matrix
|
||||
xor %edx, %edx
|
||||
movl $1, %eax
|
||||
mull $2
|
||||
addl $3, %eax
|
||||
snippet ffl Call fflush
|
||||
pushl \$0
|
||||
call fflush
|
||||
popl $1
|
||||
snippet at Call atoi
|
||||
pushl $1
|
||||
call atoi
|
||||
popl $2
|
||||
snippet len Call strlen
|
||||
pushl $1
|
||||
call strlen
|
||||
popl $2
|
||||
snippet proc Basic procedure
|
||||
$1:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
|
||||
$2
|
||||
|
||||
popl %ebp
|
||||
ret
|
66
lua/custom/snippets/snipmate/autoit.snippets
Normal file
66
lua/custom/snippets/snipmate/autoit.snippets
Normal file
|
@ -0,0 +1,66 @@
|
|||
snippet if
|
||||
If $1 Then
|
||||
${0:; True code}
|
||||
EndIf
|
||||
snippet el
|
||||
Else
|
||||
${0}
|
||||
snippet eif
|
||||
ElseIf $1 Then
|
||||
${0:; True code}
|
||||
# If/Else block
|
||||
snippet ife
|
||||
If $1 Then
|
||||
${2:; True code}
|
||||
Else
|
||||
${0:; Else code}
|
||||
EndIf
|
||||
# If/ElseIf/Else block - because there is eif this is not really neccessary
|
||||
snippet ifelif
|
||||
If ${1:condition 1} Then
|
||||
${2:; True code}
|
||||
ElseIf ${3:condition 2} Then
|
||||
${4:; True code}
|
||||
Else
|
||||
${0:; Else code}
|
||||
EndIf
|
||||
# Switch block
|
||||
snippet switch
|
||||
Switch ($1)
|
||||
Case ${2:case1}:
|
||||
${3:; Case 1 code}
|
||||
Case Else:
|
||||
${0:; Else code}
|
||||
EndSwitch
|
||||
# Select block
|
||||
snippet select
|
||||
Select ($1)
|
||||
Case ${2:case1}:
|
||||
${3:; Case 1 code}
|
||||
Case Else:
|
||||
${0:; Else code}
|
||||
EndSelect
|
||||
# While loop
|
||||
snippet wh
|
||||
While ($1)
|
||||
${0:; code...}
|
||||
WEnd
|
||||
# For loop
|
||||
snippet for
|
||||
For ${1:n} = ${3:1} to ${2:count}
|
||||
${0:; code...}
|
||||
Next
|
||||
# New Function
|
||||
snippet func
|
||||
Func ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
|
||||
${0:Return}
|
||||
EndFunc
|
||||
# Message box
|
||||
snippet msg
|
||||
MsgBox(${0:MsgType}, ${1:"Title"}, ${2:"Message Text"})
|
||||
# Debug Message
|
||||
snippet debug
|
||||
MsgBox(0, "Debug", ${0:"Debug Message"})
|
||||
# Show Variable Debug Message
|
||||
snippet showvar
|
||||
MsgBox(0, "${0:VarName}", $1)
|
82
lua/custom/snippets/snipmate/awk.snippets
Normal file
82
lua/custom/snippets/snipmate/awk.snippets
Normal file
|
@ -0,0 +1,82 @@
|
|||
# cannot use /usr/bin/env because it does not support parameters (as -f)
|
||||
snippet #! #!/usr/bin/awk -f
|
||||
#!/usr/bin/awk -f
|
||||
# @include is a gawk extension
|
||||
snippet inc @include
|
||||
@include "${1}"${0}
|
||||
# @load is a gawk extension
|
||||
snippet loa @load
|
||||
@load "${1}"${0}
|
||||
snippet beg BEGIN { ... }
|
||||
BEGIN {
|
||||
${0}
|
||||
}
|
||||
# BEGINFILE is a gawk extension
|
||||
snippet begf BEGINFILE { ... }
|
||||
BEGINFILE {
|
||||
${0}
|
||||
}
|
||||
snippet end END { ... }
|
||||
END {
|
||||
${0}
|
||||
}
|
||||
# ENDFILE is a gawk extension
|
||||
snippet endf ENDFILE { ... }
|
||||
ENDFILE {
|
||||
${0}
|
||||
}
|
||||
snippet pri print
|
||||
print ${1:"${2}"}${0}
|
||||
snippet printf printf
|
||||
printf("${1:%s}\n", ${2})${0}
|
||||
snippet ign IGNORECASE
|
||||
IGNORECASE = ${1:1}
|
||||
snippet if if {...}
|
||||
if (${1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife if ... else ...
|
||||
if (${1}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
snippet eif else if ...
|
||||
else if (${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet el else {...}
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
snippet wh while
|
||||
while (${1}) {
|
||||
${2}
|
||||
}
|
||||
snippet do do ... while
|
||||
do {
|
||||
${0}
|
||||
} while (${1})
|
||||
snippet for for
|
||||
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
|
||||
${0}
|
||||
}
|
||||
snippet fore for each
|
||||
for (${1:i} in ${2:array}) {
|
||||
${0}
|
||||
}
|
||||
# the switch is a gawk extension
|
||||
snippet sw switch
|
||||
switch (${1}) {
|
||||
case ${2}:
|
||||
${3}
|
||||
break
|
||||
default:
|
||||
${0}
|
||||
break
|
||||
}
|
||||
# the switch is a gawk extension
|
||||
snippet case case
|
||||
case ${1}:
|
||||
${0}
|
||||
break
|
25
lua/custom/snippets/snipmate/bash.snippets
Normal file
25
lua/custom/snippets/snipmate/bash.snippets
Normal file
|
@ -0,0 +1,25 @@
|
|||
extends sh
|
||||
|
||||
# Shebang
|
||||
snippet #!
|
||||
#!/usr/bin/env bash
|
||||
|
||||
snippet s#!
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
snippet if
|
||||
if [[ $1 ]]; then
|
||||
${0:${VISUAL}}
|
||||
fi
|
||||
snippet elif
|
||||
elif [[ $1 ]]; then
|
||||
${0:${VISUAL}}
|
||||
snippet wh
|
||||
while [[ $1 ]]; do
|
||||
${0:${VISUAL}}
|
||||
done
|
||||
snippet until
|
||||
until [[ $1 ]]; do
|
||||
${0:${VISUAL}}
|
||||
done
|
394
lua/custom/snippets/snipmate/c.snippets
Normal file
394
lua/custom/snippets/snipmate/c.snippets
Normal file
|
@ -0,0 +1,394 @@
|
|||
## Main
|
||||
# main
|
||||
snippet main
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# main(void)
|
||||
snippet mainn
|
||||
int main(void)
|
||||
{
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet inc
|
||||
#include <${1:stdio}.h>
|
||||
$0
|
||||
# #include "..."
|
||||
snippet Inc
|
||||
#include "${1:`vim_snippets#Filename("$1.h")`}"
|
||||
$0
|
||||
# ifndef...define...endif
|
||||
snippet ndef
|
||||
#ifndef $1
|
||||
#define ${1:SYMBOL} ${2:value}
|
||||
#endif /* ifndef $1 */
|
||||
# define
|
||||
snippet def
|
||||
#define
|
||||
# ifdef...endif
|
||||
snippet ifdef
|
||||
#ifdef ${1:FOO}
|
||||
${2:#define }
|
||||
#endif
|
||||
# if
|
||||
snippet #if
|
||||
#if ${1:FOO}
|
||||
${0:${VISUAL}}
|
||||
#endif
|
||||
# header include guard
|
||||
snippet once
|
||||
#ifndef ${1:`toupper(vim_snippets#Filename('$1_H', 'UNTITLED_H'))`}
|
||||
|
||||
#define $1
|
||||
|
||||
${0}
|
||||
|
||||
#endif /* end of include guard: $1 */
|
||||
# Disable C++ name mangling in C headers
|
||||
snippet nocxx
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
${0}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
##
|
||||
## Control Statements
|
||||
# if
|
||||
snippet if
|
||||
if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2:${VISUAL}}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
# else
|
||||
snippet el
|
||||
else {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# else if
|
||||
snippet elif
|
||||
else if (${1:true}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# ifi
|
||||
snippet ifi
|
||||
if (${1:true}) ${0};
|
||||
# ternary
|
||||
snippet t Ternary: `condition ? true : false`
|
||||
$1 ? $2 : $0
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
default:
|
||||
${6}
|
||||
}
|
||||
# switch without default
|
||||
snippet switchndef
|
||||
switch (${1:/* variable */}) {
|
||||
case ${2:/* variable case */}:
|
||||
${3}
|
||||
${4:break;}${5}
|
||||
}
|
||||
# case
|
||||
snippet case
|
||||
case ${1:/* variable case */}:
|
||||
${2}
|
||||
${3:break;}
|
||||
snippet ret
|
||||
return ${0};
|
||||
snippet ex
|
||||
exit($0);
|
||||
##
|
||||
## Loops
|
||||
# for
|
||||
snippet for
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
# for (custom)
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {
|
||||
${5}
|
||||
}
|
||||
# while
|
||||
snippet wh
|
||||
while (${1:1}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet wht
|
||||
while (true) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# do... while
|
||||
snippet do
|
||||
do {
|
||||
${0:${VISUAL}}
|
||||
} while ($1);
|
||||
##
|
||||
## Functions
|
||||
# function definition
|
||||
snippet fun
|
||||
${1:void} ${2:function_name}(${3})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# function definition with zero parameters
|
||||
snippet fun0
|
||||
${1:void} ${2:function_name}()
|
||||
{
|
||||
${3}
|
||||
}
|
||||
# function definition with Doxygen documentation
|
||||
snippet dfun0
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \return ${3:Return parameter description}
|
||||
*/
|
||||
${4:void} ${5:function_name}()
|
||||
{
|
||||
${6}
|
||||
}
|
||||
# function definition with one parameter
|
||||
snippet fun1
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter})
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# function definition with one parameter with Doxygen documentation
|
||||
snippet dfun1
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \return ${5:Return parameter description}
|
||||
*/
|
||||
${6:void} ${7:function_name}(${8:Type} ${3:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function definition with two parameters
|
||||
snippet fun2
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter})
|
||||
{
|
||||
${7}
|
||||
}
|
||||
# function definition with two parameters with Doxygen documentation
|
||||
snippet dfun2
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \param $5 ${6:Parameter description}
|
||||
* \return ${7:Return parameter description}
|
||||
*/
|
||||
${8:void} ${9:function_name}(${10:Type} ${3:Parameter}, ${11:Type} ${5:Parameter})
|
||||
{
|
||||
${12}
|
||||
}
|
||||
# function definition with three parameters
|
||||
snippet fun3
|
||||
${1:void} ${2:function_name}(${3:Type} ${4:Parameter}, ${5:Type} ${6:Parameter}, ${7:Type} ${8:Parameter})
|
||||
{
|
||||
${9}
|
||||
}
|
||||
# function definition with three parameters with Doxygen documentation
|
||||
snippet dfun3
|
||||
/*! \brief ${1:Brief function description here}
|
||||
*
|
||||
* ${2:Detailed description of the function}
|
||||
*
|
||||
* \param $3 ${4:Parameter description}
|
||||
* \param $5 ${6:Parameter description}
|
||||
* \param $7 ${8:Parameter description}
|
||||
* \return ${9:Return parameter description}
|
||||
*/
|
||||
${10:void} ${11:function_name}(${12:Type} ${3:Parameter}, ${13:Type} ${5:Parameter}, ${14:Type} ${7:Parameter})
|
||||
{
|
||||
${15}
|
||||
}
|
||||
# function declaration
|
||||
snippet fund
|
||||
${1:void} ${2:function_name}(${3});
|
||||
##
|
||||
## Types
|
||||
# typedef
|
||||
snippet td
|
||||
typedef ${1:int} ${2:MyCustomType};
|
||||
# struct
|
||||
snippet st
|
||||
/*! \struct $1
|
||||
* \brief ${3:Brief struct description}
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
struct ${1:`vim_snippets#Filename('$1_t', 'name')`} {
|
||||
${2:Data} /*!< ${4:Description} */
|
||||
}${5: /* optional variable list */};
|
||||
# typedef struct
|
||||
snippet tds
|
||||
/*! \struct $2
|
||||
* \brief ${5:Brief struct description}
|
||||
*
|
||||
* ${6:Detailed description}
|
||||
*/
|
||||
typedef struct ${2:_$1 }{
|
||||
m_${3:Data} /*!< ${4:Description} */
|
||||
} ${1:`vim_snippets#Filename('$1_t', 'name')`};
|
||||
|
||||
snippet enum
|
||||
/*! \enum $1
|
||||
*
|
||||
* ${2:Detailed description}
|
||||
*/
|
||||
enum ${1:name} { ${0} };
|
||||
# typedef enum
|
||||
snippet tde
|
||||
/*! \enum $2
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
typedef enum {
|
||||
${1:Data} /*!< ${3:Description} */
|
||||
} ${2:foo};
|
||||
##
|
||||
## Input/Output
|
||||
# printf
|
||||
snippet pr
|
||||
printf("${1:%s}\n"${2});
|
||||
# fprintf (again, this isn't as nice as TextMate's version, but it works)
|
||||
snippet fpr
|
||||
fprintf(${1:stderr}, "${2:%s}\n"${3});
|
||||
snippet prd
|
||||
printf("${1:} = %d\n", $1);
|
||||
snippet prf
|
||||
printf("${1:} = %f\n", $1);
|
||||
snippet prx
|
||||
printf("${1:} = %${2}\n", $1);
|
||||
snippet warn
|
||||
warn("${1:%s}"$0);
|
||||
snippet warnx
|
||||
warnx("${1:%s}"$0);
|
||||
snippet err
|
||||
err(${1:1}, "${2:%s}"$0);
|
||||
snippet errx
|
||||
errx(${1:1}, "${2:%s}"$0);
|
||||
# getopt
|
||||
snippet getopt
|
||||
int choice;
|
||||
while (1)
|
||||
{
|
||||
static struct option long_options[] =
|
||||
{
|
||||
/* Use flags like so:
|
||||
{"verbose", no_argument, &verbose_flag, 'V'}*/
|
||||
/* Argument styles: no_argument, required_argument, optional_argument */
|
||||
{"version", no_argument, 0, 'v'},
|
||||
{"help", no_argument, 0, 'h'},
|
||||
${1}
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
int option_index = 0;
|
||||
|
||||
/* Argument parameters:
|
||||
no_argument: " "
|
||||
required_argument: ":"
|
||||
optional_argument: "::" */
|
||||
|
||||
choice = getopt_long( argc, argv, "vh",
|
||||
long_options, &option_index);
|
||||
|
||||
if (choice == -1)
|
||||
break;
|
||||
|
||||
switch( choice )
|
||||
{
|
||||
case 'v':
|
||||
${2}
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
${3}
|
||||
break;
|
||||
|
||||
case '?':
|
||||
/* getopt_long will have already printed an error */
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Not sure how to get here... */
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Deal with non-option arguments here */
|
||||
if ( optind < argc )
|
||||
{
|
||||
while ( optind < argc )
|
||||
{
|
||||
${0}
|
||||
}
|
||||
}
|
||||
|
||||
## Assertions
|
||||
snippet asr
|
||||
assert($1);
|
||||
|
||||
snippet anl
|
||||
assert(${1:ptr} != NULL);
|
||||
|
||||
## Dynamic Allocation
|
||||
snippet mlc
|
||||
${1:ptr} = (${2:type}*) malloc(sizeof($2));
|
||||
|
||||
snippet clc
|
||||
${1:ptr} = (${2:type}*) calloc(${3:size}, sizeof($2));
|
||||
|
||||
snippet rlc
|
||||
${1:ptr} = realloc($1, ${2:size} * sizeof(${3:type}));
|
||||
|
||||
snippet mlcd
|
||||
${1:type} ${2:ptr} = ($1*) malloc(sizeof($1));
|
||||
|
||||
snippet clcd
|
||||
${1:type} ${2:ptr} = ($1*) calloc(${3:size}, sizeof($1));
|
||||
|
||||
snippet fre
|
||||
free(${1:ptr});
|
||||
|
||||
##
|
||||
# TODO section
|
||||
snippet todo
|
||||
/*! TODO: ${1:Todo description here}
|
||||
* \todo $1
|
||||
*/
|
||||
## Miscellaneous
|
||||
# This is kind of convenient
|
||||
snippet .
|
||||
[${1}]
|
||||
|
||||
snippet asm
|
||||
__asm__ __volatile__(
|
||||
"${0}\n\t"
|
||||
:
|
||||
:
|
||||
);
|
204
lua/custom/snippets/snipmate/chef.snippets
Normal file
204
lua/custom/snippets/snipmate/chef.snippets
Normal file
|
@ -0,0 +1,204 @@
|
|||
# Opscode Chef Cookbook Recipe Resources
|
||||
# Snippet by: Mike Smullin <mike@smullindesign.com>
|
||||
# Based on: http://wiki.opscode.com/display/chef/Resources
|
||||
|
||||
# @TODO: Include Meta attributes and actions in all snippets
|
||||
# @TODO: Finish writing snippets for remaining Resources
|
||||
|
||||
snippet cookbook_file
|
||||
# Cookbook File resource
|
||||
cookbook_file ${1:"/path/to/file"} do # The remote path where the file will reside
|
||||
${2:#}backup ${3} # How many backups of this file to keep. Set to false if you want no backups
|
||||
${4:#}group ${5} # The group owner of the file (string or id)
|
||||
${6:#}mode ${7} # The octal mode of the file - e.g. 0755
|
||||
${8:#}owner ${9} # The owner for the file
|
||||
${10:#}source ${11} # The basename of the source file
|
||||
${12:#}cookbook ${13} # The cookbook this file is stored in
|
||||
|
||||
${14:#}${15: action :create} # Create this file (Default)
|
||||
${16:#}${17: action :create_if_missing} # Create only if it doesn't exist yet
|
||||
${18:#}${0: action :delete} # Delete this file
|
||||
end
|
||||
|
||||
snippet execute
|
||||
# Execute resource
|
||||
execute ${1:"command to execute"} do # The command to execute
|
||||
${2:#}creates ${3:nil} # A file this command creates - if the file exists, the command will not be run.
|
||||
${4:#}cwd ${5:nil} # Current working directory to run the command from.
|
||||
${6:#}environment ${7:nil} # A hash of environment variables to set before running this command.
|
||||
${8:#}group ${9:nil} # A group name or group ID that we should change to before running this command.
|
||||
${10:#}path ${11:nil} # An array of paths to use when searching for the command. Nil uses system path.
|
||||
${12:#}returns ${13:0} # The return value of the command - this resource raises an exception if the return value does not match.
|
||||
${14:#}timeout ${15:nil} # How many seconds to let the command run before timing it out.
|
||||
${16:#}user ${17:nil} # A user name or user ID that we should change to before running this command.
|
||||
${18:#}umask ${19:nil} # Umask for files created by the command
|
||||
|
||||
${20:#}${21:action :run} # Run this command (Default)
|
||||
${22:#}${0:action :nothing} # Do not run this command
|
||||
end
|
||||
|
||||
snippet link
|
||||
# Link resource
|
||||
link ${1:"/target/file"} do # The file name of the link
|
||||
${2:#}to ${3} # The real file you want to link to
|
||||
${4:#}link_type ${5:symbolic} # Either :symbolic or :hard
|
||||
${6:#}owner ${7} # The owner of the symlink
|
||||
${8:#}group ${9} # The group of the symlink
|
||||
|
||||
${10:#}${11:action :create} # Create a link (Default)
|
||||
${12:#}${0:action :delete} # Delete a link
|
||||
end
|
||||
|
||||
snippet package
|
||||
# Package resource
|
||||
package ${1:"package_name"} do # Name of the package to install
|
||||
${2:#}version ${3:nil} # The version of the package to install/upgrade
|
||||
${4:#}response_file ${5:nil} # An optional response file - used to pre-seed packages (note: the file is fetched by Remote File)
|
||||
${6:#}source ${7} # Used to provide an optional package source for providers that use a local file (rubygems, dpkg and rpm)
|
||||
${8:#}options ${9:nil} # Add additional options to the underlying package command
|
||||
${10:#}gem_binary ${11:gem} # A gem_package attribut to specify a gem binary. Useful for installing ruby 1.9 gems while running chef in ruby 1.8
|
||||
|
||||
${12:#}${13:action :install} # Install a package - if version is provided, install that specific version (Default)
|
||||
${14:#}${15:action :upgrade} # Upgrade a package - if version is provided, upgrade to that specific version
|
||||
${16:#}${17:action :remove} # Remove a package
|
||||
${18:#}${0:action :purge} # Purge a package (this usually entails removing configuration files as well as the package itself)
|
||||
end
|
||||
|
||||
snippet service
|
||||
# Service resource
|
||||
service ${1:"service_name"} do # Name of the service
|
||||
${2:#}enabled ${3:nil} # Whether the service is enabled at boot time
|
||||
${4:#}running ${5:nil} # Make sure the service is running. Start if stopped
|
||||
${6:#}pattern ${7} # Pattern to look for in the process table
|
||||
${8:#}start_command ${9:nil} # Command used to start this service
|
||||
${10:#}stop_command ${11:nil} # Command used to stop this service
|
||||
${12:#}status_command ${13:nil} # Command used to check the service run status
|
||||
${14:#}restart_command ${15:nil} # Command used to restart this service
|
||||
${16:#}reload_command ${17:nil} # Command used to tell this service to reload its configuration
|
||||
${18:#}supports ${19:false} # Features this service supports, ie :restart, :reload, :status
|
||||
|
||||
${20:#}${21:action :enable} # Enable this service
|
||||
${22:#}${23:action :disable} # Disable this service
|
||||
${24:#}${25:action :nothing} # Don't do anything with this service (Default)
|
||||
${26:#}${27:action :start} # Start this service
|
||||
${28:#}${29:action :stop} # Stop this service
|
||||
${30:#}${31:action :restart} # Restart this service
|
||||
${32:#}${0:action :reload} # Reload the configuration for this service
|
||||
end
|
||||
|
||||
snippet file
|
||||
# File resource
|
||||
file ${1:"/path/to/file"} do # Path to the file
|
||||
${2:#}backup ${3:5} # How many backups of this file to keep. Set to false if you want no backups.
|
||||
${4:#}owner ${5} # The owner for the file
|
||||
${6:#}group ${7} # The group owner of the file (string or id)
|
||||
${8:#}mode ${9} # The octal mode of the file (4-digit format)
|
||||
${10:#}content ${11:nil} # A string to write to the file. This will replace any previous content if set
|
||||
|
||||
${12:#}${13:action :create} # Create this file (Default)
|
||||
${14:#}${15:action :delete} # Delete this file
|
||||
${16:#}${0:action :touch} # Touch this file (update the mtime/atime)
|
||||
end
|
||||
|
||||
snippet directory
|
||||
# Directory resource
|
||||
directory ${1:"/path/to/dir"} do # The path to the directory
|
||||
${2:#}group ${3} # The group owner of the directory (string or id)
|
||||
${4:#}mode ${5} # The octal mode of the directory, eg 0755
|
||||
${6:#}owner ${7} # The owner for the directory
|
||||
${10:#}recursive ${11:false} # When deleting the directory, delete it recursively. When creating the directory, create recursively (ie, mkdir -p)
|
||||
|
||||
${12:#}${13:action :create} # Create this directory (Default)
|
||||
${14:#}${0:action :delete} # Delete this directory
|
||||
end
|
||||
|
||||
snippet template
|
||||
# Template resource
|
||||
template ${1:"/path/to/file"} do # Path to the file
|
||||
${2:#}cookbook ${3:nil} # Specify the cookbook where the template is located, default is current cookbook
|
||||
${4:#}source ${5:nil} # Template source file. Found in templates/default for the cookbook
|
||||
${6:#}variables ${7} # Variables to use in the template
|
||||
${8:#}local ${9:false} # Is the template already present on the node?
|
||||
${10:#}backup ${11:5} # How many backups of this file to keep. Set to false if you want no backups.
|
||||
${12:#}owner ${13} # The owner for the file
|
||||
${14:#}group ${15} # The group owner of the file (string or id)
|
||||
${16:#}mode ${17} # The octal mode of the file (4-digit format)
|
||||
${18:#}content ${19:nil} # A string to write to the file. This will replace any previous content if set
|
||||
|
||||
${20:#}${21:action :create} # Create the file (Default)
|
||||
${22:#}${23:action :delete} # Delete this file
|
||||
${24:#}${0:action :touch} # Touch this file (update the mtime/atime)
|
||||
end
|
||||
|
||||
snippet svn
|
||||
# SCM Resource, Chef::Provider::Subversion
|
||||
svn ${1:"/destination/path"} do # Path to clone/checkout/export the source to
|
||||
${2:#}repository ${3} # URI of the repository
|
||||
${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
|
||||
${6:#}reference ${7} # (Git only) alias for revision
|
||||
${8:#}user ${9:nil} # System user to own the checked out code
|
||||
${10:#}group ${11:nil} # System group to own the checked out code
|
||||
${12:#}svn_username ${13} # (Subversion only) Username for Subversion operations
|
||||
${14:#}svn_password ${15} # (Subversion only) Password for Subversion operations
|
||||
${16:#}svn_arguments ${17} # (Subversion only) Extra arguments passed to the subversion command
|
||||
|
||||
${18:#}${19:action :sync} # Update the source to the specified revision, or get a new checkout (Default)
|
||||
${20:#}${21:action :checkout} # Checkout the source. Does nothing if a checkout is available
|
||||
${22:#}${0:action :export} # Export the source, excluding or removing any version control artifacts
|
||||
end
|
||||
|
||||
snippet git
|
||||
# SCM Resource, Chef::Provider::Git
|
||||
git ${1:"/destination/path"} do # Path to clone/checkout/export the source to
|
||||
${2:#}repository ${3} # URI of the repository
|
||||
${4:#}revision ${5:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
|
||||
${6:#}reference ${7} # (Git only) alias for revision
|
||||
${8:#}user ${9:nil} # System user to own the checked out code
|
||||
${10:#}group ${11:nil} # System group to own the checked out code
|
||||
${12:#}depth ${13:nil} # (Git only) Number of past revisions to include in Git shallow clone
|
||||
${14:#}enable_submodules ${15:"false"} # (Git only) performs a submodule init and submodule update
|
||||
${16:#}remote ${17:"origin"} # (Git only) remote repository to use for syncing an existing clone
|
||||
${18:#}ssh_wrapper ${19} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
|
||||
|
||||
${20:#}${21:action :sync} # Update the source to the specified revision, or get a new clone (Default)
|
||||
${22:#}${23:action :checkout} # Clone the source. Does nothing if a checkout is available
|
||||
${24:#}${0:action :export} # Export the source, excluding or removing any version control artifacts
|
||||
end
|
||||
|
||||
snippet deploy
|
||||
# Deploy resource
|
||||
deploy ${1:"/deploy/dir/"} do # Path to deploy to
|
||||
${2:#}deploy_to ${3} # The "meta root" for your application.
|
||||
${4:#}repository ${5} # URI of the repository
|
||||
${6:#}repo ${7} # alias for repository
|
||||
${8:#}revision ${9:"HEAD"} # revision to checkout. can be symbolic, like "HEAD" or an SCM specific revision id
|
||||
${10:#}branch ${11} # alias for revision
|
||||
${12:#}user ${13:nil} # System user to run the deploy as
|
||||
${14:#}group ${15:nil} # System group to run the deploy as
|
||||
${16:#}svn_username ${17} # (Subversion only) Username for Subversion operations}
|
||||
${18:#}svn_password ${19} # (Subversion only) Password for Subversion operations}
|
||||
${20:#}svn_arguments ${21} # (Subversion only) Extra arguments passed to the subversion command}
|
||||
${22:#}shallow_clone ${23:nil} # (Git only) boolean, true sets clone depth to 5
|
||||
${24:#}enable_submodules ${25:false} # (Git only) performs a submodule init and submodule update
|
||||
${26:#}remote ${27:"origin"} # (Git only) remote repository to use for syncing an existing clone
|
||||
${28:#}ssh_wrapper ${29} # (Git only) path to a wrapper script for running SSH with git. GIT_SSH environment variable is set to this.
|
||||
${30:#}git_ssh_wrapper ${31} # alias for ssh_wrapper
|
||||
${32:#}scm_provider ${33:Chef::Provider::Git} # SCM Provider to use.
|
||||
${34:#}repository_cache ${35: "cached-copy"} # Name of the subdirectory where the pristine copy of your app's source is kept
|
||||
${36:#}environment ${37} # A hash of the form {"ENV_VARIABLE"=>"VALUE"}}
|
||||
${38:#}purge_before_symlink ${39:%w(log tmp/pids public/system)} # An array of paths, relative to app root, to be removed from a checkout before symlinking
|
||||
${40:#}create_dirs_before_symlink ${41:%w(tmp public config)} # Directories to create before symlinking. Runs after purge_before_symlink
|
||||
${42:#}symlinks ${43:"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} # A hash that maps files in the shared directory to their paths in the current release
|
||||
${44:#}symlink_before_migrate ${45:"config/database.yml" => "config/database.yml"} # A hash that maps files in the shared directory into the current release. Runs before migration
|
||||
${46:#}migrate ${47:false} # Should the migration command be executed? (true or false)
|
||||
${48:#}migration_command ${49} # A string containing a shell command to execute to run the migration
|
||||
${50:#}restart_command ${51:nil} # A code block to evaluate or a string containing a shell command
|
||||
${52:#}before_migrate ${53:"deploy/before_migrate.rb"} # A block or path to a file containing chef code to run before migrating
|
||||
${54:#}before_symlink ${55:"deploy/before_symlink.rb"} # A block or path to a file containing chef code to run before symlinking
|
||||
${56:#}before_restart ${57:"deploy/before_restart.rb"} # A block or path to a file containing chef code to run before restarting
|
||||
${58:#}after_restart ${59:"deploy/after_restart.rb"} # A block or path to a file containing chef code to run after restarting
|
||||
|
||||
${60:#}${61::deploy} # Deploy the application (Default)
|
||||
${62:#}${63::force_deploy} # For the revision deploy strategy, this removes any existing release of the same code version and re-deploys in its place
|
||||
${64:#}${0::rollback} # Rollback the application to the previous release
|
||||
end
|
87
lua/custom/snippets/snipmate/clojure.snippets
Normal file
87
lua/custom/snippets/snipmate/clojure.snippets
Normal file
|
@ -0,0 +1,87 @@
|
|||
snippet comm
|
||||
(comment
|
||||
${0})
|
||||
snippet condp
|
||||
(condp ${1:pred} ${2:expr}
|
||||
${0})
|
||||
snippet def
|
||||
(def ${0})
|
||||
snippet defm
|
||||
(defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]
|
||||
${0:code})
|
||||
snippet defmm
|
||||
(defmulti ${1:name} "${2:doc-string}" ${0:dispatch-fn})
|
||||
snippet defma
|
||||
(defmacro ${1:name} "${2:doc-string}" ${0:dispatch-fn})
|
||||
snippet defn
|
||||
(defn ${1:name} "${2:doc-string}" [${3:arg-list}]
|
||||
${0:code})
|
||||
snippet defp
|
||||
(defprotocol ${1:name}
|
||||
${0:code})
|
||||
snippet defr
|
||||
(defrecord ${1:name} [${2:fields}]
|
||||
${3:protocol}
|
||||
${0:code})
|
||||
snippet deft
|
||||
(deftest ${1:name}
|
||||
(is (= ${0:assertion})))
|
||||
snippet is
|
||||
(is (= ${1} ${0}))
|
||||
snippet defty
|
||||
(deftype ${1:Name} [${2:fields}]
|
||||
${3:Protocol}
|
||||
${0:code})
|
||||
snippet doseq
|
||||
(doseq [${1:elem} ${2:coll}]
|
||||
${0:code})
|
||||
snippet fn
|
||||
(fn [${1:arg-list}] ${0:code})
|
||||
snippet if
|
||||
(if ${1:test-expr}
|
||||
${2:then-expr}
|
||||
${0:else-expr})
|
||||
snippet if-let
|
||||
(if-let [${1:result} ${2:test-expr}]
|
||||
(${3:then-expr} $1)
|
||||
(${0:else-expr}))
|
||||
snippet imp
|
||||
(:import [${1:package}])
|
||||
& {:keys [${1:keys}] :or {${0:defaults}}}
|
||||
snippet let
|
||||
(let [${1:name} ${2:expr}]
|
||||
${0:code})
|
||||
snippet letfn
|
||||
(letfn [(${1:name}) [${2:args}]
|
||||
${0:code})])
|
||||
snippet map
|
||||
(map ${1:func} ${0:coll})
|
||||
snippet mapl
|
||||
(map #(${1:lambda}) ${0:coll})
|
||||
snippet met
|
||||
(${1:name} [${2:this} ${3:args}]
|
||||
${0:code})
|
||||
snippet ns
|
||||
(ns ${0:name})
|
||||
snippet dotimes
|
||||
(dotimes [_ 10]
|
||||
(time
|
||||
(dotimes [_ ${1:times}]
|
||||
${0:code})))
|
||||
snippet pmethod
|
||||
(${1:name} [${2:this} ${0:args}])
|
||||
snippet refer
|
||||
(:refer-clojure :exclude [${0}])
|
||||
snippet require
|
||||
(:require [${1:namespace} :as [${0}]])
|
||||
snippet use
|
||||
(:use [${1:namespace} :only [${0}]])
|
||||
snippet print
|
||||
(println ${0})
|
||||
snippet reduce
|
||||
(reduce ${1:(fn [p n] ${3})} ${2})
|
||||
snippet when
|
||||
(when ${1:test} $0)
|
||||
snippet when-let
|
||||
(when-let [${1:result} ${2:test}]
|
||||
$0)
|
83
lua/custom/snippets/snipmate/cmake.snippets
Normal file
83
lua/custom/snippets/snipmate/cmake.snippets
Normal file
|
@ -0,0 +1,83 @@
|
|||
snippet init
|
||||
cmake_minimum_required(VERSION ${1:2.8.2})
|
||||
project(${2:ProjectName})
|
||||
|
||||
find_package(${3:library})
|
||||
|
||||
include_directories(${$3_INCLUDE_DIRS})
|
||||
|
||||
add_subdirectory(${0:src})
|
||||
|
||||
add_executable($2)
|
||||
|
||||
target_link_libraries($2 ${$3_LIBRARIES})
|
||||
|
||||
snippet proj
|
||||
project(${0:Name})
|
||||
|
||||
snippet min
|
||||
cmake_minimum_required(VERSION ${0:2.8.2})
|
||||
|
||||
snippet include
|
||||
include_directories(${${0:include_dir}})
|
||||
|
||||
snippet find
|
||||
find_package(${1:library} ${0:REQUIRED})
|
||||
|
||||
snippet glob
|
||||
file(glob ${1:srcs} *.${0:cpp})
|
||||
|
||||
snippet subdir
|
||||
add_subdirectory(${0:src})
|
||||
|
||||
snippet lib
|
||||
add_library(${1:lib} ${${0:srcs}})
|
||||
|
||||
snippet link
|
||||
target_link_libraries(${1:bin} ${0:somelib})
|
||||
|
||||
snippet bin
|
||||
add_executable(${1:bin})
|
||||
|
||||
snippet set
|
||||
set(${1:var} ${0:val})
|
||||
|
||||
snippet dep
|
||||
add_dependencies(${1:target}
|
||||
${0:dep}
|
||||
)
|
||||
|
||||
snippet Ext_url
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${1:googletest}
|
||||
URL ${2:http://googletest.googlecode.com/files/gtest-1.7.0.zip}
|
||||
URL_HASH SHA1=${3:f85f6d2481e2c6c4a18539e391aa4ea8ab0394af}
|
||||
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/gtest-src}"
|
||||
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/gtest-build}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
snippet Ext_git
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${1:googletest}
|
||||
GIT_REPOSITORY ${2:https://github.com/google/googletest.git}
|
||||
GIT_TAG ${3:master}
|
||||
SOURCE_DIR "${4:${CMAKE_BINARY_DIR}/googletest-src}"
|
||||
BINARY_DIR "${0:${CMAKE_BINARY_DIR}/googletest-build}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
snippet props
|
||||
set_target_properties(${1:target}
|
||||
${2:properties} ${3:compile_flags}
|
||||
${0:"-O3 -Wall -pedantic"}
|
||||
)
|
||||
|
||||
snippet test
|
||||
add_test(${1:ATestName} ${0:testCommand --options})
|
171
lua/custom/snippets/snipmate/codeigniter.snippets
Normal file
171
lua/custom/snippets/snipmate/codeigniter.snippets
Normal file
|
@ -0,0 +1,171 @@
|
|||
# Based on nebjak/snipmate.vim/snippets/php.snippets
|
||||
|
||||
# Controller
|
||||
snippet ci_controller
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName} extends CI_Controller
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${2:// code...}
|
||||
}
|
||||
|
||||
function ${3:index}()
|
||||
{
|
||||
${4:// code...}
|
||||
}
|
||||
}
|
||||
# Model
|
||||
snippet ci_model
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName_model} extends CI_Model
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${2:// code...}
|
||||
}
|
||||
}
|
||||
snippet ci_model_crudl
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class ${1:ClassName_model} extends CI_Model
|
||||
{
|
||||
private $table = '${2:table_name}';
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
${3:// code...}
|
||||
}
|
||||
|
||||
public function create($data)
|
||||
{
|
||||
if($this->db->insert($this->table, $data))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function read($id)
|
||||
{
|
||||
return $this->db->get_where($this->table, array('id', $id))->result();
|
||||
}
|
||||
|
||||
public function update($id, $data)
|
||||
{
|
||||
if($this->db->update($this->table, $data, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
if(is_array($id))
|
||||
{
|
||||
$this->db->trans_start();
|
||||
foreach($id as $elem)
|
||||
$this->db->delete($this->table, array('id' => $elem));
|
||||
$this->db->trans_complete();
|
||||
}
|
||||
else
|
||||
{
|
||||
if($this->db->delete($this->table, array('id' => $id)))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function listRows($limit = null, $offset = 0)
|
||||
{
|
||||
if(!is_null($limit))
|
||||
$this->db->limit($limit, $offset);
|
||||
return $this->db->get($this->table)->result();
|
||||
}
|
||||
}
|
||||
# Load view
|
||||
snippet ci_load-view
|
||||
$this->load->view("${1:view_name}", $${2:data});${3}
|
||||
# DB Class snippets
|
||||
snippet ci_db-insert
|
||||
$this->db->insert("${1:table}", $${2:data});${3}
|
||||
snippet ci_db-select
|
||||
$this->db->select("${1:id, ...}");${2}
|
||||
snippet ci_db-from
|
||||
$this->db->from("${1:table}");${2}
|
||||
snippet ci_db-join
|
||||
$this->db->join("${1:table}", "$2", "${3:type}");${4}
|
||||
snippet ci_db-where
|
||||
$this->db->where("${1:key}", "${2:value}");${3}
|
||||
snippet ci_db-or_where
|
||||
$this->db->or_where("${1:key}", "${2:value}");${3}
|
||||
snippet ci_db-get
|
||||
$this->db->get("${1:table}", ${2:limit}, ${3:offset});${4}
|
||||
snippet ci_db-delete
|
||||
$this->db->delete("${1:table}", "${2:where}");${3}
|
||||
snippet ci_db-update
|
||||
$this->db->update("${1:table}", $${2:set}, $${3:where});${4}
|
||||
# Input Class snippets
|
||||
snippet ci_input-post
|
||||
$this->input->post("${1:index}");${2}
|
||||
snippet ci_input-get
|
||||
$this->input->get("${1:index}");${2}
|
||||
snippet ci_input-cookie
|
||||
$this->input->cookie("${1:index}");${2}
|
||||
snippet ci_input-server
|
||||
$this->input->server("${1:index}");${2}
|
||||
snippet ci_input-user_agent
|
||||
$this->input->user_agent();${1}
|
||||
snippet ci_input-is_ajax_request
|
||||
$this->input->is_ajax_request();${1}
|
||||
snippet ci_input-is_cli_request
|
||||
$this->input->is_cli_request();${1}
|
||||
# Form Validation Class and Form Helper snippets
|
||||
snippet ci_form_validation-set_rules
|
||||
$this->form_validation->set_rules("${1:field}", "${2:label}", "${3:trim|required}");${4}
|
||||
snippet ci_form_open
|
||||
form_open("${1:action}");${2}
|
||||
snippet ci_form_open_multipart
|
||||
form_open_multipart("${1:action}");${2}
|
||||
snippet ci_form_hidden
|
||||
form_hidden("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_input
|
||||
form_input("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_password
|
||||
form_password("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_upload
|
||||
form_upload("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_textarea
|
||||
form_textarea("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_dropdown
|
||||
form_dropdown("${1:name}", $${2:options}, $${3:selected);${4}
|
||||
snippet ci_form_checkbox
|
||||
form_checkbox("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_radio
|
||||
form_radio("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_submit
|
||||
form_submit("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_reset
|
||||
form_reset("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_button
|
||||
form_button("${1:name}", "${2:value}");${3}
|
||||
snippet ci_form_label
|
||||
form_label("${1:label text}", "${2:id}");${3}
|
||||
snippet ci_form_close
|
||||
form_close();${1}
|
||||
snippet ci_validation_errors
|
||||
validation_errors();${1}
|
||||
# Session Class snippets
|
||||
snippet ci_session_userdata
|
||||
$this->session->userdata("${1:item}");${2}
|
||||
snippet ci_session_set_userdata
|
||||
$this->session->set_userdata($${1:array});${2}
|
||||
snippet ci_session_flashdata
|
||||
$this->session->flashdata("${1:item}");${2}
|
||||
snippet ci_session_set_flashdata
|
||||
$this->session->set_flashdata("${1:item}", "${2:value}");${3}
|
116
lua/custom/snippets/snipmate/coffee/angular_coffee.snippets
Normal file
116
lua/custom/snippets/snipmate/coffee/angular_coffee.snippets
Normal file
|
@ -0,0 +1,116 @@
|
|||
## Global Snippets
|
||||
# Define a new Angular Controller;
|
||||
# You can change the controller name and parameters
|
||||
snippet ngc
|
||||
${1:controllerName} = (${2:scope}, ${3:injectables}) ->
|
||||
${4}
|
||||
# angular.foreach loop
|
||||
snippet ngfor
|
||||
angular.forEach ${1:iterateOver}, (value, key) ->
|
||||
${2}
|
||||
## Module Based Snippets
|
||||
# A new angular module without a config function
|
||||
snippet ngm
|
||||
angular.module '${1:moduleName}', [${2:moduleDependencies}]
|
||||
${3}
|
||||
# A new angular module without a config function and a variable assignment
|
||||
snippet ngma
|
||||
${1:moduleName} = angular.module '$1', [${2:moduleDeps}]
|
||||
${3}
|
||||
# A new angular module with a config function
|
||||
snippet ngmc
|
||||
${1:moduleName} = angular.module('$1', [${2:moduleDeps}], (${3:configDeps}) ->
|
||||
${4}
|
||||
)
|
||||
# A factory in a module
|
||||
snippet ngmfa
|
||||
factory '${1:factoryName}', (${2:dependencies}) ->
|
||||
${3}
|
||||
# Define an Angular Module Service to be attached to a previously defined module
|
||||
# You can change the service name and service injectables
|
||||
snippet ngms
|
||||
service '${1:serviceName}', (${2:injectables}) ->
|
||||
${3}
|
||||
# Define an Angular Module Filter to be attached to a previously defined module
|
||||
# You can change the filter name
|
||||
snippet ngmfi
|
||||
filter '${1:filterName}', (${2:injectables}) ->
|
||||
(input, ${3:args}) ->
|
||||
${4}
|
||||
## Route Based Snippets
|
||||
# Defines a when condition of an AngularJS route
|
||||
snippet ngrw
|
||||
$routeProvider.when '${1:url}',
|
||||
templateUrl: '${2:templateUrl}'
|
||||
controller: '${3:controller}'
|
||||
${4}
|
||||
# Defines a when condition of an AngularJS route with the resolve block
|
||||
snippet ngrwr
|
||||
$routeProvider.when '${1:url}',
|
||||
templateUrl: '${2:templateUrl}'
|
||||
controller: '${3:controller}'
|
||||
resolve:
|
||||
${4}
|
||||
${5}
|
||||
# Defines an otherwise condition of an AngularJS route
|
||||
snippet ngro
|
||||
$routeProvider.otherwise redirectTo: '${1:url}'
|
||||
${2}
|
||||
## Scope Related Snippets
|
||||
# Define a new $scope'd function (usually inside an AngularJS Controller)
|
||||
# You can change the function name and arguments
|
||||
snippet $f
|
||||
$scope.${1:functionName} = (${2:args}) ->
|
||||
${3}
|
||||
# Defines a new $scope'd variable inside an AngularJS controller
|
||||
snippet $v
|
||||
$scope.${1:variable} = ${2:value}
|
||||
${3}
|
||||
# Defines a new $scope'd variable inside an AngularJS controller and assigns a value from a constructor arguments
|
||||
snippet $va
|
||||
$scope.${1:variable} = ${2:variable}
|
||||
${3}
|
||||
# Define a $watch for an expression
|
||||
# You can change the expression to be watched
|
||||
snippet $w
|
||||
$scope.$watch '${1:watchExpr}', (newValue, oldValue) ->
|
||||
${2}
|
||||
# Define a $on for a $broadcast/$emit on the $scope inside an Angular Controller
|
||||
# You can change the event name to listen on
|
||||
snippet $on
|
||||
$scope.$on '${1:eventName}', (event, ${2:args}) ->
|
||||
${3}
|
||||
# Define a $broadcast for a $scope inside an Angular Controller / Angular Controller Function
|
||||
# You can change the event name and optional event arguments
|
||||
snippet $b
|
||||
$scope.$broadcast '${1:eventName}', ${2:eventArgs}
|
||||
${3}
|
||||
# Define an $emit for a $scope inside an Angular Controller / Angular Controller Function
|
||||
# You can change the event name and optional event arguments
|
||||
snippet $e
|
||||
$scope.$emit '${1:eventName}', ${2:eventArgs}
|
||||
${3}
|
||||
## Directive related snippets
|
||||
# A compile function
|
||||
snippet ngdcf
|
||||
compile = (tElement, tAttrs, transclude) ->
|
||||
(scope, element, attrs) ->
|
||||
${1}
|
||||
# A linking function in a directive
|
||||
snippet ngdlf
|
||||
(scope, element, attrs${1:ctrl}) ->
|
||||
${2}
|
||||
# A directive with a compile function
|
||||
snippet ngdc
|
||||
directive '${1:directiveName}', factory = (${2:injectables}) ->
|
||||
directiveDefinitionObject =
|
||||
${3:directiveAttrs}
|
||||
compile: compile = (tElement, tAttrs, transclude) ->
|
||||
(scope, element, attrs) ->
|
||||
directiveDefinitionObject
|
||||
# A directive with a linking function only
|
||||
snippet ngdl
|
||||
.directive('${1:directiveName}', (${2:directiveDeps}) ->
|
||||
(scope, element, attrs${3:ctrl}) ->
|
||||
${4}
|
||||
)
|
101
lua/custom/snippets/snipmate/coffee/coffee.snippets
Normal file
101
lua/custom/snippets/snipmate/coffee/coffee.snippets
Normal file
|
@ -0,0 +1,101 @@
|
|||
# Closure loop
|
||||
snippet forindo
|
||||
for ${1:name} in ${2:array}
|
||||
do ($1) ->
|
||||
$0
|
||||
# Array comprehension
|
||||
snippet fora
|
||||
for ${1:name} in ${2:array}
|
||||
$0
|
||||
# Object comprehension
|
||||
snippet foro
|
||||
for ${1:key}, ${2:value} of ${3:object}
|
||||
$0
|
||||
# Range comprehension (inclusive)
|
||||
snippet forr
|
||||
for ${1:name} in [${2:start}..${3:finish}]
|
||||
$0
|
||||
snippet forrb
|
||||
for ${1:name} in [${2:start}..${3:finish}] by ${4:step}
|
||||
$0
|
||||
# Range comprehension (exclusive)
|
||||
snippet forrex
|
||||
for ${1:name} in [${2:start}...${3:finish}]
|
||||
$0
|
||||
snippet forrexb
|
||||
for ${1:name} in [${2:start}...${3:finish}] by ${4:step}
|
||||
$0
|
||||
# Function
|
||||
snippet fun
|
||||
(${1:args}) ->
|
||||
$0
|
||||
# Function (bound)
|
||||
snippet bfun
|
||||
(${1:args}) =>
|
||||
$0
|
||||
# Class
|
||||
snippet cla class ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
${0}
|
||||
snippet cla class .. constructor: ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`}
|
||||
constructor: (${2:args}) ->
|
||||
${3}
|
||||
|
||||
${0}
|
||||
snippet cla class .. extends ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
${0}
|
||||
snippet cla class .. extends .. constructor: ..
|
||||
class ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} extends ${2:ParentClass}
|
||||
constructor: (${3:args}) ->
|
||||
${4}
|
||||
|
||||
${0}
|
||||
# If
|
||||
snippet if
|
||||
if $1
|
||||
${0:${VISUAL}}
|
||||
# If __ Else
|
||||
snippet ife
|
||||
if $1
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
# Else if
|
||||
snippet eif
|
||||
else if $1
|
||||
${0:${VISUAL}}
|
||||
# Ternary If
|
||||
snippet ifte Ternary
|
||||
if $1 then $2 else $0
|
||||
# Unless
|
||||
snippet unl Unless
|
||||
$1 unless $0
|
||||
# Switch
|
||||
snippet swi
|
||||
switch ${1:object}
|
||||
when ${2:value}
|
||||
$0
|
||||
|
||||
# Log
|
||||
snippet log
|
||||
console.log ${0}
|
||||
# Try __ Catch
|
||||
snippet try
|
||||
try
|
||||
${1:${VISUAL}}
|
||||
catch ${2:error}
|
||||
${0}
|
||||
# Require
|
||||
snippet req
|
||||
${2:$1} = require '${1:sys}'
|
||||
# Export
|
||||
snippet exp
|
||||
${0:root} = exports ? this
|
||||
|
||||
snippet jsonp
|
||||
JSON.parse ${0:jstr}
|
||||
# JSON.stringify
|
||||
snippet jsons
|
||||
JSON.stringify ${0:object}
|
524
lua/custom/snippets/snipmate/coffee/jquery_coffee.snippets
Normal file
524
lua/custom/snippets/snipmate/coffee/jquery_coffee.snippets
Normal file
|
@ -0,0 +1,524 @@
|
|||
snippet add
|
||||
${1:obj}.add('${2:selector expression}')
|
||||
snippet addClass
|
||||
${1:obj}.addClass('${2:class name}')
|
||||
snippet after
|
||||
${1:obj}.after('${2:Some text <b>and bold!</b>}')
|
||||
snippet ajax
|
||||
$.ajax
|
||||
url: "${1:mydomain.com/url}"
|
||||
type: "${2:POST}"
|
||||
dataType: "${3:xml/html/script/json}"
|
||||
data: ${4:data}
|
||||
complete: (jqXHR, textStatus) ->
|
||||
${5:// callback}
|
||||
success: (data, textStatus, jqXHR) ->
|
||||
${6:// success callback}
|
||||
error: (jqXHR, textStatus, errorThrown) ->
|
||||
${0:// error callback}
|
||||
snippet ajaxcomplete
|
||||
${1:obj}.ajaxComplete (${1:e}, xhr, settings) ->
|
||||
${0:// callback}
|
||||
snippet ajaxerror
|
||||
${1:obj}.ajaxError (${1:e}, xhr, settings, thrownError) ->
|
||||
${2:// error callback}
|
||||
${0}
|
||||
snippet ajaxget
|
||||
$.get '${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(data, textStatus, jqXHR) ->
|
||||
${0:// success callback}
|
||||
snippet ajaxpost
|
||||
$.post '${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(data, textStatus, jqXHR) ->
|
||||
${0:// success callback}
|
||||
snippet ajaxprefilter
|
||||
$.ajaxPrefilter (${1:options}, ${2:originalOptions}, jqXHR) ->
|
||||
${0: // Modify options, control originalOptions, store jqXHR, etc}
|
||||
snippet ajaxsend
|
||||
${1:obj}.ajaxSend (${1:request, settings}) ->
|
||||
${2:// error callback}
|
||||
${0}
|
||||
snippet ajaxsetup
|
||||
$.ajaxSetup({
|
||||
url: "${1:mydomain.com/url}",
|
||||
type: "${2:POST}",
|
||||
dataType: "${3:xml/html/script/json}",
|
||||
data: $.param( $("${4:Element or Expression}") ),
|
||||
complete: (jqXHR, textStatus) ->
|
||||
${5:// callback}
|
||||
,
|
||||
success: (data, textStatus, jqXHR) ->
|
||||
${6:// success callback}
|
||||
,
|
||||
error: (jqXHR, textStatus, errorThrown) ->
|
||||
${0:// error callback}
|
||||
})
|
||||
snippet ajaxstart
|
||||
$.ajaxStart ->
|
||||
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress}
|
||||
${0}
|
||||
snippet ajaxstop
|
||||
$.ajaxStop ->
|
||||
${1:// handler for when all AJAX calls have been completed}
|
||||
${0}
|
||||
snippet ajaxsuccess
|
||||
$.ajaxSuccess (${1:e}, xhr, settings) ->
|
||||
${2:// handler for when any AJAX call is successfully completed}
|
||||
${0}
|
||||
snippet andself
|
||||
${1:obj}.andSelf()
|
||||
snippet animate
|
||||
${1:obj}.animate({${2:param1: value1, param2: value2}}, ${3:speed})
|
||||
snippet append
|
||||
${1:obj}.append('${2:Some text <b>and bold!</b>}')
|
||||
snippet appendTo
|
||||
${1:obj}.appendTo('${2:selector expression}')
|
||||
snippet attr
|
||||
${1:obj}.attr('${2:attribute}', '${3:value}')
|
||||
snippet attrm
|
||||
${1:obj}.attr({'${2:attr1}': '${3:value1}', '${4:attr2}': '${5:value2}'})
|
||||
snippet before
|
||||
${1:obj}.before('${2:Some text <b>and bold!</b>}')
|
||||
snippet bind
|
||||
${1:obj}.bind('${2:event name}', (${3:e}) ->
|
||||
${0:// event handler}
|
||||
snippet blur
|
||||
${1:obj}.blur (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet C
|
||||
$.Callbacks()
|
||||
snippet Cadd
|
||||
${1:callbacks}.add(${2:callbacks})
|
||||
snippet Cdis
|
||||
${1:callbacks}.disable()
|
||||
snippet Cempty
|
||||
${1:callbacks}.empty()
|
||||
snippet Cfire
|
||||
${1:callbacks}.fire(${2:args})
|
||||
snippet Cfired
|
||||
${1:callbacks}.fired()
|
||||
snippet Cfirew
|
||||
${1:callbacks}.fireWith(${2:this}, ${3:args})
|
||||
snippet Chas
|
||||
${1:callbacks}.has(${2:callback})
|
||||
snippet Clock
|
||||
${1:callbacks}.lock()
|
||||
snippet Clocked
|
||||
${1:callbacks}.locked()
|
||||
snippet Crem
|
||||
${1:callbacks}.remove(${2:callbacks})
|
||||
snippet change
|
||||
${1:obj}.change (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet children
|
||||
${1:obj}.children('${2:selector expression}')
|
||||
snippet clearq
|
||||
${1:obj}.clearQueue(${2:'queue name'})
|
||||
snippet click
|
||||
${1:obj}.click (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet clone
|
||||
${1:obj}.clone()
|
||||
snippet contains
|
||||
$.contains(${1:container}, ${0:contents})
|
||||
snippet css
|
||||
${1:obj}.css('${2:attribute}', '${3:value}')
|
||||
snippet csshooks
|
||||
$.cssHooks['${1:CSS prop}'] = {
|
||||
get: (elem, computed, extra) ->
|
||||
${2: // handle getting the CSS property}
|
||||
set: (elem, value) ->
|
||||
${0: // handle setting the CSS value}
|
||||
}
|
||||
snippet cssm
|
||||
${1:obj}.css({${2:attribute1}: '${3:value1}', ${4:attribute2}: '${5:value2}'})
|
||||
snippet D
|
||||
$.Deferred()
|
||||
snippet Dalways
|
||||
${1:deferred}.always(${2:callbacks})
|
||||
snippet Ddone
|
||||
${1:deferred}.done(${2:callbacks})
|
||||
snippet Dfail
|
||||
${1:deferred}.fail(${2:callbacks})
|
||||
snippet Disrej
|
||||
${1:deferred}.isRejected()
|
||||
snippet Disres
|
||||
${1:deferred}.isResolved()
|
||||
snippet Dnotify
|
||||
${1:deferred}.notify(${2:args})
|
||||
snippet Dnotifyw
|
||||
${1:deferred}.notifyWith(${2:this}, ${3:args})
|
||||
snippet Dpipe
|
||||
${1:deferred}.then(${2:doneFilter}, ${3:failFilter}, ${4:progressFilter})
|
||||
snippet Dprog
|
||||
${1:deferred}.progress(${2:callbacks})
|
||||
snippet Dprom
|
||||
${1:deferred}.promise(${2:target})
|
||||
snippet Drej
|
||||
${1:deferred}.reject(${2:args})
|
||||
snippet Drejw
|
||||
${1:deferred}.rejectWith(${2:this}, ${3:args})
|
||||
snippet Dres
|
||||
${1:deferred}.resolve(${2:args})
|
||||
snippet Dresw
|
||||
${1:deferred}.resolveWith(${2:this}, ${3:args})
|
||||
snippet Dstate
|
||||
${1:deferred}.state()
|
||||
snippet Dthen
|
||||
${1:deferred}.then(${2:doneCallbacks}, ${3:failCallbacks}, ${4:progressCallbacks})
|
||||
snippet Dwhen
|
||||
$.when(${1:deferreds})
|
||||
snippet data
|
||||
${1:obj}.data(${2:obj})
|
||||
snippet dataa
|
||||
$.data('${1:selector expression}', '${2:key}'${3:, 'value'})
|
||||
snippet dblclick
|
||||
${1:obj}.dblclick (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet delay
|
||||
${1:obj}.delay('${2:slow/400/fast}'${3:, 'queue name'})
|
||||
snippet dele
|
||||
${1:obj}.delegate '${2:selector expression}', '${3:event name}', (${4:e}) ->
|
||||
${0:// event handler}
|
||||
snippet deq
|
||||
${1:obj}.dequeue(${2:'queue name'})
|
||||
snippet deqq
|
||||
$.dequeue('${1:selector expression}'${2:, 'queue name'})
|
||||
snippet detach
|
||||
${1:obj}.detach('${2:selector expression}')
|
||||
snippet die
|
||||
${1:obj}.die(${2:event}, ${3:handler})
|
||||
snippet each
|
||||
${1:obj}.each (index) ->
|
||||
${0:this.innerHTML = this + " is the element, " + index + " is the position"}
|
||||
snippet el
|
||||
$('<${1}/>'${2:, {}})
|
||||
snippet eltrim
|
||||
$.trim('${1:string}')
|
||||
snippet empty
|
||||
${1:obj}.empty()
|
||||
snippet end
|
||||
${1:obj}.end()
|
||||
snippet eq
|
||||
${1:obj}.eq(${2:element index})
|
||||
snippet error
|
||||
${1:obj}.error (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet eventsmap
|
||||
{
|
||||
:f${0}
|
||||
}
|
||||
snippet extend
|
||||
$.extend(${1:true, }${2:target}, ${3:obj})
|
||||
snippet fadein
|
||||
${1:obj}.fadeIn('${2:slow/400/fast}')
|
||||
snippet fadeinc
|
||||
${1:obj}.fadeIn 'slow/400/fast', ->
|
||||
${0:// callback}
|
||||
snippet fadeout
|
||||
${1:obj}.fadeOut('${2:slow/400/fast}')
|
||||
snippet fadeoutc
|
||||
${1:obj}.fadeOut 'slow/400/fast', ->
|
||||
${0:// callback}
|
||||
snippet fadeto
|
||||
${1:obj}.fadeTo('${2:slow/400/fast}', ${3:0.5})
|
||||
snippet fadetoc
|
||||
${1:obj}.fadeTo 'slow/400/fast', ${2:0.5}, ->
|
||||
${0:// callback}
|
||||
snippet filter
|
||||
${1:obj}.filter('${2:selector expression}')
|
||||
snippet filtert
|
||||
${1:obj}.filter (${2:index}) ->
|
||||
${3}
|
||||
snippet find
|
||||
${1:obj}.find('${2:selector expression}')
|
||||
snippet focus
|
||||
${1:obj}.focus (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet focusin
|
||||
${1:obj}.focusIn (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet focusout
|
||||
${1:obj}.focusOut (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet get
|
||||
${1:obj}.get(${2:element index})
|
||||
snippet getjson
|
||||
$.getJSON '${1:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(data, textStatus, jqXHR) ->
|
||||
${0:// success callback}
|
||||
snippet getscript
|
||||
$.getScript '${1:mydomain.com/url}', (script, textStatus, jqXHR) ->
|
||||
${0:// callback}
|
||||
snippet grep
|
||||
$.grep(${1:array}, (item, index) >
|
||||
${2}
|
||||
${0:, true})
|
||||
snippet hasc
|
||||
${1:obj}.hasClass('${2:className}')
|
||||
snippet hasd
|
||||
$.hasData('${0:selector expression}')
|
||||
snippet height
|
||||
${1:obj}.height(${2:integer})
|
||||
snippet hide
|
||||
${1:obj}.hide('${2:slow/400/fast}')
|
||||
snippet hidec
|
||||
${1:obj}.hide '${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet hover
|
||||
${1:obj}.hover (${2:e}) ->
|
||||
${3:// event handler}
|
||||
, ($2) ->
|
||||
${4:// event handler}
|
||||
snippet html
|
||||
${1:obj}.html('${2:Some text <b>and bold!</b>}')
|
||||
snippet inarr
|
||||
$.inArray(${1:value}, ${0:array})
|
||||
snippet insa
|
||||
${1:obj}.insertAfter('${2:selector expression}')
|
||||
snippet insb
|
||||
${1:obj}.insertBefore('${2:selector expression}')
|
||||
snippet is
|
||||
${1:obj}.is('${2:selector expression}')
|
||||
snippet isarr
|
||||
$.isArray(${1:obj})
|
||||
snippet isempty
|
||||
$.isEmptyObject(${1:obj})
|
||||
snippet isfunc
|
||||
$.isFunction(${1:obj})
|
||||
snippet isnum
|
||||
$.isNumeric(${1:value})
|
||||
snippet isobj
|
||||
$.isPlainObject(${1:obj})
|
||||
snippet iswin
|
||||
$.isWindow(${1:obj})
|
||||
snippet isxml
|
||||
$.isXMLDoc(${1:node})
|
||||
snippet jj
|
||||
$('${1:selector}')
|
||||
snippet kdown
|
||||
${1:obj}.keydown (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet kpress
|
||||
${1:obj}.keypress (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet kup
|
||||
${1:obj}.keyup (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet last
|
||||
${1:obj}.last('${1:selector expression}')
|
||||
snippet live
|
||||
${1:obj}.live '${2:events}', (${3:e}) ->
|
||||
${0:// event handler}
|
||||
snippet load
|
||||
${1:obj}.load (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet loadf
|
||||
${1:obj}.load('${2:mydomain.com/url}',
|
||||
${2:{ param1: value1 },}
|
||||
(responseText, textStatus, xhr) ->
|
||||
${0:// success callback}
|
||||
})
|
||||
snippet makearray
|
||||
$.makeArray(${0:obj})
|
||||
snippet map
|
||||
${1:obj}.map (${2:index}, ${3:element}) ->
|
||||
${0:// callback}
|
||||
snippet mapp
|
||||
$.map ${1:arrayOrObject}, (${2:value}, ${3:indexOrKey}) ->
|
||||
${0:// callback}
|
||||
snippet merge
|
||||
$.merge(${1:target}, ${0:original})
|
||||
snippet mdown
|
||||
${1:obj}.mousedown (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet menter
|
||||
${1:obj}.mouseenter (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mleave
|
||||
${1:obj}.mouseleave (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mmove
|
||||
${1:obj}.mousemove (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mout
|
||||
${1:obj}.mouseout (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mover
|
||||
${1:obj}.mouseover (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet mup
|
||||
${1:obj}.mouseup (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet next
|
||||
${1:obj}.next('${2:selector expression}')
|
||||
snippet nexta
|
||||
${1:obj}.nextAll('${2:selector expression}')
|
||||
snippet nextu
|
||||
${1:obj}.nextUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet not
|
||||
${1:obj}.not('${2:selector expression}')
|
||||
snippet off
|
||||
${1:obj}.off('${2:events}', '${3:selector expression}'${4:, handler})
|
||||
snippet offset
|
||||
${1:obj}.offset()
|
||||
snippet offsetp
|
||||
${1:obj}.offsetParent()
|
||||
snippet on
|
||||
${1:obj}.on '${2:events}', '${3:selector expression}', (${4:e}) ->
|
||||
${0:// event handler}
|
||||
snippet one
|
||||
${1:obj}.one '${2:event name}', (${3:e}) ->
|
||||
${0:// event handler}
|
||||
snippet outerh
|
||||
${1:obj}.outerHeight()
|
||||
snippet outerw
|
||||
${1:obj}.outerWidth()
|
||||
snippet param
|
||||
$.param(${1:obj})
|
||||
snippet parent
|
||||
${1:obj}.parent('${2:selector expression}')
|
||||
snippet parents
|
||||
${1:obj}.parents('${2:selector expression}')
|
||||
snippet parentsu
|
||||
${1:obj}.parentsUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet parsejson
|
||||
$.parseJSON(${1:data})
|
||||
snippet parsexml
|
||||
$.parseXML(${1:data})
|
||||
snippet pos
|
||||
${1:obj}.position()
|
||||
snippet prepend
|
||||
${1:obj}.prepend('${2:Some text <b>and bold!</b>}')
|
||||
snippet prependto
|
||||
${1:obj}.prependTo('${2:selector expression}')
|
||||
snippet prev
|
||||
${1:obj}.prev('${2:selector expression}')
|
||||
snippet preva
|
||||
${1:obj}.prevAll('${2:selector expression}')
|
||||
snippet prevu
|
||||
${1:obj}.prevUntil('${2:selector expression}'${3:, 'filter expression'})
|
||||
snippet promise
|
||||
${1:obj}.promise(${2:'fx'}, ${3:target})
|
||||
snippet prop
|
||||
${1:obj}.prop('${2:property name}')
|
||||
snippet proxy
|
||||
$.proxy(${1:function}, ${2:this})
|
||||
snippet pushstack
|
||||
${1:obj}.pushStack(${2:elements})
|
||||
snippet queue
|
||||
${1:obj}.queue(${2:name}${3:, newQueue})
|
||||
snippet queuee
|
||||
$.queue(${1:element}${2:, name}${3:, newQueue})
|
||||
snippet ready
|
||||
$(() ->
|
||||
${0}
|
||||
)
|
||||
snippet rem
|
||||
${1:obj}.remove()
|
||||
snippet rema
|
||||
${1:obj}.removeAttr('${2:attribute name}')
|
||||
snippet remc
|
||||
${1:obj}.removeClass('${2:class name}')
|
||||
snippet remd
|
||||
${1:obj}.removeData('${2:key name}')
|
||||
snippet remdd
|
||||
$.removeData(${1:element}${2:, 'key name}')
|
||||
snippet remp
|
||||
${1:obj}.removeProp('${2:property name}')
|
||||
snippet repa
|
||||
${1:obj}.replaceAll(${2:target})
|
||||
snippet repw
|
||||
${1:obj}.replaceWith(${2:content})
|
||||
snippet reset
|
||||
${1:obj}.reset (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet resize
|
||||
${1:obj}.resize (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet scroll
|
||||
${1:obj}.scroll (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet scrolll
|
||||
${1:obj}.scrollLeft(${2:value})
|
||||
snippet scrollt
|
||||
${1:obj}.scrollTop(${2:value})
|
||||
snippet sdown
|
||||
${1:obj}.slideDown('${2:slow/400/fast}')
|
||||
snippet sdownc
|
||||
${1:obj}.slideDown('${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet select
|
||||
${1:obj}.select (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet serialize
|
||||
${1:obj}.serialize()
|
||||
snippet serializea
|
||||
${1:obj}.serializeArray()
|
||||
snippet show
|
||||
${1:obj}.show('${2:slow/400/fast}')
|
||||
snippet showc
|
||||
${1:obj}.show '${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet sib
|
||||
${1:obj}.siblings('${2:selector expression}')
|
||||
snippet size
|
||||
${1:obj}.size()
|
||||
snippet slice
|
||||
${1:obj}.slice(${2:start}${3:, end})
|
||||
snippet stoggle
|
||||
${1:obj}.slideToggle('${2:slow/400/fast}')
|
||||
snippet stop
|
||||
${1:obj}.stop('${2:queue}', ${3:false}, ${4:false})
|
||||
snippet submit
|
||||
${1:obj}.submit (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet sup
|
||||
${1:obj}.slideUp('${2:slow/400/fast}')
|
||||
snippet supc
|
||||
${1:obj}.slideUp '${2:slow/400/fast}', ->
|
||||
${0:// callback}
|
||||
snippet text
|
||||
${1:obj}.text(${2:'some text'})
|
||||
snippet this
|
||||
$(this)
|
||||
snippet toarr
|
||||
${0:obj}.toArray()
|
||||
snippet tog
|
||||
${1:obj}.toggle (${2:e}) ->
|
||||
${3:// event handler}
|
||||
, ($2) ->
|
||||
${4:// event handler}
|
||||
${0}
|
||||
snippet togclass
|
||||
${1:obj}.toggleClass('${2:class name}')
|
||||
snippet togsh
|
||||
${1:obj}.toggle('${2:slow/400/fast}')
|
||||
snippet trig
|
||||
${1:obj}.trigger('${2:event name}')
|
||||
snippet trigh
|
||||
${1:obj}.triggerHandler('${2:event name}')
|
||||
snippet $trim
|
||||
$.trim(${1:str})
|
||||
snippet $type
|
||||
$.type(${1:obj})
|
||||
snippet unbind
|
||||
${1:obj}.unbind('${2:event name}')
|
||||
snippet undele
|
||||
${1:obj}.undelegate(${2:selector expression}, ${3:event}, ${4:handler})
|
||||
snippet uniq
|
||||
$.unique(${1:array})
|
||||
snippet unload
|
||||
${1:obj}.unload (${2:e}) ->
|
||||
${0:// event handler}
|
||||
snippet unwrap
|
||||
${1:obj}.unwrap()
|
||||
snippet val
|
||||
${1:obj}.val('${2:text}')
|
||||
snippet width
|
||||
${1:obj}.width(${2:integer})
|
||||
snippet wrap
|
||||
${1:obj}.wrap('${2:<div class="extra-wrapper"></div>}')
|
|
@ -0,0 +1,11 @@
|
|||
snippet def
|
||||
define ["${1:#dependencies1}"], (${2:#dependencies2}) ->
|
||||
${0:TARGET}
|
||||
|
||||
snippet defn
|
||||
define "${1:#name}", ["${2:#dependencies1}"], (${3:#dependencies2}) ->
|
||||
${0:TARGET}
|
||||
|
||||
snippet reqjs
|
||||
require ["${1:#dependencies1}"], (${2:#dependencies2}) ->
|
||||
${0:TARGET}
|
253
lua/custom/snippets/snipmate/cpp.snippets
Normal file
253
lua/custom/snippets/snipmate/cpp.snippets
Normal file
|
@ -0,0 +1,253 @@
|
|||
extends c
|
||||
|
||||
## Main
|
||||
# main()
|
||||
snippet mainn
|
||||
int main()
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
##
|
||||
## Preprocessor
|
||||
# #include <...>
|
||||
snippet incc
|
||||
#include <${1:iostream}>
|
||||
snippet binc
|
||||
#include <boost/${1:shared_ptr}.hpp>
|
||||
##
|
||||
## STL Collections
|
||||
# std::array
|
||||
snippet array
|
||||
std::array<${1:T}, ${2:N}> ${3};
|
||||
# std::vector
|
||||
snippet vector
|
||||
std::vector<${1:T}> ${2};
|
||||
# std::deque
|
||||
snippet deque
|
||||
std::deque<${1:T}> ${2};
|
||||
# std::forward_list
|
||||
snippet flist
|
||||
std::forward_list<${1:T}> ${2};
|
||||
# std::list
|
||||
snippet list
|
||||
std::list<${1:T}> ${2};
|
||||
# std::set
|
||||
snippet set
|
||||
std::set<${1:T}> ${2};
|
||||
# std::map
|
||||
snippet map
|
||||
std::map<${1:Key}, ${2:T}> ${3};
|
||||
# std::multiset
|
||||
snippet mset
|
||||
std::multiset<${1:T}> ${2};
|
||||
# std::multimap
|
||||
snippet mmap
|
||||
std::multimap<${1:Key}, ${2:T}> ${3};
|
||||
# std::unordered_set
|
||||
snippet uset
|
||||
std::unordered_set<${1:T}> ${2};
|
||||
# std::unordered_map
|
||||
snippet umap
|
||||
std::unordered_map<${1:Key}, ${2:T}> ${3};
|
||||
# std::unordered_multiset
|
||||
snippet umset
|
||||
std::unordered_multiset<${1:T}> ${2};
|
||||
# std::unordered_multimap
|
||||
snippet ummap
|
||||
std::unordered_multimap<${1:Key}, ${2:T}> ${3};
|
||||
# std::stack
|
||||
snippet stack
|
||||
std::stack<${1:T}> ${2};
|
||||
# std::queue
|
||||
snippet queue
|
||||
std::queue<${1:T}> ${2};
|
||||
# std::priority_queue
|
||||
snippet pqueue
|
||||
std::priority_queue<${1:T}> ${2};
|
||||
##
|
||||
## STL smart pointers
|
||||
# std::shared_ptr
|
||||
snippet msp
|
||||
std::shared_ptr<${1:T}> ${2} = std::make_shared<$1>(${3});
|
||||
snippet amsp
|
||||
auto ${1} = std::make_shared<${2:T}>(${3});
|
||||
# std::unique_ptr
|
||||
snippet mup
|
||||
std::unique_ptr<${1:T}> ${2} = std::make_unique<$1>(${3});
|
||||
snippet amup
|
||||
auto ${1} = std::make_unique<${2:T}>(${3});
|
||||
##
|
||||
## Access Modifiers
|
||||
# private
|
||||
snippet pri
|
||||
private
|
||||
# protected
|
||||
snippet pro
|
||||
protected
|
||||
# public
|
||||
snippet pub
|
||||
public
|
||||
# friend
|
||||
snippet fr
|
||||
friend
|
||||
# mutable
|
||||
snippet mu
|
||||
mutable
|
||||
##
|
||||
## Class
|
||||
# class
|
||||
snippet cl
|
||||
/*! \class $1
|
||||
* \brief ${3:Brief class description}
|
||||
*
|
||||
* ${4:Detailed description}
|
||||
*/
|
||||
class ${1:`vim_snippets#Filename('$1', 'name')`}
|
||||
{
|
||||
public:
|
||||
$1(${2});
|
||||
virtual ~$1();
|
||||
|
||||
protected:
|
||||
m_${5}; /*!< ${6:Member description} */
|
||||
};
|
||||
# member function implementation
|
||||
snippet mfun
|
||||
${4:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {
|
||||
${0}
|
||||
}
|
||||
# member function implementation without parameters
|
||||
snippet dmfun0
|
||||
/*! \brief ${4:Brief function description here}
|
||||
*
|
||||
* ${5:Detailed description}
|
||||
*
|
||||
* \return ${6:Return parameter description}
|
||||
*/
|
||||
${3:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}() {
|
||||
${0}
|
||||
}
|
||||
# member function implementation with one parameter
|
||||
snippet dmfun1
|
||||
/*! \brief ${6:Brief function description here}
|
||||
*
|
||||
* ${7:Detailed description}
|
||||
*
|
||||
* \param $4 ${8:Parameter description}
|
||||
* \return ${9:Return parameter description}
|
||||
*/
|
||||
${5:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter}) {
|
||||
${0}
|
||||
}
|
||||
# member function implementation with two parameter
|
||||
snippet dmfun2
|
||||
/*! \brief ${8:Brief function description here}
|
||||
*
|
||||
* ${9:Detailed description}
|
||||
*
|
||||
* \param $4 ${10:Parameter description}
|
||||
* \param $6 ${11:Parameter description}
|
||||
* \return ${12:Return parameter description}
|
||||
*/
|
||||
${7:void} ${1:`vim_snippets#Filename('$1', 'ClassName')`}::${2:memberFunction}(${3:Type} ${4:Parameter},${5:Type} ${6:Parameter}) {
|
||||
${0}
|
||||
}
|
||||
# namespace
|
||||
snippet ns
|
||||
namespace ${1:`vim_snippets#Filename('', 'my')`} {
|
||||
${0}
|
||||
} /* namespace $1 */
|
||||
snippet ans
|
||||
namespace {
|
||||
${0}
|
||||
}
|
||||
##
|
||||
## Input/Output
|
||||
# std::cout
|
||||
snippet cout
|
||||
std::cout << ${1} << std::endl;
|
||||
# std::cin
|
||||
snippet cin
|
||||
std::cin >> ${1};
|
||||
##
|
||||
## Casts
|
||||
# static
|
||||
snippet sca
|
||||
static_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# dynamic
|
||||
snippet dca
|
||||
dynamic_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# reinterpret
|
||||
snippet rca
|
||||
reinterpret_cast<${1:unsigned}>(${2:expr})${3}
|
||||
# const
|
||||
snippet cca
|
||||
const_cast<${1:unsigned}>(${2:expr})${3}
|
||||
## Iteration
|
||||
# for i
|
||||
snippet fori
|
||||
for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {
|
||||
${4}
|
||||
}
|
||||
|
||||
# foreach
|
||||
snippet fore
|
||||
for (${1:auto} ${2:i} : ${3:container}) {
|
||||
${4}
|
||||
}
|
||||
# iterator
|
||||
snippet iter
|
||||
for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {
|
||||
${6}
|
||||
}
|
||||
|
||||
# auto iterator
|
||||
snippet itera
|
||||
for (auto ${1:i} = ${2:container}.begin(); $1 != $2.end(); ++$1) {
|
||||
${3:std::cout << *$1 << std::endl;}
|
||||
}
|
||||
##
|
||||
## Lambdas
|
||||
# lamda (one line)
|
||||
snippet ld
|
||||
[${1}](${2}){${3}};
|
||||
# lambda (multi-line)
|
||||
snippet lld
|
||||
[${1}](${2}){
|
||||
${3}
|
||||
};
|
||||
# snippets exception
|
||||
snippet try
|
||||
try {
|
||||
|
||||
}catch(${1}) {
|
||||
|
||||
}
|
||||
# auto function
|
||||
snippet af auto function
|
||||
auto ${1:name}(${2}) -> ${3:void}
|
||||
{
|
||||
${0}
|
||||
};
|
||||
# Range-v3 transform
|
||||
snippet transform "ranges::views::transform"
|
||||
${1:${2:std::}${3:ranges::}views::}transform($4)
|
||||
# Range-v3 transform
|
||||
snippet filter "ranges::views::filter"
|
||||
${1:${2:std::}${3:ranges::}views::}filter($4)
|
||||
# Range-v3 ranges::
|
||||
snippet r "ranges::"
|
||||
ranges::
|
||||
# Range-v3 ranges::views::
|
||||
snippet rv "ranges::views::"
|
||||
ranges::views::
|
||||
# Range-v3 ranges::actions::
|
||||
snippet ra "ranges::actions::"
|
||||
ranges::actions::
|
||||
# STL std::ranges::
|
||||
snippet sr "std::ranges::"
|
||||
std::ranges::
|
||||
# STL std::views::
|
||||
snippet sv "std::views::"
|
||||
std::views::
|
82
lua/custom/snippets/snipmate/crystal.snippets
Normal file
82
lua/custom/snippets/snipmate/crystal.snippets
Normal file
|
@ -0,0 +1,82 @@
|
|||
snippet req require
|
||||
require "${1}"
|
||||
snippet case
|
||||
case $1
|
||||
when $2
|
||||
${0}
|
||||
end
|
||||
snippet when
|
||||
when $1
|
||||
${0}
|
||||
snippet def
|
||||
def ${1:method_name}
|
||||
${0}
|
||||
end
|
||||
snippet pdef
|
||||
private def ${1:method_name}
|
||||
${0}
|
||||
end
|
||||
snippet if
|
||||
if $1
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet ife
|
||||
if $1
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet wh
|
||||
while $1
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet cla class .. end
|
||||
class ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
|
||||
${0}
|
||||
end
|
||||
snippet mod class .. end
|
||||
module ${1:`substitute(vim_snippets#Filename(), "\(_\|^\)\(.\)", "\u\2", "g")`}
|
||||
${0}
|
||||
end
|
||||
snippet r
|
||||
getter ${0:name}
|
||||
snippet r!
|
||||
getter! ${0:name}
|
||||
snippet r?
|
||||
getter? ${0:name}
|
||||
snippet w
|
||||
setter ${0:name}
|
||||
snippet w!
|
||||
setter! ${0:name}
|
||||
snippet w?
|
||||
setter? ${0:name}
|
||||
snippet rw
|
||||
property ${0:name}
|
||||
snippet rw!
|
||||
property! ${0:name}
|
||||
snippet rw?
|
||||
property? ${0:name}
|
||||
snippet defs
|
||||
def self.${1:class_method_name}
|
||||
${0}
|
||||
end
|
||||
snippet defi
|
||||
def initialize(${1})
|
||||
${0}
|
||||
end
|
||||
snippet do
|
||||
do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet dov
|
||||
do |${1:v}|
|
||||
${2}
|
||||
end
|
||||
snippet desc
|
||||
describe ${1:`substitute(substitute(vim_snippets#Filename(), "_spec$", "", ""), "\(_\|^\)\(.\)", "\u\2", "g")`} do
|
||||
${0}
|
||||
end
|
||||
snippet it
|
||||
it "${1}" do
|
||||
${0}
|
||||
end
|
531
lua/custom/snippets/snipmate/cs.snippets
Normal file
531
lua/custom/snippets/snipmate/cs.snippets
Normal file
|
@ -0,0 +1,531 @@
|
|||
# cs.snippets
|
||||
# ===========
|
||||
#
|
||||
# Standard C-Sharp snippets for snipmate.
|
||||
#
|
||||
# Largely ported over from Visual Studio 2010 snippets plus
|
||||
# a few snippets from Resharper plus a few widely known snippets.
|
||||
#
|
||||
# Most snippets on elements (i.e. classes, properties)
|
||||
# follow suffix conventions. The order of suffixes to a snippet
|
||||
# is fixed.
|
||||
#
|
||||
# Snippet Suffix Order
|
||||
# --------------------
|
||||
# 1. Access Modifiers
|
||||
# 2. Class Modifiers
|
||||
#
|
||||
# Access Modifier Suffix Table
|
||||
# ----------------------------
|
||||
# + = public
|
||||
# & = internal
|
||||
# | = protected
|
||||
# - = private
|
||||
#
|
||||
# Example: `cls&` expands to `internal class $1`.
|
||||
# Access modifiers might be doubled to indicate
|
||||
# different modifiers for get/set on properties.
|
||||
# Example: `pb+-` expands to `public bool $1 { get; private set; }`
|
||||
#
|
||||
# Class Modifier Table
|
||||
# --------------------
|
||||
# ^ = static
|
||||
# % = abstract
|
||||
#
|
||||
# Example: `cls|%` expands to `protected abstract class $1`
|
||||
#
|
||||
# On method and property snippets, you can directly set
|
||||
# one of the common types int, string and bool, if desired,
|
||||
# just by appending the type modifier.
|
||||
#
|
||||
# Type Modifier Table
|
||||
# -------------------
|
||||
# i = integer
|
||||
# s = string
|
||||
# b = bool
|
||||
#
|
||||
# Example: `pi+&` expands to `public int $1 { get; internal set; }`
|
||||
#
|
||||
# I'll most propably add more stuff in here like
|
||||
# * List/Array constructio
|
||||
# * Mostly used generics
|
||||
# * Linq
|
||||
# * Funcs, Actions, Predicates
|
||||
# * Lambda
|
||||
# * Events
|
||||
#
|
||||
# Feedback is welcome!
|
||||
#
|
||||
# Main
|
||||
snippet sim
|
||||
${1:public} static int Main(string[] args)
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
snippet simc
|
||||
public class Application
|
||||
{
|
||||
${1:public} static int Main(string[] args)
|
||||
{
|
||||
${0}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
snippet svm
|
||||
${1:public} static void Main(string[] args)
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# if condition
|
||||
snippet if
|
||||
if (${1:true})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet el
|
||||
else
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet ifs
|
||||
if (${1})
|
||||
${0:${VISUAL}}
|
||||
# ternary conditional
|
||||
snippet t
|
||||
${1} ? ${2} : ${0}
|
||||
snippet ?
|
||||
${1} ? ${2} : ${0}
|
||||
# do while loop
|
||||
snippet do
|
||||
do
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
} while (${1:true});
|
||||
# while loop
|
||||
snippet wh
|
||||
while (${1:true})
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
# for loop
|
||||
snippet for
|
||||
for (int ${1:i} = 0; $1 < ${2:count}; $1${3:++})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet forr
|
||||
for (int ${1:i} = ${2:length}; $1 >= 0; $1--)
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# foreach
|
||||
snippet fore
|
||||
foreach (${1:var} ${2:entry} in ${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet foreach
|
||||
foreach (${1:var} ${2:entry} in ${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet each
|
||||
foreach (${1:var} ${2:entry} in ${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# interfaces
|
||||
snippet interface
|
||||
public interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet if+
|
||||
public interface ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# class bodies
|
||||
snippet class
|
||||
public class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls
|
||||
${2:public} class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls+
|
||||
public class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls+^
|
||||
public static class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls&
|
||||
internal class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls&^
|
||||
internal static class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls|
|
||||
protected class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet cls|%
|
||||
protected abstract class ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# constructor
|
||||
snippet ctor
|
||||
public ${1:`vim_snippets#Filename()`}()
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# properties - auto properties by default.
|
||||
# default type is int with layout get / set.
|
||||
snippet prop
|
||||
${1:public} ${2:int} ${3} { get; set; }
|
||||
snippet p
|
||||
${1:public} ${2:int} ${3} { get; set; }
|
||||
snippet p+
|
||||
public ${1:int} ${2} { get; set; }
|
||||
snippet p+&
|
||||
public ${1:int} ${2} { get; internal set; }
|
||||
snippet p+|
|
||||
public ${1:int} ${2} { get; protected set; }
|
||||
snippet p+-
|
||||
public ${1:int} ${2} { get; private set; }
|
||||
snippet p&
|
||||
internal ${1:int} ${2} { get; set; }
|
||||
snippet p&|
|
||||
internal ${1:int} ${2} { get; protected set; }
|
||||
snippet p&-
|
||||
internal ${1:int} ${2} { get; private set; }
|
||||
snippet p|
|
||||
protected ${1:int} ${2} { get; set; }
|
||||
snippet p|-
|
||||
protected ${1:int} ${2} { get; private set; }
|
||||
snippet p-
|
||||
private ${1:int} ${2} { get; set; }
|
||||
# property - bool
|
||||
snippet pi
|
||||
${1:public} int ${2} { get; set; }
|
||||
snippet pi+
|
||||
public int ${1} { get; set; }
|
||||
snippet pi+&
|
||||
public int ${1} { get; internal set; }
|
||||
snippet pi+|
|
||||
public int ${1} { get; protected set; }
|
||||
snippet pi+-
|
||||
public int ${1} { get; private set; }
|
||||
snippet pi&
|
||||
internal int ${1} { get; set; }
|
||||
snippet pi&|
|
||||
internal int ${1} { get; protected set; }
|
||||
snippet pi&-
|
||||
internal int ${1} { get; private set; }
|
||||
snippet pi|
|
||||
protected int ${1} { get; set; }
|
||||
snippet pi|-
|
||||
protected int ${1} { get; private set; }
|
||||
snippet pi-
|
||||
private int ${1} { get; set; }
|
||||
# property - bool
|
||||
snippet pb
|
||||
${1:public} bool ${2} { get; set; }
|
||||
snippet pb+
|
||||
public bool ${1} { get; set; }
|
||||
snippet pb+&
|
||||
public bool ${1} { get; internal set; }
|
||||
snippet pb+|
|
||||
public bool ${1} { get; protected set; }
|
||||
snippet pb+-
|
||||
public bool ${1} { get; private set; }
|
||||
snippet pb&
|
||||
internal bool ${1} { get; set; }
|
||||
snippet pb&|
|
||||
internal bool ${1} { get; protected set; }
|
||||
snippet pb&-
|
||||
internal bool ${1} { get; private set; }
|
||||
snippet pb|
|
||||
protected bool ${1} { get; set; }
|
||||
snippet pb|-
|
||||
protected bool ${1} { get; private set; }
|
||||
snippet pb-
|
||||
private bool ${1} { get; set; }
|
||||
# property - string
|
||||
snippet ps
|
||||
${1:public} string ${2} { get; set; }
|
||||
snippet ps+
|
||||
public string ${1} { get; set; }
|
||||
snippet ps+&
|
||||
public string ${1} { get; internal set; }
|
||||
snippet ps+|
|
||||
public string ${1} { get; protected set; }
|
||||
snippet ps+-
|
||||
public string ${1} { get; private set; }
|
||||
snippet ps&
|
||||
internal string ${1} { get; set; }
|
||||
snippet ps&|
|
||||
internal string ${1} { get; protected set; }
|
||||
snippet ps&-
|
||||
internal string ${1} { get; private set; }
|
||||
snippet ps|
|
||||
protected string ${1} { get; set; }
|
||||
snippet ps|-
|
||||
protected string ${1} { get; private set; }
|
||||
snippet ps-
|
||||
private string ${1} { get; set; }
|
||||
# members - void
|
||||
snippet m
|
||||
${1:public} ${2:void} ${3}(${4})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m+
|
||||
public ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m&
|
||||
internal ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m|
|
||||
protected ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
snippet m-
|
||||
private ${1:void} ${2}(${3})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# members - int
|
||||
snippet mi
|
||||
${1:public} int ${2}(${3})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi+
|
||||
public int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi&
|
||||
internal int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi|
|
||||
protected int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
snippet mi-
|
||||
private int ${1}(${2})
|
||||
{
|
||||
${0:return 0;}
|
||||
}
|
||||
# members - bool
|
||||
snippet mb
|
||||
${1:public} bool ${2}(${3})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb+
|
||||
public bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb&
|
||||
internal bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb|
|
||||
protected bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
snippet mb-
|
||||
private bool ${1}(${2})
|
||||
{
|
||||
${0:return false;}
|
||||
}
|
||||
# members - string
|
||||
snippet ms
|
||||
${1:public} string ${2}(${3})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms+
|
||||
public string ${1}(${2})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms&
|
||||
internal string ${1}(${2})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms|
|
||||
protected string ${1:}(${2:})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
snippet ms-
|
||||
private string ${1}(${2})
|
||||
{
|
||||
${0:return "";}
|
||||
}
|
||||
# structure
|
||||
snippet struct
|
||||
public struct ${1:`vim_snippets#Filename()`}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# enumeration
|
||||
snippet enum
|
||||
enum ${1}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet enum+
|
||||
public enum ${1}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# preprocessor directives
|
||||
snippet #if
|
||||
#if
|
||||
${0}
|
||||
#endif
|
||||
# inline xml documentation
|
||||
snippet ///
|
||||
/// <summary>
|
||||
/// ${0}
|
||||
/// </summary>
|
||||
snippet <p
|
||||
<param name="${1}">${2:$1}</param>
|
||||
snippet <ex
|
||||
<exception cref="${1:System.Exception}">${2}</exception>
|
||||
snippet <r
|
||||
<returns>${1}</returns>
|
||||
snippet <s
|
||||
<see cref="${1}"/>
|
||||
snippet <rem
|
||||
<remarks>${1}</remarks>
|
||||
snippet <c
|
||||
<code>${1}</code>
|
||||
|
||||
snippet cw
|
||||
Console.WriteLine(${1});
|
||||
|
||||
# equals override
|
||||
snippet eq
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
${0:throw new NotImplementedException();}
|
||||
return base.Equals(obj);
|
||||
}
|
||||
# exception
|
||||
snippet exc
|
||||
public class ${1:MyException} : ${2:Exception}
|
||||
{
|
||||
public $1() { }
|
||||
public $1(string message) : base(message) { }
|
||||
public $1(string message, Exception inner) : base(message, inner) { }
|
||||
protected $1(
|
||||
System.Runtime.Serialization.SerializationInfo info,
|
||||
System.Runtime.Serialization.StreamingContext context)
|
||||
: base(info, context) { }
|
||||
}
|
||||
# indexer
|
||||
snippet index
|
||||
public ${1:object} this[${2:int} index]
|
||||
{
|
||||
get { ${0} }
|
||||
set { ${0} }
|
||||
}
|
||||
# eventhandler
|
||||
snippet inv
|
||||
EventHandler temp = ${1:MyEvent};
|
||||
if (${2:temp} != null)
|
||||
{
|
||||
$2();
|
||||
}
|
||||
# lock
|
||||
snippet lock
|
||||
lock (${1:this})
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# namespace
|
||||
snippet namespace
|
||||
namespace ${1:MyNamespace}
|
||||
{
|
||||
${0}
|
||||
}
|
||||
# property
|
||||
snippet propr
|
||||
public ${1:int} ${2:MyProperty} { get; set; }
|
||||
snippet propf
|
||||
private ${1:int} ${2:myVar};
|
||||
public $1 ${3:MyProperty}
|
||||
{
|
||||
get { return $2; }
|
||||
set { $2 = value; }
|
||||
}
|
||||
snippet propg
|
||||
public ${1:int} ${2:MyProperty} { get; private set; }
|
||||
# switch
|
||||
snippet switch
|
||||
switch (${1:switch_on})
|
||||
{
|
||||
${0}
|
||||
default:
|
||||
}
|
||||
# try
|
||||
snippet try
|
||||
try
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
catch (${1:System.Exception})
|
||||
{
|
||||
throw;
|
||||
}
|
||||
snippet tryf
|
||||
try
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
finally
|
||||
{
|
||||
${1}
|
||||
}
|
||||
# using
|
||||
snippet usi
|
||||
using (${1:resource})
|
||||
{
|
||||
${0}
|
||||
}
|
1263
lua/custom/snippets/snipmate/css.snippets
Normal file
1263
lua/custom/snippets/snipmate/css.snippets
Normal file
File diff suppressed because it is too large
Load diff
59
lua/custom/snippets/snipmate/cuda.snippets
Normal file
59
lua/custom/snippets/snipmate/cuda.snippets
Normal file
|
@ -0,0 +1,59 @@
|
|||
extends cpp
|
||||
|
||||
snippet kern "Kernel definition"
|
||||
__global__ void ${1:kernel}(${2:void}) {
|
||||
${0:// TODO: Implement}
|
||||
}
|
||||
|
||||
snippet dev "Device function definition"
|
||||
__device__ ${1:int} ${2:foo}(${3:void}) {
|
||||
${0:// TODO: Implement}
|
||||
return 0;
|
||||
}
|
||||
|
||||
snippet call "Kernel call"
|
||||
${1:kernel}<<<${2:args}>>>(${3});${0}
|
||||
|
||||
snippet sync "Synchonize threads"
|
||||
__syncthreads();
|
||||
|
||||
snippet tid "Thread Index"
|
||||
threadIdx.${0}
|
||||
|
||||
snippet bid "Block Index"
|
||||
blockIdx.${0}
|
||||
|
||||
snippet bdim "Block Dimension"
|
||||
blockDim.${0}
|
||||
|
||||
snippet ii "Get current index (1D)"
|
||||
int ${1:index} = threadIdx.${2:x} + blockIdx.$2 * blockDim.$2;
|
||||
|
||||
snippet ix "Get current X index (1D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
|
||||
snippet iy "Get current Y index (1D)"
|
||||
int ${1:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
|
||||
snippet iz "Get current Z index (1D)"
|
||||
int ${1:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet ixy "Get current X,Y index (2D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
|
||||
snippet ixz "Get current X,Z index (2D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet iyz "Get current Y,Z index (2D)"
|
||||
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet ixyz "Get current X,Y,Z index (3D)"
|
||||
int ${1:x} = threadIdx.x + blockIdx.x * blockDim.x;
|
||||
int ${2:y} = threadIdx.y + blockIdx.y * blockDim.y;
|
||||
int ${3:z} = threadIdx.z + blockIdx.z * blockDim.z;
|
||||
|
||||
snippet share "Shared memory declaration"
|
||||
__shared__ ${1:int} ${2:memo}[${3:SIZE}];${0}
|
338
lua/custom/snippets/snipmate/d.snippets
Normal file
338
lua/custom/snippets/snipmate/d.snippets
Normal file
|
@ -0,0 +1,338 @@
|
|||
### Import
|
||||
snippet imp
|
||||
import
|
||||
snippet pimp
|
||||
public import
|
||||
### My favorite modules
|
||||
snippet io
|
||||
std.stdio
|
||||
snippet traits
|
||||
std.traits
|
||||
snippet conv
|
||||
std.conv
|
||||
snippet arr
|
||||
std.array
|
||||
snippet algo
|
||||
std.algorithm
|
||||
snippet theusual
|
||||
import std.stdio, std.string, std.array;
|
||||
import std.traits, std.conv, std.algorithm;
|
||||
import std.math, std.regex;
|
||||
### Control Structures
|
||||
snippet for
|
||||
for(int ${1:i} = 0; $1 < ${2:count}; $1++) {
|
||||
${0}
|
||||
}
|
||||
snippet fe
|
||||
foreach(${1:elem}; ${2:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet fei
|
||||
foreach(${1:i}, ${2:elem}; ${3:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet fer
|
||||
foreach_reverse(${1:elem}; ${2:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet feri
|
||||
foreach_reverse(${1:i}, ${2:elem}; ${3:range}) {
|
||||
${0}
|
||||
}
|
||||
snippet sce
|
||||
scope(exit) ${1:f.close();}
|
||||
snippet scs
|
||||
scope(success) ${1}
|
||||
snippet scf
|
||||
scope(failure) ${1}
|
||||
snippet el
|
||||
else {
|
||||
${1}
|
||||
}
|
||||
snippet eif
|
||||
else if(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet if
|
||||
if(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
if(${1}) {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
snippet ifee
|
||||
if(${1}) {
|
||||
${2}
|
||||
} else if(${3}) {
|
||||
${4}
|
||||
} else {
|
||||
${5}
|
||||
}
|
||||
snippet sw
|
||||
switch(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet cs
|
||||
case ${1:0}:
|
||||
${2}
|
||||
break;
|
||||
snippet def
|
||||
default:
|
||||
${0}
|
||||
snippet fsw
|
||||
final switch(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet try
|
||||
try {
|
||||
${1:${VISUAL}}
|
||||
} catch(${2:Exception} ${3:e}) {
|
||||
${4}
|
||||
}
|
||||
snippet tcf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch(${1:Exception} ${2:e}) {
|
||||
${3}
|
||||
} finally {
|
||||
${4}
|
||||
}
|
||||
snippet wh
|
||||
while(${1:cond}) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
snippet dowh
|
||||
do {
|
||||
${1}
|
||||
} while(${2});
|
||||
snippet sif
|
||||
static if(${1:cond}) {
|
||||
${2}
|
||||
}
|
||||
snippet sife
|
||||
static if(${1}) {
|
||||
${2}
|
||||
} else {
|
||||
${3}
|
||||
}
|
||||
snippet sifee
|
||||
static if(${1}) {
|
||||
${2}
|
||||
} else static if(${3}) {
|
||||
${4}
|
||||
} else {
|
||||
${5}
|
||||
}
|
||||
snippet seif
|
||||
else static if(${1}) {
|
||||
${2}
|
||||
}
|
||||
snippet ?
|
||||
(${1: a > b}) ? ${2:a} : ${3:b};
|
||||
snippet with
|
||||
with(${1:exp}) {
|
||||
${2}
|
||||
} ${0}
|
||||
### Functions
|
||||
snippet fun
|
||||
${1:auto} ${2:func}(${3:params}) {
|
||||
${0}
|
||||
}
|
||||
snippet contr
|
||||
in {
|
||||
${1}
|
||||
} out {
|
||||
${2}
|
||||
} body {
|
||||
${0}
|
||||
}
|
||||
snippet l
|
||||
(${1:x}) => ${2:x}${0:;}
|
||||
snippet funl
|
||||
function (${1:int x}) => ${2}${3:;}
|
||||
snippet del
|
||||
delegate (${1:int x}) => ${2}${3:;}
|
||||
### Templates
|
||||
snippet temp
|
||||
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) {
|
||||
${0}
|
||||
}
|
||||
snippet tempif
|
||||
template ${1:`vim_snippets#Filename("$2", "untitled")`}(${2:T}) if(${3:isSomeString!}$2) {
|
||||
${0}
|
||||
}
|
||||
snippet opApply
|
||||
int opApply(Dg)(Dg dg) if(ParameterTypeTuble!Dg.length == 2) {
|
||||
${0}
|
||||
}
|
||||
snippet psn
|
||||
pure @safe nothrow
|
||||
snippet safe
|
||||
@safe
|
||||
snippet trusted
|
||||
@trusted
|
||||
snippet system
|
||||
@system
|
||||
### OOPs
|
||||
snippet cl
|
||||
class${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet str
|
||||
struct${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet uni
|
||||
union${1:(T)} ${2:`vim_snippets#Filename("$3", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet inter
|
||||
interface I${1:`vim_snippets#Filename("$2", "untitled")`} {
|
||||
${0}
|
||||
}
|
||||
snippet enum
|
||||
enum ${1} {
|
||||
${0}
|
||||
}
|
||||
snippet pu
|
||||
public
|
||||
snippet pr
|
||||
private
|
||||
snippet po
|
||||
protected
|
||||
snippet ctor
|
||||
this(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet dtor
|
||||
~this(${1}) {
|
||||
${0}
|
||||
}
|
||||
### Type Witchery
|
||||
snippet al
|
||||
alias ${1:b} = ${2:a};
|
||||
${0}
|
||||
snippet alth
|
||||
alias ${1:value} this;
|
||||
${0}
|
||||
### The Commonplace
|
||||
snippet main
|
||||
void main() {
|
||||
${0}
|
||||
}
|
||||
snippet maina
|
||||
void main(string[] args) {
|
||||
${0}
|
||||
}
|
||||
snippet mod
|
||||
module ${1:main};${0}
|
||||
snippet var
|
||||
${1:auto} ${2:var} = ${0:1};
|
||||
snippet new
|
||||
${1:auto} ${2:var} = new ${3:Object}(${4});
|
||||
${0}
|
||||
snippet file
|
||||
auto ${1:f} = File(${2:"useful_info.xml"}, ${3:"rw"});
|
||||
${0}
|
||||
snippet map
|
||||
map!(${1:f})(${2:xs});
|
||||
${0}
|
||||
snippet filter
|
||||
filter!(${1:p})(${2:xs});
|
||||
${0}
|
||||
snippet reduce
|
||||
reduce!(${1:f})(${2:xs});
|
||||
${0}
|
||||
snippet find
|
||||
find!(${1:p})($2:xs);
|
||||
${0}
|
||||
snippet aa
|
||||
${1:int}[${2:string}] ${3:dict} = ${0};
|
||||
### Misc
|
||||
snippet #!
|
||||
#!/usr/bin/env rdmd
|
||||
snippet bang
|
||||
#!/usr/bin/env rdmd
|
||||
snippet rdmd
|
||||
#!/usr/bin/env rdmd
|
||||
snippet isstr
|
||||
isSomeString!${1:S}
|
||||
snippet isnum
|
||||
isNumeric!${1:N}
|
||||
snippet tos
|
||||
to!string(${1:x});
|
||||
${0}
|
||||
snippet toi
|
||||
to!int(${1:str});
|
||||
${0}
|
||||
snippet tod
|
||||
to!double(${1:str});
|
||||
${0}
|
||||
snippet un
|
||||
unittest {
|
||||
${0}
|
||||
}
|
||||
snippet ver
|
||||
version(${1:Posix}) {
|
||||
${0}
|
||||
}
|
||||
snippet de
|
||||
debug {
|
||||
${0}
|
||||
}
|
||||
snippet sst
|
||||
shared static this(${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet td
|
||||
// Typedef is deprecated. Use alias instead.
|
||||
typedef
|
||||
snippet ino
|
||||
inout
|
||||
snippet imm
|
||||
immutable
|
||||
snippet fin
|
||||
final
|
||||
snippet con
|
||||
const
|
||||
snippet psi
|
||||
private static immutable ${1:int} ${2:Constant} = ${3:1};
|
||||
${0}
|
||||
snippet prag
|
||||
pragma(${1})
|
||||
snippet pms
|
||||
pragma(msg, ${1:Warning});
|
||||
snippet asm
|
||||
asm {
|
||||
${1}
|
||||
}
|
||||
snippet mixin
|
||||
mixin(${1:`writeln("Hello, World!");`});
|
||||
snippet over
|
||||
override
|
||||
snippet ret
|
||||
return ${1};
|
||||
snippet FILE
|
||||
__FILE__
|
||||
snippet MOD
|
||||
__MODULE__
|
||||
snippet LINE
|
||||
__LINE__
|
||||
snippet FUN
|
||||
__FUNCTION__
|
||||
snippet PF
|
||||
__PRETTY_FUNCTION__
|
||||
snippet cast
|
||||
cast(${1:T})(${2:val});
|
||||
snippet /*
|
||||
/*
|
||||
* ${1}
|
||||
*/
|
||||
### Fun stuff
|
||||
snippet idk
|
||||
// I don't know how this works. Don't touch it.
|
||||
snippet idfk
|
||||
// Don't FUCKING touch this.
|
93
lua/custom/snippets/snipmate/dart-flutter.snippets
Normal file
93
lua/custom/snippets/snipmate/dart-flutter.snippets
Normal file
|
@ -0,0 +1,93 @@
|
|||
# Snippets for dart in flutter project, to use add the following to your .vimrc
|
||||
# `autocmd BufRead,BufNewFile,BufEnter *.dart UltiSnipsAddFiletypes dart-flutter`
|
||||
# Flutter stateless widget
|
||||
snippet stless
|
||||
class $1 extends StatelessWidget {
|
||||
const $1({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter stateful widget
|
||||
snippet stful
|
||||
class $1 extends StatefulWidget {
|
||||
const $1({super.key});
|
||||
|
||||
@override
|
||||
State<$1> createState() => _$1State();
|
||||
}
|
||||
|
||||
class _$1State extends State<$1> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter widget with AnimationController
|
||||
snippet stanim
|
||||
class $1 extends StatefulWidget {
|
||||
const $1({super.key});
|
||||
|
||||
@override
|
||||
State<$1> createState() => _$1State();
|
||||
}
|
||||
|
||||
class _$1State extends State<$1>
|
||||
with SingleTickerProviderStateMixin {
|
||||
AnimationController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_controller.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
$2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# Flutter scaffold application
|
||||
snippet fsa
|
||||
void main() {
|
||||
runApp(
|
||||
MaterialApp(
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.blue,
|
||||
),
|
||||
debugShowCheckedModeBanner: false,
|
||||
home: const HomePage(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Home Page'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
83
lua/custom/snippets/snipmate/dart.snippets
Normal file
83
lua/custom/snippets/snipmate/dart.snippets
Normal file
|
@ -0,0 +1,83 @@
|
|||
snippet lib
|
||||
library ${1};
|
||||
${0}
|
||||
snippet im
|
||||
import 'package:${1}/${2}.dart';
|
||||
${0}
|
||||
snippet rgx
|
||||
new RegExp(r'${1}')
|
||||
snippet var
|
||||
var ${1} = ${2};
|
||||
snippet main
|
||||
main() {
|
||||
${0}
|
||||
}
|
||||
snippet st
|
||||
static ${0}
|
||||
snippet fi
|
||||
final ${0}
|
||||
snippet re
|
||||
return ${0}
|
||||
snippet br
|
||||
break;
|
||||
snippet th
|
||||
throw ${0}
|
||||
snippet cl
|
||||
class ${1:`vim_snippets#Filename("", "untitled")`} ${0}
|
||||
snippet in
|
||||
interface ${1:`vim_snippets#Filename("", "untitled")`} ${0}
|
||||
snippet imp
|
||||
implements ${0}
|
||||
snippet ext
|
||||
extends ${0}
|
||||
snippet if
|
||||
if (${1:true}) {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
if (${1:true}) {
|
||||
${2}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
else
|
||||
snippet sw
|
||||
switch (${1}) {
|
||||
${0}
|
||||
}
|
||||
snippet cs
|
||||
case ${1}:
|
||||
${0}
|
||||
snippet de
|
||||
default:
|
||||
${0}
|
||||
snippet for
|
||||
for (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) {
|
||||
${0:$1[$2]}
|
||||
}
|
||||
snippet fore
|
||||
for (final ${2:item} in ${1:itemList}) {
|
||||
${0}
|
||||
}
|
||||
snippet wh
|
||||
while ($1) {
|
||||
${0}
|
||||
}
|
||||
snippet dowh
|
||||
do {
|
||||
${0}
|
||||
} while ($0);
|
||||
snippet as
|
||||
assert($0);
|
||||
snippet try
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception e}) {
|
||||
}
|
||||
snippet tryf
|
||||
try {
|
||||
${0:${VISUAL}}
|
||||
} catch (${1:Exception e}) {
|
||||
} finally {
|
||||
}
|
11
lua/custom/snippets/snipmate/diff.snippets
Normal file
11
lua/custom/snippets/snipmate/diff.snippets
Normal file
|
@ -0,0 +1,11 @@
|
|||
# DEP-3 (http://dep.debian.net/deps/dep3/) style patch header
|
||||
snippet header DEP-3 style header
|
||||
Description: ${1}
|
||||
Origin: ${2:vendor|upstream|other}, ${3:url of the original patch}
|
||||
Bug: ${4:url in upstream bugtracker}
|
||||
Forwarded: ${5:no|not-needed|url}
|
||||
Author: ${6:`g:snips_author`}
|
||||
Reviewed-by: ${7:name and email}
|
||||
Last-Update: ${8:`strftime("%Y-%m-%d")`}
|
||||
Applied-Upstream: ${0:upstream version|url|commit}
|
||||
|
112
lua/custom/snippets/snipmate/django.snippets
Normal file
112
lua/custom/snippets/snipmate/django.snippets
Normal file
|
@ -0,0 +1,112 @@
|
|||
# Model Fields
|
||||
|
||||
# Note: Optional arguments are using defaults that match what Django will use
|
||||
# as a default, e.g. with max_length fields. Doing this as a form of self
|
||||
# documentation and to make it easy to know whether you should override the
|
||||
# default or not.
|
||||
|
||||
# Note: Optional arguments that are booleans will use the opposite since you
|
||||
# can either not specify them, or override them, e.g. auto_now_add=False.
|
||||
|
||||
snippet auto
|
||||
${1:FIELDNAME} = models.AutoField(${0})
|
||||
snippet bigint
|
||||
${1:FIELDNAME} = models.BigIntegerField(${0})
|
||||
snippet binary
|
||||
${1:FIELDNAME} = models.BinaryField(${0})
|
||||
snippet bool
|
||||
${1:FIELDNAME} = models.BooleanField(${0:default=True})
|
||||
snippet char
|
||||
${1:FIELDNAME} = models.CharField(max_length=${2}${0:, blank=True})
|
||||
snippet comma
|
||||
${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${0:, blank=True})
|
||||
snippet date
|
||||
${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
||||
snippet datetime
|
||||
${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
||||
snippet decimal
|
||||
${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${0})
|
||||
snippet email
|
||||
${1:FIELDNAME} = models.EmailField(max_length=${2:75}${0:, blank=True})
|
||||
snippet file
|
||||
${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${0:, max_length=100})
|
||||
snippet filepath
|
||||
${1:FIELDNAME} = models.FilePathField(path=${2:"/abs/path/to/dir"}${3:, max_length=100}${4:, match="*.ext"}${5:, recursive=True}${0:, blank=True, })
|
||||
snippet float
|
||||
${1:FIELDNAME} = models.FloatField(${0})
|
||||
snippet image
|
||||
${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${0:, max_length=100})
|
||||
snippet int
|
||||
${1:FIELDNAME} = models.IntegerField(${0})
|
||||
snippet ip
|
||||
${1:FIELDNAME} = models.IPAddressField(${0})
|
||||
snippet nullbool
|
||||
${1:FIELDNAME} = models.NullBooleanField(${0})
|
||||
snippet posint
|
||||
${1:FIELDNAME} = models.PositiveIntegerField(${0})
|
||||
snippet possmallint
|
||||
${1:FIELDNAME} = models.PositiveSmallIntegerField(${0})
|
||||
snippet slug
|
||||
${1:FIELDNAME} = models.SlugField(max_length=${2:50}${0:, blank=True})
|
||||
snippet smallint
|
||||
${1:FIELDNAME} = models.SmallIntegerField(${0})
|
||||
snippet text
|
||||
${1:FIELDNAME} = models.TextField(${0:blank=True})
|
||||
snippet time
|
||||
${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${0:, blank=True, null=True})
|
||||
snippet url
|
||||
${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${0:, blank=True})
|
||||
snippet xml
|
||||
${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${0:, blank=True})
|
||||
# Relational Fields
|
||||
snippet fk
|
||||
${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${0:, to_field=''})
|
||||
snippet m2m
|
||||
${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${0:, db_table=''})
|
||||
snippet o2o
|
||||
${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${0:, to_field=''})
|
||||
|
||||
# Code Skeletons
|
||||
|
||||
snippet form
|
||||
class ${1:FormName}(forms.Form):
|
||||
"""${2:docstring}"""
|
||||
${0}
|
||||
|
||||
snippet model
|
||||
class ${1:ModelName}(models.Model):
|
||||
"""${2:docstring}"""
|
||||
${3}
|
||||
|
||||
class Meta:
|
||||
${4}
|
||||
|
||||
def __unicode__(self):
|
||||
${5}
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
${6}
|
||||
|
||||
@models.permalink
|
||||
def get_absolute_url(self):
|
||||
return ('${7:view_or_url_name}' ${0})
|
||||
|
||||
snippet modeladmin
|
||||
class ${1:ModelName}Admin(admin.ModelAdmin):
|
||||
${0}
|
||||
|
||||
admin.site.register($1, $1Admin)
|
||||
|
||||
snippet tabularinline
|
||||
class ${0:ModelName}Inline(admin.TabularInline):
|
||||
model = $1
|
||||
|
||||
snippet stackedinline
|
||||
class ${0:ModelName}Inline(admin.StackedInline):
|
||||
model = $1
|
||||
|
||||
snippet r2r
|
||||
return render_to_response('${1:template.html}', {
|
||||
${2}
|
||||
}${0:, context_instance=RequestContext(request)}
|
||||
)
|
12
lua/custom/snippets/snipmate/dosini.snippets
Normal file
12
lua/custom/snippets/snipmate/dosini.snippets
Normal file
|
@ -0,0 +1,12 @@
|
|||
snippet ec
|
||||
; http://editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = ${1:space_or_tab}
|
||||
indent_size = ${2:indent_size}
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
71
lua/custom/snippets/snipmate/eelixir.snippets
Normal file
71
lua/custom/snippets/snipmate/eelixir.snippets
Normal file
|
@ -0,0 +1,71 @@
|
|||
extends html
|
||||
|
||||
snippet % <% %>
|
||||
<% ${0} %>
|
||||
snippet = <%= %>
|
||||
<%= ${0} %>
|
||||
snippet # <%# %>
|
||||
<%# ${0} %>
|
||||
snippet end
|
||||
<% end %>
|
||||
snippet for
|
||||
<%= for ${1:item} <- ${2:items} ${3:@conn} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet if
|
||||
<%= if ${1} do %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<%= if ${1} do %>
|
||||
${2:${VISUAL}}
|
||||
<% else %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet cond
|
||||
<%= cond do %>
|
||||
<% ${1} -> %>
|
||||
${2:${VISUAL}}
|
||||
|
||||
<% true -> %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet unless
|
||||
<%= unless ${1} do %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ft form_tag
|
||||
<%= form_tag(${1:"/users"}, method: ${2::post}) %>
|
||||
${0}
|
||||
</form>
|
||||
|
||||
snippet sl select
|
||||
<%= select ${1:f}, :${2:field}, ${3:[{"key", "value"}]}, prompt: ${4:"Prompt"} %>
|
||||
|
||||
snippet sb submit
|
||||
<%= submit ${1:"Submit"} %>
|
||||
|
||||
snippet rb radio_button
|
||||
<%= radio_button ${1:f}, :${2:field}, ${3:"value"} %>
|
||||
|
||||
|
||||
snippet et error_tag
|
||||
<%= error_tag ${1:f}, :${2:field} %>
|
||||
snippet ti text_input
|
||||
<%= text_input ${1:f}, :${2:field} %>
|
||||
snippet la label
|
||||
<%= label ${1:f}, :${2:field}, "${3:Label}" %>
|
||||
snippet pi password_input
|
||||
<%= password_input ${1:f}, :${2:password} %>
|
||||
snippet render
|
||||
<%= render "${1:index}.html", ${2:var: @var} %>
|
||||
snippet lin link
|
||||
<%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
|
||||
snippet ff form_for
|
||||
<%= form_for @changeset, ${1:"/users"}, fn f -> %>
|
||||
${0}
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
snippet pry
|
||||
<% require IEx; IEx.pry %>
|
297
lua/custom/snippets/snipmate/elixir.snippets
Normal file
297
lua/custom/snippets/snipmate/elixir.snippets
Normal file
|
@ -0,0 +1,297 @@
|
|||
snippet do
|
||||
do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet put IO.puts
|
||||
IO.puts("${0}")
|
||||
snippet ins IO.inspect
|
||||
IO.inspect(${0})
|
||||
snippet insl IO.inspect with label
|
||||
IO.inspect(${0}label: "${1:label}")
|
||||
snippet if if .. do .. end
|
||||
if ${1} do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet if: if .. do: ..
|
||||
if $1, do: ${0}
|
||||
snippet ife if .. do .. else .. end
|
||||
if $1 do
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet ife: if .. do: .. else:
|
||||
if $1, do: ${2}, else: ${0}
|
||||
snippet unless unless .. do .. end
|
||||
unless ${1} do
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet unless: unless .. do: ..
|
||||
unless $1, do: ${0}
|
||||
snippet unlesse unless .. do .. else .. end
|
||||
unless $1 do
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
end
|
||||
snippet unlesse: unless .. do: .. else:
|
||||
unless $1, do: ${2}, else: ${0}
|
||||
snippet cond
|
||||
cond do
|
||||
${1} ->
|
||||
${0:${VISUAL}}
|
||||
end
|
||||
snippet case
|
||||
case ${1} do
|
||||
${2} ->
|
||||
${0}
|
||||
end
|
||||
snippet for
|
||||
for ${1:item} <- ${2:items} do
|
||||
${0}
|
||||
end
|
||||
snippet for:
|
||||
for ${1:item} <- ${2:items}, do: ${0}
|
||||
snippet fori
|
||||
for ${1:item} <- ${2:items}, into: ${3} do
|
||||
${0}
|
||||
end
|
||||
snippet wi
|
||||
with ${1:item} <- ${2:items} do
|
||||
${0}
|
||||
end
|
||||
snippet wie
|
||||
with(
|
||||
${1:item} <- ${2:items}
|
||||
) do
|
||||
${3}
|
||||
else
|
||||
${4} ->
|
||||
${0}
|
||||
end
|
||||
snippet sp
|
||||
@spec ${1:name}(${2:args}) :: ${3:returns}
|
||||
snippet op
|
||||
@opaque ${1:type_name} :: ${2:type}
|
||||
snippet ty
|
||||
@type ${1:type_name} :: ${2:type}
|
||||
snippet typ
|
||||
@typep ${1:type_name} :: ${2:type}
|
||||
snippet cb
|
||||
@callback ${1:name}(${2:args}) :: ${3:returns}
|
||||
snippet df
|
||||
def ${1:name}, do: ${2}
|
||||
snippet dfw
|
||||
def ${1:name}(${2:args}) when ${3:guard}, do:
|
||||
snippet def
|
||||
def ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
"""
|
||||
def ${2:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defs
|
||||
@spec ${1:name}(${2:arg types}) :: ${3:no_return}
|
||||
def $1(${4:args}) do
|
||||
${0}
|
||||
end
|
||||
snippet defsd
|
||||
@doc """
|
||||
${1:doc string}
|
||||
"""
|
||||
@spec ${2:name}(${3:arg types}) :: ${4:no_return}
|
||||
def $2(${5:args}) do
|
||||
${0}
|
||||
end
|
||||
snippet defw
|
||||
def ${1:name}(${2:args}) when ${3:guard} do
|
||||
${0}
|
||||
end
|
||||
snippet defim
|
||||
defimpl ${1:protocol_name}, for: ${2:data_type} do
|
||||
${0}
|
||||
end
|
||||
snippet defma
|
||||
defmacro ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defmo
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
${0}
|
||||
end
|
||||
snippet %M
|
||||
%__MODULE__{
|
||||
${1:key_name}: ${2:value}
|
||||
}
|
||||
snippet enfk
|
||||
@enforce_keys [:${1:key_name}]
|
||||
snippet dfp
|
||||
defp ${1:name}, do: ${2}
|
||||
snippet dfpw
|
||||
defp ${1:name}(${2:args}) when ${3:guard}, do: ${4}
|
||||
snippet defp
|
||||
defp ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet defpw
|
||||
defp ${1:name}(${2:args}) when ${3:guard} do
|
||||
${0}
|
||||
end
|
||||
snippet defpr
|
||||
defprotocol ${1:name}, [${0:function}]
|
||||
snippet defr
|
||||
defrecord ${1:record_name}, ${0:fields}
|
||||
snippet doc
|
||||
@doc """
|
||||
${0}
|
||||
"""
|
||||
snippet docs
|
||||
@doc ~S"""
|
||||
${0}
|
||||
"""
|
||||
snippet docf
|
||||
@doc false
|
||||
snippet im
|
||||
@impl true
|
||||
snippet fn
|
||||
fn ${1:args} -> ${0} end
|
||||
snippet mdoc
|
||||
@moduledoc """
|
||||
${0}
|
||||
"""
|
||||
snippet mdocs
|
||||
@moduledoc ~S"""
|
||||
${0}
|
||||
"""
|
||||
snippet mdocf
|
||||
@moduledoc false
|
||||
snippet rec
|
||||
receive do
|
||||
${1} ->
|
||||
${0}
|
||||
end
|
||||
snippet req
|
||||
require ${0:Logger}
|
||||
snippet imp
|
||||
import ${0:module_name}
|
||||
snippet ali
|
||||
alias ${0:module_name}
|
||||
snippet test
|
||||
test "${1:test name}" do
|
||||
${0}
|
||||
end
|
||||
snippet testc
|
||||
test "${1:test_name}", ctx do
|
||||
${0}
|
||||
end
|
||||
snippet testa
|
||||
test "${1:test_name}", %{${2:arg: arg}} do
|
||||
${0}
|
||||
end
|
||||
snippet des
|
||||
describe "${1:test group subject}" do
|
||||
${0}
|
||||
end
|
||||
snippet destag
|
||||
@describetag :${1:describe tag}
|
||||
snippet mtag
|
||||
@moduletag :${1:module tag}
|
||||
snippet dt
|
||||
doctest ${1:filename}
|
||||
snippet tp
|
||||
@tag :pending
|
||||
snippet exunit
|
||||
defmodule ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
${0}
|
||||
end
|
||||
snippet setup
|
||||
setup do
|
||||
${1}
|
||||
end
|
||||
snippet setupa
|
||||
setup_all do
|
||||
${1}
|
||||
end
|
||||
snippet try try .. rescue .. end
|
||||
try do
|
||||
${1:${VISUAL}}
|
||||
rescue
|
||||
${2} -> ${0}
|
||||
end
|
||||
snippet pry
|
||||
require IEx; IEx.pry
|
||||
${0}
|
||||
snippet ppry
|
||||
|> (fn x -> require IEx; IEx.pry; x end).()${0}
|
||||
snippet qu
|
||||
quote do
|
||||
${1}
|
||||
end
|
||||
snippet beh
|
||||
@behaviour ${1:Mix.Task}
|
||||
${0}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet >e pipe to each
|
||||
|> Enum.each(fn ${1} -> ${0} end)
|
||||
snippet >m pipe to map
|
||||
|> Enum.map(fn ${1} -> ${0} end)
|
||||
snippet >f pipe to filter
|
||||
|> Enum.filter(fn ${1} -> ${0} end)
|
||||
snippet >r pipe to reduce
|
||||
|> Enum.reduce(${1:acc}, fn ${2}, ${3:acc} -> ${0} end)
|
||||
snippet >i pipe to inspect
|
||||
|> IO.inspect()
|
||||
snippet >il pipe to inspect with label
|
||||
|> IO.inspect(label: "${1:label}")
|
||||
snippet cs
|
||||
@doc false
|
||||
def child_spec(${1:_opts}) do
|
||||
%{
|
||||
id: __MODULE__,
|
||||
start: {__MODULE__, :start_link, ${2:[]}},
|
||||
restart: ${3::permanent},
|
||||
shutdown: ${4:5000},
|
||||
type: ${5::worker}
|
||||
}
|
||||
end
|
||||
snippet genserver basic genserver structure
|
||||
use GenServer
|
||||
|
||||
@doc false
|
||||
def start_link(init_args) do
|
||||
GenServer.start_link(__MODULE__, init_args, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(state) do
|
||||
{:ok, state}
|
||||
end
|
||||
snippet super basic supervisor structure
|
||||
use Supervisor
|
||||
|
||||
@doc false
|
||||
def start_link(init_args) do
|
||||
Supervisor.start_link(__MODULE__, init_args, name: __MODULE__)
|
||||
end
|
||||
|
||||
@impl true
|
||||
def init(_init_args) do
|
||||
children = [${1}]
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
end
|
||||
snippet impl
|
||||
@impl true
|
||||
def ${1:name} do
|
||||
${0}
|
||||
end
|
||||
snippet wl word list
|
||||
~w(${0})
|
||||
snippet al atom list
|
||||
~w(${0})a
|
158
lua/custom/snippets/snipmate/elm.snippets
Normal file
158
lua/custom/snippets/snipmate/elm.snippets
Normal file
|
@ -0,0 +1,158 @@
|
|||
snippet mod
|
||||
module `substitute(substitute(expand('%:r'), '[/\\]','.','g'),'^\%(\l*\.\)\?','','')` exposing (${1})
|
||||
${0}
|
||||
snippet imp
|
||||
import ${0:Http}
|
||||
snippet impe
|
||||
import ${1:Html} exposing (${0:..})
|
||||
snippet impae
|
||||
import ${1:Json.Encode} as ${2:Encode} exposing (${0:Value})
|
||||
snippet fn
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn1
|
||||
${1:fn} : ${2:a} -> ${3:a}
|
||||
$1 ${4} =
|
||||
${0}
|
||||
snippet fn2
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a}
|
||||
$1 ${5} =
|
||||
${0}
|
||||
snippet fn3
|
||||
${1:fn} : ${2:a} -> ${3:a} -> ${4:a} -> ${5:a}
|
||||
$1 ${6} =
|
||||
${0}
|
||||
snippet fn0
|
||||
${1:fn} : ${2:a}
|
||||
$1 =
|
||||
${0}
|
||||
snippet case
|
||||
case ${1} of
|
||||
${2} ->
|
||||
${0}
|
||||
snippet -
|
||||
${1} ->
|
||||
${0}
|
||||
snippet let
|
||||
let
|
||||
${1} =
|
||||
${2}
|
||||
in
|
||||
${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2:${VISUAL}}
|
||||
else
|
||||
${0}
|
||||
snippet ty
|
||||
type ${1:Msg}
|
||||
= ${0}
|
||||
snippet tya
|
||||
type alias ${1:Model} =
|
||||
${0}
|
||||
snippet test
|
||||
test "${1}" <| \_ -> $0
|
||||
snippet desc
|
||||
describe "${1}" [ $0 ]
|
||||
snippet doc
|
||||
{-| ${0}
|
||||
-}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet program Elm 0.18 program
|
||||
import Html exposing (Html)
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
type Msg
|
||||
= Noop
|
||||
|
||||
|
||||
main : Program Never Model Msg
|
||||
main =
|
||||
Html.program
|
||||
{ init = init
|
||||
, view = view
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
}
|
||||
|
||||
|
||||
init : ( Model, Cmd Msg )
|
||||
init =
|
||||
{} ! []
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
Noop ->
|
||||
model ! []
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
Sub.none
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
Html.text "Hello, sailor!"
|
||||
snippet element
|
||||
module Main exposing (Model, Msg(..), init, main, subscriptions, update, view)
|
||||
|
||||
import Browser
|
||||
import Html exposing (..)
|
||||
import Json.Encode
|
||||
|
||||
|
||||
main : Program Flags Model Msg
|
||||
main =
|
||||
Browser.element
|
||||
{ init = init
|
||||
, update = update
|
||||
, subscriptions = subscriptions
|
||||
, view = view
|
||||
}
|
||||
|
||||
|
||||
type alias Model =
|
||||
{}
|
||||
|
||||
|
||||
type alias Flags =
|
||||
Json.Encode.Value
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init flags_ =
|
||||
( {}
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
type Msg
|
||||
= Noop
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
case msg of
|
||||
Noop ->
|
||||
( model
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
Sub.none
|
||||
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
h1 [] [ text "Hello, world!" ]
|
722
lua/custom/snippets/snipmate/erlang.snippets
Normal file
722
lua/custom/snippets/snipmate/erlang.snippets
Normal file
|
@ -0,0 +1,722 @@
|
|||
# module
|
||||
snippet mod
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
# module and export all
|
||||
snippet modall
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
-compile([export_all]).
|
||||
|
||||
start() ->
|
||||
${0}
|
||||
|
||||
stop() ->
|
||||
ok.
|
||||
snippet d
|
||||
erlang:display(${0}),
|
||||
snippet dt
|
||||
erlang:display({${1}, ${0}}),
|
||||
# define directive
|
||||
snippet def
|
||||
-define(${1:macro}, $2).
|
||||
# export directive
|
||||
snippet exp
|
||||
-export([${1:function}/${0:arity}]).
|
||||
# include directive
|
||||
snippet inc
|
||||
-include("${1:file}").
|
||||
# include_lib directive
|
||||
snippet incl
|
||||
-include_lib("${1:lib}/include/${1}.hrl").${2}
|
||||
# behavior directive
|
||||
snippet beh
|
||||
-behaviour(${1:behaviour}).
|
||||
snippet ifd
|
||||
-ifdef(${1:TEST}).
|
||||
${0}
|
||||
-endif.
|
||||
snippet ifnd
|
||||
-ifndef(${1:TEST}).
|
||||
${0}
|
||||
-endif.
|
||||
snippet undef
|
||||
-undef(${1:macro}).
|
||||
# if expression
|
||||
snippet if
|
||||
if
|
||||
${1:guard} ->
|
||||
$0
|
||||
end
|
||||
# case expression
|
||||
snippet case
|
||||
case ${1:expression} of
|
||||
${2:pattern} ->
|
||||
$0;
|
||||
end
|
||||
# anonymous function
|
||||
snippet fun
|
||||
fun (${1:Parameters}) -> $2 end
|
||||
# try...catch
|
||||
snippet try
|
||||
try
|
||||
${1:${VISUAL}}
|
||||
catch
|
||||
${2:_:_} -> ${0:got_some_exception}
|
||||
end
|
||||
snippet rcv "Receive Expression"
|
||||
receive
|
||||
${1: ${2:pattern}${3: when ${4:guard}} ->
|
||||
$5
|
||||
${6:after
|
||||
${7:expression} ->
|
||||
$8
|
||||
end
|
||||
# record directive
|
||||
snippet rec
|
||||
-record(${1:record}, {${2:field}=${3:value}}).
|
||||
# todo comment
|
||||
snippet todo
|
||||
%% TODO: ${0}
|
||||
## Snippets below (starting with '%') are in EDoc format.
|
||||
## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details
|
||||
# doc comment
|
||||
snippet %d
|
||||
%% @doc ${0}
|
||||
# end of doc comment
|
||||
snippet %e
|
||||
%% @end
|
||||
# specification comment
|
||||
snippet %s
|
||||
%% @spec ${0}
|
||||
# private function marker
|
||||
snippet %p
|
||||
%% @private
|
||||
# OTP application
|
||||
snippet application
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(application).
|
||||
|
||||
-export([start/2, stop/1]).
|
||||
|
||||
start(_Type, _StartArgs) ->
|
||||
case ${0:root_supervisor}:start_link() of
|
||||
{ok, Pid} ->
|
||||
{ok, Pid};
|
||||
Other ->
|
||||
{error, Other}
|
||||
end.
|
||||
|
||||
stop(_State) ->
|
||||
ok.
|
||||
# OTP supervisor
|
||||
snippet supervisor
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(supervisor).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% Supervisor callbacks
|
||||
-export([init/1]).
|
||||
|
||||
-define(SERVER, ?MODULE).
|
||||
|
||||
start_link() ->
|
||||
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||
|
||||
init([]) ->
|
||||
Server = {${0:my_server}, {${2}, start_link, []},
|
||||
permanent, 2000, worker, [${2}]},
|
||||
Children = [Server],
|
||||
RestartStrategy = {one_for_one, 0, 1},
|
||||
{ok, {RestartStrategy, Children}}.
|
||||
# OTP gen_server
|
||||
snippet gen_server
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(gen_server).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% gen_server callbacks
|
||||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
|
||||
|
||||
-define(SERVER, ?MODULE).
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
%%%===================================================================
|
||||
%%% API
|
||||
%%%===================================================================
|
||||
|
||||
start_link() ->
|
||||
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_server callbacks
|
||||
%%%===================================================================
|
||||
|
||||
init([]) ->
|
||||
{ok, #state{}}.
|
||||
|
||||
handle_call(_Request, _From, State) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, State}.
|
||||
|
||||
handle_cast(_Msg, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
handle_info(_Info, State) ->
|
||||
{noreply, State}.
|
||||
|
||||
terminate(_Reason, _State) ->
|
||||
ok.
|
||||
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# OTP gen_fsm
|
||||
snippet gen_fsm
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(gen_fsm).
|
||||
|
||||
%% API
|
||||
-export([start_link/0]).
|
||||
|
||||
%% gen_fsm callbacks
|
||||
-export([init/1, state_name/2, state_name/3, handle_event/3, handle_sync_event/4,
|
||||
handle_info/3, terminate/3, code_change/4]).
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
%%%===================================================================
|
||||
%%% API
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc
|
||||
%% Creates a gen_fsm process which calls Module:init/1 to
|
||||
%% initialize. To ensure a synchronized start-up procedure, this
|
||||
%% function does not return until Module:init/1 has returned.
|
||||
%%
|
||||
%% @spec start_link() -> {ok, Pid} | ignore | {error, Error}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
start_link() ->
|
||||
gen_fsm:start_link({local, ?MODULE}, ?MODULE, [], []).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_fsm callbacks
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a gen_fsm is started using gen_fsm:start/[3,4] or
|
||||
%% gen_fsm:start_link/[3,4], this function is called by the new
|
||||
%% process to initialize.
|
||||
%%
|
||||
%% @spec init(Args) -> {ok, StateName, State} |
|
||||
%% {ok, StateName, State, Timeout} |
|
||||
%% ignore |
|
||||
%% {stop, StopReason}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
init([]) ->
|
||||
{ok, state_name, #state{}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% There should be one instance of this function for each possible
|
||||
%% state name. Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:send_event/2, the instance of this function with the same
|
||||
%% name as the current state name StateName is called to handle
|
||||
%% the event. It is also called if a timeout occurs.
|
||||
%%
|
||||
%% @spec state_name(Event, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
state_name(_Event, State) ->
|
||||
{next_state, state_name, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% There should be one instance of this function for each possible
|
||||
%% state name. Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:sync_send_event/[2,3], the instance of this function with
|
||||
%% the same name as the current state name StateName is called to
|
||||
%% handle the event.
|
||||
%%
|
||||
%% @spec state_name(Event, From, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {reply, Reply, NextStateName, NextState} |
|
||||
%% {reply, Reply, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState} |
|
||||
%% {stop, Reason, Reply, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
state_name(_Event, _From, State) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, state_name, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:send_all_state_event/2, this function is called to handle
|
||||
%% the event.
|
||||
%%
|
||||
%% @spec handle_event(Event, StateName, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_event(_Event, StateName, State) ->
|
||||
{next_state, StateName, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a gen_fsm receives an event sent using
|
||||
%% gen_fsm:sync_send_all_state_event/[2,3], this function is called
|
||||
%% to handle the event.
|
||||
%%
|
||||
%% @spec handle_sync_event(Event, From, StateName, State) ->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {reply, Reply, NextStateName, NextState} |
|
||||
%% {reply, Reply, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState} |
|
||||
%% {stop, Reason, Reply, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_sync_event(_Event, _From, StateName, State) ->
|
||||
Reply = ok,
|
||||
{reply, Reply, StateName, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% This function is called by a gen_fsm when it receives any
|
||||
%% message other than a synchronous or asynchronous event
|
||||
%% (or a system message).
|
||||
%%
|
||||
%% @spec handle_info(Info,StateName,State)->
|
||||
%% {next_state, NextStateName, NextState} |
|
||||
%% {next_state, NextStateName, NextState, Timeout} |
|
||||
%% {stop, Reason, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_info(_Info, StateName, State) ->
|
||||
{next_state, StateName, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% This function is called by a gen_fsm when it is about to
|
||||
%% terminate. It should be the opposite of Module:init/1 and do any
|
||||
%% necessary cleaning up. When it returns, the gen_fsm terminates with
|
||||
%% Reason. The return value is ignored.
|
||||
%%
|
||||
%% @spec terminate(Reason, StateName, State) -> void()
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
terminate(_Reason, _StateName, _State) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Convert process state when code is changed
|
||||
%%
|
||||
%% @spec code_change(OldVsn, StateName, State, Extra) ->
|
||||
%% {ok, StateName, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
code_change(_OldVsn, StateName, State, _Extra) ->
|
||||
{ok, StateName, State}.
|
||||
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# OTP gen_event
|
||||
snippet gen_event
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-behaviour(gen_event).
|
||||
|
||||
%% API
|
||||
-export([start_link/0,
|
||||
add_handler/2]).
|
||||
|
||||
%% gen_event callbacks
|
||||
-export([init/1,
|
||||
handle_event/2,
|
||||
handle_call/2,
|
||||
handle_info/2,
|
||||
terminate/2,
|
||||
code_change/3]).
|
||||
|
||||
-record(state, {}).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_event callbacks
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc
|
||||
%% Creates an event manager
|
||||
%%
|
||||
%% @spec start_link() -> {ok, Pid} | {error, Error}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
start_link() ->
|
||||
gen_event:start_link({local, ?MODULE}).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @doc
|
||||
%% Adds an event handler
|
||||
%%
|
||||
%% @spec add_handler(Handler, Args) -> ok | {'EXIT', Reason} | term()
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
add_handler(Handler, Args) ->
|
||||
gen_event:add_handler(?MODULE, Handler, Args).
|
||||
|
||||
%%%===================================================================
|
||||
%%% gen_event callbacks
|
||||
%%%===================================================================
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever a new event handler is added to an event manager,
|
||||
%% this function is called to initialize the event handler.
|
||||
%%
|
||||
%% @spec init(Args) -> {ok, State}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
init([]) ->
|
||||
{ok, #state{}}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever an event manager receives an event sent using
|
||||
%% gen_event:notify/2 or gen_event:sync_notify/2, this function is
|
||||
%% called for each installed event handler to handle the event.
|
||||
%%
|
||||
%% @spec handle_event(Event, State) ->
|
||||
%% {ok, State} |
|
||||
%% {swap_handler, Args1, State1, Mod2, Args2} |
|
||||
%% remove_handler
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_event(_Event, State) ->
|
||||
{ok, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever an event manager receives a request sent using
|
||||
%% gen_event:call/3,4, this function is called for the specified
|
||||
%% event handler to handle the request.
|
||||
%%
|
||||
%% @spec handle_call(Request, State) ->
|
||||
%% {ok, Reply, State} |
|
||||
%% {swap_handler, Reply, Args1, State1, Mod2, Args2} |
|
||||
%% {remove_handler, Reply}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_call(_Request, State) ->
|
||||
Reply = ok,
|
||||
{ok, Reply, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% This function is called for each installed event handler when
|
||||
%% an event manager receives any other message than an event or a
|
||||
%% synchronous request (or a system message).
|
||||
%%
|
||||
%% @spec handle_info(Info, State) ->
|
||||
%% {ok, State} |
|
||||
%% {swap_handler, Args1, State1, Mod2, Args2} |
|
||||
%% remove_handler
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
handle_info(_Info, State) ->
|
||||
{ok, State}.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Whenever an event handler is deleted from an event manager, this
|
||||
%% function is called. It should be the opposite of Module:init/1 and
|
||||
%% do any necessary cleaning up.
|
||||
%%
|
||||
%% @spec terminate(Reason, State) -> void()
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
terminate(_Reason, _State) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% @private
|
||||
%% @doc
|
||||
%% Convert process state when code is changed
|
||||
%%
|
||||
%% @spec code_change(OldVsn, State, Extra) -> {ok, NewState}
|
||||
%% @end
|
||||
%%--------------------------------------------------------------------
|
||||
code_change(_OldVsn, State, _Extra) ->
|
||||
{ok, State}.
|
||||
|
||||
%%%===================================================================
|
||||
%%% Internal functions
|
||||
%%%===================================================================
|
||||
# EUnit snippets
|
||||
snippet eunit
|
||||
-module(${1:`vim_snippets#Filename()`}).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
snippet ieunit
|
||||
-ifdef(TEST).
|
||||
-include_lib("eunit/include/eunit.hrl").
|
||||
|
||||
${0}
|
||||
|
||||
-endif.
|
||||
snippet itest
|
||||
-ifdef(TEST).
|
||||
|
||||
${1}_test() ->
|
||||
${0}
|
||||
|
||||
-endif.
|
||||
snippet test
|
||||
${1}_test() ->
|
||||
${0}
|
||||
snippet as
|
||||
?assert(${0})
|
||||
snippet asn
|
||||
?assertNot(${0})
|
||||
snippet aseq
|
||||
?assertEqual(${1}, ${0})
|
||||
snippet asneq
|
||||
?assertNotEqual(${1}, ${0})
|
||||
snippet asmat
|
||||
?assertMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet asnmat
|
||||
?assertNotMatch(${1:Pattern}, ${0:Expression})
|
||||
snippet aserr
|
||||
?assertError(${1:Pattern}, ${0:Expression})
|
||||
snippet asex
|
||||
?assertExit(${1:Pattern}, ${0:Expression})
|
||||
snippet asexc
|
||||
?assertException(${1:Class}, ${2:Pattern}, ${0:Expression})
|
||||
# common_test test_SUITE
|
||||
snippet testsuite
|
||||
-module(${0:`vim_snippets#Filename()`}).
|
||||
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
|
||||
%% Test server callbacks
|
||||
-export([suite/0, all/0, groups/0,
|
||||
init_per_suite/1, end_per_suite/1,
|
||||
init_per_group/2, end_per_group/2,
|
||||
init_per_testcase/2, end_per_testcase/2]).
|
||||
|
||||
%% Test cases
|
||||
-export([
|
||||
]).
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% COMMON TEST CALLBACK FUNCTIONS
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: suite() -> Info
|
||||
%%
|
||||
%% Info = [tuple()]
|
||||
%% List of key/value pairs.
|
||||
%%
|
||||
%% Description: Returns list of tuples to set default properties
|
||||
%% for the suite.
|
||||
%%
|
||||
%% Note: The suite/0 function is only meant to be used to return
|
||||
%% default data values, not perform any other operations.
|
||||
%%--------------------------------------------------------------------
|
||||
suite() ->
|
||||
[{timetrap,{minutes,10}}].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_suite(Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the suite.
|
||||
%%
|
||||
%% Description: Initialization before the suite.
|
||||
%%
|
||||
%% Note: This function is free to add any key/value pairs to the Config
|
||||
%% variable, but should NOT alter/remove any existing entries.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_suite(Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_suite(Config0) -> void() | {save_config,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%%
|
||||
%% Description: Cleanup after the suite.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_suite(_Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_group(GroupName, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% GroupName = atom()
|
||||
%% Name of the test case group that is about to run.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding configuration data for the group.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping all test cases and subgroups in the group.
|
||||
%%
|
||||
%% Description: Initialization before each test case group.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_group(_GroupName, Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_group(GroupName, Config0) ->
|
||||
%% void() | {save_config,Config1}
|
||||
%%
|
||||
%% GroupName = atom()
|
||||
%% Name of the test case group that is finished.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding configuration data for the group.
|
||||
%%
|
||||
%% Description: Cleanup after each test case group.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_group(_GroupName, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: init_per_testcase(TestCase, Config0) ->
|
||||
%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% TestCase = atom()
|
||||
%% Name of the test case that is about to run.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the test case.
|
||||
%%
|
||||
%% Description: Initialization before each test case.
|
||||
%%
|
||||
%% Note: This function is free to add any key/value pairs to the Config
|
||||
%% variable, but should NOT alter/remove any existing entries.
|
||||
%%--------------------------------------------------------------------
|
||||
init_per_testcase(_TestCase, Config) ->
|
||||
Config.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: end_per_testcase(TestCase, Config0) ->
|
||||
%% void() | {save_config,Config1} | {fail,Reason}
|
||||
%%
|
||||
%% TestCase = atom()
|
||||
%% Name of the test case that is finished.
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for failing the test case.
|
||||
%%
|
||||
%% Description: Cleanup after each test case.
|
||||
%%--------------------------------------------------------------------
|
||||
end_per_testcase(_TestCase, _Config) ->
|
||||
ok.
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: groups() -> [Group]
|
||||
%%
|
||||
%% Group = {GroupName,Properties,GroupsAndTestCases}
|
||||
%% GroupName = atom()
|
||||
%% The name of the group.
|
||||
%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}]
|
||||
%% Group properties that may be combined.
|
||||
%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase]
|
||||
%% TestCase = atom()
|
||||
%% The name of a test case.
|
||||
%% Shuffle = shuffle | {shuffle,Seed}
|
||||
%% To get cases executed in random order.
|
||||
%% Seed = {integer(),integer(),integer()}
|
||||
%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail |
|
||||
%% repeat_until_any_ok | repeat_until_any_fail
|
||||
%% To get execution of cases repeated.
|
||||
%% N = integer() | forever
|
||||
%%
|
||||
%% Description: Returns a list of test case group definitions.
|
||||
%%--------------------------------------------------------------------
|
||||
groups() ->
|
||||
[].
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: all() -> GroupsAndTestCases | {skip,Reason}
|
||||
%%
|
||||
%% GroupsAndTestCases = [{group,GroupName} | TestCase]
|
||||
%% GroupName = atom()
|
||||
%% Name of a test case group.
|
||||
%% TestCase = atom()
|
||||
%% Name of a test case.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping all groups and test cases.
|
||||
%%
|
||||
%% Description: Returns the list of groups and test cases that
|
||||
%% are to be executed.
|
||||
%%--------------------------------------------------------------------
|
||||
all() ->
|
||||
[].
|
||||
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% TEST CASES
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%%--------------------------------------------------------------------
|
||||
%% Function: TestCase(Config0) ->
|
||||
%% ok | exit() | {skip,Reason} | {comment,Comment} |
|
||||
%% {save_config,Config1} | {skip_and_save,Reason,Config1}
|
||||
%%
|
||||
%% Config0 = Config1 = [tuple()]
|
||||
%% A list of key/value pairs, holding the test case configuration.
|
||||
%% Reason = term()
|
||||
%% The reason for skipping the test case.
|
||||
%% Comment = term()
|
||||
%% A comment about the test case that will be printed in the html log.
|
||||
%%
|
||||
%% Description: Test case function. (The name of it must be specified in
|
||||
%% the all/0 list or in a test case group for the test case
|
||||
%% to be executed).
|
||||
%%--------------------------------------------------------------------
|
||||
|
138
lua/custom/snippets/snipmate/eruby.snippets
Normal file
138
lua/custom/snippets/snipmate/eruby.snippets
Normal file
|
@ -0,0 +1,138 @@
|
|||
# .erb and .rhmtl files
|
||||
|
||||
# Includes html.snippets
|
||||
extends html
|
||||
|
||||
# Rails *****************************
|
||||
snippet rc
|
||||
<% ${0} %>
|
||||
snippet rce
|
||||
<%= ${1} %>
|
||||
snippet %
|
||||
<% ${0} %>
|
||||
snippet =
|
||||
<%= ${1} %>
|
||||
snippet end
|
||||
<% end %>
|
||||
snippet ead
|
||||
<% ${1}.each do |${2}| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet for
|
||||
<% for ${2:item} in ${1} %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet rp
|
||||
<%= render partial: '${0:item}' %>
|
||||
snippet rpl
|
||||
<%= render partial: '${1:item}', locals: { :${2:name} => '${3:value}'${0} } %>
|
||||
snippet rps
|
||||
<%= render partial: '${1:item}', status: ${0:500} %>
|
||||
snippet rpc
|
||||
<%= render partial: '${1:item}', collection: ${0:items} %>
|
||||
snippet lia
|
||||
<%= link_to '${1:link text...}', action: '${0:index}' %>
|
||||
snippet liai
|
||||
<%= link_to '${1:link text...}', action: '${2:edit}', id: ${0:@item} %>
|
||||
snippet lic
|
||||
<%= link_to '${1:link text...}', controller: '${0:items}' %>
|
||||
snippet lica
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
|
||||
snippet licai
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
|
||||
snippet lib
|
||||
<%= link_to '${1:link text...}' do %>
|
||||
<% end %>
|
||||
snippet yield
|
||||
<%= yield ${1::content_symbol} %>
|
||||
snippet conf
|
||||
<% content_for :${1:head} do %>
|
||||
${0}
|
||||
<% end %>
|
||||
|
||||
snippet cs
|
||||
<%= collection_select(:${1:object}, :${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %>
|
||||
snippet ct
|
||||
<%= content_tag '${1:DIV}', ${2:content}${0:,options} %>
|
||||
snippet ff
|
||||
<%= form_for @${1:model} do |f| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet ffi
|
||||
<%= ${1:f}.input :${0:attribute} %>
|
||||
snippet ffcb
|
||||
<%= ${1:f}.check_box :${0:attribute} %>
|
||||
snippet ffe
|
||||
<% error_messages_for :${1:model} %>
|
||||
|
||||
<%= form_for @${2:model} do |f| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet ffff
|
||||
<%= ${1:f}.file_field :${0:attribute} %>
|
||||
snippet ffhf
|
||||
<%= ${1:f}.hidden_field :${0:attribute} %>
|
||||
snippet ffl
|
||||
<%= ${1:f}.label :${2:attribute}, '${0:$2}' %>
|
||||
snippet ffpf
|
||||
<%= ${1:f}.password_field :${0:attribute} %>
|
||||
snippet ffrb
|
||||
<%= ${1:f}.radio_button :${2:attribute}, :${0:tag_value} %>
|
||||
snippet ffs
|
||||
<%= ${1:f}.submit "${0:submit}" %>
|
||||
snippet ffta
|
||||
<%= ${1:f}.text_area :${0:attribute} %>
|
||||
snippet fftf
|
||||
<%= ${1:f}.text_field :${0:attribute} %>
|
||||
snippet fcs
|
||||
<%= ${1:f}.collection_select(:${2:method}, ${3:collection}, :${4:value_method}, :${5:text_method}, options = {${0:prompt: true}}) %>
|
||||
snippet fields
|
||||
<%= fields_for :${1:model}, @$1 do |${2:f}| %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet i18
|
||||
I18n.t('${1:type.key}')
|
||||
snippet it
|
||||
<%= image_tag "${1}"${0} %>
|
||||
snippet jit
|
||||
<%= javascript_include_tag ${0::all} %>
|
||||
snippet jsit
|
||||
<%= javascript_include_tag "${0}" %>
|
||||
snippet lim
|
||||
<%= link_to ${1:model}.${2:name}, ${3:$1}_path(${0:$1}) %>
|
||||
snippet linp
|
||||
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${4:@$2}, ${0:@$3}) %>
|
||||
snippet linpp
|
||||
<%= link_to "${1:Link text...}", ${2:parent}_${3:child}_path(${0:@$2}) %>
|
||||
snippet lip
|
||||
<%= link_to "${1:Link text...}", ${2:model}_path(${0:@$2}) %>
|
||||
snippet lipp
|
||||
<%= link_to "${1:Link text...}", ${0:model}s_path %>
|
||||
snippet lt
|
||||
<%= link_to "${1:name}", ${0:dest} %>
|
||||
snippet ntc
|
||||
<%= number_to_currency(${1}) %>
|
||||
snippet ofcfs
|
||||
<%= options_from_collection_for_select ${1:collection}, ${2:value_method}, ${3:text_method}, ${0:selected_value} %>
|
||||
snippet ofs
|
||||
<%= options_for_select ${1:collection}, ${2:value_method} %>
|
||||
snippet rf
|
||||
<%= render file: "${1:file}"${0} %>
|
||||
snippet rt
|
||||
<%= render template: "${1:file}"${0} %>
|
||||
snippet slt
|
||||
<%= stylesheet_link_tag ${1::all}, cache: ${0:true} %>
|
||||
snippet sslt
|
||||
<%= stylesheet_link_tag "${0}" %>
|
||||
snippet if
|
||||
<% if ${1} %>
|
||||
${0:${VISUAL}}
|
||||
<% end %>
|
||||
snippet ife
|
||||
<% if ${1} %>
|
||||
${2}
|
||||
<% else %>
|
||||
${0}
|
||||
<% end %>
|
||||
snippet pry
|
||||
<% require 'pry'; binding.pry %>
|
71
lua/custom/snippets/snipmate/falcon.snippets
Normal file
71
lua/custom/snippets/snipmate/falcon.snippets
Normal file
|
@ -0,0 +1,71 @@
|
|||
snippet #!
|
||||
#!/usr/bin/env falcon
|
||||
|
||||
# Import
|
||||
snippet imp
|
||||
import ${0:module}
|
||||
|
||||
# Function
|
||||
snippet fun
|
||||
function ${2:function_name}(${3})
|
||||
${0}
|
||||
end
|
||||
|
||||
# Class
|
||||
snippet class
|
||||
class ${1:class_name}(${2:class_params})
|
||||
${0:/* members/methods */}
|
||||
end
|
||||
|
||||
# If
|
||||
snippet if
|
||||
if $1
|
||||
${0}
|
||||
end
|
||||
|
||||
# If else
|
||||
snippet ife
|
||||
if $1
|
||||
${0}
|
||||
else
|
||||
${1}
|
||||
end
|
||||
|
||||
# If else if
|
||||
snippet eif
|
||||
elif $1
|
||||
${0}
|
||||
|
||||
# Switch case
|
||||
snippet switch
|
||||
switch ${1:expression}
|
||||
case ${2:item}
|
||||
case ${0:item}
|
||||
default
|
||||
end
|
||||
|
||||
# Select
|
||||
snippet select
|
||||
select ${1:variable}
|
||||
case ${2:TypeSpec}
|
||||
case ${0:TypeSpec}
|
||||
default
|
||||
end
|
||||
|
||||
# For/in Loop
|
||||
snippet forin
|
||||
for ${1:element} in ${2:container}
|
||||
${0}
|
||||
end
|
||||
|
||||
# For/to Loop
|
||||
snippet forto
|
||||
for ${1:lowerbound} to ${2:upperbound}
|
||||
${0}
|
||||
end
|
||||
|
||||
# While Loop
|
||||
snippet wh
|
||||
while ${1:conidition}
|
||||
${0}
|
||||
end
|
103
lua/custom/snippets/snipmate/fortran.snippets
Normal file
103
lua/custom/snippets/snipmate/fortran.snippets
Normal file
|
@ -0,0 +1,103 @@
|
|||
snippet impl
|
||||
implicit none
|
||||
${0}
|
||||
snippet prog
|
||||
program ${1:main}
|
||||
${0}
|
||||
end program $1
|
||||
snippet mod
|
||||
module ${1:modulename}
|
||||
${0}
|
||||
end module $1
|
||||
snippet proc
|
||||
procedure ${1:name}
|
||||
${0}
|
||||
end procedure $1
|
||||
snippet iface
|
||||
interface ${1:name}
|
||||
${0}
|
||||
end interface $1
|
||||
snippet doc
|
||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
! File: ${2:`vim_snippets#Filename('$1')`}
|
||||
! Author: `g:snips_author`
|
||||
! Email: `g:snips_email`
|
||||
! Github: `g:snips_github`
|
||||
! Description: $1
|
||||
! """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
${0}
|
||||
snippet dox
|
||||
!> @brief ${1}
|
||||
!!
|
||||
!> ${2}
|
||||
!> @author `g:snips_author`
|
||||
${0}
|
||||
snippet doxp
|
||||
!> @param[${1}]${0}
|
||||
# Variables definitions
|
||||
# Boolean
|
||||
snippet bool
|
||||
logical :: ${0}
|
||||
# Integer
|
||||
snippet int
|
||||
integer :: ${0}
|
||||
snippet real
|
||||
real :: ${0}
|
||||
# Double Precision
|
||||
snippet double
|
||||
double precision :: ${0}
|
||||
# Char
|
||||
snippet str
|
||||
character(len=${1:*}) :: ${0:}
|
||||
# Types
|
||||
snippet type
|
||||
type(${1:name})
|
||||
${0}
|
||||
end type
|
||||
snippet const
|
||||
${1:type}, parameter :: $2 = ${0}
|
||||
snippet arr
|
||||
${1:type}, ${2:allocatable, }dimension(${3::}) :: ${0}
|
||||
snippet intent
|
||||
${1:type}, intent(inout) :: ${0}
|
||||
# Array
|
||||
snippet /
|
||||
(/ $1 /) ${2:,&} ${0}
|
||||
snippet if
|
||||
if ($1) then
|
||||
${0}
|
||||
end if
|
||||
snippet case
|
||||
select case (${1:expr})
|
||||
case ($2)
|
||||
case default
|
||||
$3
|
||||
end select ${0}
|
||||
snippet do
|
||||
do ${1:i} = ${2:start}, ${3:end}, ${4:incr}
|
||||
${0}
|
||||
end do
|
||||
snippet dow
|
||||
do while ($1)
|
||||
$2
|
||||
end do
|
||||
snippet sub
|
||||
subroutine ${1:name}($2)
|
||||
${0}
|
||||
end subroutine $1
|
||||
snippet func
|
||||
function ${1:name}($2) result($3)
|
||||
${0}
|
||||
end function $1
|
||||
snippet pr
|
||||
write(*,*) ${0}
|
||||
snippet dpr
|
||||
write(*,*) '$1 = ', $1
|
||||
snippet read
|
||||
read(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
|
||||
snippet write
|
||||
write(unit = ${1:fp}, file = ${2:filename}, iostat = ${3:ierr}) ${0}
|
||||
snippet open
|
||||
open(unit = ${1:fp}, file = ${2:filename}, status = ${3:unknown}, iostat = ${4:ierr}) ${0}
|
||||
snippet close
|
||||
close(unit = ${1:fp}) ${0}
|
74
lua/custom/snippets/snipmate/freemarker.snippets
Normal file
74
lua/custom/snippets/snipmate/freemarker.snippets
Normal file
|
@ -0,0 +1,74 @@
|
|||
extends html
|
||||
|
||||
# Freemarker version
|
||||
snippet ver "${.version}"
|
||||
\${.version}
|
||||
# Interpolation
|
||||
snippet int "${interpolation}"
|
||||
\${${0:interpolation${VISUAL}}\}
|
||||
# Interpolation with default string
|
||||
snippet intd "${interpolation!"default_string"}"
|
||||
\${${0:interpolation${VISUAL}}!"${1:default_string}"\}
|
||||
# Comment
|
||||
snippet com "<#-- comment -->"
|
||||
<#-- ${0:comment${VISUAL}} -->
|
||||
# Variable assignment on a single line
|
||||
snippet ass "<#assign variable_name = value />"
|
||||
<#assign ${1:variable_name} = ${0:value${VISUAL}} />
|
||||
# Variable assignments on multiple lines
|
||||
snippet assm "<#assign <#-- multiple lines --> />"
|
||||
<#assign
|
||||
${1:variable_name} = ${0:value${VISUAL}}
|
||||
/>
|
||||
# Local variable assignment on a single
|
||||
snippet loc "<#local variable_name = value />"
|
||||
<#local ${1:variable_name} = ${0:value${VISUAL}} />
|
||||
# Local variable assignments on multiple lines
|
||||
snippet locm "<#local <#-- multiple lines --> />"
|
||||
<#local
|
||||
${1:variable_name} = ${0:value${VISUAL}}
|
||||
/>
|
||||
# Include Freemarker file
|
||||
snippet inc "<#include \"file.ftl\" />"
|
||||
<#include "${0:file.ftl${VISUAL}}" />
|
||||
# If statement
|
||||
snippet if "<#if condition>...</#if>"
|
||||
<#if ${1:true}>
|
||||
${0:${VISUAL}}
|
||||
</#if>
|
||||
# If/else statement
|
||||
snippet ife "<#if condition>...<#else>...</#if>"
|
||||
<#if ${1:true}>
|
||||
${0:${VISUAL}}
|
||||
<#else>
|
||||
${2}
|
||||
</#if>
|
||||
# Iteration over a sequence
|
||||
snippet lis "<#list sequence as element>...</#list>"
|
||||
<#list ${1:sequence} as ${2:element}>
|
||||
${0:${VISUAL}}
|
||||
</#list>
|
||||
# Iteration over an hashmap
|
||||
snippet lish "<#list hashmap?keys as element>...</#list>"
|
||||
<#list ${1:hashmap}?keys as ${2:key}>
|
||||
\${$2\}: \${$1[$2]\}${0:${VISUAL}}
|
||||
</#list>
|
||||
# Macro statement
|
||||
snippet mac "<#macro macro_name param1>...</#macro>"
|
||||
<#macro ${1:macro_name} ${2:param1}>
|
||||
${0:${VISUAL}}
|
||||
</#macro>
|
||||
# Function statement
|
||||
snippet fun "<#function function_name param1>...</#function>"
|
||||
<#function ${1:function_name} ${2:param1}>
|
||||
${0:${VISUAL}}
|
||||
</#function>
|
||||
# Attempt statement (try-catch to prevent runtime exceptions)
|
||||
snippet att "<#attempt>...<#recover></#attempt>"
|
||||
<#attempt>
|
||||
${0:${VISUAL}}
|
||||
<#recover>
|
||||
</#attempt>
|
||||
# Then built-in for booleans
|
||||
snippet ?th "?then(true, false)"
|
||||
?then(${1:true}, ${0:false${VISUAL}})
|
80
lua/custom/snippets/snipmate/fsharp.snippets
Normal file
80
lua/custom/snippets/snipmate/fsharp.snippets
Normal file
|
@ -0,0 +1,80 @@
|
|||
snippet doc
|
||||
/// ${0}
|
||||
snippet comment
|
||||
// ${0}
|
||||
snippet let
|
||||
let ${1} = ${0}
|
||||
snippet lit
|
||||
[<Literal>]
|
||||
let ${1} = ${0}
|
||||
snippet rec
|
||||
type ${1} = { ${0} }
|
||||
snippet arec
|
||||
{| ${0} |}
|
||||
snippet fn
|
||||
let ${1} =
|
||||
${0}
|
||||
snippet fnr
|
||||
let rec ${1} =
|
||||
${0}
|
||||
snippet lam
|
||||
(fun ${1} -> ${0})
|
||||
snippet mod
|
||||
module ${1} =
|
||||
${0}
|
||||
snippet for
|
||||
for ${1} in ${2} do
|
||||
${0}
|
||||
snippet if
|
||||
if ${1} then
|
||||
${2}
|
||||
snippet ife
|
||||
if ${1} then
|
||||
${2}
|
||||
else
|
||||
${0}
|
||||
snippet ifee
|
||||
if ${1} then
|
||||
${2}
|
||||
elif ${3} then
|
||||
${4}
|
||||
else
|
||||
${0}
|
||||
snippet eif
|
||||
elif ${1} then
|
||||
${0}
|
||||
snippet el
|
||||
else
|
||||
${0}
|
||||
snippet try
|
||||
try
|
||||
${1}
|
||||
with ${0}
|
||||
snippet match
|
||||
match ${1} with
|
||||
| ${2} -> ${0}
|
||||
snippet |
|
||||
| ${1} -> ${0}
|
||||
snippet p
|
||||
|> ${0}
|
||||
snippet pr
|
||||
printfn "${1}" ${0}
|
||||
snippet pri
|
||||
printfn \$"${0}"
|
||||
snippet amap
|
||||
|> Array.map (fun ${1} -> ${0})
|
||||
snippet lmap
|
||||
|> List.map (fun ${1} -> ${0})
|
||||
snippet smap
|
||||
|> Seq.map (fun ${1} -> ${0})
|
||||
snippet atap
|
||||
|> Array.map (fun x -> printfn "%A" x; x) // tap
|
||||
snippet ltap
|
||||
|> List.map (fun x -> printfn "%A" x; x) // tap
|
||||
snippet stap
|
||||
|> Seq.map (fun x -> printfn "%A" x; x) // tap
|
||||
snippet main
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
${0}
|
||||
0
|
125
lua/custom/snippets/snipmate/gdscript.snippets
Normal file
125
lua/custom/snippets/snipmate/gdscript.snippets
Normal file
|
@ -0,0 +1,125 @@
|
|||
snippet class
|
||||
class $1 extends ${2:Reference}
|
||||
\t$3
|
||||
|
||||
|
||||
snippet pr
|
||||
print($1)
|
||||
|
||||
|
||||
snippet ready
|
||||
func _ready():
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet init
|
||||
func _init():
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet process
|
||||
func _process(delta):
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet input
|
||||
func _input(event):
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet inpute
|
||||
func _input_event(event):
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet draw
|
||||
func _draw():
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet guii
|
||||
func _gui_input(event):
|
||||
\t${1:pass}
|
||||
|
||||
|
||||
snippet for
|
||||
for $1 in $2:
|
||||
\t${3:pass}
|
||||
|
||||
|
||||
snippet for
|
||||
for $1 in range(${2:start}{$3:,end}):
|
||||
\t${4:pass}
|
||||
|
||||
|
||||
snippet if
|
||||
if ${1:condition}:
|
||||
\t${3:pass}
|
||||
elif ${2:condition}:
|
||||
\t${4:pass}
|
||||
else:
|
||||
\t${5:pass}
|
||||
|
||||
|
||||
snippet if
|
||||
if ${1:condition}:
|
||||
\t${2:pass}
|
||||
else:
|
||||
\t${3:pass}
|
||||
|
||||
|
||||
snippet if
|
||||
if ${1:condition}:
|
||||
\t${2:pass}
|
||||
|
||||
|
||||
snippet while
|
||||
while ${1:condition}:
|
||||
\t${2:pass}
|
||||
|
||||
|
||||
snippet func
|
||||
func ${1:method}(${2:args}):
|
||||
\t${3:pass}
|
||||
|
||||
|
||||
snippet signal
|
||||
signal ${1:signalname}(${2:args})
|
||||
|
||||
|
||||
snippet export
|
||||
export(${1:type}${2:,other_configs}) var ${3:name}${4: = default}${5: setget }
|
||||
|
||||
|
||||
snippet var
|
||||
var ${1:name}${2: = default}${3: setget }
|
||||
|
||||
|
||||
snippet onready
|
||||
onready var ${1:name} = get_node($2)
|
||||
|
||||
|
||||
snippet is
|
||||
${1:instance} is ${2:class}
|
||||
|
||||
|
||||
snippet in
|
||||
${1:element} in ${$2:array}
|
||||
|
||||
|
||||
snippet gdscript
|
||||
extends ${1:BaseClass}
|
||||
|
||||
# class member variables go here, for example:
|
||||
# var a = 2
|
||||
# var b = \textvar\
|
||||
|
||||
func _ready():
|
||||
\t# Called every time the node is added to the scene.
|
||||
\t# Initialization here
|
||||
\tpass
|
||||
|
||||
|
||||
|
||||
# snippet pass ##### do we really need this?
|
||||
# pass
|
2
lua/custom/snippets/snipmate/gitcommit.snippets
Normal file
2
lua/custom/snippets/snipmate/gitcommit.snippets
Normal file
|
@ -0,0 +1,2 @@
|
|||
snippet co
|
||||
Co-authored-by: ${1} <${2}>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue