Initial commit on new repo

Signed-off-by: TiagoRG <tiago.rgarcia@ua.pt>
This commit is contained in:
Tiago Garcia 2023-10-21 14:05:20 +01:00 committed by Tiago Garcia
commit 8a894b1889
Signed by: TiagoRG
GPG Key ID: FF0A53A30B1ADF82
82 changed files with 12994 additions and 0 deletions

3
.config/nvim/README.md Normal file
View File

@ -0,0 +1,3 @@
# Neovim
## This is my neovim configuration, highly based on [ThePrimeagen](https://github.com/ThePrimeagen)

View File

@ -0,0 +1,11 @@
function ColorMyPencils(color)
color = color or "rose-pine"
vim.cmd.colorscheme(color)
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
ColorMyPencils()

View File

@ -0,0 +1 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);

View File

@ -0,0 +1,10 @@
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<C-t>", function() ui.nav_file(2) end)
vim.keymap.set("n", "<C-n>", function() ui.nav_file(3) end)
vim.keymap.set("n", "<C-s>", function() ui.nav_file(4) end)

View File

@ -0,0 +1,59 @@
local lsp = require("lsp-zero")
lsp.preset("recommended")
lsp.ensure_installed({
'tsserver',
'rust_analyzer',
})
-- Fix Undefined global 'vim'
lsp.nvim_workspace()
local cmp = require('cmp')
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<Tab>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
})
-- cmp_mappings['<Tab>'] = nil
-- cmp_mappings['<S-Tab>'] = nil
lsp.setup_nvim_cmp({
mapping = cmp_mappings
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})
lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)
lsp.setup()
vim.diagnostic.config({
virtual_text = true
})

View File

@ -0,0 +1,7 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ")});
end)

View File

@ -0,0 +1,25 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "bash", "lua", "vim", "vimdoc", "query", "regex",
--"c",
"cpp", "c_sharp", "rust", "python",
"html", "css", "php", "javascript", "typescript", "sql"
},
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = true,
},
}

View File

@ -0,0 +1 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)

View File

@ -0,0 +1,14 @@
opts = {
auto_set_mode_filetype_allowlist = {
"asciidoc",
"gitcommit",
"html",
"latex",
"mail",
"markdown",
"rst",
"tex",
"text",
},
soft_wrap = true,
}

2
.config/nvim/init.lua Normal file
View File

@ -0,0 +1,2 @@
require("tiagorg")

View File

@ -0,0 +1,142 @@
require("tiagorg.set")
vim.g.copilot_node_command = "~/.nodenv/bin/nodenv"
vim.keymap.set("n", "<leader>e", vim.cmd.E)
vim.keymap.set("n", "<leader>w", vim.cmd.w)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- greatest remap ever
vim.keymap.set("x", "<leader>p", [["_dP]])
-- next greatest remap ever : asbjornHaland
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
-- This is going to get me cancelled
vim.keymap.set("i", "<C-c>", "<Esc>")
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.config/nvim/lua/tiagorg/packer.lua<CR>");
vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>");
vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so")
end)
vim.api.nvim_set_keymap("i", "<C-Q>", "copilot#Accept(\"<CR>\")", { expr = true, silent = true })
-- Discord
-- The setup config table shows all available config options with their default values:
require("presence").setup({
-- General options
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
-- neovim_image_text = "The One True Text Editor", -- Text displayed when hovered over the Neovim image
neovim_image_text = "Neovim", -- Text displayed when hovered over the Neovim image
main_image = "file", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 1, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
})
-- Rainbow indent lines
local highlight = {
"RainbowRed",
"RainbowYellow",
"RainbowBlue",
"RainbowOrange",
"RainbowGreen",
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
vim.g.rainbow_delimiters = { highlight = highlight }
require("ibl").setup { scope = { highlight = highlight } }
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
------------------------------------
require("autoclose").setup({
keys = {
["("] = { escape = false, close = true, pair = "()", disabled_filetypes = {} },
["["] = { escape = false, close = true, pair = "[]", disabled_filetypes = {} },
["{"] = { escape = false, close = true, pair = "{}", disabled_filetypes = {} },
[">"] = { escape = true, close = false, pair = "<>", disabled_filetypes = {} },
[")"] = { escape = true, close = false, pair = "()", disabled_filetypes = {} },
["]"] = { escape = true, close = false, pair = "[]", disabled_filetypes = {} },
["}"] = { escape = true, close = false, pair = "{}", disabled_filetypes = {} },
['"'] = { escape = true, close = true, pair = '""', disabled_filetypes = {} },
["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = {} },
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = {} },
},
options = {
disabled_filetypes = { "text" },
disable_when_touch = false,
pair_spaces = false,
auto_indent = true,
},
})
require("luasnip.loaders.from_snipmate").load({ path = { "$HOME/.config/nvim/snippets/" } })
local ls = require("luasnip")
vim.keymap.set({"i"}, "<C-K>", function() ls.expand() end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-D>", function() ls.jump( 1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-S>", function() ls.jump(-1) end, {silent = true})
vim.keymap.set({"i", "s"}, "<C-E>", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, {silent = true})

View File

@ -0,0 +1,65 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use {
'nvim-telescope/telescope.nvim', tag = '0.1.1',
-- or , branch = '0.1.x',
requires = { { 'nvim-lua/plenary.nvim' } }
}
use({
'rose-pine/neovim',
as = 'rose-pine',
config = function()
vim.cmd('colorscheme rose-pine')
end
})
use('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
use('nvim-treesitter/playground')
use('theprimeagen/harpoon')
use('mbbill/undotree')
use('tpope/vim-fugitive')
use('wakatime/vim-wakatime')
use('andweeb/presence.nvim')
use('m4xshen/autoclose.nvim')
use({
"andrewferrier/wrapping.nvim",
config = function()
require("wrapping").setup()
end,
})
use "lukas-reineke/indent-blankline.nvim"
use {
'VonHeikemen/lsp-zero.nvim',
requires = {
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
{ 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-path' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-nvim-lua' },
{ 'L3MON4D3/LuaSnip' },
{ 'rafamadriz/friendly-snippets' },
}
}
use({
"L3MON4D3/LuaSnip",
-- follow latest release.
tag = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!:).
run = "make install_jsregexp"
})
end)

View File

@ -0,0 +1,41 @@
vim.keymap.set("n", "<leader>e", vim.cmd.E)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- greatest remap ever
vim.keymap.set("x", "<leader>p", [["_dP]])
-- next greatest remap ever : asbjornHaland
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set({"n", "v"}, "<leader>d", [["_d]])
-- This is going to get me cancelled
vim.keymap.set("i", "<C-c>", "<Esc>")
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("n", "<leader>vpp", "<cmd>e ~/.dotfiles/nvim/.config/nvim/lua/theprimeagen/packer.lua<CR>");
vim.keymap.set("n", "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>");
vim.keymap.set("n", "<leader><leader>", function()
vim.cmd("so")
end)

View File

@ -0,0 +1,33 @@
-- vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.termguicolors = true
vim.opt.scrolloff = 10
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "0"
vim.g.mapleader = " "

@ -0,0 +1 @@
Subproject commit 998cf5ab1b85e844c7e8edb864a997e590df7182

View File

@ -0,0 +1,234 @@
-- Automatically generated packer.nvim plugin loader code
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
return
end
vim.api.nvim_command('packadd packer.nvim')
local no_errors, error_msg = pcall(function()
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
if start then
profile_info[chunk] = hrtime()
else
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
time = function(chunk, start) end
end
local function save_profiles(threshold)
local sorted_times = {}
for chunk_name, time_taken in pairs(profile_info) do
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
end
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
local results = {}
for i, elem in ipairs(sorted_times) do
if not threshold or threshold and elem[2] > threshold then
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
end
end
if threshold then
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
end
_G._packer.profile_output = results
end
time([[Luarocks path setup]], true)
local package_path_str = "/home/tiagorg/.cache/nvim/packer_hererocks/2.1.1696795921/share/lua/5.1/?.lua;/home/tiagorg/.cache/nvim/packer_hererocks/2.1.1696795921/share/lua/5.1/?/init.lua;/home/tiagorg/.cache/nvim/packer_hererocks/2.1.1696795921/lib/luarocks/rocks-5.1/?.lua;/home/tiagorg/.cache/nvim/packer_hererocks/2.1.1696795921/lib/luarocks/rocks-5.1/?/init.lua"
local install_cpath_pattern = "/home/tiagorg/.cache/nvim/packer_hererocks/2.1.1696795921/lib/lua/5.1/?.so"
if not string.find(package.path, package_path_str, 1, true) then
package.path = package.path .. ';' .. package_path_str
end
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
package.cpath = package.cpath .. ';' .. install_cpath_pattern
end
time([[Luarocks path setup]], false)
time([[try_loadstring definition]], true)
local function try_loadstring(s, component, name)
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
if not success then
vim.schedule(function()
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
end)
end
return result
end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_G.packer_plugins = {
LuaSnip = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/LuaSnip",
url = "https://github.com/L3MON4D3/LuaSnip"
},
["autoclose.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/autoclose.nvim",
url = "https://github.com/m4xshen/autoclose.nvim"
},
["cmp-buffer"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/cmp-buffer",
url = "https://github.com/hrsh7th/cmp-buffer"
},
["cmp-nvim-lsp"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
},
["cmp-nvim-lua"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
url = "https://github.com/hrsh7th/cmp-nvim-lua"
},
["cmp-path"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/cmp-path",
url = "https://github.com/hrsh7th/cmp-path"
},
cmp_luasnip = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
url = "https://github.com/saadparwaiz1/cmp_luasnip"
},
["friendly-snippets"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/friendly-snippets",
url = "https://github.com/rafamadriz/friendly-snippets"
},
harpoon = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/harpoon",
url = "https://github.com/theprimeagen/harpoon"
},
["indent-blankline.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
},
["lsp-zero.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
},
["mason-lspconfig.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
url = "https://github.com/williamboman/mason-lspconfig.nvim"
},
["mason.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/mason.nvim",
url = "https://github.com/williamboman/mason.nvim"
},
["nvim-cmp"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-cmp",
url = "https://github.com/hrsh7th/nvim-cmp"
},
["nvim-lspconfig"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
url = "https://github.com/neovim/nvim-lspconfig"
},
["nvim-treesitter"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
url = "https://github.com/nvim-treesitter/nvim-treesitter"
},
["packer.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/packer.nvim",
url = "https://github.com/wbthomason/packer.nvim"
},
playground = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/playground",
url = "https://github.com/nvim-treesitter/playground"
},
["plenary.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/plenary.nvim",
url = "https://github.com/nvim-lua/plenary.nvim"
},
["presence.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/presence.nvim",
url = "https://github.com/andweeb/presence.nvim"
},
["rose-pine"] = {
config = { "\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0" },
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/rose-pine",
url = "https://github.com/rose-pine/neovim"
},
["telescope.nvim"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/telescope.nvim",
url = "https://github.com/nvim-telescope/telescope.nvim"
},
undotree = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/undotree",
url = "https://github.com/mbbill/undotree"
},
["vim-fugitive"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vim-fugitive",
url = "https://github.com/tpope/vim-fugitive"
},
["vim-wakatime"] = {
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/vim-wakatime",
url = "https://github.com/wakatime/vim-wakatime"
},
["wrapping.nvim"] = {
config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rwrapping\frequire\0" },
loaded = true,
path = "/home/tiagorg/.local/share/nvim/site/pack/packer/start/wrapping.nvim",
url = "https://github.com/andrewferrier/wrapping.nvim"
}
}
time([[Defining packer_plugins]], false)
-- Config for: rose-pine
time([[Config for rose-pine]], true)
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\0056\0\0\0009\0\1\0'\2\2\0B\0\2\1K\0\1\0\26colorscheme rose-pine\bcmd\bvim\0", "config", "rose-pine")
time([[Config for rose-pine]], false)
-- Config for: wrapping.nvim
time([[Config for wrapping.nvim]], true)
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rwrapping\frequire\0", "config", "wrapping.nvim")
time([[Config for wrapping.nvim]], false)
_G._packer.inside_compile = false
if _G._packer.needs_bufread == true then
vim.cmd("doautocmd BufRead")
end
_G._packer.needs_bufread = false
if should_profile then save_profiles() end
end)
if not no_errors then
error_msg = error_msg:gsub('"', '\\"')
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
end

View File

@ -0,0 +1,289 @@
# 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}

View File

@ -0,0 +1 @@
extends _

View 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

View 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

View File

@ -0,0 +1,392 @@
## 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>
# #include "..."
snippet Inc
#include "${1:`vim_snippets#Filename("$1.h")`}"
# 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"
:
:
);

View 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})

View 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}
)

View 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}

View 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:&ltdiv class="extra-wrapper"&gt&lt/div&gt}')

View File

@ -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}

View 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::

View 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}
}

File diff suppressed because it is too large Load Diff

View 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'),
),
);
}
}

View File

@ -0,0 +1,90 @@
snippet af
(${1}) {${2}}${0}
snippet pr
print(${1});
snippet deb
debugger();
${0}
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 {
}

View 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)}
)

View 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

View File

@ -0,0 +1,6 @@
snippet co
Co-authored-by: ${1} <${2}>
snippet so
Signed-off-by: ${1} <${2}>
snippet sotrg
Signed-off-by: TiagoRG <tiago.rgarcia@ua.pt>

View File

@ -0,0 +1,280 @@
snippet v "shorthand variable declaration"
${1} := ${2}
snippet vr "variable initialization"
var ${1:t} ${0:string}
snippet var "variable declaration"
var ${1} ${2} = ${3}
snippet vars "variables declaration"
var (
${1} ${2} = ${3}
)
snippet ap "append"
append(${1:slice}, ${0:value})
snippet bl "bool"
bool
snippet bt "byte"
byte
snippet br "break"
break
snippet ch "channel"
chan ${0:int}
snippet cs "case"
case ${1:value}:
${0:${VISUAL}}
snippet co "constants with iota"
const (
${1:NAME1} = iota
${0:NAME2}
)
snippet cn "continue"
continue
snippet df "defer"
defer ${0:func}()
snippet dfr "defer recover"
defer func() {
if err := recover(); err != nil {
${0:${VISUAL}}
}
}()
snippet im "import"
import (
"${1:package}"
)
snippet in "interface"
interface{}
snippet inf "full interface "
interface ${1:name} {
${2:/* methods */}
}
snippet if "if condition"
if $1 {
${2:${VISUAL}}
}
snippet ife "if else condition"
if $1 {
${2:${VISUAL}}
} else {
${0}
}
snippet el "else"
else {
${0:${VISUAL}}
}
snippet ir "if error not nil, return err"
if err != nil {
return err
}
${0}
snippet f "false"
false
snippet ft "fallthrough"
fallthrough
snippet fl "float"
float32
snippet f3 "float32"
float32
snippet f6 "float64"
float64
snippet for "for loop"
for ${1}{
${0:${VISUAL}}
}
snippet fori "for int loop"
for ${2:i} := 0; $2 < ${1:count}; $2${3:++} {
${0:${VISUAL}}
}
snippet forr "for range loop"
for ${1:e} := range ${2:collection} {
${0:${VISUAL}}
}
snippet fun "function"
func ${1:funcName}(${2}) ${3:error} {
${4}
}
${0}
snippet fum "method"
func (${1:receiver} ${2:type}) ${3:funcName}(${4}) ${5:error} {
${6}
}
${0}
snippet fumh "http handler function on receiver"
func (${1:receiver} ${2:type}) ${3:funcName}(${4:w} http.ResponseWriter, ${5:r} *http.Request) {
${0:${VISUAL}}
}
snippet lf "log printf"
log.Printf("%${1:s}", ${2:var})
snippet lp "log println"
log.Println("${1}")
snippet mk "make"
make(${1:[]string}, ${0:0})
snippet mp "map"
map[${1:string}]${0:int}
snippet main "func main()"
func main() {
${1}
}
${0}
snippet nw "new"
new(${0:type})
snippet pa "package"
package ${1:main}
snippet pn "panic"
panic("${0:msg}")
snippet pf "fmt.Printf()"
fmt.Printf("%${1:s}\n", ${2:var})
snippet pl "fmt.Println()"
fmt.Println("${1:s}")
snippet rn "range"
range ${0}
snippet rt "return"
return ${0}
snippet rs "result"
result
snippet sl "select"
select {
case ${1:v1} := <-${2:chan1}
${3}
default:
${0}
}
snippet sr "string"
string
snippet st "struct"
struct ${1:name} {
${2:/* data */}
}
${0}
snippet sw "switch"
switch ${1:var} {
case ${2:value1}:
${3}
case ${4:value2}:
${5}
default:
${0}
}
snippet ps "fmt.Sprintf"
fmt.Sprintf("%${1:s}", ${2:var})
snippet t "true"
true
snippet g "goroutine named function"
go ${1:funcName}(${0})
snippet ga "goroutine anonymous function"
go func(${1} ${2:type}) {
${3:/* code */}
}(${0})
snippet test "test function"
func Test${1:name}(t *testing.T) {
${0:${VISUAL}}
}
snippet testt "table test function"
func Test${1:name}(t *testing.T) {
tests := []struct {
name string
}{
{
name: "${2:test name}",
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
${0:${VISUAL}}
})
}
}
snippet bench "benchmark function"
func Benchmark${1:name}(b *testing.B) {
for i := 0; i < b.N; i++ {
${2}
}
}
${0}
snippet cl "composite literals"
type ${1:name} struct {
${2:attrName} ${3:attrType}
}
snippet om "if key in a map"
if ${1:value}, ok := ${2:map}[${3:key}]; ok == true {
${4:/* code */}
}
snippet gg "Grouped globals with anonymous struct"
var ${1:var} = struct{
${2:name} ${3:type}
}{
$2: ${4:value},
}
snippet ja "Marshalable json alias"
type ${1:parentType}Alias $1
func (p *$1) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct{ *$1Alias }{(*$1Alias)(p)})
}
snippet errwr "Error handling with fmt.Errorf"
if ${1}err != nil {
return fmt.Errorf("${2} %w", err)
}

View File

@ -0,0 +1,858 @@
# Some useful Unicode entities
# Non-Breaking Space
snippet nbs
&nbsp;
# ←
snippet left
&#x2190;
# →
snippet right
&#x2192;
# ↑
snippet up
&#x2191;
# ↓
snippet down
&#x2193;
# ↩
snippet return
&#x21A9;
# ⇤
snippet backtab
&#x21E4;
# ⇥
snippet tab
&#x21E5;
# ⇧
snippet shift
&#x21E7;
# ⌃
snippet ctrl
&#x2303;
# ⌅
snippet enter
&#x2305;
# ⌘
snippet cmd
&#x2318;
# ⌥
snippet option
&#x2325;
# ⌦
snippet delete
&#x2326;
# ⌫
snippet backspace
&#x232B;
# ⎋
snippet esc
&#x238B;
# comment
snippet //
<!-- ${1} -->${0}
# HTML Doctype 4.01 Strict
snippet docts
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
# HTML Doctype 4.01 Transitional
snippet doct
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
# HTML Doctype 5
snippet doct5
<!DOCTYPE HTML>
# XHTML Doctype 1.0 Frameset
snippet docxf
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
# XHTML Doctype 1.0 Strict
snippet docxs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
# XHTML Doctype 1.0 Transitional
snippet docxt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
# XHTML Doctype 1.1
snippet docx
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
# Attributes
snippet attr
${1:attribute}="${0:property}"
snippet attr+
${1:attribute}="${2:property}" attr+
snippet .
class="${1}"
snippet #
id="${1}"
snippet alt
alt="${1}"
snippet charset
charset="${1:utf-8}"
snippet data
data-${1}="${2:$1}"
snippet for
for="${1}"
snippet height
height="${1}"
snippet href
href="${1:#}"
snippet lang
lang="${1:en}"
snippet media
media="${1}"
snippet name
name="${1}"
snippet rel
rel="${1}"
snippet scope
scope="${1:row}"
snippet src
src="${1}"
snippet title=
title="${1}"
snippet type
type="${1}"
snippet value
value="${1}"
snippet width
width="${1}"
# Elements
snippet a
<a href="${1:#}">${0:$1}</a>
snippet a.
<a class="${1}" href="${2:#}">${0:$1}</a>
snippet a#
<a id="${1}" href="${2:#}">${0:$1}</a>
snippet a:ext
<a href="http://${1:example.com}">${0:$1}</a>
snippet a:mail
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${0:email me}</a>
snippet ac
<a href="`@+`">${0:`@+`}</a>
snippet abbr
<abbr title="${1}">${0}</abbr>
snippet address
<address>
${0}
</address>
snippet area
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${0}">
snippet area+
<area shape="${1:rect}" coords="${2}" href="${3}" alt="${4}">
area+
snippet area:c
<area shape="circle" coords="${1}" href="${2}" alt="${0}">
snippet area:d
<area shape="default" coords="${1}" href="${2}" alt="${0}">
snippet area:p
<area shape="poly" coords="${1}" href="${2}" alt="${0}">
snippet area:r
<area shape="rect" coords="${1}" href="${2}" alt="${0}">
snippet article
<article>
${0}
</article>
snippet article.
<article class="${1}">
${0}
</article>
snippet article#
<article id="${1}">
${0}
</article>
snippet aside
<aside>
${0}
</aside>
snippet aside.
<aside class="${1}">
${0}
</aside>
snippet aside#
<aside id="${1}">
${0}
</aside>
snippet audio
<audio src="${1}">${0}</audio>
snippet b
<b>${0}</b>
snippet base
<base href="${1}" target="${0}">
snippet bdi
<bdi>${0}</bdo>
snippet bdo
<bdo dir="${1}">${0}</bdo>
snippet bdo:l
<bdo dir="ltr">${0}</bdo>
snippet bdo:r
<bdo dir="rtl">${0}</bdo>
snippet blockquote
<blockquote>
${0}
</blockquote>
snippet body
<body>
${0}
</body>
snippet br
<br>
snippet button
<button type="${1:submit}">${0}</button>
snippet button.
<button class="${1:button}" type="${2:submit}">${0}</button>
snippet button#
<button id="${1}" type="${2:submit}">${0}</button>
snippet button:s
<button type="submit">${0}</button>
snippet button:r
<button type="reset">${0}</button>
snippet canvas
<canvas>
${0}
</canvas>
snippet caption
<caption>${0}</caption>
snippet cite
<cite>${0}</cite>
snippet code
<code>${0}</code>
snippet col
<col>
snippet colgroup
<colgroup>
${0}
</colgroup>
snippet colgroup+
<colgroup>
<col>
col+${0}
</colgroup>
snippet command
<command type="command" label="${1}" icon="${0}">
snippet command:c
<command type="checkbox" label="${1}" icon="${0}">
snippet command:r
<command type="radio" radiogroup="${1}" label="${2}" icon="${0}">
snippet datagrid
<datagrid>
${0}
</datagrid>
snippet datalist
<datalist>
${0}
</datalist>
snippet datatemplate
<datatemplate>
${0}
</datatemplate>
snippet dd
<dd>${0}</dd>
snippet dd.
<dd class="${1}">${0}</dd>
snippet dd#
<dd id="${1}">${0}</dd>
snippet del
<del>${0}</del>
snippet details
<details>${0}</details>
snippet dfn
<dfn>${0}</dfn>
snippet dialog
<dialog>
${0}
</dialog>
snippet div
<div>
${0}
</div>
snippet div.
<div class="${1}">
${0}
</div>
snippet div#
<div id="${1}">
${0}
</div>
snippet dl
<dl>
${0}
</dl>
snippet dl.
<dl class="${1}">
${0}
</dl>
snippet dl#
<dl id="${1}">
${0}
</dl>
snippet dl+
<dl>
<dt>${1}</dt>
<dd>${2}</dd>
dt+${0}
</dl>
snippet dt
<dt>${0}</dt>
snippet dt.
<dt class="${1}">${0}</dt>
snippet dt#
<dt id="${1}">${0}</dt>
snippet dt+
<dt>${1}</dt>
<dd>${2}</dd>
dt+${0}
snippet em
<em>${0}</em>
snippet embed
<embed src="${1}" type="${0}">
snippet fieldset
<fieldset>
${0}
</fieldset>
snippet fieldset.
<fieldset class="${1}">
${0}
</fieldset>
snippet fieldset#
<fieldset id="${1}">
${0}
</fieldset>
snippet fieldset+
<fieldset>
<legend><span>${1}</span></legend>
${2}
</fieldset>
fieldset+${0}
snippet figcaption
<figcaption>${0}</figcaption>
snippet figure
<figure>${0}</figure>
snippet figure#
<figure id="${1}">
${0}
</figure>
snippet figure.
<figure class="${1}">
${0}
</figure>
snippet footer
<footer>
${0}
</footer>
snippet footer.
<footer class="${1}">
${0}
</footer>
snippet footer#
<footer id="${1}">
${0}
</footer>
snippet form
<form action="${1}" method="${2:post}">
${0}
</form>
snippet form.
<form class="${1}" action="${2}" method="${3:post}">
${0}
</form>
snippet form#
<form id="${1}" action="${2}" method="${3:post}">
${0}
</form>
snippet h1
<h1>${0}</h1>
snippet h1.
<h1 class="${1}">${0}</h1>
snippet h1#
<h1 id="${1}">${0}</h1>
snippet h2
<h2>${0}</h2>
snippet h2.
<h2 class="${1}">${0}</h2>
snippet h2#
<h2 id="${1}">${0}</h2>
snippet h3
<h3>${0}</h3>
snippet h3.
<h3 class="${1}">${0}</h3>
snippet h3#
<h3 id="${1}">${0}</h3>
snippet h4
<h4>${0}</h4>
snippet h4.
<h4 class="${1}">${0}</h4>
snippet h4#
<h4 id="${1}">${0}</h4>
snippet h5
<h5>${0}</h5>
snippet h5.
<h5 class="${1}">${0}</h5>
snippet h5#
<h5 id="${1}">${0}</h5>
snippet h6
<h6>${0}</h6>
snippet h6.
<h6 class="${1}">${0}</h6>
snippet h6#
<h6 id="${1}">${0}</h6>
snippet head
<head>
<meta charset="utf-8">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${0}
</head>
snippet header
<header>
${0}
</header>
snippet header.
<header class="${1}">
${0}
</header>
snippet header#
<header id="${1}">
${0}
</header>
snippet hgroup
<hgroup>
${0}
</hgroup>
snippet hgroup.
<hgroup class="${1}>
${0}
</hgroup>
snippet hr
<hr>
snippet html
<html>
${0}
</html>
snippet xhtml
<html xmlns="http://www.w3.org/1999/xhtml">
${0}
</html>
snippet html5
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${1:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
</head>
<body>
$0
</body>
</html>
snippet html5l
<!DOCTYPE html>
<html lang="${1:en}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>${2:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
${3:link}
</head>
<body>
$0
</body>
</html>
snippet i
<i>${0}</i>
snippet iframe
<iframe src="${1}" frameborder="0"></iframe>
snippet iframe.
<iframe class="${1}" src="${2}" frameborder="0"></iframe>
snippet iframe#
<iframe id="${1}" src="${2}" frameborder="0"></iframe>
snippet img
<img src="${1}" alt="${2}">
snippet img.
<img class="${1}" src="${2}" alt="${3}">
snippet img#
<img id="${1}" src="${2}" alt="${3}">
snippet input
<input type="${1:text/submit/hidden/button/image}" name="${2}" id="${3:$2}" value="${4}">
snippet input.
<input class="${1}" type="${2:text/submit/hidden/button/image}" name="${3}" id="${4:$3}" value="${5}">
snippet input:text
<input type="text" name="${1}" id="${2:$1}" value="${3}">
snippet input:submit
<input type="submit" name="${1}" id="${2:$1}" value="${3}">
snippet input:hidden
<input type="hidden" name="${1}" id="${2:$1}" value="${3}">
snippet input:button
<input type="button" name="${1}" id="${2:$1}" value="${3}">
snippet input:image
<input type="image" name="${1}" id="${2:$1}" src="${3}" alt="${4}">
snippet input:checkbox
<input type="checkbox" name="${1}" id="${2:$1}">
snippet input:radio
<input type="radio" name="${1}" id="${2:$1}">
snippet input:color
<input type="color" name="${1}" id="${2:$1}" value="${3}">
snippet input:date
<input type="date" name="${1}" id="${2:$1}" value="${3}">
snippet input:datetime
<input type="datetime" name="${1}" id="${2:$1}" value="${3}">
snippet input:datetime-local
<input type="datetime-local" name="${1}" id="${2:$1}" value="${3}">
snippet input:email
<input type="email" name="${1}" id="${2:$1}" value="${3}">
snippet input:file
<input type="file" name="${1}" id="${2:$1}" value="${3}">
snippet input:month
<input type="month" name="${1}" id="${2:$1}" value="${3}">
snippet input:number
<input type="number" name="${1}" id="${2:$1}" value="${3}">
snippet input:password
<input type="password" name="${1}" id="${2:$1}" value="${3}">
snippet input:range
<input type="range" name="${1}" id="${2:$1}" value="${3}">
snippet input:reset
<input type="reset" name="${1}" id="${2:$1}" value="${3}">
snippet input:search
<input type="search" name="${1}" id="${2:$1}" value="${3}">
snippet input:time
<input type="time" name="${1}" id="${2:$1}" value="${3}">
snippet input:url
<input type="url" name="${1}" id="${2:$1}" value="${3}">
snippet input:week
<input type="week" name="${1}" id="${2:$1}" value="${3}">
snippet ins
<ins>${0}</ins>
snippet kbd
<kbd>${0}</kbd>
snippet label
<label for="${0:$1}">${1}</label>
snippet label:i
<label for="${2:$1}">${1}</label>
<input type="${3:text/submit/hidden/button}" name="${4:$2}" id="${5:$2}" value="${6}" />
snippet label:s
<label for="${2:$1}">${1}</label>
<select name="${3:$2}" id="${4:$2}">
<option value="${5}">${0:$5}</option>
</select>
snippet legend
<legend>${0}</legend>
snippet legend+
<legend><span>${0}</span></legend>
snippet li
<li>${0}</li>
snippet li.
<li class="${1}">${0}</li>
snippet li+
<li>${1}</li>
li+
snippet lia
<li><a href="${0:#}">${1}</a></li>
snippet lia+
<li><a href="${2:#}">${1}</a></li>
lia+
snippet link
<link rel="${1}" href="${2}" title="${3}" type="${4}">
snippet link:atom
<link rel="alternate" href="${1:atom.xml}" title="Atom" type="application/atom+xml">
snippet link:s
<link rel="stylesheet" href="${1:style.css}">
snippet link:css
<link rel="stylesheet" href="${1:style.css}" type="text/css" media="${2:all}">
snippet link:favicon
<link rel="shortcut icon" href="${1:favicon.ico}" type="image/x-icon">
snippet link:rss
<link rel="alternate" href="${1:rss.xml}" title="RSS" type="application/atom+xml">
snippet link:touch
<link rel="apple-touch-icon" href="${1:favicon.png}">
snippet main
<main role="main">
${0}
</main>
snippet map
<map name="${1}">
${0}
</map>
snippet map.
<map class="${1}" name="${2}">
${0}
</map>
snippet map#
<map name="${1}" id="${2:$1}>
${0}
</map>
snippet map+
<map name="${1}">
<area shape="${2}" coords="${3}" href="${4}" alt="${5}" />${6}
</map>
snippet mark
<mark>${0}</mark>
snippet menu
<menu>
${0}
</menu>
snippet menu:c
<menu type="context">
${0}
</menu>
snippet menu:t
<menu type="toolbar">
${0}
</menu>
snippet meta
<meta http-equiv="${1}" content="${2}">
snippet meta:s
<meta ${0}>
snippet meta:d
<meta name="description" content="${0}">
snippet meta:compat
<meta http-equiv="X-UA-Compatible" content="IE=${1:7,8,edge}">
snippet meta:refresh
<meta http-equiv="refresh" content="3;url=${0}">
snippet meta:utf5
<meta charset="utf-8">
snippet meta:utf
<meta http-equiv="content-type" content="text/html;charset=UTF-8">
snippet meter
<meter>${0}</meter>
snippet nav
<nav>
${0}
</nav>
snippet nav.
<nav class="${1}">
${0}
</nav>
snippet nav#
<nav id="${1}">
${0}
</nav>
snippet noscript
<noscript>
${0}
</noscript>
snippet object
<object data="${1}" type="${2}">
${3}
</object>
# Embed QT Movie
snippet movie
<object width="$2" height="$3" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
codebase="http://www.apple.com/qtactivex/qtplugin.cab">
<param name="src" value="$1">
<param name="controller" value="$4">
<param name="autoplay" value="$5">
<embed src="${1:movie.mov}"
width="${2:320}" height="${3:240}"
controller="${4:true}" autoplay="${5:true}"
scale="tofit" cache="true"
pluginspage="http://www.apple.com/quicktime/download/">
</object>
snippet ol
<ol>
${0}
</ol>
snippet ol.
<ol class="${1}">
${0}
</ol>
snippet ol#
<ol id="${1}">
${0}
</ol>
snippet ol+
<ol>
<li>${1}</li>
li+${0}
</ol>
snippet opt
<option value="${1}">${0:$1}</option>
snippet opt+
<option value="${1}">${2:$1}</option>
opt+${0}
snippet optt
<option>${0}</option>
snippet optgroup
<optgroup>
<option value="${1}">${2:$1}</option>
opt+${0}
</optgroup>
snippet output
<output>${0}</output>
snippet p
<p>${0}</p>
snippet p.
<p class="${1}">${0}</p>
snippet p#
<p id="${1}">${0}</p>
snippet param
<param name="${1}" value="${2}">
snippet pre
<pre>
${0}
</pre>
snippet progress
<progress>${0}</progress>
snippet q
<q>${0}</q>
snippet rp
<rp>${0}</rp>
snippet rt
<rt>${0}</rt>
snippet ruby
<ruby>
<rp><rt>${0}</rt></rp>
</ruby>
snippet s
<s>${0}</s>
snippet samp
<samp>
${0}
</samp>
snippet script
<script>
${0}
</script>
snippet scripts
<script src="${0}.js"></script>
snippet scriptt
<script type="${1}" id="${2}">
${0}
</script>
snippet scriptsrc
<script src="${0}.js" charset="utf-8"></script>
snippet section
<section>
${0}
</section>
snippet section.
<section class="${1}">
${0}
</section>
snippet section#
<section id="${1}">
${0}
</section>
snippet select
<select name="${1}" id="${2:$1}">
${0}
</select>
snippet select.
<select name="${1}" id="${2:$1}" class="${3}>
${0}
</select>
snippet select+
<select name="${1}" id="${2:$1}">
<option value="${3}">${4:$3}</option>
opt+${0}
</select>
snippet small
<small>${0}</small>
snippet source
<source src="${1}" type="${2}" media="${0}">
snippet span
<span>${0}</span>
snippet span.
<span class="${1}">${0}</span>
snippet span#
<span id="${1}">${0}</span>
snippet strong
<strong>${0}</strong>
snippet style
<style type="text/css" media="${1:all}">
${0}
</style>
snippet sub
<sub>${0}</sub>
snippet summary
<summary>
${0}
</summary>
snippet sup
<sup>${0}</sup>
snippet table
<table>
${0}
</table>
snippet table.
<table class="${1}">
${0}
</table>
snippet table#
<table id="${1}">
${0}
</table>
snippet tbody
<tbody>
${0}
</tbody>
snippet td
<td>${0}</td>
snippet td.
<td class="${1}">${0}</td>
snippet td#
<td id="${1}">${0}</td>
snippet td+
<td>${1}</td>
td+${0}
snippet textarea
<textarea name="${1}" id="${2:$1}" rows="${3:8}" cols="${4:40}">${5}</textarea>
snippet tfoot
<tfoot>
${0}
</tfoot>
snippet th
<th>${0}</th>
snippet th.
<th class="${1}">${0}</th>
snippet th#
<th id="${1}">${0}</th>
snippet th+
<th>${1}</th>
th+${0}
snippet thead
<thead>
${0}
</thead>
snippet time
<time datetime="${1}" pubdate="${2:$1}">${0:$1}</time>
snippet title
<title>${0:`substitute(vim_snippets#Filename('', 'Page Title'), '^.', '\u&', '')`}</title>
snippet tr
<tr>
${0}
</tr>
snippet tr+
<tr>
<td>${1}</td>
td+${0}
</tr>
snippet track
<track src="${1}" srclang="${2}" label="${3}" default="${4:default}>${5}
snippet ul
<ul>
${0}
</ul>
snippet ul.
<ul class="${1}">
${0}
</ul>
snippet ul#
<ul id="${1}">
${0}
</ul>
snippet ul+
<ul>
<li>${1}</li>
li+${0}
</ul>
snippet var
<var>${0}</var>
snippet video
<video src="${1}" height="${2}" width="${3}" preload="${4:none}" autoplay="${5:autoplay}">${6}</video>
snippet video.
<video class="${1}" src="${2}" height="${3}" width="${4}" preload="${5:none}" autoplay="${6:autoplay}">${7}</video>
snippet wbr
<wbr>
snippet viewport
<meta name="viewport" content="width=device-width, initial-scale=1">

View File

@ -0,0 +1,142 @@
# Generic tags
extends html
snippet %
{% ${1} %}
snippet %%
{% ${1:tag_name} %}
${0}
{% end$1 %}
snippet {
{{ ${1} }}
# Template Tags
snippet autoescape
{% autoescape ${1:off} %}
${0}
{% endautoescape %}
snippet block
{% block ${1} %}
${0}
{% endblock %}
snippet #
{# ${0:comment} #}
snippet comment
{% comment %}
${0}
{% endcomment %}
snippet cycle
{% cycle ${1:val1} ${2:val2} ${3:as ${4}} %}
snippet debug
{% debug %}
snippet extends
{% extends "${0:base.html}" %}
snippet filter
{% filter ${1} %}
${0}
{% endfilter %}
snippet firstof
{% firstof ${1} %}
snippet for
{% for ${1} in ${2} %}
${0}
{% endfor %}
snippet empty
{% empty %}
${0}
snippet if
{% if ${1} %}
${0}
{% endif %}
snippet el
{% else %}
${1}
snippet eif
{% elif ${1} %}
${0}
snippet ifchanged
{% ifchanged %}${1}{% endifchanged %}
snippet ifequal
{% ifequal ${1} ${2} %}
${0}
{% endifequal %}
snippet ifnotequal
{% ifnotequal ${1} ${2} %}
${0}
{% endifnotequal %}
snippet include
{% include "${0}" %}
snippet load
{% load ${0} %}
snippet now
{% now "${0:jS F Y H:i}" %}
snippet regroup
{% regroup ${1} by ${2} as ${0} %}
snippet spaceless
{% spaceless %}${0}{% endspaceless %}
snippet ssi
{% ssi ${0} %}
snippet trans
{% trans "${0:string}" %}
snippet url
{% url ${1} as ${0} %}
snippet widthratio
{% widthratio ${1:this_value} ${2:max_value} ${0:100} %}
snippet with
{% with ${1} as ${2} %}
${0}
{% endwith %}
# Template Filters
# Note: Since SnipMate can't determine which template filter you are
# expanding without the "|" character, these do not add the "|"
# character. These save a few keystrokes still.
# Note: Template tags that take no arguments are not implemented.
snippet add
add:"${0}"
snippet center
center:"${0}"
snippet cut
cut:"${0}"
snippet date
date:"${0}"
snippet default
default:"${0}"
snippet defaultifnone
default_if_none:"${0}"
snippet dictsort
dictsort:"${0}"
snippet dictsortrev
dictsortreversed:"${0}"
snippet divisibleby
divisibleby:"${0}"
snippet floatformat
floatformat:"${0}"
snippet getdigit
get_digit:"${0}"
snippet join
join:"${0}"
snippet lengthis
length_is:"${0}"
snippet pluralize
pluralize:"${0}"
snippet removetags
removetags:"${0}"
snippet slice
slice:"${0}"
snippet stringformat
stringformat:"${0}"
snippet time
time:"${0}"
snippet truncatewords
truncatewords:${0}
snippet truncatewordshtml
truncatewords_html:${0}
snippet urlizetrunc
urlizetrunc:${0}
snippet wordwrap
wordwrap:${0}

View File

@ -0,0 +1,55 @@
# Generic tags
snippet {
{{ ${0} }}
# Template tags
snippet extends
{% extends "${0:base.html}" %}
snippet autoescape
{% autoescape ${0:xhtml_escape | None} %}
snippet apply
{% apply ${1:function} %}
${0}
{% end %}
snippet block
{% block ${1} %}
${0}
{% end %}
snippet for
{% for ${1:item} in ${2} %}
${0}
{% end %}
snippet from
{% from ${1:x} import ${0:y} %}
snippet if
{% if $1 %}
${0}
{% end %}
snippet eif
{% elif $0 %}
snippet el
{% else %}
snippet import
{% import ${0:module} %}
snippet include
{% include "${0:filename}" %}
snippet module
{% module ${0:expression} %}
snippet raw
{% raw ${0:expression} %}
snippet set
{% set ${1:x} = ${0:y} %}
snippet try
{% try %}
${1:${VISUAL}}
{% except %}
${2}
{% finallly %}
${0}
{% end %}
snippet wh
{% while $1 %}
${0}
{% end %}

View File

@ -0,0 +1,297 @@
## Access Modifiers
snippet po
protected ${0}
snippet pu
public ${0}
snippet pr
private ${0}
##
## Annotations
snippet before
@Before
static void ${1:intercept}(${2:args}) { ${0} }
snippet mm
@ManyToMany
${0}
snippet mo
@ManyToOne
${0}
snippet om
@OneToMany${1:(cascade=CascadeType.ALL)}
${0}
snippet oo
@OneToOne
${1}
##
## Basic Java packages and import
snippet im
import ${0}
snippet j.b
java.beans.
snippet j.i
java.io.
snippet j.m
java.math.
snippet j.n
java.net.
snippet j.u
java.util.
##
## Class
snippet cl
class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
snippet pcl
public class ${1:`vim_snippets#Filename("$1", "untitled")`} ${0}
snippet in
interface ${1:`vim_snippets#Filename("$1", "untitled")`} ${2:extends Parent}
snippet tc
public class ${1:`vim_snippets#Filename("$1")`} extends ${0:TestCase}
##
## Class Enhancements
snippet ext
extends ${0}
snippet imp
implements ${0}
##
## Comments
snippet /*
/*
* ${0}
*/
##
## Constants
snippet co
static public final ${1:String} ${2:var} = ${3};
snippet cos
static public final String ${1:var} = "${2}";
##
## Control Statements
snippet case
case ${1}:
${0}
snippet def
default:
${0}
snippet el
else
snippet eif
else if (${1}) ${0}
snippet if
if (${1}) ${0}
snippet sw
switch (${1}) {
${0}
}
##
## Create a Method
snippet m
${1:void} ${2:method}(${3}) ${4:throws }
##
## Create a Variable
snippet v
${1:String} ${2:var}${3: = null}${4};
##
## Declaration for ArrayList
snippet d.al
List<${1:Object}> ${2:list} = new ArrayList<$1>();${0}
## Declaration for HashMap
snippet d.hm
Map<${1:Object}, ${2:Object}> ${3:map} = new HashMap<$1, $2>();${0}
## Declaration for HashSet
snippet d.hs
Set<${1:Object}> ${2:set} = new HashSet<$1>();${0}
## Declaration for Stack
snippet d.st
Stack<${1:Object}> ${2:stack} = new Stack<$1>();${0}
##
## Singleton Pattern
snippet singlet
private static class Holder {
private static final ${1:`vim_snippets#Filename("$1")`} INSTANCE = new $1();
}
private $1() { }
public static $1 getInstance() {
return Holder.INSTANCE;
}
##
## Enhancements to Methods, variables, classes, etc.
snippet ab
abstract ${0}
snippet fi
final ${0}
snippet st
static ${0}
snippet sy
synchronized ${0}
##
## Error Methods
snippet err
System.err.print("${0:Message}");
snippet errf
System.err.printf("${1:Message}", ${0:exception});
snippet errln
System.err.println("${0:Message}");
##
## Exception Handling
snippet as
assert ${1:test} : "${2:Failure message}";
snippet ae
assertEquals("${1:Failure message}", ${2:expected}, ${3:actual});
snippet aae
assertArrayEquals("${1:Failure message}", ${2:expecteds}, ${3:actuals});
snippet af
assertFalse("${1:Failure message}", $2);
snippet at
assertTrue("${1:Failure message}", $2);
snippet an
assertNull("${1:Failure message}", ${2:object});
snippet ann
assertNotNull("${1:Failure message}", ${2:object});
snippet ass
assertSame("${1:Failure message}", ${2:expected}, ${3:actual});
snippet asns
assertNotSame("${1:Failure message}", ${2:expected}, ${3:actual});
snippet fa
fail("${1:Failure message}");
snippet ca
catch(${1:Exception} ${2:e}) ${0}
snippet thr
throw ${0}
snippet ths
throws ${0}
snippet try
try {
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
}
snippet tryf
try {
${0:${VISUAL}}
} catch(${1:Exception} ${2:e}) {
} finally {
}
##
## Find Methods
snippet findall
List<${1:listName}> ${2:items} = $1.findAll();
snippet findbyid
${1:var} ${2:item} = $1.findById(${3});
##
## Javadocs
snippet /**
/**
* ${0}
*/
snippet @au
@author `system("grep \`id -un\` /etc/passwd | cut -d \":\" -f5 | cut -d \",\" -f1")`
snippet @br
@brief ${0:Description}
snippet @fi
@file ${0:`vim_snippets#Filename("$1")`}.java
snippet @pa
@param ${0:param}
snippet @re
@return ${0:param}
##
## Logger Methods
snippet debug
Logger.debug(${1:param});
snippet error
Logger.error(${1:param});
snippet info
Logger.info(${1:param});
snippet warn
Logger.warn(${1:param});
##
## Loops
snippet enfor
for (${1} : ${2}) ${0}
snippet for
for (${1}; ${2}; ${3}) ${0}
snippet wh
while (${1:true}) ${0}
snippet wht
while (true) ${0}
##
## Main method
snippet psvm
public static void main (String[] args) {
${0}
}
snippet main
public static void main (String[] args) {
${0}
}
##
## Print Methods
snippet sout
System.out.println(${0});
snippet serr
System.err.println(${0});
snippet print
System.out.print("${0:Message}");
snippet printf
System.out.printf("${1:Message}", ${0:args});
snippet println
System.out.println(${0});
snippet printlna
System.out.println(Arrays.toString(${0}));
##
## Render Methods
snippet ren
render(${1:param});
snippet rena
renderArgs.put("${1}", ${2});
snippet renb
renderBinary(${1:param});
snippet renj
renderJSON(${1:param});
snippet renx
renderXml(${1:param});
##
## Setter and Getter Methods
snippet set
${1:public} void set${3:}(${2:String} ${0:}){
this.$4 = $4;
}
snippet get
${1:public} ${2:String} get${3:}(){
return this.${0:};
}
##
## Terminate Methods or Loops
snippet re
return ${0}
snippet br
break;
##
## Test Methods
snippet t
public void test${1:Name}() throws Exception {
${0}
}
snippet test
@Test
public void test${1:Name}() throws Exception {
${0}
}
##
## Utils
snippet Sc
Scanner
##
## Miscellaneous
snippet action
public static void ${1:index}(${2:args}) { ${0} }
snippet rnf
notFound(${1:param});
snippet rnfin
notFoundIfNull(${1:param});
snippet rr
redirect(${1:param});
snippet ru
unauthorized(${1:param});
snippet unless
(unless=${1:param});

View File

@ -0,0 +1,52 @@
# Snippet for bemjson. https://en.bem.info/platform/bemjson/
# Blocks
snippet b
{
block : '${1:name}',
content : [
'${2:content}'
]
}
# btc - BEM block with text content
snippet btc
{
block : '${1:name}',
content: '${2:content}'
}
# bwm - BEM block with modifier.
snippet bwm
{
block : '${1:name}',
mods: { ${2:modName}: '${3:modVal}' },
content : [
'${4:content}'
]
}
# Elems
# e - BEM elem
snippet e
{
elem : '${1:name}',
content : [
'${2:content}'
]
}
# mo - Mods
snippet mo
mods : { ${1:modName} : '${2:modVal}' },
# mi - BEM mix mod
snippet mi
mix : [ { ${1:block} : '${2:block}' } ],
# a - BEM attrs mod
snippet a
attrs : { ${1:attr} : '${2:val}' },

View File

@ -0,0 +1,30 @@
snippet .attr
.attr("${1}", ${2})
snippet .style
.style("${1}", ${2})
snippet axis
d3.svg.axis()
.orient(${1})
.scale(${2})
snippet fd
function(d) { ${1} }
snippet fdi
function(d, i) { ${1} }
snippet marginconvention
var ${1:margin} = { top: ${2:10}, right: ${3:10}, bottom: ${4:10}, left: ${5:10} };
var ${6:width} = ${7:970} - $1.left - $1.right;
var ${8:height} = ${9:500} - $1.top - $1.bottom;
var ${10:svg} = d3.select("${11}").append("svg")
.attr("width", $6 + $1.left + $1.right)
.attr("height", $8 + $1.top + $1.bottom)
.append("g")
.attr("transform", "translate(" + $1.left + "," + $1.top + ")")
snippet nest
d3.nest()
.key(${1})
.entries(${2})
snippet scale
d3.scale.linear()
.domain(${1})
.range(${2})

View File

@ -0,0 +1,175 @@
snippet des "Describe (js)"
describe('${1:description}', function() {
$0
});
snippet it "it (js)"
it('${1:description}', function() {
$0
});
snippet bef "before each (js)"
beforeEach(function() {
$0
});
snippet aft "after each (js)"
afterEach(function() {
$0
});
snippet befa "before all (js)"
beforeAll(function() {
$0
});
snippet afta "after all (js)"
afterAll(function() {
$0
});
snippet any "any (js)"
jasmine.any($1)
snippet anyt "anything (js)"
jasmine.anything()
snippet objc "object containing (js)"
jasmine.objectContaining({
${VISUAL}$0
});
snippet arrc "array containing (js)"
jasmine.arrayContaining([${1:value1}]);
snippet strm "string matching (js)"
jasmine.stringMatching("${1:matcher}")
snippet ru "runs (js)"
runs(function() {
$0
});
snippet wa "waits (js)"
waits($1);
snippet ex "expect (js)"
expect(${1:target})$0;
snippet ee "expect to equal (js)"
expect(${1:target}).toEqual(${2:value});
snippet el "expect to be less than (js)"
expect(${1:target}).toBeLessThan(${2:value});
snippet eg "expect to be greater than (js)"
expect(${1:target}).toBeGreaterThan(${2:value});
snippet eb "expect to be (js)"
expect(${1:target}).toBe(${2:value});
snippet em "expect to match (js)"
expect(${1:target}).toMatch(${2:pattern});
snippet eha "expect to have attribute (js)"
expect(${1:target}).toHaveAttr('${2:attr}'${3:, '${4:value}'});
snippet et "expect to be truthy (js)"
expect(${1:target}).toBeTruthy();
snippet ef "expect to be falsy (js)"
expect(${1:target}).toBeFalsy();
snippet etbd "expect to be defined (js)"
expect(${1:target}).toBeDefined();
snippet eud "expect to be defined (js)"
expect(${1:target}).toBeUndefined();
snippet en "expect to be null (js)"
expect(${1:target}).toBeNull();
snippet ec "expect to contain (js)"
expect(${1:target}).toContain(${2:value});
snippet ev "expect to be visible (js)"
expect(${1:target}).toBeVisible();
snippet eh "expect to be hidden (js)"
expect(${1:target}).toBeHidden();
snippet eth "expect to throw (js)"
expect(${1:target}).toThrow(${2:value});
snippet ethe "expect to throw error (js)"
expect(${1:target}).toThrowError(${2:value});
snippet notx "expect not (js)"
expect(${1:target}).not$0;
snippet note "expect not to equal (js)"
expect(${1:target}).not.toEqual(${2:value});
snippet notl "expect to not be less than (js)"
expect(${1:target}).not.toBeLessThan(${2:value});
snippet notg "expect to not be greater than (js)"
expect(${1:target}).not.toBeGreaterThan(${2:value});
snippet notm "expect not to match (js)"
expect(${1:target}).not.toMatch(${2:pattern});
snippet notha "expect to not have attribute (js)"
expect(${1:target}).not.toHaveAttr('${2:attr}'${3:, '${4:value}'});
snippet nott "expect not to be truthy (js)"
expect(${1:target}).not.toBeTruthy();
snippet notf "expect not to be falsy (js)"
expect(${1:target}).not.toBeFalsy();
snippet notd "expect not to be defined (js)"
expect(${1:target}).not.toBeDefined();
snippet notn "expect not to be null (js)"
expect(${1:target}).not.toBeNull();
snippet notc "expect not to contain (js)"
expect(${1:target}).not.toContain(${2:value});
snippet notv "expect not to be visible (js)"
expect(${1:target}).not.toBeVisible();
snippet noth "expect not to be hidden (js)"
expect(${1:target}).not.toBeHidden();
snippet notth "expect not to throw (js)"
expect(${1:target}).not.toThrow(${2:value});
snippet notthe "expect not to throw error (js)"
expect(${1:target}).not.toThrowError(${2:value});
snippet s "spy on (js)"
spyOn(${1:object}, '${2:method}')$0;
snippet sr "spy on and return (js)"
spyOn(${1:object}, '${2:method}').and.returnValue(${3:arguments});
snippet st "spy on and throw (js)"
spyOn(${1:object}, '${2:method}').and.throwError(${3:exception});
snippet sct "spy on and call through (js)"
spyOn(${1:object}, '${2:method}').and.callThrough();
snippet scf "spy on and call fake (js)"
spyOn(${1:object}, '${2:method}').and.callFake(${3:function});
snippet ethbc "expect to have been called (js)"
expect(${1:target}).toHaveBeenCalled();
snippet nthbc "expect not to have been called (js)"
expect(${1:target}).not.toHaveBeenCalled();
snippet ethbcw "expect to have been called with (js)"
expect(${1:target}).toHaveBeenCalledWith(${2:arguments});

View File

@ -0,0 +1,34 @@
snippet des "describe('thing', function() { ... })" b
describe('${1:}', function() {
${0:${VISUAL}}
});
snippet it "it('should do', function() { ... })" b
it('${1:}', function() {
${0:${VISUAL}}
});
snippet xit "xit('should do', function() { ... })" b
xit('${1:}', function() {
${0:${VISUAL}}
});
snippet bef "before(function() { ... })" b
before(function() {
${0:${VISUAL}}
});
snippet befe "beforeEach(function() { ... })" b
beforeEach(function() {
${0:${VISUAL}}
});
snippet aft "after(function() { ... })" b
after(function() {
${0:${VISUAL}}
});
snippet afte "afterEach(function() { ... })" b
afterEach(function() {
${0:${VISUAL}}
});
snippet exp "expect(...)" b
expect(${1:})${0};
snippet expe "expect(...).to.equal(...)" b
expect(${1:}).to.equal(${0});
snippet expd "expect(...).to.deep.equal(...)" b
expect(${1:}).to.deep.equal(${0});

View File

@ -0,0 +1,205 @@
snippet sapmlabel
var $1 = new sap.m.Label({
design : $2,
text : $3,
visible : $4,
textAlign : $5,
textDirection : $6,
width : $7,
required : $7
});
snippet sapmtext
var $1 = new sap.m.Text({
text :$2,
textDirection :$3,
visible :$4,
wrapping : $5,
textAlign : $6,
width :$7,
maxLines :$8
});
snippet sapmbutton
var $1 = new sap.m.Button({
text : $2,
type : $3,
width : $4,
enabled :$5,
visible :$6,
icon : $7,
iconFirst : $8,
activeIcon :$9,
iconDensityAware : $10,
});
snippet sapmflexbox
var $1 = new sap.m.FlexBox({
visible : $2,
height : $3,
width : $4,
displayInline :$5,
direction :$6,
fitContainer : $7,
renderType : $8,
justifyContent :$9,
alignItems : $10,
items:[]
});
snippet sapmhbox
var $1 = new sap.m.HBox({
visible : $2,
height : $3,
width : $4,
displayInline :$5,
direction :$6,
fitContainer : $7,
renderType : $8,
justifyContent :$9,
alignItems : $10,
items:[]
});
snippet sapmvbox
var $1 = new sap.m.VBox({
visible : $2,
height : $3,
width : $4,
displayInline :$5,
direction :$6,
fitContainer : $7,
renderType : $8,
justifyContent :$9,
alignItems : $10,
items:[]
});
snippet sapcomponent
sap.ui.controller("$1", {
onInit: function(){
},
onAfterRendering: function() {
},
onAfterRendering: function() {
},
onExit: function() {
},
});
snippet sapminput
var $1 = new sap.m.Input({
value :$2,
width : $3,
enabled :$4,
visible :$5,
valueState :$6,
name : $7,
placeholder : $8,
editable : $9,
type : $10,
maxLength :$11,
valueStateText :$12,
showValueStateMessage :$13,
dateFormat :$14,
showValueHelp :$15,
showSuggestion :$16,
valueHelpOnly :$17,
filterSuggests :$18,
maxSuggestionWidth :$19,
startSuggestion : $20,
showTableSuggestionValueHelp : $21,
description : $22,
fieldWidth : $23,
valueLiveUpdate :$24,
suggestionItems :[$25],
suggestionColumns : [$26],
suggestionRows : [$27],
liveChange : $28,
valueHelpRequest :$29,
suggest : $30,
suggestionItemSelected : $31
});
snippet _sthis
var _self = this;
snippet sapmresponsivepopup
var $1 = new sap.m.ResponsivePopover({
placement :$2 ,//sap.m.PlacementType (default: sap.m.PlacementType.Right)
showHeader :$3 ,//boolean (default: true)
title : $4,//string
icon :$5 ,//sap.ui.core.URI
modal :$6 ,// boolean
offsetX :$7, //int
offsetY :$8, //int
contentWidth : $9,//sap.ui.core.CSSSize
contentHeight :$10, //sap.ui.core.CSSSize
horizontalScrolling :$11, //boolean
verticalScrolling :$12, //boolean
showCloseButton :$13, //boolean (default: true)
//Aggregations
content :$14, //sap.ui.core.Control[]
customHeader :$15, //sap.m.IBar
subHeader : $16, //sap.m.IBar
beginButton :$17, //sap.m.Button
endButton : $18, //sap.m.Button
//Associations
initialFocus : $19, //string | sap.ui.core.Control
//Events
beforeOpen :$20, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
afterOpen : $21, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
beforeClose : $22, //fnListenerFunction or [fnListenerFunction, oListenerObject] or [oData, fnListenerFunction, oListenerObject]
afterClose : $23 //fnList
});
snippet sapicon
var $1 = new sap.ui.core.Icon({
src :$2 , //sap.ui.core.URI
size :$3 , //sap.ui.core.CSSSize
color :$4 , //sap.ui.core.CSSColor
hoverColor : $5 , // sap.ui.core.CSSColor
activeColor :$6 , //sap.ui.core.CSSColor
width :$7 , //sap.ui.core.CSSSize
height : $8 ,//sap.ui.core.CSSSize
backgroundColor :$8 , //sap.ui.core.CSSColor
hoverBackgroundColor :$9 , //sap.ui.core.CSSColor
activeBackgroundColor :$10 , //sap.ui.core.CSSColor
visible :$11 , //boolean (default: true)
decorative : $12 ,//boolean (default: true)
});
snippet extendVerticalL
sap.ui.layout.VerticalLayout.extend("$1", {
metadata: {
properties: {
$2
},
aggregations: {
$3
},
events: {
$4
}
},
init: function(){
$5
},
renderer: "$6"
});
snippet extendHorizontalL
sap.ui.layout.HorizontalLayout.extend("$1", {
metadata: {
properties: {
$2
},
aggregations: {
$3
},
events: {
$4
}
},
init: function(){
$5
},
renderer: "$6"
});

View File

@ -0,0 +1,589 @@
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: $.param( $('${4:Element or Expression}') ),
complete: function (jqXHR, textStatus) {
${5:// callback}
},
success: function (data, textStatus, jqXHR) {
${6:// success callback}
},
error: function (jqXHR, textStatus, errorThrown) {
${0:// error callback}
}
});
snippet ajaxcomplete
${1:obj}.ajaxComplete(function (${1:e}, xhr, settings) {
${0:// callback}
});
snippet ajaxerror
${1:obj}.ajaxError(function (${1:e}, xhr, settings, thrownError) {
${2:// error callback}
});
${0}
snippet ajaxget
$.get('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${0:// success callback}
}
);
snippet ajaxpost
$.post('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${0:// success callback}
}
);
snippet ajaxprefilter
$.ajaxPrefilter(function (${1:options}, ${2:originalOptions}, jqXHR) {
${0: // Modify options, control originalOptions, store jqXHR, etc}
});
snippet ajaxsend
${1:obj}.ajaxSend(function (${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: function (jqXHR, textStatus) {
${5:// callback}
},
success: function (data, textStatus, jqXHR) {
${6:// success callback}
},
error: function (jqXHR, textStatus, errorThrown) {
${0:// error callback}
}
});
snippet ajaxstart
$.ajaxStart(function () {
${1:// handler for when an AJAX call is started and no other AJAX calls are in progress};
});
${0}
snippet ajaxstop
$.ajaxStop(function () {
${1:// handler for when all AJAX calls have been completed};
});
${0}
snippet ajaxsuccess
$.ajaxSuccess(function (${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}', function (${3:e}) {
${0:// event handler}
});
snippet blur
${1:obj}.blur(function (${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(function (${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(function (${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: function (elem, computed, extra) {
${2: // handle getting the CSS property}
},
set: function (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(function (${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}', function (${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(function (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(function (${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', function () {
${0:// callback};
});
snippet fadeout
${1:obj}.fadeOut('${2:slow/400/fast}')
snippet fadeoutc
${1:obj}.fadeOut('slow/400/fast', function () {
${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}, function () {
${0:// callback};
});
snippet filter
${1:obj}.filter('${2:selector expression}')
snippet filtert
${1:obj}.filter(function (${2:index}) {
${3}
})
snippet find
${1:obj}.find('${2:selector expression}')
snippet focus
${1:obj}.focus(function (${2:e}) {
${0:// event handler}
});
snippet focusin
${1:obj}.focusIn(function (${2:e}) {
${0:// event handler}
});
snippet focusout
${1:obj}.focusOut(function (${2:e}) {
${0:// event handler}
});
snippet get
${1:obj}.get(${2:element index})
snippet getjson
$.getJSON('${1:mydomain.com/url}',
${2:{ param1: value1 },}
function (data, textStatus, jqXHR) {
${0:// success callback}
}
);
snippet getscript
$.getScript('${1:mydomain.com/url}', function (script, textStatus, jqXHR) {
${0:// callback}
});
snippet grep
$.grep(${1:array}, function (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}', function () {
${0:// callback}
});
snippet hover
${1:obj}.hover(function (${2:e}) {
${3:// event handler}
}, function ($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(function (${2:e}) {
${0:// event handler}
});
snippet kpress
${1:obj}.keypress(function (${2:e}) {
${0:// event handler}
});
snippet kup
${1:obj}.keyup(function (${2:e}) {
${0:// event handler}
});
snippet last
${1:obj}.last('${1:selector expression}')
snippet live
${1:obj}.live('${2:events}', function (${3:e}) {
${0:// event handler}
});
snippet load
${1:obj}.load(function (${2:e}) {
${0:// event handler}
});
snippet loadf
${1:obj}.load('${2:mydomain.com/url}',
${2:{ param1: value1 },}
function (responseText, textStatus, xhr) {
${0:// success callback}
}
});
snippet makearray
$.makeArray(${0:obj});
snippet map
${1:obj}.map(function (${2:index}, ${3:element}) {
${0:// callback}
});
snippet mapp
$.map(${1:arrayOrObject}, function (${2:value}, ${3:indexOrKey}) {
${0:// callback}
});
snippet merge
$.merge(${1:target}, ${0:original});
snippet mdown
${1:obj}.mousedown(function (${2:e}) {
${0:// event handler}
});
snippet menter
${1:obj}.mouseenter(function (${2:e}) {
${0:// event handler}
});
snippet mleave
${1:obj}.mouseleave(function (${2:e}) {
${0:// event handler}
});
snippet mmove
${1:obj}.mousemove(function (${2:e}) {
${0:// event handler}
});
snippet mout
${1:obj}.mouseout(function (${2:e}) {
${0:// event handler}
});
snippet mover
${1:obj}.mouseover(function (${2:e}) {
${0:// event handler}
});
snippet mup
${1:obj}.mouseup(function (${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}', function (${4:e}) {
${0:// event handler}
});
snippet one
${1:obj}.one('${2:event name}', function (${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
$(function () {
${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(function (${2:e}) {
${0:// event handler}
});
snippet resize
${1:obj}.resize(function (${2:e}) {
${0:// event handler}
});
snippet scroll
${1:obj}.scroll(function (${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}', function () {
${0:// callback};
});
snippet select
${1:obj}.select(function (${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}', function () {
${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(function (${2:e}) {
${0:// event handler}
});
snippet sup
${1:obj}.slideUp('${2:slow/400/fast}')
snippet supc
${1:obj}.slideUp('${2:slow/400/fast}', function () {
${0:// callback};
});
snippet text
${1:obj}.text(${2:'some text'})
snippet this
$(this)
snippet toarr
${0:obj}.toArray()
snippet tog
${1:obj}.toggle(function (${2:e}) {
${3:// event handler}
}, function ($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(function (${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:&lt;div class="extra-wrapper"&gt;&lt;/div&gt;}')

View File

@ -0,0 +1,190 @@
# Import
snippet ir import React
import React from 'react';
snippet irc import React and Component
import React, { Component } from 'react';
snippet irh import React hooks
import { use$1 } from 'react';
snippet ird import ReactDOM
import ReactDOM from 'react-dom';
snippet irp import PropTypes
import PropTypes from 'prop-types';
# Lifecycle Methods
snippet cdm componentDidMount
componentDidMount() {
${1}
};
snippet cdup componentDidUpdate
componentDidUpdate(prevProps, prevState) {
${1}
};
snippet cwm componentWillMount
componentWillMount() {
${1}
};
snippet cwr componentWillReceiveProps
componentWillReceiveProps(nextProps) {
${1}
};
snippet cwun componentWillUnmount
componentWillUnmount() {
${1}
};
snippet cwu componentWillUpdate
componentWillUpdate(nextProps, nextState) {
${1}
};
snippet scu shouldComponentUpdate
shouldComponentUpdate(nextProps, nextState) {
${1}
}
# Props
snippet spt static propTypes
static propTypes = {
${1}: PropTypes.${2}
};
snippet pt propTypes
${1}.propTypes = {
${2}: PropTypes.${2}
};
snippet sdp static defaultProps
static defaultProps = {
${1}: ${2}
};
snippet dp defaultProps
${1}.defaultProps = {
${2}: ${3}
};
snippet pp props
props.${1};
snippet tp this props
this.props.${1};
# State
snippet st
state = {
${1}: ${2},
};
snippet sst
this.setState({
${1}: ${2}
});
snippet tst
this.state.${1};
# Component
snippet raf
const ${1:ComponentName} = (${2:props}) => {
${3:state}
return (
<>
${4}
</>
);
};
snippet rcla
class ${1:ClassName} extends Component {
render() {
return (
<>
${2}
</>
);
}
}
snippet ercla
export default class ${1:ClassName} extends Component {
render() {
return (
<>
${2}
</>
);
};
};
snippet ctor
constructor() {
super();
${1:state}
}
snippet ren
render() {
return (
<>
${2}
</>
);
}
snippet fup
forceUpdate(${1:callback});
# Hooks
snippet uses useState
const [${1:state}, set${2}] = useState(${3:initialState});
snippet usee useEffect
useEffect(() => {
${1}
});
snippet userd useReducer
const [${1:state}, ${2:dispatch}] = useReducer(${3:reducer});
snippet userf useRef
const ${1:refContainer} = useRef(${2:initialValue});
snippet usect useContext
const ${1:value} = useContext(${2:MyContext});
snippet usecb useCallback
const ${1:memoizedCallback} = useCallback(
() => {
${2}(${3})
},
[$3]
);
snippet usem useMemo
const ${1:memoizedCallback} = useMemo(() => ${2}(${3}), [$3]);
snippet usei useImperativeHandle
useImperativeHandle(${1:ref}, ${2:createHandle});
snippet used useDebugValue
useDebugValue(${1:value});
# ReactDOM methods
snippet rdr ReactDOM.render
ReactDOM.render(${1}, ${2});
snippet rdh ReactDOM.hydrate
ReactDOM.hydrate(${1:element}, ${2:container}[, ${3:callback}]);
snippet rdcp ReactDOM.createPortal
ReactDOM.createPortal(${1:child}, ${2:container});

View File

@ -0,0 +1,37 @@
snippet ist
import { createStore } from 'redux';
snippet con
connect(${1:mapStateToProps}, ${2:mapDispatchToProps})(<${3:VISUAL}/>);
snippet act
const ${1:actionName} = (${2:arg}) => {
return {
type: ${3:VISUAL},
$2
};
};
snippet rdc
const ${1:reducerName} = (state={}, action) => {
switch(action.type) {
case ${1:action}:
return {
...state,
$2
};
default:
return state;
};
};
snippet mstp
const mapStateToProps = (state) => {
return {
${1:propName}: state.$1,
};
};
snippet mdtp
const mapDispatchToProps = (dispatch) => {
return {
${1:propName}: () => {
dispatch(${2:actionName}());
},
};
};

View File

@ -0,0 +1,14 @@
snippet def
define(["${1:#dependencies1}"], function (${2:#dependencies2}) {
return ${0:TARGET};
});
snippet defn
define("${1:#name}", ["${2:#dependencies1}"], function (${3:#dependencies2}) {
return ${0:TARGET};
});
snippet reqjs
require(["${1:#dependencies1}"], function (${2:#dependencies2}) {
return ${0:TARGET};
});

View File

@ -0,0 +1,51 @@
snippet #!
#!/usr/bin/env node
# module exports
snippet ex
module.exports = ${1};
# require
snippet re
const ${1} = require('${2:module_name}');
# EventEmitter
snippet on
on('${1:event_name}', function(${2:stream}) {
${3}
});
snippet emit
emit('${1:event_name}', ${2:args});
snippet once
once('${1:event_name}', function(${2:stream}) {
${3}
});
# http. User js function snippet as handler
snippet http
http.createServer(${1:handler}).listen(${2:port_number});
# net
snippet net
net.createServer(function(${1:socket}){
${1}.on('data', function('data'){
${2}
]});
${1}.on('end', function(){
${3}
});
}).listen(${4:8124});
# Stream snippets
snippet pipe
pipe(${1:stream})${2}
# Express snippets
snippet eget
${1:app}.get('${2:route}', ${3:handler});
snippet epost
${1:app}.post('${2:route}', ${3:handler});
snippet eput
${1:app}.put('${2:route}', ${3:handler});
snippet edel
${1:app}.delete('${2:route}', ${3:handler});
# process snippets
snippet stdin
process.stdin
snippet stdout
process.stdout
snippet stderr
process.stderr

View File

@ -0,0 +1,363 @@
# Functions
# prototype
snippet proto
${1:class_name}.prototype.${2:method_name} = function(${3}) {
${0:${VISUAL}}
};
# Function
snippet fun "function"
function ${1:function_name}(${2}) {
${0:${VISUAL}}
}
# Asynchronous Function
snippet asf "async function"
async function ${1:function_name}(${2}) {
${0:${VISUAL}}
}
# Anonymous Function
snippet anf "" w
function(${1}) {
${0:${VISUAL}}
}
# Anonymous Function assigned to variable
snippet vaf
var ${1:function_name} = function(${2}) {
${0:${VISUAL}}
};
# Function assigned to variable
snippet vf
var ${1:function_name} = function $1(${2}) {
${0:${VISUAL}}
};
# Immediate function
snippet (f
(function(${1}) {
${0:${VISUAL}}
}(${2}));
# Minify safe iife
snippet ;fe
;(function(${1}) {
${0:${VISUAL}}
}(${2}))
# self-defining function
snippet sdf
var ${1:function_name} = function (${2:argument}) {
${3}
$1 = function ($2) {
${0:${VISUAL}}
};
};
# Flow control
# if
snippet if "if (condition) { ... }"
if (${1:true}) {
${0:${VISUAL}}
}
# if ... else
snippet ife "if (condition) { ... } else { ... }"
if (${1:true}) {
${0:${VISUAL}}
} else {
${2}
}
# tertiary conditional
snippet ter Ternary: `condition ? true : false`
$1 ? $2: $0
# switch
snippet switch
switch (${1:expression}) {
case '${3:case}':
${4}
break;
${0}
default:
${2}
}
snippet case "case 'xyz': ... break"
case '${1:case}':
${0:${VISUAL}}
break;
snippet try "try { ... } catch(e) { ... }"
try {
${0:${VISUAL}}
} catch (${1:e}) {
${2:/* handle error */}
}
snippet tryf "try { ... } catch(e) { ... } finally { ... }"
try {
${0:${VISUAL}}
} catch (${1:e}) {
${2:/* handle error */}
} finally {
${3:/* be executed regardless of the try / catch result*/}
}
# throw Error
snippet terr
throw new Error('${1:error message}')
# return
snippet ret
return ${0:result};
snippet for "for (...) {...}"
for (let ${1:i} = 0, ${2:len} = ${3:Things.length}; $1 < $2; $1++) {
${0:${VISUAL}}
}
snippet forr "reversed for (...) {...}"
for (let ${2:i} = ${1:Things.length} - 1; $2 >= 0; $2--) {
${0:${VISUAL}}
}
snippet wh "(condition) { ... }"
while (${1:true}) {
${0:${VISUAL}}
}
snippet wht "(true) { ... }"
while (true) {
${0:${VISUAL}}
}
snippet do "do { ... } while (condition)"
do {
${0:${VISUAL}}
} while ($1);
# For in loop
snippet fori
for (let ${1:prop} in ${2:object}) {
${0:$2[$1]}
}
# Objects
# Object Method
snippet :f
${1:method_name}: function (${2:attribute}) {
${0:${VISUAL}}
},
# hasOwnProperty
snippet has
hasOwnProperty(${0})
# singleton
snippet sing
function ${1:Singleton} (${2:argument}) {
// the cached instance
var instance;
// rewrite the constructor
$1 = function $1($2) {
return instance;
};
// carry over the prototype properties
$1.prototype = this;
// the instance
instance = new $1();
// reset the constructor pointer
instance.constructor = $1;
${0}
return instance;
}
# Crockford's object function
snippet obj
function object(o) {
function F() {}
F.prototype = o;
return new F();
}
# Define multiple properties
snippet props
var ${1:my_object} = Object.defineProperties(
${2:new Object()},
{
${3:property} : {
get : function $1_$3_getter() {
// getter code
},
set : function $1_$3_setter(value) {
// setter code
},
value : ${4:value},
writeable : ${5:boolean},
enumerable : ${6:boolean},
configurable : ${0:boolean}
}
}
);
# Define single property
snippet prop
Object.defineProperty(
${1:object},
'${2:property}',
{
get : function $1_$2_getter() {
// getter code
},
set : function $1_$2_setter(value) {
// setter code
},
value : ${3:value},
writeable : ${4:boolean},
enumerable : ${5:boolean},
configurable : ${0:boolean}
}
);
# Documentation
# docstring
snippet /**
/**
* ${0:description}
*
*/
snippet @par
@param {${1:type}} ${2:name} ${0:description}
snippet @ret
@return {${1:type}} ${0:description}
# JSON.parse
snippet jsonp
JSON.parse(${0:jstr});
# JSON.stringify
snippet jsons
JSON.stringify(${0:object});
# DOM selectors
# Get elements
snippet get
getElementsBy${1:TagName}('${0}')
# Get element
snippet gett
getElementBy${1:Id}('${0}')
# Elements by class
snippet by.
${1:document}.getElementsByClassName('${0:class}')
# Element by ID
snippet by#
${1:document}.getElementById('${0:element ID}')
# Query selector
snippet qs
${1:document}.querySelector('${0:CSS selector}')
# Query selector all
snippet qsa
${1:document}.querySelectorAll('${0:CSS selector}')
# Debugging
snippet de
debugger;
snippet cl "console.log"
console.log(${0});
snippet cd "console.debug"
console.debug(${0});
snippet ce "console.error"
console.error(${0});
snippet cw "console.warn"
console.warn(${0});
snippet ci "console.info"
console.info(${0});
snippet ct "console.trace"
console.trace(${0:label});
snippet ctime "console.time ... console.timeEnd"
console.time("${1:label}");
${0:${VISUAL}}
console.timeEnd("$1");
snippet ctimestamp "console.timeStamp"
console.timeStamp("${1:label}");
snippet ca "console.assert"
console.assert(${1:expression}, ${0:obj});
snippet cclear "console.clear"
console.clear();
snippet cdir "console.dir"
console.dir(${0:obj});
snippet cdirx "console.dirxml"
console.dirxml(${1:object});
snippet cgroup "console.group"
console.group("${1:label}");
${0:${VISUAL}}
console.groupEnd();
snippet cgroupc "console.groupCollapsed"
console.groupCollapsed("${1:label}");
${0:${VISUAL}}
console.groupEnd();
snippet cprof "console.profile"
console.profile("${1:label}");
${0:${VISUAL}}
console.profileEnd();
snippet ctable "console.table"
console.table(${1:"${2:value}"});
snippet clstr "console.log stringified"
console.log(JSON.stringify(${0}, null, 2));
# Misc
snippet us
'use strict';
# setTimeout function
snippet timeout
setTimeout(function () {${0}}${2}, ${1:10});
snippet const
const ${1} = ${0};
snippet constn
const ${1} = new ${0};
snippet let
let ${1} = ${0};
snippet im "import xyz from 'xyz'"
import ${1} from '${2:$1}';
snippet imas "import * as xyz from 'xyz'"
import * as ${1} from '${2:$1}';
snippet imm "import { member } from 'xyz'"
import { ${1} } from '${2}';
snippet cla
class ${1} {
${0:${VISUAL}}
}
snippet clax
class ${1} extends ${2} {
${0:${VISUAL}}
}
snippet clac
class ${1} {
constructor(${2}) {
${0:${VISUAL}}
}
}
snippet foro "for (const prop of object}) { ... }"
for (const ${1:prop} of ${2:object}) {
${0:$1}
}
snippet forl "for (let prop of object}) { ... }"
for (let ${1:prop} of ${2:object}) {
${0:$1}
}
snippet fun*
function* ${1:function_name}(${2}) {
${0:${VISUAL}}
}
snippet c=>
const ${1:function_name} = (${2}) => {
${0:${VISUAL}}
}
snippet ca=>
const ${1:function_name} = async (${2}) => {
${0:${VISUAL}}
}
snippet caf
const ${1:function_name} = (${2}) => {
${0:${VISUAL}}
}
snippet casf
const ${1:function_name} = async (${2}) => {
${0:${VISUAL}}
}
snippet =>
(${1}) => {
${0:${VISUAL}}
}
snippet af "() =>"
(${1}) => ${0:${VISUAL}}
snippet afb "() => {}"
(${1}) => {
${0:${VISUAL}}
}
snippet sym
const ${1} = Symbol('${0}');
snippet ed
export default ${0}
snippet ${
\${${1}}${0}
snippet as "async"
async ${0}
snippet aw "await"
await ${0:${VISUAL}}

View File

@ -0,0 +1,72 @@
snippet #!
#!/usr/bin/env lua
$1
snippet local
local ${1:x} = ${0:1}
snippet fun
function ${1:fname}(${2:...})
$0
end
snippet for
for ${1:i}=${2:1},${3:10} do
${0:print(i)}
end
snippet forp
for ${1:i},${2:v} in pairs(${3:table_name}) do
$0
end
snippet fori
for ${1:i},${2:v} in ipairs(${3:table_name}) do
$0
end
snippet if
if $1 then
$2
end
snippet ife
if $1 then
${2:-- if condition}
else
${0:-- else}
end
snippet elif
elseif $1 then
$0
snippet repeat
repeat
$1
until $0
snippet while
while $1 do
$0
end
snippet wh
while ${1:true} do
${0}
end
snippet wht
while true do
${0}
end
snippet print
print("${1:string}")
snippet pr
print($0)
snippet prs
print("$0")
snippet prf
print(string.format("${1:%s}"$0))
snippet wr
io.write($0)
snippet wrs
io.write("$0")
snippet wrf
io.write(string.format("${1:%s}"$0))
snippet fwr
io.${1:stderr}:write($0)
snippet fwrs
io.${1:stderr}:write("$0")
snippet fwrf
io.${1:stderr}:write(string.format("${2:%s}"$0))
snippet req
require('${1:mod}')

View File

@ -0,0 +1,50 @@
# base
snippet base
.PHONY: clean, mrproper
CC = gcc
CFLAGS = -g -Wall
all: $1
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
${1:out}: $1.o
$(CC) $(CFLAGS) -o $@ $+
clean:
rm -f *.o core.*
mrproper: clean
rm -f $1
# add
snippet add
${1:out}: $1.o
$(CC) $(CFLAGS) -o $@ $+
# print
snippet print
print-%: ; @echo $*=$($*)
# ifeq
snippet if
ifeq (${1:cond0}, ${2:cond1})
${0:${VISUAL}}
endif
# ifeq ... else ... endif
snippet ife
ifeq (${1:cond0}, ${2:cond1})
${3:${VISUAL}}
else
${0}
endif
# else ...
snippet el
else
${0:${VISUAL}}
# .DEFAULT_GOAL := target
snippet default
.DEFAULT_GOAL := ${1}
# help target for self-documented Makefile
snippet help
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $\$1, $\$2}'
${0}

View File

@ -0,0 +1,156 @@
# Markdown
# Includes octopress (http://octopress.org/) snippets
# The suffix `c` stands for "Clipboard".
snippet [
[${1:text}](https://${2:address})
snippet [*
[${1:link}](${2:`@*`})
snippet [c
[${1:link}](${2:`@+`})
snippet ["
[${1:text}](https://${2:address} "${3:title}")
snippet ["*
[${1:link}](${2:`@*`} "${3:title}")
snippet ["c
[${1:link}](${2:`@+`} "${3:title}")
snippet [:
[${1:id}]: https://${2:url}
snippet [:*
[${1:id}]: ${2:`@*`}
snippet [:c
[${1:id}]: ${2:`@+`}
snippet [:"
[${1:id}]: https://${2:url} "${3:title}"
snippet [:"*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet [:"c
[${1:id}]: ${2:`@+`} "${3:title}"
snippet ![
![${1:alttext}](${2:/images/image.jpg})
snippet ![*
![${1:alt}](${2:`@*`})
snippet ![c
![${1:alt}](${2:`@+`})
snippet !["
![${1:alttext}](${2:/images/image.jpg} "${3:title}")
snippet !["*
![${1:alt}](${2:`@*`} "${3:title}")
snippet !["c
![${1:alt}](${2:`@+`} "${3:title}")
snippet ![:
![${1:id}]: ${2:url}
snippet ![:*
![${1:id}]: ${2:`@*`}
snippet ![:"
![${1:id}]: ${2:url} "${3:title}"
snippet ![:"*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet ![:"c
![${1:id}]: ${2:`@+`} "${3:title}"
snippet <
<http://${1:url}>
snippet <*
<`@*`>
snippet <c
<`@+`>
snippet ** Bold
**$0**
snippet __ Bold
__$0__
snippet --- Front matter
---
$0
---
snippet ====
`repeat('=', strlen(getline(line('.') - 3)))`
${0}
snippet -
- ${0}
snippet ----
`repeat('-', strlen(getline(line('.') - 3)))`
${0}
snippet blockquote
{% blockquote %}
${0:quote}
{% endblockquote %}
snippet blockquote-author
{% blockquote ${1:author}, ${2:title} %}
${0:quote}
{% endblockquote %}
snippet blockquote-link
{% blockquote ${1:author} ${2:URL} ${3:link_text} %}
${0:quote}
{% endblockquote %}
snippet ```
\`\`\`${1}
${0:${VISUAL}}
\`\`\`
# Language.
snippet ```l
\`\`\`${1:language}
${2:code}
\`\`\`
snippet codeblock-short
{% codeblock %}
${0:code_snippet}
{% endcodeblock %}
snippet codeblock-full
{% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %}
${0:code_snippet}
{% endcodeblock %}
snippet gist-full
{% gist ${1:gist_id} ${0:filename} %}
snippet gist-short
{% gist ${0:gist_id} %}
snippet img
{% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${0:alt_text} %}
snippet youtube
{% youtube ${0:video_id} %}
snippet tb
| ${0:factors} | ${1:a} | ${2:b} |
| ------------- |------------- | ------- |
| ${3:f1} | Y | N |
| ${4:f2} | Y | N |
# The quote should appear only once in the text. It is inherently part of it.
# See http://octopress.org/docs/plugins/pullquote/ for more info.
snippet pullquote
{% pullquote %}
${1:text} {" ${2:quote} "} ${0:text}
{% endpullquote %}
# Definition lists
snippet : Definition list
$1
: $0
snippet :: Alternate definition list
$1
- $0

View File

@ -0,0 +1,64 @@
snippet if if
if ${1}
${0}
end
snippet ife if ... else
if ${1}
${2}
else
${0}
end
snippet el else
else
${0}
snippet eif elsif
elseif ${1}
${0}
snippet wh while
while ${1}
${0}
end
snippet for for
for ${1:i} = ${2:1:n}
${0}
end
snippet parfor parfor
parfor ${1:i} = ${2:1:n}
${0}
end
snippet fun function
function [${3:out}] = ${1:`vim_snippets#Filename("$1", "fun_name")`}(${2})
${0}
snippet try try ... catch
try
${1}
catch ${2:err}
${0}
end
snippet switch switch
switch ${1:n}
case ${2:0}
${0}
end
snippet @ anonymous function
@(${1:x}) ${0:x*x}
snippet cl class
classdef ${1:`vim_snippets#Filename("$1", "class_name")`}
properties
${2}
end
methods
${0}
end
end

View File

@ -0,0 +1,135 @@
# Org Mode Snippets Imported from (https://github.com/doomemacs/snippets/)
# Imported by ybenel (github.com/m1ndo)
# Begin
snippet begin
#+begin_${1:type} ${2:options}
$0
#+end_$1
# Begin Center
snippet <C
#+begin_center
$0
#+end_center
# Begin Comment
snippet <c
#+begin_comment
$0
#+end_comment
# Begin Example
snippet <e
#+begin_example
$0
#+end_example
# Begin Export Ascii
snippet <a
#+begin_export ascii
$0
#+end_export
# Begin export html
snippet <h
#+begin_export html
$0
#+end_export
# Begin export Latex
snippet <l
#+begin_export latex
$0
#+end_export
# Begin export python
snippet <p
#+begin_export python
$0
#+end_export
# Begin export shell
snippet <s
#+begin_export shell
$0
#+end_export
# dot
snippet dot
#+begin_src dot :file ${1:file}.${2:svg} :results file graphics
$0
#+end_src
# elisp
snippet elisp
#+begin_src emacs-lisp :tangle yes
$0
#+end_src
# Entry
snippet entry
#+begin_html
---
layout: ${1:default}
title: ${2:title}
---
#+end_html
$0
# Begin example
snippet ex
#+begin_example
$0
#+end_example
# Begin export
snippet export
#+begin_export ${1:type}
$0
#+end_export
# Figure
snippet fig
#+caption: ${1:caption}
#+attr_latex: ${2:scale=0.75}
#+name: fig-${3:label}
# Org Header
snippet head
#+title: ${1:untitled document}
#+author: ${2:user-full-name}
#+email: ${3:user-mail-address}
# Image
snippet img
#+attr_html: :alt $2 :align ${3:left} :class img
[[${1:src}]${4:[${5:title}]}]
$0
# Inline
snippet inl
src_${1:language}${2:[${3::exports code}]}{${4:code}}
# Inline source
snippet srci
src_${1:language}[${2:header}]{${0:body}}
# Jupyter
snippet jupyter
#+begin_src jupyter-${1:$$(yas-choose-value '("python" "julia" "R"))}${2: :session $3}${4: :async yes}
$0
#+end_src
# Matrix (latex)
snippet matrix
\left \(
\begin{array}{${1:ccc}}
${2:v1 & v2} \\
$0
\end{array}
\right \)
# Name
snippet name
#+name: $0
# Quote
snippet quote
#+begin_quote
$0
#+end_quote
# Source
snippet src
#+begin_src $1
$0
#+end_src
# Todo
snippet todo
TODO ${1:task description}
# Verse
snippet verse
#+begin_verse
$0
#+end_verse
# Atrribute Width
snippet #+attr_html:width
#+attr_html: :width ${1:500px}

View File

@ -0,0 +1,690 @@
snippet <?
<?php
${0:${VISUAL}}
snippet dst "declare(strict_types=1)"
declare(strict_types=${1:1});
snippet ec
echo ${0};
snippet <?e
<?php echo ${0} ?>
# this one is for php5.4
snippet <?=
<?=${0}?>
snippet ?=
<?= ${0} ?>
snippet ?
<?php ${0} ?>
snippet ?f
<?php foreach ($${1:vars} as $${2:$var}): ?>
${0:${VISUAL}}
<?php endforeach ?>
snippet ?i
<?php if ($${1:var}): ?>
${0:${VISUAL}}
<?php endif ?>
snippet ns
namespace ${1:Foo\Bar\Baz};
${0:${VISUAL}}
snippet c
class ${1:`vim_snippets#Filename()`}
{
${0:${VISUAL}}
}
snippet i
interface ${1:`vim_snippets#Filename()`}
{
${0:${VISUAL}}
}
snippet t.
\$this->
snippet f
function ${1}(${3})
{
${0:${VISUAL}}
}
# method
snippet m
${1:protected} function ${2:foo}()
{
${0:${VISUAL}}
}
snippet sm "PHP Class Setter"
/**
* Sets the value of ${1:foo}
*
* @param ${2:string} $$1 ${3:description}
*
* @return ${4:`vim_snippets#Filename()`}
*/
${5:public} function set${6:$1}(${7:$2 }$$1)
{
$this->${8:$1} = $$1;
return $this;
}
snippet gm "PHP Class Getter Setter"
/**
* Gets the value of ${1:foo}
*
* @return ${2:string}
*/
${3:public} function get${4:$1}()
{
return $this->${5:$1};
}
#setter
snippet $s
${1:$foo}->set${2:Bar}(${0});
#getter
snippet $g
${1:$foo}->get${0:Bar}();
# Tertiary conditional
snippet =?:
$${1:foo} = ${2:true} ? ${3:a} : ${0};
snippet ?:
${1:true} ? ${2:a} : ${0}
snippet t "$retVal = (condition) ? a : b"
$${1:retVal} = ($2) ? ${3:a} : ${4:b};
# Predefined variables
snippet C
$_COOKIE['${1:variable}']
snippet E
$_ENV['${1:variable}']
snippet F
$_FILES['${1:variable}']
snippet G "_GET array"
$_GET['${1:variable}']
snippet P "_POST array"
$_POST['${1:variable}']
snippet R
$_REQUEST['${1:variable}']
snippet S
$_SERVER['${1:variable}']
snippet SS
$_SESSION['${1:variable}']
snippet get "get"
$_GET['${1}']
snippet post "post"
$_POST['${1}']
snippet session "session"
$_SESSION['${1}']
# the following are old ones
snippet inc
include '${1:file}';
snippet inc1
include_once '${1:file}';
snippet req
require '${1:file}';
snippet req1
require_once '${1:file}';
# Start Docblock
snippet /*
/**
* ${0}
*/
# Class - post doc
snippet doc_cp
/**
* ${1:undocumented class}
*
* @package ${2:default}
* @subpackage ${3:default}
* @author ${4:`g:snips_author`}
*/
# Class Variable - post doc
snippet doc_vp
/**
* ${1:undocumented class variable}
*
* @var ${2:string}
*/
# Class Variable
snippet doc_v
/**
* ${3:undocumented class variable}
*
* @var ${4:string}
*/
${1:var} $${2};
# Class attribute with short comment
snippet att
/** @var ${3:string} */
${1:public} $${2};
# Class
snippet doc_c
/**
* ${3:undocumented class}
*
* @package ${4:default}
* @subpackage ${5:default}
* @author ${6:`g:snips_author`}
*/
${1:}class ${2:}
{
${0:${VISUAL}}
} // END $1class $2
# Constant Definition - post doc
snippet doc_dp
/**
* ${1:undocumented constant}
*/
# Constant Definition
snippet doc_d
/**
* ${3:undocumented constant}
*/
define(${1}, ${2});
# Function - post doc
snippet doc_fp
/**
* ${1:undocumented function}
*
* @return ${2:void}
* @author ${3:`g:snips_author`}
*/
# Function signature
snippet doc_s
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
*/
${1}function ${2}(${3});
# Function
snippet doc_f
/**
* ${4:undocumented function}
*
* @return ${5:void}
* @author ${6:`g:snips_author`}
*/
${1}function ${2}(${3})
{${0}
}
# Header
snippet doc_h
/**
* ${1}
*
* @author ${2:`g:snips_author`}
* @version ${3:$Id$}
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${0:default}
*/
snippet doc_i "interface someClass {}"
/**
* $1
* @package ${2:default}
* @author ${3:`!v g:snips_author`}
**/
interface ${1:someClass}
{${4}
}
snippet inheritdoc "@inheritdoc docblock"
/**
* {@inheritdoc}
*/
# Interface
snippet interface
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
*/
interface ${1:`vim_snippets#Filename()`}
{
${0:${VISUAL}}
}
# Trait
snippet trait
/**
* ${2:undocumented class}
*
* @package ${3:default}
* @author ${4:`g:snips_author`}
*/
trait ${1:`vim_snippets#Filename()`}
{
${0:${VISUAL}}
}
# class ...
snippet class
/**
* ${1}
*/
class ${2:`vim_snippets#Filename()`}
{
${3}
/**
* ${4}
*/
${5:public} function ${6:__construct}(${7:argument})
{
${0}
}
}
snippet nc
namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`};
${2:abstract }class ${3:`vim_snippets#Filename()`}
{
${0:${VISUAL}}
}
# define(...)
snippet def "define('VARIABLE_NAME', 'definition')"
define('${1:VARIABLE_NAME}', ${2:'definition'});
# defined(...)
snippet def?
${1}defined('${2}')
snippet wh "while (condition) { ... }"
while ($1) {
${0:${VISUAL}}
}
snippet do "do { ... } while (condition)"
do {
${0:${VISUAL}}
} while (${1});
snippet if "if (condition) { ... }"
if (${1}) {
${0:${VISUAL}}
}
snippet ifn "if (!condition) { ... }"
if (!${1}) {
${0:${VISUAL}}
}
snippet ifil "<?php if (condition): ?> ... <?php endif; ?>"
<?php if (${1}): ?>
${0:${VISUAL}}
<?php endif; ?>
snippet ife "if (cond) { ... } else { ... }"
if (${1}) {
${0:${VISUAL}}
} else {
${2}
}
snippet ifeil "<?php if (condition): ?> ... <?php else: ?> ... <?php endif; ?>"
<?php if (${1}): ?>
${0:${VISUAL}}
<?php else: ?>
${2}
<?php endif; ?>
snippet el "else { ... }"
else {
${0:${VISUAL}}
}
snippet eif "elseif(condition) { ... }"
elseif (${1}) {
${0:${VISUAL}}
}
snippet switch "switch($var) { case 'xyz': ... default: .... }"
switch ($${1:variable}) {
case '${2:value}':
${3}
break;
${0}
default:
${4}
break;
}
snippet case "case 'value': ... break"
case '${1:value}':
${0:${VISUAL}}
break;
snippet for "for ($i = 0; $i < $count; $i++) { ... }"
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
${0:${VISUAL}}
}
snippet foreach "foreach ($var as $value) { .. }"
foreach ($${1:variable} as $${2:value}) {
${0:${VISUAL}}
}
snippet foreachil "<?php foreach ($var as $value): ?> ... <?php endforeach; ?>"
<?php foreach ($${1:variable} as $${2:value}): ?>
${0:${VISUAL}}
<?php endforeach; ?>
snippet foreachk "foreach ($var as $key => $value) { .. }"
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${0:${VISUAL}}
}
snippet foreachkil "<?php foreach ($var as $key => $value): ?> ... <?php endforeach; ?>"
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
${0:<!-- html... -->}
<?php endforeach; ?>
snippet array "$... = ['' => ]"
$${1:arrayName} = ['${2}' => ${3}];
snippet try "try { ... } catch (Exception $e) { ... }"
try {
${0:${VISUAL}}
} catch (${1:Exception} $e) {
}
# lambda with closure
snippet lambda
${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {
${0}
};
# pre_dump();
snippet pd
echo '<pre>'; var_dump(${0}); echo '</pre>';
# pre_dump(); die();
snippet pdd
echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${0:});
snippet vd
var_dump(${0});
snippet vdd
var_dump(${1}); die(${0:});
snippet pr
print_r(${0});
snippet prs
print_r(${0}, 1);
snippet vdf
error_log(print_r($${1:foo}, true), 3, '${2:/tmp/debug.log}');
snippet http_redirect
header ("HTTP/1.1 301 Moved Permanently");
header ("Location: ".URL);
exit();
snippet log "error_log(var_export($var, true));"
error_log(var_export(${1}, true));
snippet var "var_export($var)"
var_export(${1});
snippet ve "Dumb debug helper in HTML"
echo '<pre>' . var_export(${1}, 1) . '</pre>';
snippet pc "Dumb debug helper in cli"
var_export($1);$0
# Getters & Setters
snippet gs "PHP Class Getter Setter"
/**
* Gets the value of ${1:foo}
*
* @return ${2:string}
*/
public function get${3:$1}()
{
return $this->${4:$1};
}
/**
* Sets the value of $1
*
* @param $2 $$1 ${5:description}
*
* @return ${6:`vim_snippets#Filename()`}
*/
public function set$3(${7:$2 }$$1)
{
$this->$4 = $$1;
return $this;
}
# anotation, get, and set, useful for doctrine
snippet ags
/**
* ${1:description}
*
* @${0}
*/
${2:protected} $${3:foo};
public function get${4:$3}()
{
return $this->$3;
}
public function set$4(${5:$4 }$${6:$3})
{
$this->$3 = $$6;
return $this;
}
snippet rett
return true;
snippet retf
return false;
snippet am
$${1:foo} = array_map(function($${2:v}) {
${0}
return $$2;
}, $$1);
snippet aw
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
$$2 = ${0};
});
# static var assign once
snippet static_var
static $${1} = null;
if (is_null($$1)){
$$1 = ${2};
}
snippet CSVWriter
<?php
class CSVWriter {
public function __construct($file_or_handle, $sep = "\t", $quot = '"'){
$args = func_get_args();
$mode = isset($opts['mode']) ? $opts['mode'] : 'w';
$this->f =
is_string($file_or_handle)
? fopen($file_or_handle, $mode)
: $file_or_handle;
$this->fputcsv_args = [$this->f, null, $sep, $quot];
if (!$this->f) throw new Exception('bad file descriptor');
}
public function write($row){
$this->fputcsv_args[1] =& $row;
call_user_func_array('fputcsv', $this->fputcsv_args);
}
public function close(){
if (!is_null($this->f))
fclose($this->f);
$this->f = null;
}
public function __destruct(){
$this->close();
}
}
snippet CSVIterator
// http://snipplr.com/view.php?codeview&id=1986 // modified
class CSVIterator implements Iterator
{
private $f;
private $curr;
private $rowCounter;
/* opts keys:
* row_size
* escape
* enclosure
* delimiter
*/
public function __construct( $file_or_handle, $opts = [4096, ','] )
{
$d = function($n) use(&$opts){ return isset($opts[$n]) ? $opts[$n] : false; };
$this->combine = $d('combine');
$this->headers = $d('headers');
$this->headerCheckFunction = $d('header_check_function');
$this->f =
is_string($file_or_handle)
? fopen( $file_or_handle, 'r' )
: $file_or_handle;
if (!$this->f) throw new Exception('bad file descriptor');
$this->fgetcsv_args = [
$this->f,
isset($opts['row_size']) ? $opts['row_size'] : 4096,
isset($opts['delimiter']) ? $opts['delimiter'] : ',',
isset($opts['enclosure']) ? $opts['enclosure'] : '"',
isset($opts['escape']) ? $opts['escape'] : '\\',
];
$this->start();
}
protected function readRow(){
$this->curr = call_user_func_array('fgetcsv', $this->fgetcsv_args );
$this->rowCounter++;
if ($this->rowCounter == 1){
$this->processHeader();
} elseif ($this->curr) {
$this->processRow();
}
}
public function processHeader(){
if ($this->headers || $this->combine){
$this->header = $this->curr;
if ($this->headerCheckFunction){
$f = $this->headerCheckFunction;
$f($this->header);
}
$this->readRow();
}
}
public function processRow(){
if ($this->combine)
$this->curr = array_combine($this->header, $this->curr);
}
public function start(){
$this->rowCounter = 0;
rewind( $this->f );
$this->readRow();
}
public function rewind()
{
$this->start();
}
public function current()
{
$curr = $this->curr;
$this->readRow();
return $curr;
}
public function key()
{
return $this->rowCounter;
}
public function next()
{
return $this->curr;
}
public function valid(){
if( !$this->next() )
{
fclose( $this->f );
return FALSE;
}
return TRUE;
}
} // end class
# phpunit
snippet ase "$this->assertEquals($a, $b)"
$this->assertEquals(${1:$expected}, ${2:$actual});
snippet asne "$this->assertNotEquals($a, $b)"
$this->assertNotEquals(${1:$expected}, ${2:$actual});
snippet asf "$this->assertFalse($a)"
$this->assertFalse(${1});
snippet ast "$this->assertTrue($a)"
$this->assertTrue(${1});
snippet asfex "$this->assertFileExists('path/to/file')"
$this->assertFileExists(${1:'path/to/file'});
snippet asfnex "$this->assertFileNotExists('path/to/file')"
$this->assertFileNotExists(${1:'path/to/file'});
snippet ascon "$this->assertContains($needle, $haystack)"
$this->assertContains(${1:$needle}, ${2:$haystack});
snippet asncon "$this->assertNotContains($needle, $haystack)"
$this->assertNotContains(${1:$needle}, ${2:$haystack});
snippet ascono "$this->assertContainsOnly($needle, $haystack)"
$this->assertContainsOnly(${1:$needle}, ${2:$haystack});
snippet asconoi "$this->assertContainsOnlyInstancesOf(Example::class, $haystack)"
$this->assertContainsOnlyInstancesOf(${1:Example}::class, ${2:$haystack});
snippet ashk "$this->assertArrayHasKey($key, $array)"
$this->assertArrayHasKey(${1:$key}, ${2:$array});
snippet asnhk "$this->assertArrayNotHasKey($key, $array)"
this->assertArrayNotHasKey(${1:$key}, ${2:$array});
snippet ascha "$this->assertClassHasAttribute($name, Example::class)"
$this->assertClassHasAttribute(${1:$attributeName}, ${2:Example}::class);
snippet asi "$this->assertInstanceOf(Example::class, $actual)"
$this->assertInstanceOf(${1:Example}::class, ${2:$actual});
snippet asit "$this->assertInternalType('string', $actual)"
$this->assertInternalType(${1:'string'}, ${2:actual});
snippet asco "$this->assertCount($count, $haystack)"
$this->assertCount(${1:$expectedCount}, ${2:$haystack});
snippet asnco "$this->assertNotCount($count, $haystack)"
$this->assertNotCount(${1:$count}, ${2:$haystack});
snippet assub "$this->assertArraySubset($subset, $array)"
$this->assertArraySubset(${1:$subset}, ${2:$array});
snippet asnu "$this->assertNull($a)"
$this->assertNull(${1});
snippet asnnu "$this->assertNotNull($a)"
$this->assertNotNull(${1});
snippet test "public function testXYZ() { ... }"
public function test${1}()
{
${0:${VISUAL}}
}
snippet setup "protected function setUp() { ... }"
protected function setUp()
{
${0:${VISUAL}}
}
snippet teardown "protected function tearDown() { ... }"
protected function tearDown()
{
${0:${VISUAL}}
}
snippet proph "$observer = $this->prophesize(SomeClass::class);"
$${1:observer} = $this->prophesize(${2:SomeClass}::class);
snippet mock "$mock = $this->createMock(SomeClass::class);"
$${1:mock} = $this->createMock(${2:SomeClass}::class);
snippet exp "phpunit expects"
expects($this->${1:once}())
->method('${2}')
->with(${3})
->willReturn(${4});
snippet testcmt "phpunit comment with group"
/**
* @group ${1}
*/
snippet fail "$this->fail()"
$this->fail(${1});
snippet marki "$this->markTestIncomplete()"
$this->markTestIncomplete(${1});
snippet marks "$this->markTestSkipped()"
$this->markTestSkipped(${1});
# end of phpunit snippets
snippet te "throw new Exception()"
throw new ${1:Exception}("${2:Error Processing Request}");
snippet fpc "file_put_contents" b
file_put_contents(${1:file}, ${2:content}${3:, FILE_APPEND});$0
snippet sr "str_replace"
str_replace(${1:search}, ${2:replace}, ${3:subject})$0
snippet ia "in_array"
in_array(${1:needle}, ${2:haystack})$0
snippet is "isset"
isset(${1:var})$0
snippet isa "isset array"
isset($${1:array}[${2:key}])$0
snippet in "is_null"
is_null($${1:var})$0
snippet fe "file_exists"
file_exists(${1:file})$0
snippet id "is_dir"
is_dir(${1:path})$0

View File

@ -0,0 +1,523 @@
snippet #!
#!/usr/bin/env python3
snippet #!2
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
snippet #!3
#!/usr/bin/env python3
snippet imp
import ${0:module}
snippet uni
def __unicode__(self):
${0:representation}
snippet from
from ${1:package} import ${0:module}
# Module Docstring
snippet docs
"""
File: ${1:`vim_snippets#Filename('$1.py', 'foo.py')`}
Author: `g:snips_author`
Email: `g:snips_email`
Github: `g:snips_github`
Description: ${0}
"""
# Unittest skip
snippet sk "skip unittests" b
@unittest.skip(${1:skip_reason})
snippet wh
while $1:
${0:${VISUAL}}
# dowh - does the same as do...while in other languages
snippet dowh
while True:
${1}
if $0:
break
snippet with
with ${1:expr} as ${2:var}:
${0:${VISUAL}}
snippet awith
async with ${1:expr} as ${2:var}:
${0:${VISUAL}}
# New Class
snippet cl
class ${1:ClassName}(${2:object}):
"""${3:docstring for $1}"""
def __init__(self, ${4:arg}):
${5:super($1, self).__init__()}
self.$4 = $4
${0}
snippet cla
class ${1:class_name}:
"""${0:description}"""
snippet clai
class ${1:class_name}:
"""${2:description}"""
def __init__(self, ${3:args}):
${0}
# Data class
snippet dcl dataclass
@dataclass
class ${1:ClassName}:
"""${2:description}"""
${3:var_1}: ${4:int}
${5:var_2}: ${6:float} = ${7:0}
def ${8:total}(self): -> $6:
return ${0:self.$3 * self.$5}
# New Function
snippet def
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${0}
snippet deff
def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${0}
snippet adef
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
"""${3:docstring for $1}"""
${0}
snippet adeff
async def ${1:fname}(${2:`indent('.') ? 'self' : ''`}):
${0}
# New Method
snippet defi
def __init__(self, ${1:args}):
${0}
snippet defm
def ${1:mname}(self, ${2:arg}):
${0}
snippet adefm
async def ${1:mname}(self, ${2:arg}):
${0}
# New Property
snippet property
@property
def ${1:foo}(self) -> ${2:type}:
"""${3:doc}"""
return self._$1
@$1.setter
def $1(self, value: $2):
self._$1 = value
# Ifs
snippet if
if $1:
${0:${VISUAL}}
snippet el
else:
${0:${VISUAL}}
snippet ei
elif $1:
${0:${VISUAL}}
# Match
snippet match Structural pattern matching
match ${1:expression}:
case ${2:pattern_1}:
${3:pass}
case ${4:pattern_2}:
${5:pass}
# Match with wildcard
snippet matchw Pattern matching with wildcard
match ${1:expression}:
case ${2:pattern_1}:
${3:pass}
case _:
${0:pass}
# For
snippet for
for ${1:item} in ${2:items}:
${0}
# Encodes
snippet cutf8
# -*- coding: utf-8 -*-
snippet clatin1
# -*- coding: latin-1 -*-
snippet cascii
# -*- coding: ascii -*-
# Lambda
snippet ld
${1:var} = lambda ${2:vars} : ${0:action}
snippet ret
return ${0}
snippet .
self.
snippet sa self.attribute = attribute
self.${1:attribute} = $1
snippet try Try/Except
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${0:raise $3}
snippet trye Try/Except/Else
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
else:
${0}
snippet tryf Try/Except/Finally
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
finally:
${0}
snippet tryef Try/Except/Else/Finally
try:
${1:${VISUAL}}
except ${2:Exception} as ${3:e}:
${4:raise $3}
else:
${5}
finally:
${0}
# if __name__ == '__main__':
snippet ifmain
if __name__ == '__main__':
${0:main()}
# __magic__
snippet _
__${1:init}__
# debugger breakpoint
snippet br
breakpoint()
# python debugger (pdb)
snippet pdb
__import__('pdb').set_trace()
# bpython debugger (bpdb)
snippet bpdb
__import__('bpdb').set_trace()
# ipython debugger (ipdb)
snippet ipdb
__import__('ipdb').set_trace()
# embed ipython itself
snippet iem
__import__('IPython').embed()
# remote python debugger (rpdb)
snippet rpdb
__import__('rpdb').set_trace()
# web python debugger (wdb)
snippet wdb
__import__('wdb').set_trace()
# ptpython
snippet ptpython
__import__('ptpython.repl', fromlist=('repl')).embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
# python console debugger (pudb)
snippet pudb
__import__('pudb').set_trace()
# python console debugger remote (pudb)
snippet pudbr
from pudb.remote import set_trace
set_trace()
# pdb in nosetests
snippet nosetrace
__import__('nose').tools.set_trace()
snippet pprint
__import__('pprint').pprint(${1})
snippet "
"""${0:doc}
"""
# assertions
snippet a=
self.assertEqual(${0}, ${1})
# test function/method
snippet test
def test_${1:description}(${2:`indent('.') ? 'self' : ''`}):
${0}
# test case
snippet testcase
class ${1:ExampleCase}(unittest.TestCase):
def test_${2:description}(self):
${0}
# test given when then
snippet tgwt
# given: ${1}
# when: ${2}
# then: ${3}
snippet fut
from __future__ import ${0}
#getopt
snippet getopt
try:
# Short option syntax: "hv:"
# Long option syntax: "help" or "verbose="
opts, args = getopt.getopt(sys.argv[1:], "${1:short_options}", [${2:long_options}])
except getopt.GetoptError, err:
# Print debug info
print str(err)
${3:error_action}
for option, argument in opts:
if option in ("-h", "--help"):
${0}
elif option in ("-v", "--verbose"):
verbose = argument
# argparse
snippet addp
parser = ${VISUAL:argparse.}ArgumentParser()
snippet addsp
${0:sub_parser} = parser.add_subparsers().add_parser("${1:name}")
snippet addarg
parser.add_argument("${0:short_arg}", "${1:long_arg}", default=${2:None}, help="${3:Help text}")
snippet addnarg
parser.add_argument("${0:arg}", nargs="${1:*}", default=${2:None}, help="${3:Help text}")
snippet addaarg
parser.add_argument("${0:arg}", "${1:long_arg}", action="${2:store_true}", default=${3:False}, help="${4:Help text}")
snippet pargs
"${VISUAL:return }"parser.parse_args()
# logging
# glog = get log
snippet glog
import logging
LOGGER = logging.getLogger(${0:__name__})
snippet le
LOGGER.error(${0:msg})
# conflict with lambda=ld, therefor we change into Logger.debuG
snippet lg
LOGGER.debug(${0:msg})
snippet lw
LOGGER.warning(${0:msg})
snippet lc
LOGGER.critical(${0:msg})
snippet li
LOGGER.info(${0:msg})
snippet epydoc
"""${1:Description}
@param ${2:param}: ${3: Description}
@type $2: ${4: Type}
@return: ${5: Description}
@rtype : ${6: Type}
@raise e: ${0: Description}
"""
snippet dol
def ${1:__init__}(self, *args, **kwargs):
super(${0:ClassName}, self).$1(*args, **kwargs)
snippet kwg
self.${1:var_name} = kwargs.get('$1', ${2:None})
snippet lkwg
${1:var_name} = kwargs.get('$1', ${2:None})
snippet args
*args${1:,}${0}
snippet kwargs
**kwargs${1:,}${0}
snippet akw
*args, **kwargs${1:,}${0}
# comprehensions
snippet lcp list comprehension
[${1} for ${2} in ${3:${VISUAL}}]${0}
snippet dcp dict comprehension
{${1}: ${2} for ${3} in ${4:${VISUAL}}}${0}
snippet scp set comprehension
{${1} for ${2} in ${3:${VISUAL}}}${0}
snippet contain "methods for emulating a container type" b
def __len__(self):
${1:pass}
def __getitem__(self, key):
${2:pass}
def __setitem__(self, key, value):
${3:pass}
def __delitem__(self, key):
${4:pass}
def __iter__(self):
${5:pass}
def __reversed__(self):
${6:pass}
def __contains__(self, item):
${7:pass}
snippet context "context manager methods" b
def __enter__(self):
${1:pass}
def __exit__(self, exc_type, exc_value, traceback):
${2:pass}
snippet attr "methods for customizing attribute access" b
def __getattr__(self, name):
${1:pass}
def __setattr__(self, name, value):
${2:pass}
def __delattr__(self, name):
${3:pass}
snippet desc "methods implementing descriptors" b
def __get__(self, instance, owner):
${1:pass}
def __set__(self, instance, value):
${2:pass}
def __delete__(self, instance):
${3:pass}
snippet cmp "methods implementing rich comparison"
def __eq__(self, other):
${1:pass}
def __ne__(self, other):
${2:pass}
def __lt__(self, other):
${3:pass}
def __le__(self, other):
${4:pass}
def __gt__(self, other):
${5:pass}
def __ge__(self, other):
${6:pass}
def __cmp__(self, other):
${7:pass}
snippet repr "methods implementing string representation"
def __repr__(self):
${1:pass}
def __str__(self):
${2:pass}
def __unicode__(self):
${3:pass}
# note: reflected operands and augmented arithmeitc assignements have been
# intentionally ommited to reduce verbosity.
snippet numeric "methods for emulating a numeric type" b
def __add__(self, other):
${1:pass}
def __sub__(self, other):
${2:pass}
def __mul__(self, other):
${3:pass}
def __div__(self, other):
${4:pass}
def __truediv__(self, other):
${5:pass}
def __floordiv__(self, other):
${6:pass}
def __mod__(self, other):
${7:pass}
def __divmod__(self, other):
${8:pass}
def __pow__(self, other):
${9:pass}
def __lshift__(self, other):
${10:pass}
def __rshift__(self, other):
${11:pass}
def __and__(self, other):
${12:pass}
def __xor__(self, other):
${13:pass}
def __or__(self, other):
${14:pass}
def __neg__(self):
${15:pass}
def __pos__(self):
${16:pass}
def __abs__(self):
${17:pass}
def __invert__(self):
${18:pass}
def __complex__(self):
${19:pass}
def __int__(self):
${20:pass}
def __long__(self):
${21:pass}
def __float__(self):
${22:pass}
def __oct__(self):
${22:pass}
def __hex__(self):
${23:pass}
def __index__(self):
${24:pass}
def __coerce__(self, other):
${25:pass}
# Printing
snippet pr
print($0)
snippet prs
print("$0")
snippet prf
print(f"$0")
snippet fpr
print($0, file=${1:sys.stderr})
snippet fprs
print("$0", file=${1:sys.stderr})
snippet fprf
print(f"$0", file=${1:sys.stderr})

View File

@ -0,0 +1,252 @@
#################
# Rust Snippets #
#################
# Functions
snippet fn "Function definition"
fn ${1:function_name}(${2})${3} {
${0}
}
snippet pfn "Function definition"
pub fn ${1:function_name}(${2})${3} {
${0}
}
snippet afn "Async function definition"
async fn ${1:function_name}(${2})${3} {
${0}
}
snippet pafn "Async function definition"
pub async fn ${1:function_name}(${2})${3} {
${0}
}
snippet bench "Bench function" b
#[bench]
fn ${1:bench_function_name}(b: &mut test::Bencher) {
b.iter(|| {
${0}
})
}
snippet new "Constructor function"
pub fn new(${2}) -> ${1:Self} {
$1 { ${3} }
}
snippet main "Main function"
pub fn main() {
${0}
}
snippet let "let variable declaration with type inference"
let ${1} = ${2};
snippet lett "let variable declaration with explicit type annotation"
let ${1}: ${2} = ${3};
snippet letm "let mut variable declaration with type inference"
let mut ${1} = ${2};
snippet lettm "let mut variable declaration with explicit type annotation"
let mut ${1}: ${2} = ${3};
snippet pri "print!"
print!("${1}");
snippet pri, "print! with format param"
print!("${1}{${2}}", ${3});
snippet pln "println!"
println!("${1}");
snippet pln, "println! with format param"
println!("${1}{${2}}", ${3});
snippet fmt "format!"
format!("${1}{${2}}", ${3});
snippet d "dbg! debugging macro"
dbg!(${0:${VISUAL}})
snippet d; "dbg! debugging macro statement"
dbg!(&${1});
${0}
# Modules
snippet ec "extern crate"
extern crate ${1:sync};
snippet ecl "extern crate log"
#[macro_use]
extern crate log;
snippet mod
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
} /* $1 */
# Testing
snippet as "assert!"
assert!(${1:predicate});
snippet ase "assert_eq!"
assert_eq!(${1:expected}, ${2:actual});
snippet test "Unit test function"
#[test]
fn ${1:function_name}_test() {
${0}
}
snippet testmod "Test module" b
#[cfg(test)]
mod tests {
use super::${1:*};
test${0}
}
snippet ig "#[ignore]"
#[ignore]
# Attributes
snippet allow "allow lint attribute" b
#[allow(${1:unused_variables})]
snippet cfg "cfg attribute" b
#[cfg(${1:target_os = "linux"})]
snippet feat "feature attribute" b
#![feature(${1:plugin})]
snippet der "#[derive(..)]" b
#[derive(${1:Debug})]
snippet attr "#[..]" b
#[${1:inline}]
snippet crate "Define create meta attributes"
// Crate name
#![crate_name = "${1:crate_name}"]
// Additional metadata attributes
#![desc = "${2:Description.}"]
#![license = "${3:BSD}"]
#![comment = "${4:Comment.}"]
// Specify the output type
#![crate_type = "${5:lib}"]
# Common types
snippet opt "Option<T>"
Option<${1:i32}>
snippet res "Result<T, E>"
Result<${1:&str}, ${2:()}>
# Control structures
snippet if
if ${1} {
${0:${VISUAL}}
}
snippet ife "if / else"
if ${1} {
${2:${VISUAL}}
} else {
${0}
}
snippet ifl "if let (...)"
if let ${1:Some($2)} = $3 {
${0:${VISUAL}}
}
snippet el "else"
else {
${0:${VISUAL}}
}
snippet eli "else if"
else if ${1} {
${0:${VISUAL}}
}
snippet mat "match pattern"
match ${1} {
${2} => ${3}
}
snippet case "Case clause of pattern match"
${1:_} => ${2:expression}
snippet = "=> "
=> $0
snippet loop "loop {}" b
loop {
${0:${VISUAL}}
}
snippet wh "while loop"
while $1 {
${0:${VISUAL}}
}
snippet whl "while let (...)"
while let ${1:Some($2)} = $3 {
${0:${VISUAL}}
}
snippet for "for ... in ... loop"
for ${1:i} in ${2} {
${0}
}
# TODO commenting
snippet todo "TODO comment"
// TODO: $0
snippet fixme "FIXME comment"
// FIXME: $0
# Struct
snippet st "Struct definition"
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
snippet impl "Struct/Trait implementation"
impl ${1:Type/Trait}${2: for $3} {
${0}
}
snippet stn "Struct with new constructor"
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
${0}
}
impl$2 $1$2 {
pub fn new(${4}) -> Self {
$1 { ${5} }
}
}
snippet ty "Type alias"
type ${1:NewName} = $2;
snippet enum "enum definition"
enum ${1:Name} {
${2},
}
snippet penum "pub enum definition"
pub enum ${1:Name} {
${2},
}
# Traits
snippet trait "Trait definition"
trait ${1:Name} {
${0}
}
snippet drop "Drop trait implementation (destructor)"
impl Drop for $1 {
fn drop(&mut self) {
${0}
}
}
# Statics
snippet ss "static string declaration"
static ${1}: &'static str = "${0}";
snippet stat "static item declaration"
static ${1}: ${2:usize} = ${0};
# Concurrency
snippet spawn "spawn a thread"
thread::spawn(${1:move }|| {
${0}
});
snippet chan "Declare (Sender, Receiver) pair of asynchronous channel()"
let (${1:tx}, ${2:rx}): (Sender<${3:i32}>, Receiver<${4:i32}>) = channel();
# Implementations
snippet asref "AsRef trait implementation"
impl AsRef<${1:Ref}> for ${2:Type} {
fn as_ref(&self) -> &${3:$1} {
&self.${0:field}
}
}
snippet asmut "AsMut trait implementation"
impl AsMut<${1:Ref}> for ${2:Type} {
fn as_mut(&mut self) -> &mut ${3:$1} {
&mut self.${0:field}
}
}
snippet fd "Struct field definition" w
${1:name}: ${2:Type},
snippet || "Closure, anonymous function (inline)" i
${1:move }|$2| { $3 }
snippet |} "Closure, anonymous function (block)" i
${1:move }|$2| {
$3
}
snippet macro "macro_rules!" b
macro_rules! ${1:name} {
(${2:matcher}) => (
$3
)
}
snippet boxp "Box::new()"
Box::new(${0:${VISUAL}})
snippet rc "Rc::new()"
Rc::new(${0:${VISUAL}})
snippet unim "unimplemented!()"
unimplemented!()
snippet use "use ...;" b
use ${1:std::$2};

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
snippet +
(+ ${1}
${0})
snippet -
(- ${1}
${0})
snippet /
(/ ${1}
${0})
snippet *
(* ${1}
${0})
# Definition
snippet def
(define (${1:name})
${0:definition})
# Definition with lambda
snippet defl
(define ${1:name}
(lambda (x)(${0:definition})))
# Condition
snippet cond
(cond ((${1:predicate}) (${2:action}))
((${3:predicate}) (${0:action})))
# If statement
snippet if
(if (${1:predicate})
(${2:true-action})
(${0:false-action}))

View File

@ -0,0 +1,44 @@
extends css
snippet $
$${1:variable}: ${0:value};
snippet imp
@import '${0}';
snippet mix
@mixin ${1:name}(${2}) {
${0}
}
snippet inc
@include ${1:mixin}(${2});
snippet ext
@extend ${0};
snippet fun
@function ${1:name}(${2:args}) {
${0}
}
snippet if
@if $1 {
${0}
}
snippet ife
@if $1 {
${2}
} @else {
${0}
}
snippet eif
@else if $1 {
${0}
}
snippet for
@for ${1:$i} from ${2:1} through ${3:3} {
${0}
}
snippet each
@each ${1:$item} in ${2:items} {
${0}
}
snippet while
@while ${1:$i} ${2:>} ${3:0} {
${0}
}

View File

@ -0,0 +1,110 @@
# Shebang
snippet #!
#!/bin/sh
snippet s#!
#!/bin/sh
set -eu
snippet safe
set -eu
snippet bash
#!/usr/bin/env bash
snippet sbash
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
snippet if
if [ $1 ]; then
${0:${VISUAL}}
fi
snippet elif
elif [ $1 ]; then
${0:${VISUAL}}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${0:${VISUAL}}
done
snippet fori
for ${1:needle} in ${2:haystack} ; do
${0:${VISUAL}}
done
snippet wh
while [ $1 ]; do
${0:${VISUAL}}
done
snippet wht
while true; do
${0:${VISUAL}}
done
snippet until
until [ $1 ]; do
${0:${VISUAL}}
done
snippet case
case ${1:word} in
${2:pattern})
${0};;
esac
snippet go
while getopts '${1:o}' ${2:opts}
do
case $$2 in
${3:o0})
${0:#staments};;
esac
done
# Set SCRIPT_DIR variable to directory script is located.
snippet sdir
SCRIPT_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
# getopt
snippet getopt
__ScriptVersion="${1:version}"
#=== FUNCTION ================================================================
# NAME: usage
# DESCRIPTION: Display usage information.
#===============================================================================
function usage ()
{
echo "Usage : \$${0:0} [options] [--]
Options:
-h|help Display this message
-v|version Display script version"
} # ---------- end of function usage ----------
#-----------------------------------------------------------------------
# Handle command line arguments
#-----------------------------------------------------------------------
while getopts ":hv" opt
do
case \$opt in
h|help ) usage; exit 0 ;;
v|version ) echo "\$${0:0} -- Version \$__ScriptVersion"; exit 0 ;;
* ) echo -e "\\n Option does not exist : \$OPTARG\\n"
usage; exit 1 ;;
esac # --- end of case ---
done
shift \$(($OPTIND-1))
snippet root
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi
snippet fun-sh
${1:function_name}() {
$0
}
snippet fun
function ${1:function_name}() {
$0
}

View File

@ -0,0 +1,8 @@
# snippets for making snippets :)
snippet snip
snippet ${1:trigger} "${2:description}"
${0:${VISUAL}}
snippet v
{VISUAL}
snippet $
${${1:1}:${0:text}}

View File

@ -0,0 +1,26 @@
snippet tbl
create table ${1:table} (
${0:columns}
);
snippet col
${1:name} ${2:type} ${3:default ''} ${0:not null}
snippet ccol
${1:name} varchar2(${2:size}) ${3:default ''} ${0:not null}
snippet ncol
${1:name} number ${3:default 0} ${0:not null}
snippet dcol
${1:name} date ${3:default sysdate} ${0:not null}
snippet ind
create index ${0:$1_$2} on ${1:table}(${2:column});
snippet uind
create unique index ${1:name} on ${2:table}(${0:column});
snippet tblcom
comment on table ${1:table} is '${0:comment}';
snippet colcom
comment on column ${1:table}.${2:column} is '${0:comment}';
snippet addcol
alter table ${1:table} add (${2:column} ${0:type});
snippet seq
create sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${0:1};
snippet s*
select * from ${0:table}

View File

@ -0,0 +1,437 @@
#version 1
#PREAMBLE
#documentclass without options
snippet dcl \documentclass{}
\\documentclass{${1:class}} ${0}
#documentclass with options
snippet dclo \documentclass[]{}
\\documentclass[${1:options}]{${2:class}} ${0}
snippet tmplt "Template"
\\documentclass{${1:article}}
\\usepackage{import}
\\usepackage{pdfpages}
\\usepackage{transparent}
\\usepackage{xcolor}
$2
\\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
$3
\\pdfsuppresswarningpagegroup=1
\\begin{document}
$0
\\end{document}
#newcommand
snippet nc \newcommand
\\newcommand{\\${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}
#usepackage
snippet up \usepackage
\\usepackage[${1:options}]{${2:package}} ${0}
#newunicodechar
snippet nuc \newunicodechar
\\newunicodechar{${1}}{${2:\\ensuremath}${3:tex-substitute}}} ${0}
#DeclareMathOperator
snippet dmo \DeclareMathOperator
\\DeclareMathOperator{${1}}{${2}} ${0}
#DOCUMENT
# \begin{}...\end{}
snippet begin \begin{} ... \end{} block
\\begin{${1:env}}
${0:${VISUAL}}
\\end{$1}
# Maketitle
snippet mkt maketitle
\\maketitle
# Tabular
snippet tab tabular (or arbitrary) environment
\\begin{${1:tabular}}{${2:c}}
${0:${VISUAL}}
\\end{$1}
snippet thm thm (or arbitrary) environment with optional argument
\\begin[${1:author}]{${2:thm}}
${0:${VISUAL}}
\\end{$2}
snippet center center environment
\\begin{center}
${0:${VISUAL}}
\\end{center}
# Align(ed)
snippet ali align(ed) environment
\\begin{align${1:ed}}
\\label{eq:${2}}
${0:${VISUAL}}
\\end{align$1}
# Gather(ed)
snippet gat gather(ed) environment
\\begin{gather${1:ed}}
${0:${VISUAL}}
\\end{gather$1}
# Equation
snippet eq equation environment
\\begin{equation}
${0:${VISUAL}}
\\end{equation}
# Equation
snippet eql Labeled equation environment
\\begin{equation}
\\label{eq:${2}}
${0:${VISUAL}}
\\end{equation}
# Equation
snippet eq* unnumbered equation environment
\\begin{equation*}
${0:${VISUAL}}
\\end{equation*}
# Unnumbered Equation
snippet \ unnumbered equation: \[ ... \]
\\[
${0:${VISUAL}}
\\]
# Equation array
snippet eqnarray eqnarray environment
\\begin{eqnarray}
${0:${VISUAL}}
\\end{eqnarray}
# Label
snippet lab \label
\\label{${1:eq:}${2:fig:}${3:tab:}${0}}
# Enumerate
snippet enum enumerate environment
\\begin{enumerate}
\\item ${0}
\\end{enumerate}
snippet enuma enumerate environment
\\begin{enumerate}[(a)]
\\item ${0}
\\end{enumerate}
snippet enumi enumerate environment
\\begin{enumerate}[(i)]
\\item ${0}
\\end{enumerate}
# Itemize
snippet item itemize environment
\\begin{itemize}
\\item ${0}
\\end{itemize}
snippet it \item
\\item ${1:${VISUAL}}
# Description
snippet desc description environment
\\begin{description}
\\item[${1}] ${0}
\\end{description}
# Endless new item
snippet ]i \item (recursive)
\\item ${1}
${0:]i}
# Matrix
snippet mat smart matrix environment
\\begin{${1:p/b/v/V/B/small}matrix}
${0:${VISUAL}}
\\end{$1matrix}
# Cases
snippet cas cases environment
\\begin{cases}
${1:equation}, &\\text{ if }${2:case}\\
${0:${VISUAL}}
\\end{cases}
# Split
snippet spl split environment
\\begin{split}
${0:${VISUAL}}
\\end{split}
# Part
snippet part document \part
\\part{${1:part name}} % (fold)%
\\label{prt:${2:$1}}
${0}
% part $2 (end)
# Chapter
snippet cha \chapter
\\chapter{${1:chapter name}}%
\\label{cha:${2:$1}}
${0}
# Section
snippet sec \section
\\section{${1:section name}}%
\\label{sec:${2:$1}}
${0}
# Section without number
snippet sec* \section*
\\section*{${1:section name}}%
\\label{sec:${2:$1}}
${0}
# Sub Section
snippet sub \subsection
\\subsection{${1:subsection name}}%
\\label{sub:${2:$1}}
${0}
# Sub Section without number
snippet sub* \subsection*
\\subsection*{${1:subsection name}}%
\\label{sub:${2:$1}}
${0}
# Sub Sub Section
snippet ssub \subsubsection
\\subsubsection{${1:subsubsection name}}%
\\label{ssub:${2:$1}}
${0}
# Sub Sub Section without number
snippet ssub* \subsubsection*
\\subsubsection*{${1:subsubsection name}}%
\\label{ssub:${2:$1}}
${0}
# Paragraph
snippet par \paragraph
\\paragraph{${1:paragraph name}}%
\\label{par:${2:$1}}
${0}
# Sub Paragraph
snippet subp \subparagraph
\\subparagraph{${1:subparagraph name}}%
\\label{subp:${2:$1}}
${0}
snippet ni \noindent
\\noindent
${0}
#References
snippet itd description \item
\\item[${1:description}] ${0:item}
snippet figure reference to a figure
${1:Figure}~\\ref{${2:fig:}}
snippet table reference to a table
${1:Table}~\\ref{${2:tab:}}
snippet listing reference to a listing
${1:Listing}~\\ref{${2:list}}
snippet section reference to a section
${1:Section}~\\ref{sec:${2}} ${0}
snippet page reference to a page
${1:page}~\\pageref{${2}} ${0}
snippet index \index
\\index{${1:index}} ${0}
#Citations
snippet citen \citen
\\citen{${1}} ${0}
# natbib citations
snippet citep \citep
\\citep{${1}} ${0}
snippet citet \citet
\\citet{${1}} ${0}
snippet cite \cite[]{}
\\cite[${1}]{${2}} ${0}
snippet citea \citeauthor
\\citeauthor{${1}} ${0}
snippet citey \citeyear
\\citeyear{${1}} ${0}
snippet fcite \footcite[]{}
\\footcite[${1}]{${2}}${0}
#Formating text: italic, bold, underline, small capital, emphase ..
snippet ita italic text
\\textit{${1:${VISUAL:text}}}${0}
snippet bf bold face text
\\textbf{${1:${VISUAL:text}}}${0}
snippet under underline text
\\underline{${1:${VISUAL:text}}}${0}
snippet over overline text
\\overline{${1:${VISUAL:text}}}${0}
snippet emp emphasize text
\\emph{${1:${VISUAL:text}}}${0}
snippet sc small caps text
\\textsc{${1:${VISUAL:text}}}${0}
#Choosing font
snippet sf sans serife text
\\textsf{${1:${VISUAL:text}}}${0}
snippet rm roman font text
\\textrm{${1:${VISUAL:text}}}${0}
snippet tt typewriter (monospace) text
\\texttt{${1:${VISUAL:text}}}${0}
snippet tsub subscripted text
\\textsubscript{${1:${VISUAL:text}}}${0}
snippet tsup superscripted text
\\textsuperscript{${1:${VISUAL:text}}}${0}
#Math font
snippet mf mathfrak
\\mathfrak{${1:${VISUAL:text}}}${0}
snippet mc mathcal
\\mathcal{${1:${VISUAL:text}}}${0}
snippet ms mathscr
\\mathscr{${1:${VISUAL:text}}}${0}
#misc
snippet ft \footnote
\\footnote{${1:${VISUAL:text}}}${0}
snippet fig figure environment (includegraphics)
\\begin{figure}
\\begin{center}
\\includegraphics[scale=${1}]{Figures/${2}}
\\end{center}
\\caption{${3}}
\\label{fig:${4}}
\\end{figure}
${0}
snippet tikz figure environment (tikzpicture)
\\begin{figure}[htpb]
\\begin{center}
\\begin{tikzpicture}[scale=${1:1}, transform shape]
${2}
\\end{tikzpicture}
\\end{center}
\\caption{${3}}%
\\label{fig:${4}}
\\end{figure}
${0}
snippet subfig subfigure environment
\\begin{subfigure}[${1}]{${2:\\textwidth}}
\\begin{center}
${3}
\\end{center}
\\caption{${4}}
\\label{fig:${5}}
\\end{subfigure}
${0}
snippet tikzcd tikzcd environment in equation
\\begin{equation}
\\begin{tikzcd}
${1}
\\end{tikzcd}
\\end{equation}
${0}
snippet tikzcd* tikzcd environment in equation*
\\begin{equation*}
\\begin{tikzcd}
${1}
\\end{tikzcd}
\\end{equation*}
${0}
#math
snippet stackrel \stackrel{}{}
\\stackrel{${1:above}}{${2:below}} ${0}
snippet frac \frac{}{}
\\frac{${1:num}}{${2:denom}} ${0}
snippet sum \sum^{}_{}
\\sum^{${1:n}}_{${2:i=1}} ${0}
snippet lim \lim_{}
\\lim_{${1:n \\to \\infty}} ${0}
snippet frame frame environment
\\begin{frame}[${1:t}]
\frametitle{${2:title}}
\framesubtitle{${3:subtitle}}
${0:${VISUAL}}
\\end{frame}
snippet block block environment
\\begin{block}{${1:title}}
${0:${VISUAL}}
\\end{block}
snippet alert alert text
\\alert{${1:${VISUAL:text}}} ${0}
snippet alertblock alertblock environment
\\begin{alertblock}{${1:title}}
${0:${VISUAL}}
\\end{alertblock}
snippet example exampleblock environment
\\begin{exampleblock}{${1:title}}
${0:${VISUAL}}
\\end{exampleblock}
snippet col2 two-column environment
\\begin{columns}
\\begin{column}{0.5\\textwidth}
${1}
\\end{column}
\\begin{column}{0.5\\textwidth}
${0}
\\end{column}
\\end{columns}
snippet multicol2 two-column environment with multicol
\\begin{multicols}{2}
${1}
\columnbreak
${0}
\\end{multicols}
snippet \{ \{ \}
\\{ ${0} \\}
#delimiter
snippet lr left right
\\left${1} ${0:${VISUAL}} \\right$1
snippet lr( left( right)
\\left( ${0:${VISUAL}} \\right)
snippet lr| left| right|
\\left| ${0:${VISUAL}} \\right|
snippet lr{ left\{ right\}
\\left\\{ ${0:${VISUAL}} \\right\\}
snippet lr[ left[ right]
\\left[ ${0:${VISUAL}} \\right]
snippet lra langle rangle
\\langle ${0:${VISUAL}} \\rangle
# Code listings
snippet lst
\\begin{listing}[language=${1:language}]
${0:${VISUAL}}
\\end{listing}
snippet lsi
\\lstinline|${1}| ${0}
# Hyperlinks
snippet url
\\url{${1}} ${0}
snippet href
\\href{${1}}{${2}} ${0}
# URL from Clipboard.
snippet urlc
\\url{`@+`} ${0}
snippet hrefc
\\href{`@+`}{${1}} ${0}
# enquote from package csquotes
snippet enq enquote
\\enquote{${1:${VISUAL:text}}} ${0}
# Time derivative
snippet ddt time derivative
\\frac{d}{dt} {$1} {$0}
# Limit
snippet lim limit
\\lim_{{$1}} {{$2}} {$0}
# Partial derivative
snippet pdv partial derivation
\\frac{\\partial {$1}}{\\partial {$2}} {$0}
# Second order partial derivative
snippet ppdv second partial derivation
\\frac{\\partial^2 {$1}}{\\partial {$2} \\partial {$3}} {$0}
# Ordinary derivative
snippet dv derivative
\\frac{d {$1}}{d {$2}} {$0}
# Summation
snippet summ summation
\\sum_{{$1}} {$0}
# Shorthand for time derivative
snippet dot dot
\\dot{{$1}} {$0}
# Shorthand for second order time derivative
snippet ddot ddot
\\ddot{{$1}} {$0}
# Vector
snippet vec vector
\\vec{{$1}} {$0}
# Bar
snippet bar bar
\\bar{{$1}} {$0}
# Cross product
snippet \x cross product
\\times {$0}
# Dot product
snippet . dot product
\\cdot {$0}
# Integral
snippet int integral
\\int_{{$1}}^{{$2}} {$3} \\: d{$4} {$0}
# Right arrow
snippet ra rightarrow
\\rightarrow {$0}
# Long right arrow
snippet lra longrightarrow
\\longrightarrow {$0}

View File

@ -0,0 +1,67 @@
extends javascript
snippet tconst "ts const"
const ${1}: ${2:any} = ${3};
${0}
snippet tlet "ts let"
let ${1}: ${2:any} = ${3};
${0}
snippet tvar "ts var"
var ${1}: ${2:any} = ${3};
${0}
snippet + "ts create field"
${1}: ${0:any}
snippet #+ "ts create private field using #"
#${1}: ${0:any}
snippet tpfi "ts create public field"
public ${1}: ${0:any}
snippet tprfi "ts create private field"
private ${1}: ${0:any}
snippet tprofi "ts create protected field"
protected ${1}: ${0:any}
snippet int "interface"
interface ${1} {
${2}: ${3:any};
${0}
}
snippet intx "interface extends"
interface ${1} extends ${2} {
${3}: ${4:any};
${0}
}
snippet tfun "ts function"
function ${1}(${2}): ${3:any} {
${0}
}
snippet tpmet "ts public method"
public ${1}(${2}): ${3:any} {
${0}
}
snippet tpsmet "ts public static method"
public static ${1}(${2}): ${3:any} {
${0}
}
snippet tprmet "ts private method"
private ${1}(${2}): ${3:any} {
${0}
}
snippet tpromet "ts protected method"
protected ${1}(${2}): ${3:any} {
${0}
}
snippet tcla "ts class"
class ${1} {
${2}
constructor(public ${3}: ${4: any}) {
${5}
}
${0}
}
snippet tclax "ts class extends"
class ${1} extends ${2} {
${3}
constructor(public ${4}: ${5: any}) {
${6}
}
${0}
}

View File

@ -0,0 +1 @@
extends typescript

View File

@ -0,0 +1,137 @@
#
## Libraries
snippet lib
library ${1}
use $1.${2}
# Standard Libraries
snippet libs
library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.ALL;
# Xilinx Library
snippet libx
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
## Entity Declaration
snippet ent
entity ${1:`vim_snippets#Filename()`} is
generic (
${2}
);
port (
${3}
);
end entity $1;
## Architecture
snippet arc
architecture ${1:behav} of ${2:`vim_snippets#Filename()`} is
${3}
begin
end $1;
## Declarations
# std_logic
snippet st
signal ${1} : std_logic;
# std_logic_vector
snippet sv
signal ${1} : std_logic_vector (${2} downto 0);
# std_logic in
snippet ist
${1} : in std_logic;
# std_logic_vector in
snippet isv
${1} : in std_logic_vector (${2} downto 0);
# std_logic out
snippet ost
${1} : out std_logic;
# std_logic_vector out
snippet osv
${1} : out std_logic_vector (${2} downto 0);
# unsigned
snippet un
signal ${1} : unsigned (${2} downto 0);
## Process Statements
# process
snippet pr
process (${1})
begin
${2}
end process;
# process with clock
snippet prc
process (${1:clk})
begin
if rising_edge ($1) then
${2}
end if;
end process;
# process with clock and reset
snippet prcr
process (${1:clk}, ${2:nrst})
begin
if ($2 = '${3:0}') then
${4}
elsif rising_edge($1) then
${5}
end if;
end process;
# process all
snippet pra
process (${1:all})
begin
${2}
end process;
## Control Statements
# if
snippet if
if ${1} then
${2}
end if;
# if
snippet ife
if ${1} then
${2}
else
${3}
end if;
# else
snippet el
else
${1}
# if
snippet eif
elsif ${1} then
${2}
# case
snippet ca
case ${1} is
${2}
end case;
# when
snippet wh
when ${1} =>
${2}
# for
snippet for
for ${1:i} in ${2} ${3:to} ${4} loop
${5}
end loop;
# while
snippet wh
while ${1} loop
${2}
end loop;
## Misc
# others
snippet oth
(others => '${1:0}');

View File

@ -0,0 +1,85 @@
snippet header standard Vim script file header
" File: ${1:`expand('%:t')`}
" Author: ${2:`g:snips_author`}
" Description: ${3}
${0:" Last Modified: `strftime("%B %d, %Y")`}
snippet guard script reload guard
if exists('${1:did_`vim_snippets#Filename()`}') || &cp${2: || version < 700}
finish
endif
let $1 = 1${0}
snippet f function
fun! ${1:`expand('%') =~ 'autoload' ? substitute(matchstr(expand('%:p'),'autoload/\zs.*\ze.vim'),'[/\\]','#','g').'#' : ''`}${2:function_name}(${3})
${0}
endf
snippet t try ... catch statement
try
${1:${VISUAL}}
catch ${2}
${0}
endtry
snippet for for ... in loop
for ${1} in ${2}
${0:${VISUAL}}
endfor
snippet forkv for [key, value] in loop
for [${1},${2}] in items(${3})
${0}
unlet $1 $2
endfor
snippet wh while loop
while ${1}
${0:${VISUAL}}
endw
snippet if if statement
if ${1}
${0:${VISUAL}}
endif
snippet ife if ... else statement
if ${1}
${2:${VISUAL}}
else
${0}
endif
snippet au augroup ... autocmd block
augroup ${1:AU_NAME}
autocmd!
autocmd ${2:BufRead,BufNewFile} ${3:*.ext,*.ext3|<buffer[=N]>} ${0}
augroup END
snippet auv augroupvisual ... autocmd block with visual placeholder
augroup ${1:AU_NAME}
autocmd!
${0:${VISUAL}}
augroup END
snippet bun Vundle.vim Plugin definition
Plugin '${0}'
snippet plug vim-plug Plugin definition
Plug '${0}'
snippet plugdo vim-plug Plugin definition with { 'do': '' }
Plug '${1}', { 'do': '${0}' }
snippet plugon vim-plug Plugin definition with { 'on': '' }
Plug '${1}', { 'on': '${0}' }
snippet plugfor vim-plug Plugin definition with { 'for': '' }
Plug '${1}', { 'for': '${0}' }
snippet plugbr vim-plug Plugin definition with { 'branch': '' }
Plug '${1}', { 'branch': '${0}' }
snippet plugtag vim-plug Plugin definition with { 'tag': '' }
Plug '${1}', { 'tag': '${0}' }
snippet let
let ${1:variable} = ${0: value}
snippet se
set ${1:setting};
snippet set
set ${1:setting} = ${0:value}
snippet nn
nnoremap ${1} ${2}<CR>
snippet no
noremap ${1} ${2}
snippet vm
vmap ${1} ${2}
snippet im
imap ${1} ${2}
snippet exe
execute ${1}
snippet filename
`Filename()`

View File

@ -0,0 +1,12 @@
# xml declaration
snippet xml
<?xml version="1.0" encoding="UTF-8"?>
# tag
snippet t
<${1:}>
${2}
</$1>
# inline tag
snippet ti
<${1:}>${2}</$1>

View File

@ -0,0 +1,68 @@
# #!/bin/zsh
extends bash
snippet #!
#!/usr/bin/env zsh
snippet if
if $1; then
${0:${VISUAL}}
fi
snippet ife
if $1; then
${2:${VISUAL}}
else
${0:# statements}
fi
snippet eif
elif $1; then
${0:${VISUAL}}
snippet for
for (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do
${0:${VISUAL}}
done
snippet fori
for ${1:needle} in ${2:haystack}; do
${0:${VISUAL}}
done
snippet fore
for ${1:item} in ${2:list}; do
${0:${VISUAL}}
done
snippet wh
while $1; do
${0:${VISUAL}}
done
snippet until
until $1; do
${0:${VISUAL}}
done
snippet repeat
repeat ${1:integer}; do
${0:${VISUAL}}
done
snippet case
case ${1:word} in
${2:pattern})
${0};;
esac
snippet select
select ${1:answer} in ${2:choices}; do
${0:${VISUAL}}
done
snippet (
( ${0:#statements} )
snippet {
{ ${0:#statements} }
snippet [
[[ ${0:test} ]]
snippet always
{ ${1:try} } always { ${0:always} }
snippet fun
${1:function_name}() {
${0:# function_body}
}
snippet ffun
function ${1:function_name}() {
${0:# function_body}
}

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule ".config/nvim/pack/github/start/copilot.vim"]
path = .config/nvim/pack/github/start/copilot.vim
url = https://github.com/github/copilot.vim.git
[submodule ".zsh/zsh-syntax-highlighting"]
path = .zsh/zsh-syntax-highlighting
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
[submodule ".zsh/zsh-autosuggestions"]
path = .zsh/zsh-autosuggestions
url = https://github.com/zsh-users/zsh-autosuggestions

1
.local/bin/Mars.jar Symbolic link
View File

@ -0,0 +1 @@
Mars.jar

18
.local/bin/dotnet-run Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
if [ -z "$1" ]
then
echo "No argument supplied"
exit 1
fi
dotnet build "$1"
clear
if [ $# -eq 1 ]; then
dotnet run --project "$1"
exit 0
else
dotnet run --project "$1" "$(for i in $(seq 2 $#) ; do
printf "%s" "${!i} "
done)"
fi

69
.local/bin/filelist Executable file
View File

@ -0,0 +1,69 @@
#!/bin/python3.11
import os
from sys import argv
def main():
path = argv[1] if len(argv) > 1 else os.getcwd()
print_files_size(path)
def print_files_size(path):
try:
directory = os.listdir(path)
except FileNotFoundError:
print(f"[Error] Unable to find that directory: '{os.path.abspath(path)}'")
exit(1)
except NotADirectoryError:
print(f"[Error] Path is not a directory: '{os.path.abspath(path)}'")
exit(1)
else:
print(f"|{'-'*237}|\n| ID | {'File':<200} {'Size':>24} | ID |\n|{'-'*237}|")
total_size = 0
for index, file in enumerate(directory, 1):
size = get_dir_size(f'{path}/{file}') if os.path.isdir(f'{path}/{file}') else os.stat(f'{path}/{file}').st_size
total_size += size
size = compact_size(size)
if os.path.isdir(f'{path}/{file}'):
size = f"{'<DIR>':<5} {size:>12}"
print(f"| {index:<2} | {file:<184} {size:>40} | {index:>2} |")
total_size = compact_size(total_size)
print(f"|{'-'*237}|\n| {f'{len(directory)} files/directories found in {os.path.abspath(path)}':<162} {f'Total size: {total_size}':>72} |\n|{'-'*237}|")
def get_dir_size(path):
total = 0
try:
for file in os.listdir(path):
if os.path.isfile(f'{path}/{file}'):
total += os.stat(f'{path}/{file}').st_size
else:
total += get_dir_size(f'{path}/{file}')
except PermissionError:
return 0
except FileNotFoundError:
return 0
except NotADirectoryError:
return 0
except OSError:
return 0
return total
def compact_size(size):
if size < 1024:
size = str(size) + ' B'
elif size < 1048576:
size = str(round(size / 1024, 2)) + ' KB'
elif size < 1073741824:
size = str(round(size / 1048576, 2)) + ' MB'
elif size < 1099511627776:
size = str(round(size / 1073741824, 2)) + ' GB'
elif size < 1125899906842624:
size = str(round(size / 1099511627776, 2)) + ' TB'
return size
if __name__ == "__main__":
main()

99
.local/bin/git-safe-push Executable file
View File

@ -0,0 +1,99 @@
#!/bin/bash
# Handles the arguments
remote="origin"
branch="temp"
newbranch="true"
while getopts ":r:b:n:h:" opt; do
case $opt in
r) remote="$OPTARG" ;;
b) branch="$OPTARG" ;;
n) newbranch="$OPTARG" ;;
h)
printf "Usage: git-safe-push\n Options:\n -r <remote (default=\"origin\")>\n -b <branch (default=\"temp\")>\n -n <newbranch <true/false> (default=true)>"
exit
;;
\?)
printf "Usage: git-safe-push\n Options:\n -r <remote (default=\"origin\")>\n -b <branch (default=\"temp\")>\n -n <newbranch <true/false> (default=true)>"
exit
;;
esac
done
if git rev-parse --is-inside-work-tree >/dev/null 2>/dev/null; then
printf "Trying to connect to remote %s...\n" "$remote"
if git ls-remote --exit-code "$remote" >/dev/null 2>/dev/null; then
remote_link=$(git remote get-url "$remote")
printf "Connected successfully to %s (%s)\n" "$remote" "$remote_link"
link=${remote_link%.git}
if [ "$newbranch" = "true" ]; then
# Checks if branch exists in the remote
printf "\nChecking for branch %s...\n\n" "$branch"
exists_in_remote=$(git ls-remote --heads "$remote" "$branch")
# If the branch does not exist
if [ -z "$exists_in_remote" ]; then
# Creates the branch, pushes it and deletes the branch locally
git branch "$branch"
git push "$remote" "$branch"
git branch -d "$branch" >/dev/null 2>/dev/null
# Prints output message
printf "\n----------------------------------------------------------------------------------------------\n\n Branch does not yet exist, pushed to %s/%s...\n\n You can now create a pull request at:\n > %s/pull/new/%s\n\n----------------------------------------------------------------------------------------------\n\n" "$remote" "$branch" "$link" "$branch"
else
# Makes sure to get a free indexed temporary branch
for i in $(seq 1 100) ; do
# Checks if branch exists in the remote
printf "Checking for branch %s...\n" "$branch$i"
exists_in_remote=$(git ls-remote --heads "$remote" "$branch$i")
# If the branch does not exist
if [ -z "$exists_in_remote" ]; then
# Creates the branch, pushes it and deletes the branch locally
git branch "$branch$i"
git push "$remote" "$branch$i"
git branch -d "$branch$i" >/dev/null 2>/dev/null
break
else
printf "Branch already exists, trying again...\n\n"
fi
done
# Prints output message
printf "\n----------------------------------------------------------------------------------------------\n\n Branch does not yet exist, pushed to %s/%s...\n\n You can now create a pull request at:\n > %s/pull/new/%s\n\n----------------------------------------------------------------------------------------------\n\n" "$remote" "$branch$i" "$link" "$branch$i"
fi
else
# Checks if branch exists in the remote
printf "\nChecking for branch %s...\n" "$branch"
exists_in_remote=$(git ls-remote --heads "$remote" "$branch")
# If the branch does not exist
if [ -z "$exists_in_remote" ]; then
printf "\n----------------------------------------------------------------------------------------------\n\n Branch does not exist, aborting...\n\n----------------------------------------------------------------------------------------------\n\n"
exit
fi
# Creates the branch, pushes it and deletes the branch locally
git branch "$branch"
result=$(git push "$remote" "$branch")
if ! echo "$result" | grep -q "rejected"; then
git branch -d "$branch" >/dev/null 2>/dev/null
printf "\n----------------------------------------------------------------------------------------------\n\n Failed to push to %s/%s, aborting...\n\n----------------------------------------------------------------------------------------------\n\n" "$remote" "$branch"
elif ! echo "$result" | grep -q "Everything up-to-date"; then
git branch -d "$branch" >/dev/null 2>/dev/null
printf "\n----------------------------------------------------------------------------------------------\n\n Branch is up-to-date, aborting...\n\n----------------------------------------------------------------------------------------------\n\n"
elif ! echo "$result" | grep -q "To $remote.git"; then
git branch -d "$branch" >/dev/null 2>/dev/null
printf "\n----------------------------------------------------------------------------------------------\n\n Pushed to %s/%s...\n\n You can now create a pull request at:\n > %s/pull/new/%s\n\n----------------------------------------------------------------------------------------------\n\n" "$remote" "$branch" "$link" "$branch"
else
git branch -d "$branch" >/dev/null 2>/dev/null
printf "\n----------------------------------------------------------------------------------------------\n\n Failed to push to %s/%s, aborting...\n\n----------------------------------------------------------------------------------------------\n\n" "$remote" "$branch"
fi
fi
else
printf "\nRemote %s is unreachable for this repository.\nIf you pretend to use a different remote name specify it using: git-safe-push <remote>\nIf this is the correct name, check if the current remote url is correct.\n" "$remote"
fi
else
printf "You are currently not in a git repository."
fi

26
.local/bin/run Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
script=""
args=""
run_as_sudo="false"
while getopts "s:r:a:l" opt; do
case $opt in
s) run_as_sudo="true" ;;
r) script="$OPTARG" ;;
a) args="$OPTARG" ;;
l)
printf "Available scripts:\n%s" "$(/bin/ls "$HOME/.dotfiles/scripts/")"
exit
;;
\?)
printf "Get good"
exit
;;
esac
done
if [ "$run_as_sudo" = "true" ]; then
sudo bash "$HOME/.dotfiles/scripts/$script" "$args"
else
bash "$HOME/.dotfiles/scripts/$script" "$args"
fi

69
.local/bin/totp Executable file
View File

@ -0,0 +1,69 @@
#!/bin/python
import sys
import pyotp
import time
def main():
if len(sys.argv) < 2:
print("Usage: totp.py <list|get|regist|calc>")
sys.exit(1)
if sys.argv[1] == "calc":
if len(sys.argv) != 3:
print("Usage: totp.py calc <secret>")
sys.exit(1)
print(get_totp_string(sys.argv[2]))
if sys.argv[1] == "regist":
if len(sys.argv) != 4:
print("Usage: totp.py regist <name> <secret>")
sys.exit(1)
try:
with open("/root/secrets.txt", "a") as secrets_file:
secrets_file.write(f"{sys.argv[2]},{sys.argv[3]}\n")
except PermissionError:
print("Permission denied")
sys.exit(1)
try:
with open("/root/secrets.txt", "r") as secrets_file:
secrets_file_lines = secrets_file.readlines()
secrets = [(str(i+1), secrets_file_lines[i].split(",")[0], secrets_file_lines[i].split(",")[1]) for i in range(len(secrets_file_lines))]
if sys.argv[1] == "list":
for secret in secrets:
print(f"ID: {secret[0]}\nName: {secret[1]}\n")
sys.exit(0)
if sys.argv[1] == "get":
if len(sys.argv) != 3:
print("Usage: totp.py get <secret ID>")
sys.exit(1)
for secret in secrets:
if secret[0] == sys.argv[2]:
print(f"Name: {secret[1]}\n{get_totp_string(secret[2].strip())}")
sys.exit(0)
found = False
for secret in secrets:
if sys.argv[2].lower() in secret[1].lower():
print(f"Name: {secret[1]}\n{get_totp_string(secret[2].strip())}\n")
found = True
if not found:
print("Secret not found")
sys.exit(1)
sys.exit(0)
except PermissionError:
print("Permission denied")
sys.exit(1)
def get_totp_string(secret):
totp = pyotp.TOTP(secret)
remaining = 30 - int(time.time()) % 30
return f"OTP: {totp.now()}\nValid for: {remaining} seconds"
if __name__ == '__main__':
main()

298
.zsh/.zshrc Normal file
View File

@ -0,0 +1,298 @@
# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples
setopt autocd # change directory just by typing its name
setopt correct # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of the form anything=expression
setopt nonomatch # hide error message if there is no match for the pattern
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
setopt promptsubst # enable command substitution in prompt
WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
# hide EOL sign ('%')
PROMPT_EOL_MARK=""
# configure key keybindings
bindkey -e # emacs key bindings
bindkey ' ' magic-space # do history expansion on space
bindkey '^U' backward-kill-line # ctrl + U
bindkey '^[[3;5~' kill-word # ctrl + Supr
bindkey '^[[3~' delete-char # delete
bindkey '^[[1;5C' forward-word # ctrl + ->
bindkey '^[[1;5D' backward-word # ctrl + <-
bindkey '^[[5~' beginning-of-buffer-or-history # page up
bindkey '^[[6~' end-of-buffer-or-history # page down
bindkey '^[[H' beginning-of-line # home
bindkey '^[[F' end-of-line # end
bindkey '^[[Z' undo # shift + tab undo last action
# suggestions
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"
ZSH_AUTOSUGGEST_STRATEGY=(history)
# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' rehash true
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
# History configurations
HISTFILE=/home/tiagorg/.dotfiles/zsh/.zsh_history
HISTSIZE=500000
SAVEHIST=500000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups # ignore duplicated commands history list
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show command with history expansion to user before running it
#setopt share_history # share command history data
# force zsh to show the complete history
alias history="history 0"
# configure `time` format
TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
configure_prompt() {
prompt_symbol=@
# Skull emoji for root terminal
[ "$EUID" -eq 0 ] && prompt_symbol=💀
case "$PROMPT_ALTERNATIVE" in
twoline)
PROMPT=$'%F{%(#.blue.green)}┌──${debian_chroot:+($debian_chroot)─}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))─}(%B%F{%(#.red.blue)}%n'$prompt_symbol$'%m%b%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
# Right-side prompt with exit codes and background processes
#RPROMPT=$'%(?.. %? %F{red}%B%b%F{reset})%(1j. %j %F{yellow}%B⚙%b%F{reset}.)'
;;
oneline)
PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{%(#.red.blue)}%n@%m%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
RPROMPT=
;;
backtrack)
PROMPT=$'${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%B%F{red}%n@%m%b%F{reset}:%B%F{blue}%~%b%F{reset}%(#.#.$) '
RPROMPT=
;;
esac
unset prompt_symbol
}
# The following block is surrounded by two delimiters.
# These delimiters must not be modified. Thanks.
# START KALI CONFIG VARIABLES
PROMPT_ALTERNATIVE=twoline
NEWLINE_BEFORE_PROMPT=yes
# STOP KALI CONFIG VARIABLES
if [ "$color_prompt" = yes ]; then
# override default virtualenv indicator in prompt
VIRTUAL_ENV_DISABLE_PROMPT=1
configure_prompt
# enable syntax-highlighting
if [ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]; then
. /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern)
ZSH_HIGHLIGHT_STYLES[default]=none
ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=white,underline
ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[global-alias]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[precommand]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[commandseparator]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=green,underline
ZSH_HIGHLIGHT_STYLES[path]=bold
ZSH_HIGHLIGHT_STYLES[path_pathseparator]=
ZSH_HIGHLIGHT_STYLES[path_prefix_pathseparator]=
ZSH_HIGHLIGHT_STYLES[globbing]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[history-expansion]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[command-substitution]=none
ZSH_HIGHLIGHT_STYLES[command-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[process-substitution]=none
ZSH_HIGHLIGHT_STYLES[process-substitution-delimiter]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=green
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]=none
ZSH_HIGHLIGHT_STYLES[back-quoted-argument-delimiter]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[single-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[double-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[dollar-quoted-argument]=fg=yellow
ZSH_HIGHLIGHT_STYLES[rc-quote]=fg=magenta
ZSH_HIGHLIGHT_STYLES[dollar-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-double-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[back-dollar-quoted-argument]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[assign]=none
ZSH_HIGHLIGHT_STYLES[redirection]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[comment]=fg=black,bold
ZSH_HIGHLIGHT_STYLES[named-fd]=none
ZSH_HIGHLIGHT_STYLES[numeric-fd]=none
ZSH_HIGHLIGHT_STYLES[arg0]=fg=cyan
ZSH_HIGHLIGHT_STYLES[bracket-error]=fg=red,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-1]=fg=blue,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-2]=fg=green,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-3]=fg=magenta,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-4]=fg=yellow,bold
ZSH_HIGHLIGHT_STYLES[bracket-level-5]=fg=cyan,bold
ZSH_HIGHLIGHT_STYLES[cursor-matchingbracket]=standout
fi
else
PROMPT='${debian_chroot:+($debian_chroot)}%n@%m:%~%(#.#.$) '
fi
unset color_prompt force_color_prompt
toggle_oneline_prompt(){
if [ "$PROMPT_ALTERNATIVE" = oneline ]; then
PROMPT_ALTERNATIVE=twoline
else
PROMPT_ALTERNATIVE=oneline
fi
configure_prompt
zle reset-prompt
}
zle -N toggle_oneline_prompt
bindkey ^P toggle_oneline_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|alacritty)
TERM_TITLE=$'\e]0;${debian_chroot:+($debian_chroot)}${VIRTUAL_ENV:+($(basename $VIRTUAL_ENV))}%n@%m: %~\a'
;;
*)
;;
esac
precmd() {
# Print the previously configured title
print -Pnr -- "$TERM_TITLE"
# Print a new line before the prompt, but only if it is not the first line
if [ "$NEWLINE_BEFORE_PROMPT" = yes ]; then
if [ -z "$_NEW_LINE_BEFORE_PROMPT" ]; then
_NEW_LINE_BEFORE_PROMPT=1
else
print ""
fi
fi
}
# enable color support of ls, less and man, and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
export LS_COLORS="$LS_COLORS:ow=30;44:" # fix ls color for folders with 777 permissions
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff='diff --color=auto'
alias ip='ip --color=auto'
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
# Take advantage of $LS_COLORS for completion as well
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
fi
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -aCF'
# enable auto-suggestions based on the history
if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
. /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# change suggestion color
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
fi
# enable command-not-found if installed
if [ -f /etc/zsh_command_not_found ]; then
. /etc/zsh_command_not_found
fi
# ALL EDITORS CRINGE!
# NEOVIM FOR THE WIN!
export EDITOR=nvim
#alias vim='gnome-terminal --maximize --title "Neovim" -- nvim'
alias vim='nvim'
# Custom made alias
alias zshrc='vim /home/tiagorg/.zsh/.zshrc'
# improved system commands
alias update='yay -Syu --noconfirm && flatpak update -y'
alias autoremove='sudo pacman -Qqd | sudo pacman -Rsu - && flatpak uninstall --unused -y'
alias c='clear'
alias r='cd && reset'
alias repos='cd /home/tiagorg/repos/'
# uaveiro-leci repository
alias ua='cd /home/tiagorg/repos/uaveiro-leci'
alias ua-gi='nvim /home/tiagorg/repos/uaveiro-leci/.git/info/exclude'
alias aed='$HOME/repos/uaveiro-leci/2ano/1semestre/aed/setup.sh'
# ua vpn/ssh server
alias vpn='snx -s go.ua.pt -u tiago.rgarcia@ua.pt'
alias vpnd='snx -d'
alias commit='commit -s'
source /home/tiagorg/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source /home/tiagorg/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999999'
# Set up path to check dotfiles bin directory
export PATH=$HOME/.local/bin:$PATH

@ -0,0 +1 @@
Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8

@ -0,0 +1 @@
Subproject commit 143b25eb98aa3227af63bd7f04413e1b3e7888ec

1
.zshenv Normal file
View File

@ -0,0 +1 @@
ZDOTDIR=/home/tiagorg/.zsh