mirror of
https://github.com/amix/vimrc
synced 2025-07-03 14:14:59 +08:00
Update vim-snippets.
This commit is contained in:
195
sources_non_forked/vim-snippets/snippets/asm.snippets
Normal file
195
sources_non_forked/vim-snippets/snippets/asm.snippets
Normal file
@ -0,0 +1,195 @@
|
||||
snippet scode Start basic code for assembly
|
||||
.data
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
.global main
|
||||
|
||||
|
||||
main:
|
||||
|
||||
|
||||
snippet scodes Start basic code for assembly with _start label
|
||||
.data
|
||||
|
||||
|
||||
.text
|
||||
|
||||
|
||||
.globl _start
|
||||
|
||||
|
||||
_start:
|
||||
|
||||
|
||||
snippet lo Long
|
||||
$1: .long $2
|
||||
snippet wo Word
|
||||
$1: .word $2
|
||||
snippet by Byte
|
||||
$1: .byte $2
|
||||
snippet sp Space
|
||||
$1: .space $2
|
||||
snippet ai Ascii
|
||||
$1: .ascii "$2"
|
||||
snippet az Asciz
|
||||
$1: .asciz "$2"
|
||||
snippet ze Zero
|
||||
$1: .zero "$2"
|
||||
snippet qu Quad
|
||||
$1: .quad "$2"
|
||||
snippet si Single
|
||||
$1: .single "$2"
|
||||
snippet do Double
|
||||
$1: .single "$2"
|
||||
snippet fl Float
|
||||
$1: .single "$2"
|
||||
snippet oc Octa
|
||||
$1: .single "$2"
|
||||
snippet sh Short
|
||||
$1: .single "$2"
|
||||
snippet exit0 Exit without error
|
||||
movl \$1, %eax
|
||||
xorl %ebx, %ebx
|
||||
int \$0x80
|
||||
|
||||
snippet exit Exit with error
|
||||
mov \$1, %eax
|
||||
mov $1, %ebx
|
||||
int \$0x80
|
||||
|
||||
snippet readfstdin Read fixed length text from stdin
|
||||
mov \$3, %eax
|
||||
mov \$2, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet writestdout Write text to stdout
|
||||
mov \$4, %eax
|
||||
mov \$1, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet writestderr Write text to stderr
|
||||
mov \$4, %eax
|
||||
mov \$2, %ebx
|
||||
mov $1, %ecx
|
||||
mov $2, %edx
|
||||
int \$0x80
|
||||
|
||||
snippet * Multiplication
|
||||
mov $1, %eax
|
||||
mul $2
|
||||
|
||||
snippet / Division
|
||||
mov $1, %eax
|
||||
div $2
|
||||
|
||||
snippet jmpl Conditional lower jump
|
||||
cmp $1, $2
|
||||
jl $3
|
||||
|
||||
snippet jmple Conditional lower or equal jump
|
||||
cmp $1, $2
|
||||
jle $3
|
||||
|
||||
snippet jmpe Conditional equal jump
|
||||
cmp $1, $2
|
||||
je $3
|
||||
|
||||
snippet jmpn Conditional not equal jump
|
||||
cmp $1, $2
|
||||
jn $3
|
||||
|
||||
snippet jmpg Conditional greater jump
|
||||
cmp $1, $2
|
||||
jg $3
|
||||
|
||||
snippet jmpge Conditional greater or equal jump
|
||||
cmp $1, $2
|
||||
je $3
|
||||
|
||||
snippet loopn Loop n times
|
||||
mov $1, %ecx
|
||||
|
||||
et_for:
|
||||
$2
|
||||
|
||||
loop et_for
|
||||
|
||||
snippet loopnn Loop n-1 times
|
||||
mov $1, %ecx
|
||||
dec %ecx
|
||||
|
||||
et_for:
|
||||
$2
|
||||
|
||||
loop et_for
|
||||
|
||||
snippet loopv Loop through a vector
|
||||
lea $1, %edi
|
||||
xor %ecx, %ecx
|
||||
|
||||
et_for:
|
||||
cmp %ecx, $2
|
||||
je $3
|
||||
|
||||
$4
|
||||
|
||||
inc %ecx
|
||||
jmp et_for
|
||||
|
||||
snippet mul Multiply
|
||||
xor %edx, %edx
|
||||
mov $1, %eax
|
||||
mul $2
|
||||
snippet mul64 Multiply numbers greater than 2^32
|
||||
mov $1, %edx
|
||||
mov $2, %eax
|
||||
mul $3
|
||||
snippet div Divide
|
||||
xor %edx, %edx
|
||||
mov $1, %eax
|
||||
div $2
|
||||
snippet div64 Divide numbers greater than 2^32
|
||||
mov $1, %edx
|
||||
mov $2, %eax
|
||||
div $3
|
||||
snippet pr Call printf
|
||||
pushl $1
|
||||
call printf
|
||||
popl $2
|
||||
snippet sc Call scanf
|
||||
pushl $1
|
||||
call scanf
|
||||
popl $2
|
||||
snippet mindex Current index from a matrix
|
||||
xor %edx, %edx
|
||||
movl $1, %eax
|
||||
mull $2
|
||||
addl $3, %eax
|
||||
snippet ffl Call fflush
|
||||
pushl \$0
|
||||
call fflush
|
||||
popl $1
|
||||
snippet at Call atoi
|
||||
pushl $1
|
||||
call atoi
|
||||
popl $2
|
||||
snippet len Call strlen
|
||||
pushl $1
|
||||
call strlen
|
||||
popl $2
|
||||
snippet proc Basic procedure
|
||||
$1:
|
||||
pushl %ebp
|
||||
movl %esp, %ebp
|
||||
|
||||
$2
|
||||
|
||||
popl %ebp
|
||||
ret
|
@ -1245,3 +1245,19 @@ snippet ::a
|
||||
::after
|
||||
snippet ::b
|
||||
::before
|
||||
snippet var
|
||||
var(${0:${VISUAL}});
|
||||
snippet vard
|
||||
var(${0}, ${1:${VISUAL});
|
||||
snippet host
|
||||
:host {
|
||||
${1:${VISUAL}}
|
||||
}
|
||||
snippet host(
|
||||
:host(${1}) {
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
snippet part {
|
||||
::part(${1})
|
||||
${2:${VISUAL}}
|
||||
}
|
||||
|
@ -57,3 +57,33 @@ snippet stanim
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
# 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'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,6 +40,9 @@ snippet lica
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${0:index}' %>
|
||||
snippet licai
|
||||
<%= link_to '${1:link text...}', controller: '${2:items}', action: '${3:edit}', id: ${0:@item} %>
|
||||
snippet lib
|
||||
<%= link_to '${1:link text...}' do %>
|
||||
<% end %>
|
||||
snippet yield
|
||||
<%= yield ${1::content_symbol} %>
|
||||
snippet conf
|
||||
|
98
sources_non_forked/vim-snippets/snippets/gleam.snippets
Normal file
98
sources_non_forked/vim-snippets/snippets/gleam.snippets
Normal file
@ -0,0 +1,98 @@
|
||||
snippet fn "fn"
|
||||
fn ${1:function_name}(${2}) -> ${3:Nil} {
|
||||
${0:${VISUAL:todo}}
|
||||
}
|
||||
|
||||
snippet pfn "pub fn"
|
||||
pub fn ${1:function_name}(${2}) -> ${3:Nil} {
|
||||
${0:${VISUAL:todo}}
|
||||
}
|
||||
|
||||
snippet test "test fn"
|
||||
pub fn ${1:name}_test() {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet af "anonymous fn"
|
||||
fn(${1}) { ${0:${VISUAL}} }
|
||||
|
||||
snippet let "let binding"
|
||||
let ${1} = ${0}
|
||||
|
||||
snippet l "let binding"
|
||||
let ${1} = ${0}
|
||||
|
||||
snippet as "assert binding"
|
||||
assert ${1} = ${0}
|
||||
|
||||
snippet tr "try binding"
|
||||
try ${1} = ${0}
|
||||
|
||||
snippet - "->"
|
||||
-> ${0}
|
||||
|
||||
snippet case "case expression"
|
||||
case ${1} {
|
||||
${2} -> ${0}
|
||||
}
|
||||
|
||||
snippet ty "type"
|
||||
type ${1:Name} {
|
||||
${0:$1}
|
||||
}
|
||||
|
||||
snippet pty "pub type"
|
||||
pub type ${1:Name} {
|
||||
${0:$1}
|
||||
}
|
||||
|
||||
snippet tya "type alias"
|
||||
type ${1:Name} =
|
||||
${0:$1}
|
||||
|
||||
snippet ptya "pub type alias"
|
||||
pub type ${1:Name} =
|
||||
${0:$1}
|
||||
|
||||
snippet ext "external type"
|
||||
external type ${0}
|
||||
|
||||
snippet pext "pub external type"
|
||||
pub external type ${0}
|
||||
|
||||
snippet exfn "external fn"
|
||||
external fn ${1:function_name}(${2}) -> ${3}
|
||||
= "${4}" "${0}"
|
||||
|
||||
snippet pexfn "pub external fn"
|
||||
pub external fn ${1:function_name}(${2}) -> ${3}
|
||||
= "${4}" "${0}"
|
||||
|
||||
snippet im "import"
|
||||
import ${0:gleam/result}
|
||||
|
||||
snippet im. "import exposing"
|
||||
import ${1:gleam/result}.{${0}}
|
||||
|
||||
snippet p "|>"
|
||||
|> ${0}
|
||||
|
||||
snippet tup "tuple()"
|
||||
tuple(${0:${VISUAL}})
|
||||
|
||||
snippet bl "block"
|
||||
{
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
|
||||
snippet tf "fn(Type) -> Type"
|
||||
fn(${1}) -> ${0}
|
||||
|
||||
snippet seq "should.equal"
|
||||
should.equal(${0:${VISUAL}})
|
||||
|
||||
snippet strue "should.be_true"
|
||||
should.be_true(${0:${VISUAL}})
|
||||
|
||||
snippet sfalse "should.be_false"
|
||||
should.be_true(${0:${VISUAL}})
|
@ -1,29 +1,29 @@
|
||||
snippet des "describe('thing', () => { ... })" b
|
||||
describe('${1:}', () => {
|
||||
snippet des "describe('thing', function() { ... })" b
|
||||
describe('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet it "it('should do', () => { ... })" b
|
||||
it('${1:}', () => {
|
||||
snippet it "it('should do', function() { ... })" b
|
||||
it('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet xit "xit('should do', () => { ... })" b
|
||||
xit('${1:}', () => {
|
||||
snippet xit "xit('should do', function() { ... })" b
|
||||
xit('${1:}', function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet bef "before(() => { ... })" b
|
||||
before(() => {
|
||||
snippet bef "before(function() { ... })" b
|
||||
before(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet befe "beforeEach(() => { ... })" b
|
||||
beforeEach(() => {
|
||||
snippet befe "beforeEach(function() { ... })" b
|
||||
beforeEach(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet aft "after(() => { ... })" b
|
||||
after(() => {
|
||||
snippet aft "after(function() { ... })" b
|
||||
after(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet afte "afterEach(() => { ... })" b
|
||||
afterEach(() => {
|
||||
snippet afte "afterEach(function() { ... })" b
|
||||
afterEach(function() {
|
||||
${0:${VISUAL}}
|
||||
});
|
||||
snippet exp "expect(...)" b
|
||||
|
@ -352,7 +352,7 @@ snippet sym
|
||||
snippet ed
|
||||
export default ${0}
|
||||
snippet ${
|
||||
${${1}}${0}
|
||||
\${${1}}${0}
|
||||
snippet as "async"
|
||||
async ${0}
|
||||
snippet aw "await"
|
||||
|
@ -18,7 +18,7 @@ snippet cremove
|
||||
snippet ccatch
|
||||
<c:catch var="${0}" />
|
||||
snippet cif
|
||||
<c:if test="${${1}}">
|
||||
<c:if test="\${${1}}">
|
||||
${0}
|
||||
</c:if>
|
||||
snippet cchoose
|
||||
@ -26,7 +26,7 @@ snippet cchoose
|
||||
${0}
|
||||
</c:choose>
|
||||
snippet cwhen
|
||||
<c:when test="${${1}}">
|
||||
<c:when test="\${${1}}">
|
||||
${0}
|
||||
</c:when>
|
||||
snippet cother
|
||||
@ -34,12 +34,12 @@ snippet cother
|
||||
${0}
|
||||
</c:otherwise>
|
||||
snippet cfore
|
||||
<c:forEach items="${${1}}" var="${2}" varStatus="${3}">
|
||||
<c:forEach items="\${${1}}" var="${2}" varStatus="${3}">
|
||||
${0:<c:out value="$2" />}
|
||||
</c:forEach>
|
||||
snippet cfort
|
||||
<c:set var="${1}">${2:item1,item2,item3}</c:set>
|
||||
<c:forTokens var="${3}" items="${$1}" delims="${4:,}">
|
||||
<c:forTokens var="${3}" items="\${$1}" delims="${4:,}">
|
||||
${0:<c:out value="$3" />}
|
||||
</c:forTokens>
|
||||
snippet cparam
|
||||
@ -56,13 +56,13 @@ snippet cimport+
|
||||
</c:import>
|
||||
snippet curl
|
||||
<c:url value="${1}" var="${2}" />
|
||||
<a href="${$2}">${0}</a>
|
||||
<a href="\${$2}">${0}</a>
|
||||
snippet curl+
|
||||
<c:url value="${1}" var="${2}">
|
||||
<c:param name="${4}" value="${5}" />
|
||||
cparam+${0}
|
||||
</c:url>
|
||||
<a href="${$2}">${3}</a>
|
||||
<a href="\${$2}">${3}</a>
|
||||
snippet credirect
|
||||
<c:redirect url="${0}" />
|
||||
snippet contains
|
||||
|
@ -6,6 +6,11 @@ snippet pfun
|
||||
private fun ${1:name}(${2}): ${3:String} {
|
||||
${4}
|
||||
}
|
||||
snippet main
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
${0}
|
||||
}
|
||||
snippet ret
|
||||
return ${0}
|
||||
snippet whe
|
||||
|
@ -28,7 +28,7 @@ snippet ife
|
||||
${3}
|
||||
}
|
||||
snippet eif
|
||||
elsif ${1) {
|
||||
elsif ${1} {
|
||||
${2}
|
||||
}
|
||||
# Conditional One-line
|
||||
|
@ -88,11 +88,11 @@ snippet property
|
||||
@property
|
||||
def ${1:foo}(self) -> ${2:type}:
|
||||
"""${3:doc}"""
|
||||
return self._${1:foo}
|
||||
return self._$1
|
||||
|
||||
@${1:foo}.setter
|
||||
def ${1:foo}(self, value: ${2:type}):
|
||||
self._${1:foo} = value
|
||||
@$1.setter
|
||||
def $1(self, value: $2):
|
||||
self._$1 = value
|
||||
|
||||
# Ifs
|
||||
snippet if
|
||||
@ -159,6 +159,10 @@ snippet ifmain
|
||||
# __magic__
|
||||
snippet _
|
||||
__${1:init}__
|
||||
|
||||
# debugger breakpoint
|
||||
snippet br
|
||||
breakpoint()
|
||||
# python debugger (pdb)
|
||||
snippet pdb
|
||||
__import__('pdb').set_trace()
|
||||
|
@ -274,22 +274,6 @@ snippet sl
|
||||
end
|
||||
snippet sha1
|
||||
Digest::SHA1.hexdigest(${0:string})
|
||||
snippet sweeper
|
||||
class ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper
|
||||
observe $1
|
||||
|
||||
def after_save(${0:model_class_name})
|
||||
expire_cache($2)
|
||||
end
|
||||
|
||||
def after_destroy($2)
|
||||
expire_cache($2)
|
||||
end
|
||||
|
||||
def expire_cache($2)
|
||||
expire_page
|
||||
end
|
||||
end
|
||||
snippet va validates_associated
|
||||
validates_associated :${0:attribute}
|
||||
snippet va validates .., acceptance: true
|
||||
|
@ -598,6 +598,8 @@ snippet begin
|
||||
#debugging
|
||||
snippet debug
|
||||
require 'byebug'; byebug
|
||||
snippet dbg
|
||||
require 'debug'; debugger
|
||||
snippet debug19
|
||||
require 'debugger'; debugger
|
||||
snippet debug18
|
||||
|
@ -17,7 +17,7 @@ snippet *
|
||||
# Definition
|
||||
snippet def
|
||||
(define (${1:name})
|
||||
(${0:definition}))
|
||||
${0:definition})
|
||||
|
||||
# Definition with lambda
|
||||
snippet defl
|
||||
|
@ -55,7 +55,7 @@ snippet go
|
||||
done
|
||||
# Set SCRIPT_DIR variable to directory script is located.
|
||||
snippet sdir
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
SCRIPT_DIR="\$( cd "\$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# getopt
|
||||
snippet getopt
|
||||
__ScriptVersion="${1:version}"
|
||||
@ -66,7 +66,7 @@ snippet getopt
|
||||
#===============================================================================
|
||||
function usage ()
|
||||
{
|
||||
echo "Usage : $${0:0} [options] [--]
|
||||
echo "Usage : \$${0:0} [options] [--]
|
||||
|
||||
Options:
|
||||
-h|help Display this message
|
||||
@ -80,18 +80,18 @@ snippet getopt
|
||||
|
||||
while getopts ":hv" opt
|
||||
do
|
||||
case $opt in
|
||||
case \$opt in
|
||||
|
||||
h|help ) usage; exit 0 ;;
|
||||
|
||||
v|version ) echo "$${0:0} -- Version $__ScriptVersion"; exit 0 ;;
|
||||
v|version ) echo "\$${0:0} -- Version \$__ScriptVersion"; exit 0 ;;
|
||||
|
||||
* ) echo -e "\n Option does not exist : $OPTARG\n"
|
||||
* ) echo -e "\\n Option does not exist : \$OPTARG\\n"
|
||||
usage; exit 1 ;;
|
||||
|
||||
esac # --- end of case ---
|
||||
done
|
||||
shift $(($OPTIND-1))
|
||||
shift \$(($OPTIND-1))
|
||||
snippet root
|
||||
if [ \$(id -u) -ne 0 ]; then exec sudo \$0; fi
|
||||
|
||||
|
@ -50,7 +50,7 @@ snippet vactions
|
||||
${1:updateValue}({commit}, ${2:payload}) {
|
||||
commit($1, $2);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
# Add in js animation hooks
|
||||
snippet vanim:js:el
|
||||
@ -106,14 +106,33 @@ snippet vdata
|
||||
return {
|
||||
${1:key}: ${2:value}
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
snippet vmounted
|
||||
mounted() {
|
||||
console.log('mounted');
|
||||
},
|
||||
|
||||
snippet vmethods
|
||||
methods: {
|
||||
${1:method}() {
|
||||
console.log('method');
|
||||
}
|
||||
},
|
||||
|
||||
snippet vcomputed
|
||||
computed: {
|
||||
${1:fnName}() {
|
||||
return;
|
||||
}
|
||||
},
|
||||
|
||||
snippet vfilter
|
||||
filters: {
|
||||
${1:fnName}: function(${2:value}) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
snippet vfor
|
||||
<div v-for="${1:item} in ${2:items}" :key="$1.id">
|
||||
@ -125,7 +144,7 @@ snippet vgetters
|
||||
${1:value}: state => {
|
||||
return state.$1;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
snippet vimport
|
||||
import ${1:New} from './components/$1.vue';
|
||||
@ -152,7 +171,7 @@ snippet vmutations
|
||||
${1:updateValue}(state, ${3:payload}) => {
|
||||
state.${2:value} = $3;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
snippet vprops:d
|
||||
${1:propName}: {
|
||||
|
Reference in New Issue
Block a user