snippets added
This commit is contained in:
1 parent
6c10ae3461
commit
2080230313
18 files changed
+1083
-16
No files matched your search
@@ -119,5 +119,3 @@ map('n', '<leader>e', function()
|
||||
require("oil").toggle_float()
|
||||
end, { desc = icons.documents.OpenFolder .. 'Oil File Explorer' })
|
||||
|
||||
|
||||
|
||||
@@ -238,6 +238,8 @@ cmp.setup({
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
local snippet_path = vim.fn.stdpath("config") .. "/snippets"
|
||||
require("luasnip.loaders.from_snipmate").load({ path = { snippet_path } })
|
||||
|
||||
|
||||
+13
-13
@@ -11,19 +11,19 @@
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"co-author.nvim": { "branch": "main", "commit": "3beddbbd5fdf3121921fc7b28fd731cffc70f952" },
|
||||
"code_runner.nvim": { "branch": "main", "commit": "d135c4178bf8980ca5fa4aa6e27ab9ee4373c875" },
|
||||
"codeium.vim": { "branch": "main", "commit": "cec58651f90abc84fbc333ed1067664026db666c" },
|
||||
"codeium.vim": { "branch": "main", "commit": "9406f13cf3eaa08318b76746bd105a04506cab27" },
|
||||
"compiler.nvim": { "branch": "main", "commit": "cb14acd32ba9ea09d01bbe3493aefdc59b68965c" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "1c8b82c5b02bb890862538be2061e37ef801a99b" },
|
||||
"dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "5162edb1442a729a885c45455a07e9a89058be2f" },
|
||||
"flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "d5f74ce4dfdd82848f3f4eac65fe6e29ac5df4c2" },
|
||||
"flash.nvim": { "branch": "main", "commit": "7bb4a9c75d1e20cd24185afedeaa11681829ba23" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "fa36367422da5a38560892e3db6d090a635d9d41" },
|
||||
"gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "9cafac31a091267838e1e90fd6e083d37611f516" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "bc933d24a669608968ff4791b14d2d9554813a65" },
|
||||
"hardtime.nvim": { "branch": "main", "commit": "eaf4bc31b86419c26ad7b3a142dd36ca545ca2e4" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "3f13f080434ac942b150679223d54f5ca91e0d52" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" },
|
||||
"live-server.nvim": { "branch": "main", "commit": "f6f00a3f541251f0320910bb0d03c4ae14ee6d10" },
|
||||
"lsp_lines.nvim": { "branch": "main", "commit": "dbfd8e96ec2696e1ceedcd23fd70e842256e3dea" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "052234296f13e2705d5d290c7bd5a36d3dd81fde" },
|
||||
@@ -40,33 +40,33 @@
|
||||
"neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" },
|
||||
"neotest-rspec": { "branch": "main", "commit": "201f4891b5a0edc2e5f12196f35726f4d4eca410" },
|
||||
"nerdy.nvim": { "branch": "main", "commit": "1ad36242f40a8fd95ae5711258540a07a5dabb51" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" },
|
||||
"noice.nvim": { "branch": "main", "commit": "f4decbc7a80229ccc9f86026b74bdcf0c39e38a7" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "f5632db2491fbe02b54f1a321a98548a8ba2bd15" },
|
||||
"nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
|
||||
"nui.nvim": { "branch": "main", "commit": "274fa89a9b4bed746647c2917091902f882509ec" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "14e97371b2aab6ee70054c1070a123dfaa3e217e" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" },
|
||||
"nvim-dap": { "branch": "master", "commit": "6ae8a14828b0f3bff1721a35a1dfd604b6a933bb" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "5934302d63d1ede12c0b22b6f23518bb183fc972" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "aa5f4f4ee10b2688fb37fa46215672441d5cd5d9" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ee450e6a9364fc740236166dd57aaca1ec7cdb48" },
|
||||
"nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" },
|
||||
"nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" },
|
||||
"nvim-spectre": { "branch": "master", "commit": "4651801ba37a9407b7257287aec45b6653ffc5e9" },
|
||||
"nvim-spider": { "branch": "main", "commit": "76819082ef964db1f67f92454e18ad28ae34b37b" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "347e1eb35264677f66a79466bb5e3d111968e12c" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "b1f3f02027f1fd21956c1e219878764014498a59" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "64f61e4c913047a045ff90bd188dd3b54ee443cf" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "73fdd31377d76aa1eea63e66581a8c6b7a71da94" },
|
||||
"nvim-treesitter-endwise": { "branch": "master", "commit": "8b34305ffc28bd75a22f5a0a9928ee726a85c9a6" },
|
||||
"nvim-treesitter-refactor": { "branch": "master", "commit": "65ad2eca822dfaec2a3603119ec3cc8826a7859e" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
|
||||
"nvim-treesitter-textsubjects": { "branch": "master", "commit": "9f9a6b307fb122f13708f78483222abd43b7bb3a" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "a6382f744f584bbf71d0a563af789af7190aabda" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "475fbcfcb6ee7c35aa33a6b6207ebd4032791d87" },
|
||||
"oil.nvim": { "branch": "master", "commit": "bcfc0a2e01def5019aa14fac2fc6de20dedb6d3d" },
|
||||
"overseer.nvim": { "branch": "master", "commit": "89942ad366c8a9bb93f82411de17dc7c644b4e3b" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "7ef0766b5cd2f5cdf4fcb08886f0a2ebf65981fa" },
|
||||
"refactoring.nvim": { "branch": "master", "commit": "d2786877c91aa409c824f27b4ce8a9f560dda60a" },
|
||||
"sniprun": { "branch": "master", "commit": "97daa506e2faa3939e0491642103635f9d22cd04" },
|
||||
"sniprun": { "branch": "master", "commit": "9006d4af4f7016523f8619ae1526ab4e7f0df785" },
|
||||
"tabout.nvim": { "branch": "master", "commit": "26cf934f872e2fbfab55d572c5eb7dad0e82238e" },
|
||||
"tdo.nvim": { "branch": "main", "commit": "678d6fdaf9df964cdc516c8a716d5c4c27d79cdc" },
|
||||
"telescope-file-browser.nvim": { "branch": "master", "commit": "4d5fd21bae12ee6e9a79232e1c377f43c419d0c5" },
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
snippet qq "qq"
|
||||
q.Q(${1:})
|
||||
${2}
|
||||
|
||||
snippet httphandler "http handler"
|
||||
func $1(${2:w} http.ResponseWriter, ${3:r} *http.Request){
|
||||
$0
|
||||
}
|
||||
|
||||
snippet httpredir "http redirect"
|
||||
http.Redirect(${1:w}, ${2:r}, \"${3:/}\", ${4:http.StatusFound})
|
||||
|
||||
snippet httperr "http error"
|
||||
http.Error(${1:w}, ${2:err}.Error(), ${3:http.StatusInternalServerError})
|
||||
|
||||
snippet httpboil "http boilerplate"
|
||||
package main
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
func greet(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintf(w, "Hello World! %s", time.Now())
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", greet)
|
||||
http.ListenAndServe(":8080", nil)
|
||||
}
|
||||
|
||||
snippet testfn "test function"
|
||||
func Test$1(t *testing.T) {
|
||||
$0
|
||||
}
|
||||
|
||||
snippet testfnt "test table"
|
||||
func Test$1(t *testing.T) {
|
||||
testCases := []struct {
|
||||
desc string
|
||||
$2
|
||||
}{
|
||||
{
|
||||
desc: \"$3\",
|
||||
$4
|
||||
},
|
||||
}
|
||||
for _, tC := range testCases {
|
||||
tt.Run(tC.desc, func(t *testing.T) {
|
||||
$0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
snippet benchfn "benchmark"
|
||||
func Benchmark$1(b *testing.B) {
|
||||
for ${2:i} := 0; ${2:i} < b.N; ${2:i}++ {
|
||||
$0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
snippet boil "boilerplate"
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>App</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<script defer type="module" src="app.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"></link>
|
||||
</head>
|
||||
<body>
|
||||
$0
|
||||
</body>
|
||||
</html>
|
||||
|
||||
snippet basic
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
## 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});
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
snippet bvstory "vue story"
|
||||
import $1 from './$1.vue';
|
||||
|
||||
export default {
|
||||
title: 'Components/$1',
|
||||
component: $1,
|
||||
};
|
||||
|
||||
const Template = (_, { argTypes }) => ({
|
||||
components: { $1 },
|
||||
props: Object.keys(argTypes),
|
||||
template: '<$1 v-bind="$$props" />',
|
||||
});
|
||||
|
||||
export const Default = Template.bind({});
|
||||
Default.args = {
|
||||
$0
|
||||
};
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
extends javascript
|
||||
|
||||
snippet component
|
||||
export default function $1(){
|
||||
return <>$0</>;
|
||||
}
|
||||
|
||||
snippet el
|
||||
<$1>
|
||||
$0
|
||||
</$1>
|
||||
|
||||
snippet us "useState()"
|
||||
const [$1, set${1/(.)/${1:/upcase}/}] = useState($0);
|
||||
|
||||
snippet ur "useRef()"
|
||||
const $0 = useRef(null);
|
||||
|
||||
snippet ue "useEffect()"
|
||||
useEffect(() => $0, []);
|
||||
|
||||
snippet um "useMemo()"
|
||||
const $1 = useMemo(() => $0, []);
|
||||
|
||||
snippet uc "useCallback()"
|
||||
const $1 = useCallback(() => $0, []);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env lua
|
||||
$1
|
||||
|
||||
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:-- body}
|
||||
end
|
||||
|
||||
snippet fori
|
||||
for ${1:i},${2:v} in ipairs(${3:table_name}) do
|
||||
${0:-- body}
|
||||
end
|
||||
|
||||
snippet fn "Create a local function"
|
||||
local $1 = function($2)
|
||||
$0
|
||||
end
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
snippet boil "boilerplate"
|
||||
SHELL := bash
|
||||
.SHELLFLAGS := -eu -o pipefail -c
|
||||
.ONESHELL:
|
||||
.DELETE_ON_ERROR:
|
||||
MAKEFLAGS += --warn-undefined-variables
|
||||
MAKEFLAGS += --no-builtin-rules
|
||||
.RECIPEPREFIX = >
|
||||
.DEFAULT_GOAL = help
|
||||
|
||||
HOME := \${HOME}
|
||||
UNAME = \$(shell uname -s | tr A-Z a-z)
|
||||
HOSTNAME = \$(shell hostname)
|
||||
SOURCE = \$(realpath \$(dir \$(realpath \$(lastword \$(MAKEFILE_LIST)))))
|
||||
|
||||
BLACK = \$(shell tput -Txterm setaf 0)
|
||||
RED = \$(shell tput -Txterm setaf 1)
|
||||
GREEN = \$(shell tput -Txterm setaf 2)
|
||||
YELLOW = \$(shell tput -Txterm setaf 3)
|
||||
BLUE = \$(shell tput -Txterm setaf 4)
|
||||
MAGENTA = \$(shell tput -Txterm setaf 5)
|
||||
CYAN = \$(shell tput -Txterm setaf 6)
|
||||
WHITE = \$(shell tput -Txterm setaf 7)
|
||||
RESET = \$(shell tput -Txterm sgr0)
|
||||
|
||||
define print_mod_start
|
||||
@echo "╭── \$(1)"
|
||||
endef
|
||||
define print_mod
|
||||
@echo "│ • \$(1)"
|
||||
endef
|
||||
define print_mod_end
|
||||
@echo "╰──────"
|
||||
endef
|
||||
|
||||
define link
|
||||
\$(eval REL_SRC=\$(strip \$(1)))
|
||||
\$(eval SRC=\$(SOURCE)/\$(strip \$(1)))
|
||||
\$(eval LOG="\${RED}link\${RESET} \${MAGENTA}\$(REL_SRC)\${RESET} -> \${YELLOW}\$(strip \$(2)\${RESET})")
|
||||
\$(call print_mod,"\$(LOG)")
|
||||
@ln -fns \$(SRC) \$(2)
|
||||
endef
|
||||
|
||||
help: ## help
|
||||
> @grep --no-filename -E '^[a-zA-Z_0-9%-]+:.*?## .*\$\$' \$(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\${BLUE}%-20s\${RESET} %s\n", \$\$1, \$\$2}'
|
||||
.PHONY: help
|
||||
|
||||
build: ## build
|
||||
> @echo " 🔥 Building on \${YELLOW}☯ \$(HOSTNAME)\${RESET} \${MAGENTA}(\$(UNAME))\${RESET}"
|
||||
> $(call print_mod_start,Link)
|
||||
> \$(call link,src_path,dest_path)
|
||||
> \$(call print_mod_end)
|
||||
.PHONY: build
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
extends tex
|
||||
|
||||
snippet boil
|
||||
---
|
||||
layout: "@layouts/ArticleLayout.astro"
|
||||
title: "$1"
|
||||
description: "$1"
|
||||
date: ${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}
|
||||
---
|
||||
|
||||
# $1
|
||||
|
||||
There I was, sitting in my chair, thinking about $1.
|
||||
|
||||
snippet te "Create an inline TeX block"
|
||||
$$1$$0
|
||||
|
||||
snippet tex "Create a TeX block"
|
||||
$$
|
||||
$0
|
||||
$$
|
||||
|
||||
snippet bo
|
||||
__$1__$0
|
||||
|
||||
snippet it
|
||||
_$1_$0
|
||||
|
||||
snippet link
|
||||
[$1]($0)
|
||||
|
||||
snippet img
|
||||

|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
extends tex
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
snippet derive
|
||||
#[derive(Debug$0)]
|
||||
|
||||
snippet les
|
||||
let $1 = $2 else {
|
||||
return $0;
|
||||
}
|
||||
|
||||
snippet uvec
|
||||
Vec::new()
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
snippet boil "boilerplace"
|
||||
#!/usr/bin/env bash
|
||||
set -uf -o pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
$0
|
||||
|
||||
snippet boil2 "Boilerplate" b
|
||||
#!/usr/bin/env bash
|
||||
set -euf -o pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
#/ Usage:
|
||||
#/ Description:
|
||||
#/ Examples:
|
||||
#/ Options:
|
||||
#/ --help: Display this help message
|
||||
usage() {
|
||||
grep '^#/' "\$0" | cut -c4-
|
||||
exit 0
|
||||
}
|
||||
expr "$*" : ".*--help" > /dev/null && usage
|
||||
|
||||
echoerr() { printf "%s\n" "$*" >&2; }
|
||||
info() { echoerr "[INFO] $*"; }
|
||||
warning() { echoerr "[WARNING] $*"; }
|
||||
error() { echoerr "[ERROR] $*"; }
|
||||
fatal() {
|
||||
echoerr "[FATAL] $*"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
info "... cleaned up"
|
||||
}
|
||||
|
||||
if [[ "\${BASH_SOURCE[0]}" = "\$0" ]]; then
|
||||
trap cleanup EXIT
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet scriptdir "get dir of current script"
|
||||
DIR="$( cd "$(dirname "\${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
snippet arg_default "argument with default value"
|
||||
ARG=\$\{1:-default\}
|
||||
|
||||
snippet arg_switch "getopts switch"
|
||||
while getopts "hv" arg; do
|
||||
case "\$arg" in
|
||||
h) # help
|
||||
show_help
|
||||
exit 0
|
||||
;;
|
||||
v) # version
|
||||
printf "%s\\n" "\$version"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
snippet if_empty "if empty"
|
||||
if [ -z "$VAR" ]; then
|
||||
true
|
||||
fi
|
||||
|
||||
snippet if_not_empty "if not empty"
|
||||
if [ -n "$VAR" ]; then
|
||||
true
|
||||
fi
|
||||
|
||||
snippet if_file "if file exists"
|
||||
if [[ -f "$PATH" ]]; then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet if_dir "if dir exists"
|
||||
if [[ -d "$PATH" ]]; then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet if_grep "if file contains"
|
||||
if grep -q "$1" "$2"; then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet if_argc "if argument count"
|
||||
if [ "$#" -eq $1 ]; then
|
||||
$0
|
||||
fi
|
||||
echo $#
|
||||
|
||||
snippet if_not_argc "if not argument count"
|
||||
if [ "$#" -ne $1 ]; then
|
||||
$0
|
||||
fi
|
||||
echo $#
|
||||
|
||||
snippet if_numeric "check if numeric"
|
||||
if printf "%s" "$1" | grep -Eq '^[+-]?[0-9]+$'; then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet if_tmux "if in tmux"
|
||||
if printf "%s" "$TERM" | grep -Fq screen && test "$TMUX" ; then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet if_root "if not running as root"
|
||||
if [[ $EUID -eq 0 ]]; then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet if_not_root "if not running as root"
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo "This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
snippet for_line_in_var "for line in variable"
|
||||
while read -r LINE; do
|
||||
printf 'line: %s\n' "$LINE"
|
||||
done <<< "$VAR"
|
||||
|
||||
snippet for_file_rg "for file in rg match"
|
||||
FILES=$(rg -e "^<<<<<<")
|
||||
while IFS=: read -r FILE _; do
|
||||
printf 'file: %s\n' "$FILE"
|
||||
done <<< "$FILES"
|
||||
|
||||
snippet confirm "prompt user to confirm action"
|
||||
read -p "$1" -n 1 -r
|
||||
echo
|
||||
if [[ \$REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
$0
|
||||
fi
|
||||
|
||||
snippet colors "use colors"
|
||||
BLACK = $(shell tput -Txterm setaf 0)
|
||||
RED = $(shell tput -Txterm setaf 1)
|
||||
GREEN = $(shell tput -Txterm setaf 2)
|
||||
YELLOW = $(shell tput -Txterm setaf 3)
|
||||
BLUE = $(shell tput -Txterm setaf 4)
|
||||
MAGENTA = $(shell tput -Txterm setaf 5)
|
||||
CYAN = $(shell tput -Txterm setaf 6)
|
||||
WHITE = $(shell tput -Txterm setaf 7)
|
||||
RESET = $(shell tput -Txterm sgr0)
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
# -- SNIPPETS --
|
||||
#
|
||||
# new glossary entry
|
||||
snippet gloss "Glossary Entry" b
|
||||
\newglossaryentry{${1:entry}}{
|
||||
name = {${2:name}},
|
||||
symbol = {\ensuremath{${3:symbol}}},
|
||||
description = {${4:description}}
|
||||
}
|
||||
#
|
||||
|
||||
# custom theorem enviornment
|
||||
snippet customthm "Custom Theorem" b
|
||||
\vspace{.1in}
|
||||
\begin{customthm}{(${1:label})}
|
||||
${2:claim}
|
||||
\end{customthm}
|
||||
|
||||
\begin{Answer}
|
||||
${0}
|
||||
\end{Answer}
|
||||
#
|
||||
|
||||
# framed text enviornment
|
||||
snippet textbox "Text Box" b
|
||||
\begin{tcolorbox}
|
||||
${0}
|
||||
\end{tcolorbox}
|
||||
#
|
||||
|
||||
# new command
|
||||
snippet nc "New Command" b
|
||||
\newcommand{${1:cmd}}[${2:opt}]{${3:realcmd}} ${0}
|
||||
#
|
||||
|
||||
#usepackage
|
||||
snippet up "Use Package" b
|
||||
\usepackage[${1:options}]{${2:package}} ${0}
|
||||
#
|
||||
|
||||
# \begin{}...\end{}
|
||||
snippet begin "Begin End"
|
||||
\begin{${1:env}}
|
||||
${2:${VISUAL}}
|
||||
\end{$1}${0}
|
||||
#
|
||||
|
||||
# Align(ed)
|
||||
snippet align "Align Env" b
|
||||
\begin{align${1:ed}}
|
||||
\label{${2:name}}
|
||||
${0}
|
||||
\end{align$1}
|
||||
#
|
||||
|
||||
# Quote
|
||||
snippet quote "Quotation" b
|
||||
\vspace{-.1in}
|
||||
\begin{quote}\singlespacing\small
|
||||
${0}
|
||||
\hfill(p.~${1})
|
||||
\end{quote}
|
||||
\vspace{.1in}
|
||||
#
|
||||
|
||||
# Labelalign
|
||||
snippet labelalign "Label Align" b
|
||||
\vspace{.05in}
|
||||
\begin{labelalign} %\small\onehalfspacing
|
||||
\item[${2:\it} ${3:Label:}] ${0}
|
||||
\end{labelalign}
|
||||
\vspace{.05in}
|
||||
#
|
||||
|
||||
# Enumerate
|
||||
snippet enum "Enumerate" b
|
||||
\begin{enumerate}
|
||||
\item[${1:\it }${2:Label:}] ${0}
|
||||
\end{enumerate}
|
||||
#
|
||||
|
||||
# Itemize
|
||||
snippet item "Itemize" b
|
||||
\begin{itemize}
|
||||
\item[${1:\it} ${2:Label:}] ${0}
|
||||
\end{itemize}
|
||||
#
|
||||
|
||||
#Item
|
||||
snippet i "Item"
|
||||
\item[${1:\it} ${2:Label:}] ${0}
|
||||
#
|
||||
|
||||
# Cases
|
||||
snippet case "Cases"
|
||||
${1:LHS}=
|
||||
\begin{cases}
|
||||
${2:Value}, &\text{ if } ${3:case}\\
|
||||
${4:Value}, &\text{ otherwise.} ${5:otherwise}.
|
||||
\end{cases}${0}
|
||||
#
|
||||
|
||||
# Section
|
||||
snippet sec "Section" b
|
||||
\section{${1:Name}}%
|
||||
\label{sec:${2:$1}}
|
||||
${0}
|
||||
#
|
||||
|
||||
# Sub Section
|
||||
snippet sub "Sub Section" b
|
||||
\subsection{${1:Name}}%
|
||||
\label{sub:${2:$1}}
|
||||
${0}
|
||||
#
|
||||
|
||||
# Sub Sub Section
|
||||
snippet ssub "Sub Sub Section" b
|
||||
\subsubsection{${1:Name}}%
|
||||
\label{sub:${2:$1}}
|
||||
${0}
|
||||
#
|
||||
|
||||
# Hyper Section
|
||||
snippet hsec "Hyper Section" b
|
||||
\hypsection{${1:Name}}%
|
||||
\label{sec:${2:$1}}
|
||||
${0}
|
||||
#
|
||||
|
||||
# Hyper Sub Section
|
||||
snippet hsub "Hyper Sub Section" b
|
||||
\hypsubsection{${1:Name}}%
|
||||
\label{sub:${2:$1}}
|
||||
${0}
|
||||
#
|
||||
|
||||
# Hyper Sub Sub Section
|
||||
snippet hssub "Hyper Sub Sub Section" b
|
||||
\hypsubsubsection{${1:Name}}%
|
||||
\label{sub:${2:$1}}
|
||||
${0}
|
||||
#
|
||||
|
||||
#Formating text: italic, bold, underline, small capital, emphase ..
|
||||
snippet it "Italics" wi
|
||||
\textit{${1}}${0}
|
||||
#
|
||||
|
||||
snippet tt "Teletype" wi
|
||||
\texttt{${1}}${0}
|
||||
#
|
||||
|
||||
snippet bf "Bold" wi
|
||||
\textbf{${1}}${0}
|
||||
#
|
||||
|
||||
snippet sc "Small Caps" wi
|
||||
\textsc{${1}}${0}
|
||||
#
|
||||
|
||||
snippet tsub "Subscripted" i
|
||||
\textsubscript{${1}}${0}
|
||||
#
|
||||
|
||||
snippet tsup "Superscripted" i
|
||||
\textsuperscript{${1}}${0}
|
||||
#
|
||||
|
||||
#Math font
|
||||
snippet mf "Mathfrak" w
|
||||
\mathfrak{${1}}${0}
|
||||
#
|
||||
|
||||
snippet mc "Mathcal" w
|
||||
\mathcal{${1}}${0}
|
||||
#
|
||||
|
||||
snippet ms "Mathscr" w
|
||||
\mathscr{${1}}${0}
|
||||
#
|
||||
|
||||
#misc
|
||||
snippet fproof "Footnote Proof" bi
|
||||
\footnote{\textit{Proof:} ${1:Begin} \qed}${0}
|
||||
#
|
||||
|
||||
snippet lab "Label" wi
|
||||
\label{${1:LABEL}}${0}
|
||||
#
|
||||
|
||||
snippet fn "Footnote" wi
|
||||
\footnote{${1:FOOTNOTE}}${0}
|
||||
#
|
||||
|
||||
snippet fig "Figure environment" b
|
||||
\begin{figure}
|
||||
\begin{center}
|
||||
\includegraphics[scale=${1}]{Figures/${2}}
|
||||
\end{center}
|
||||
\caption{${3}}
|
||||
\label{fig:${4}}
|
||||
\end{figure}
|
||||
${0}
|
||||
#
|
||||
|
||||
snippet tikz "Tikz environment" b
|
||||
\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 lemma "Lemma" bi
|
||||
\begin{lemma}
|
||||
${0:${VISUAL}}
|
||||
\end{lemma}
|
||||
|
||||
snippet prop "Proposition" bi
|
||||
\begin{prop}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{prop}
|
||||
|
||||
snippet thrm "Theorem" bi
|
||||
\begin{theorem}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{theorem}
|
||||
|
||||
snippet prf "Proof" bi
|
||||
\begin{myproof}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{myproof}
|
||||
|
||||
snippet def "Definition" bi
|
||||
\begin{definition}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{definition}
|
||||
|
||||
snippet prob "Problem" bi
|
||||
\begin{problem}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{problem}
|
||||
|
||||
snippet corl "Corollary" bi
|
||||
\begin{corollary}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{corollary}
|
||||
|
||||
snippet example "Example" bi
|
||||
\begin{example}[$1]
|
||||
${0:${VISUAL}}
|
||||
\end{example}
|
||||
|
||||
snippet matrix
|
||||
\begin{bmatrix}$0\end{bmatrix}
|
||||
|
||||
snippet vec
|
||||
\vec{$0}
|
||||
|
||||
snippet frac
|
||||
\frac{$1}{$0}
|
||||
|
||||
snippet ra "→"
|
||||
\rightarrow
|
||||
|
||||
snippet la "←"
|
||||
\leftarrow
|
||||
|
||||
snippet det "det(A)"
|
||||
\text{det}($1)$0
|
||||
|
||||
snippet hat
|
||||
\hat{$1}$0
|
||||
|
||||
snippet it
|
||||
\textit{$1}$0
|
||||
|
||||
snippet bo
|
||||
\textbf{$1}$0
|
||||
|
||||
snippet bq
|
||||
\begin{quote}
|
||||
$0
|
||||
\end{quote}
|
||||
|
||||
snippet ci
|
||||
\cite{$1}$0
|
||||
|
||||
snippet pc
|
||||
\parencite{$1}$0
|
||||
|
||||
snippet cy
|
||||
\cite*{$1}$0
|
||||
|
||||
snippet pcy
|
||||
\parencite*{$1}$0
|
||||
|
||||
snippet se
|
||||
\section{$1}$0
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
extends javascript
|
||||
@@ -0,0 +1,40 @@
|
||||
snippet boil "react component"
|
||||
import React from "react";
|
||||
|
||||
interface $1Props {
|
||||
}
|
||||
|
||||
const $1 = ({$2}: $1Props) => {
|
||||
return $0;
|
||||
};
|
||||
|
||||
export { $1 };
|
||||
export default $1;
|
||||
|
||||
snippet bstory "react fixture"
|
||||
import React from "react";
|
||||
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
||||
|
||||
import $1 from "./$1";
|
||||
|
||||
export default {
|
||||
title: '$1',
|
||||
component: $1,
|
||||
argTypes: {
|
||||
// https://storybook.js.org/docs/react/api/argtypes
|
||||
backgroundColor: { control: 'color' },
|
||||
onClick: { action: "clicked" },
|
||||
},
|
||||
} as ComponentMeta<typeof $1>;
|
||||
|
||||
// https://storybook.js.org/docs/react/writing-stories/introduction#using-args
|
||||
const Template: ComponentStory<typeof $1> = (args) => <$1 {...args} />;
|
||||
|
||||
export const Default = Template.bind({});
|
||||
// https://storybook.js.org/docs/react/writing-stories/args
|
||||
Default.args = {
|
||||
primary: true,
|
||||
label: '$1',
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
snippet boil "boilerplate"
|
||||
<template>
|
||||
<div>$0</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "$1"
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
||||
Reference in new issue
Block a user