Merge branch 'master' of https://github.com/switch87/vim-snippets
This commit is contained in:
commit
9987d5e053
@ -205,7 +205,7 @@ to maintain snippets for a language, please get in touch.
|
||||
Notes: People are interested in snippets - and their interest may wane again.
|
||||
This list is kept up-to-date on a best effort basis.
|
||||
|
||||
* Elixir - [iurifq](https://github.com/iurifq)
|
||||
* Elixir - [lpil](https://github.com/lpil), [iurifq](https://github.com/iurifq)
|
||||
* Falcon - [steveno](https://github.com/steveno)
|
||||
* HTML Django - [honza](http://github.com/honza)
|
||||
* Javascript - [honza](http://github.com/honza)
|
||||
|
@ -89,7 +89,8 @@ endsnippet
|
||||
|
||||
snippet bbox "A nice box over the full width" b
|
||||
`!p
|
||||
width = int(vim.eval("&textwidth")) or 71
|
||||
if not snip.c:
|
||||
width = int(vim.eval("&textwidth - (virtcol('.') == 1 ? 0 : virtcol('.'))")) or 71
|
||||
box = make_box(len(t[1]), width)
|
||||
snip.rv = box[0]
|
||||
snip += box[1]
|
||||
|
@ -1,3 +1,33 @@
|
||||
priority -50
|
||||
|
||||
extends html
|
||||
|
||||
snippet % "<% %>" w
|
||||
<% $0 %>
|
||||
endsnippet
|
||||
|
||||
snippet = "<%= %>" w
|
||||
<%= $0 %>
|
||||
endsnippet
|
||||
|
||||
snippet end "<% end %>" w
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
||||
snippet ft "form_tag" w
|
||||
<%= form_tag(${1:"${2:/users}"}, method: ${3::post}) %>
|
||||
$0
|
||||
</form>
|
||||
endsnippet
|
||||
|
||||
snippet lin "link" w
|
||||
<%= link ${1:"${2:Submit}"}, to: ${3:"${4:/users}"}, method: ${5::delete} %>
|
||||
endsnippet
|
||||
|
||||
snippet ff "form_for" w
|
||||
<%= form_for @changeset, ${1:"${2:/users}"}, fn f -> %>
|
||||
$0
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
endsnippet
|
||||
|
@ -111,6 +111,12 @@ func ${1:name}(${2:params})${3/(.+)/ /}${3:type} {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet funch "HTTP handler" b
|
||||
func ${1:handler}(${2:w} http.ResponseWriter, ${3:r} *http.Request) {
|
||||
${0:${VISUAL}}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# types and variables
|
||||
snippet map "Map type" b
|
||||
map[${1:keytype}]${2:valtype}
|
||||
@ -135,3 +141,10 @@ snippet json "JSON field"
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
||||
# error handling
|
||||
snippet err "Basic error handling" b
|
||||
if err != nil {
|
||||
log.${1:Fatal}(err)
|
||||
}
|
||||
endsnippet
|
||||
|
@ -198,6 +198,18 @@ snippet h1 "XHTML <h1>" w
|
||||
<h1>$0</h1>
|
||||
endsnippet
|
||||
|
||||
snippet h2 "XHTML <h2>" w
|
||||
<h2>$0</h2>
|
||||
endsnippet
|
||||
|
||||
snippet h3 "XHTML <h3>" w
|
||||
<h3>$0</h3>
|
||||
endsnippet
|
||||
|
||||
snippet h4 "XHTML <h4>" w
|
||||
<h4>$0</h4>
|
||||
endsnippet
|
||||
|
||||
snippet head "XHTML <head>"
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
@ -29,5 +29,5 @@ snippet textarea
|
||||
endsnippet
|
||||
|
||||
snippet img
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
<img src="$1"${2: alt="$3"}/>
|
||||
endsnippet
|
||||
|
@ -4,12 +4,34 @@
|
||||
|
||||
priority -50
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type." b
|
||||
snippet let "let variable declaration" b
|
||||
let ${1:name}${2:: ${3:type}} = ${4};
|
||||
endsnippet
|
||||
|
||||
snippet letm "let mut variable declaration" b
|
||||
let mut ${1:name}${2:: ${3:type}} = ${4};
|
||||
endsnippet
|
||||
|
||||
snippet fn "A function, optionally with arguments and return type."
|
||||
fn ${1:function_name}(${2})${3/..*/ -> /}${3} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet arg "Function Arguments" i
|
||||
${1:a}: ${2:T}${3:, arg}
|
||||
endsnippet
|
||||
|
||||
snippet || "Closure, anonymous function (inline)" i
|
||||
${1:move }|${2}| { $3 }
|
||||
endsnippet
|
||||
|
||||
snippet |} "Closure, anonymous function (block)" i
|
||||
${1:move }|${2}| {
|
||||
$3
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet pri "print!(..)" b
|
||||
print!("${1}"${2/..*/, /}${2});
|
||||
endsnippet
|
||||
@ -30,7 +52,7 @@ macro_rules! ${1:name} (
|
||||
)
|
||||
endsnippet
|
||||
|
||||
snippet mod "A module" b
|
||||
snippet mod "A module" b
|
||||
mod ${1:`!p snip.rv = snip.basename.lower() or "name"`} {
|
||||
${VISUAL}${0}
|
||||
}
|
||||
@ -52,18 +74,27 @@ struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# TODO: fancy dynamic field mirroring like Python slotclass
|
||||
snippet stn "Struct with new constructor." b
|
||||
pub struct ${1:`!p snip.rv = snip.basename.title() or "Name"`} {
|
||||
${3}
|
||||
fd${0}
|
||||
}
|
||||
|
||||
impl $1 {
|
||||
pub fn new(${2}) -> $1 {
|
||||
${4}return $1 {
|
||||
${5}
|
||||
};
|
||||
$1 { ${3} };
|
||||
}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet fd "Struct field definition" w
|
||||
${1:name}: ${2:Type},
|
||||
endsnippet
|
||||
|
||||
snippet impl "Struct/Trait implementation" b
|
||||
impl ${1:Type/Trait}${2: for ${3:Type}} {
|
||||
${0}
|
||||
}
|
||||
endsnippet
|
||||
|
||||
# vim:ft=snippets:
|
||||
|
@ -71,7 +71,7 @@ snippet simc
|
||||
}
|
||||
# if condition
|
||||
snippet if
|
||||
if (${1}) {
|
||||
if (${1:True}) {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
@ -90,7 +90,7 @@ snippet ?
|
||||
snippet do
|
||||
do {
|
||||
${0}
|
||||
} while (${1});
|
||||
} while (${1:True});
|
||||
# while loop
|
||||
snippet wh
|
||||
while (${1}) {
|
||||
@ -101,17 +101,21 @@ 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 (var ${1:entry} in ${2}) {
|
||||
foreach (${1:var} ${2:entry} in ${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet foreach
|
||||
foreach (var ${1:entry} in ${2}) {
|
||||
foreach (${1:var} ${2:entry} in ${3}) {
|
||||
${0}
|
||||
}
|
||||
snippet each
|
||||
foreach (var ${1:entry} in ${2}) {
|
||||
foreach (${1:var} ${2:entry} in ${3}) {
|
||||
${0}
|
||||
}
|
||||
# interfaces
|
||||
@ -347,6 +351,11 @@ snippet struct
|
||||
}
|
||||
# enumeration
|
||||
snippet enum
|
||||
enum ${1} {
|
||||
${0}
|
||||
}
|
||||
|
||||
snippet enum+
|
||||
public enum ${1} {
|
||||
${0}
|
||||
}
|
||||
@ -372,3 +381,39 @@ 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
|
||||
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
|
||||
snippet index
|
||||
public ${1:object} this[${2:int} index]{
|
||||
get { ${3:} }
|
||||
set { ${0:} }
|
||||
}
|
||||
# eventhandler snippet
|
||||
snippet inv
|
||||
EventHandler temp = ${1:MyEvent};
|
||||
if (${2:temp} != null){
|
||||
$2();
|
||||
}
|
||||
|
@ -1,6 +1,23 @@
|
||||
snippet %
|
||||
<% ${0} %>
|
||||
|
||||
snippet =
|
||||
<%= ${1} %>
|
||||
<%= ${0} %>
|
||||
|
||||
snippet end
|
||||
<% end %>
|
||||
|
||||
snippet ft
|
||||
<%= form_tag(${1:"/users"}, method: ${2::post}) %>
|
||||
${0}
|
||||
</form>
|
||||
|
||||
snippet lin
|
||||
<%= link "${1:Submit}", to: ${2:"/users"}, method: ${3::delete} %>
|
||||
|
||||
snippet ff
|
||||
<%= form_for @changeset, ${1:"/users"}, fn f -> %>
|
||||
${0}
|
||||
|
||||
<%= submit "Submit" %>
|
||||
<% end %>
|
||||
|
@ -592,6 +592,10 @@ 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}
|
||||
|
@ -1,3 +1,5 @@
|
||||
snippet #!
|
||||
#!/usr/bin/env node
|
||||
# module exports
|
||||
snippet ex
|
||||
module.exports = ${1};
|
||||
|
@ -257,6 +257,10 @@ snippet cdir
|
||||
|
||||
# Misc
|
||||
|
||||
# 'use strict';
|
||||
snippet us
|
||||
'use strict';
|
||||
|
||||
# setTimeout function
|
||||
snippet timeout
|
||||
setTimeout(function () {${0}}${2}, ${1:10});
|
||||
|
@ -138,10 +138,10 @@ snippet pdbbb
|
||||
# remote python debugger (rpdb)
|
||||
snippet rpdb
|
||||
import rpdb; rpdb.set_trace()
|
||||
# python_prompt_toolkit
|
||||
snippet ppt
|
||||
from prompt_toolkit.contrib.repl import embed
|
||||
embed(globals(), locals(), vi_mode=${1:default=False}, history_filename=${2:default=None})
|
||||
# ptpython
|
||||
snippet ptpython
|
||||
from ptpython.repl import embed
|
||||
embed(globals(), locals(), vi_mode=${1:False}, history_filename=${2:None})
|
||||
# python console debugger (pudb)
|
||||
snippet pudb
|
||||
import pudb; pudb.set_trace()
|
||||
|
@ -36,7 +36,7 @@ snippet crw
|
||||
cattr_accessor :${0:attr_names}
|
||||
snippet defcreate
|
||||
def create
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])
|
||||
@${1:model_class_name} = ${2:ModelClassName}.new($1_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @$1.save
|
||||
@ -95,7 +95,7 @@ snippet defupdate
|
||||
@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @$1.update_attributes(params[:$1])
|
||||
if @$1.update($1_params)
|
||||
flash[:notice] = '$2 was successfully updated.'
|
||||
format.html { redirect_to(@$1) }
|
||||
format.xml { head :ok }
|
||||
@ -105,6 +105,10 @@ snippet defupdate
|
||||
end
|
||||
end
|
||||
end
|
||||
snippet defparams
|
||||
def ${1:model_class_name}_params
|
||||
params.require(:$1).permit()
|
||||
end
|
||||
snippet dele delegate .. to
|
||||
delegate :${1:methods}, to: :${0:object}
|
||||
snippet dele delegate .. to .. prefix .. allow_nil
|
||||
|
@ -3,11 +3,11 @@
|
||||
#################
|
||||
|
||||
# Functions
|
||||
snippet fn
|
||||
snippet fn "Function definition"
|
||||
fn ${1:function_name}(${2})${3} {
|
||||
${0}
|
||||
}
|
||||
snippet test
|
||||
snippet test "Unit test function"
|
||||
#[test]
|
||||
fn ${1:test_function_name}() {
|
||||
${0}
|
||||
@ -19,32 +19,51 @@ snippet bench "Bench function" b
|
||||
${0}
|
||||
})
|
||||
}
|
||||
snippet new
|
||||
snippet new "Constructor function"
|
||||
pub fn new(${2}) -> ${1:Name} {
|
||||
${0}return $1 { ${3} };
|
||||
$1 { ${3} };
|
||||
}
|
||||
snippet main
|
||||
snippet main "Main function"
|
||||
pub fn main() {
|
||||
${0}
|
||||
}
|
||||
snippet let
|
||||
let ${1:name: type} = ${2};
|
||||
snippet let
|
||||
let mut ${1:name: type} = ${2};
|
||||
snippet pln
|
||||
snippet let "let variable declaration"
|
||||
let ${1:name}${2:: ${3:type}} = ${4};
|
||||
snippet letm "let mut variable declaration"
|
||||
let mut ${1:name}${2:: ${3:type}} = ${4};
|
||||
snippet pln "println!"
|
||||
println!("${1}");
|
||||
snippet pln,
|
||||
snippet pln, "println! with format param"
|
||||
println!("${1}", ${2});
|
||||
snippet ec
|
||||
# Modules
|
||||
snippet ec "extern crate"
|
||||
extern crate ${1:sync};
|
||||
snippet ecl
|
||||
#![feature(phase)]
|
||||
#[phase(plugin, link)] extern crate log;
|
||||
snippet ecl "extern crate log"
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
snippet mod
|
||||
mod ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||
${0}
|
||||
} /* $1 */
|
||||
snippet crate
|
||||
snippet testmod "Test module" b
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::${1:*};
|
||||
|
||||
test${0}
|
||||
}
|
||||
# Attributes
|
||||
snippet allow "allow lint attribute" b
|
||||
#[allow(${1:unused_variable})]
|
||||
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
|
||||
@ -53,110 +72,107 @@ snippet crate
|
||||
#![comment = "${4:Comment.}"]
|
||||
// Specify the output type
|
||||
#![crate_type = "${5:lib}"]
|
||||
snippet allow
|
||||
#[allow(${1:unused_variable})]
|
||||
snippet feat
|
||||
#![feature(${1:macro_rules})]
|
||||
snippet der "#[deriving(..)]" b
|
||||
#[deriving(${1:Show})]
|
||||
snippet attr "#[..]" b
|
||||
#[${1:inline}]
|
||||
|
||||
# Common types
|
||||
snippet opt
|
||||
Option<${1:int}>
|
||||
snippet res
|
||||
snippet opt "Option<T>"
|
||||
Option<${1:i32}>
|
||||
snippet res "Result<T, E>"
|
||||
Result<${1:~str}, ${2:()}>
|
||||
# Control structures
|
||||
snippet if
|
||||
if ${1} {
|
||||
${0}
|
||||
}
|
||||
snippet ife
|
||||
snippet ife "if / else"
|
||||
if ${1} {
|
||||
${2}
|
||||
} else {
|
||||
${0}
|
||||
}
|
||||
snippet el
|
||||
snippet el "else"
|
||||
else {
|
||||
${0}
|
||||
}
|
||||
snippet eli
|
||||
snippet eli "else if"
|
||||
else if ${1} {
|
||||
${0}
|
||||
}
|
||||
snippet mat
|
||||
snippet mat "match pattern"
|
||||
match ${1} {
|
||||
${2} => ${3},
|
||||
${2} => ${3}
|
||||
}
|
||||
snippet case "Case clause of pattern match"
|
||||
${1:_} => ${2:expression}
|
||||
snippet loop "loop {}" b
|
||||
loop {
|
||||
${0}
|
||||
}
|
||||
snippet while
|
||||
snippet while "while loop"
|
||||
while ${1:condition} {
|
||||
${0}
|
||||
}
|
||||
snippet for
|
||||
snippet for "for ... in ... loop"
|
||||
for ${1:i} in ${2:0u..10} {
|
||||
${0}
|
||||
}
|
||||
snippet spawn
|
||||
spawn(proc() {
|
||||
${0}
|
||||
});
|
||||
snippet chan
|
||||
let (${1:tx}, ${2:rx}): (Sender<${3:int}>, Receiver<${4:int}>) = channel();
|
||||
snippet duplex
|
||||
let (${1:from_child}, ${2:to_child}) = sync::duplex();
|
||||
# TODO commenting
|
||||
snippet todo
|
||||
snippet todo "TODO comment"
|
||||
// [TODO]: ${0:Description}
|
||||
snippet fixme "FIXME comment"
|
||||
// FIXME: $0
|
||||
|
||||
# Struct
|
||||
snippet st
|
||||
snippet st "Struct definition"
|
||||
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||
${0}
|
||||
}
|
||||
snippet stn
|
||||
struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||
snippet impl "Struct/Trait implementation"
|
||||
impl ${1:Type/Trait}${2: for ${3:Type}} {
|
||||
${0}
|
||||
}
|
||||
snippet stn "Struct with new constructor"
|
||||
pub struct ${1:`substitute(vim_snippets#Filename(), '\(_\|^\)\(.\)', '\u\2', 'g')`} {
|
||||
${0}
|
||||
}
|
||||
|
||||
impl $1 {
|
||||
pub fn new(${2}) -> $1 {
|
||||
${4}return $1 {
|
||||
${5}
|
||||
};
|
||||
$1 { ${3} };
|
||||
}
|
||||
}
|
||||
snippet typ
|
||||
type ${1:NewName} = $0;
|
||||
# Enum
|
||||
snippet enum
|
||||
snippet type "Type alias"
|
||||
type ${1:NewName} = $2;
|
||||
snippet enum "enum definition"
|
||||
enum ${1:Name} {
|
||||
${0},
|
||||
${2},
|
||||
}
|
||||
# Impl
|
||||
snippet imp
|
||||
impl ${1:Name} {
|
||||
# Traits
|
||||
snippet trait "Trait definition"
|
||||
trait ${1:Name} {
|
||||
${0}
|
||||
}
|
||||
snippet drop
|
||||
snippet drop "Drop trait implementation (destructor)"
|
||||
impl Drop for ${1:Name} {
|
||||
fn drop(&mut self) {
|
||||
${0}
|
||||
}
|
||||
}
|
||||
# Traits
|
||||
snippet trait
|
||||
trait ${1:Name} {
|
||||
${0}
|
||||
}
|
||||
# Statics
|
||||
snippet ss
|
||||
snippet ss "static string declaration"
|
||||
static ${1}: &'static str = "${0}";
|
||||
snippet stat
|
||||
snippet stat "static item declaration"
|
||||
static ${1}: ${2:usize} = ${0};
|
||||
# Concurrency
|
||||
snippet scoped "spawn a scoped thread"
|
||||
thread::scoped(${1:move }|| {
|
||||
${0}
|
||||
});
|
||||
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();
|
||||
# Testing
|
||||
snippet as "assert!"
|
||||
assert!(${1:predicate})
|
||||
snippet ase "assert_eq!"
|
||||
assert_eq!(${1:expected}, ${2:actual})
|
||||
|
@ -92,28 +92,3 @@ snippet fun
|
||||
function ${1:function_name}() {
|
||||
${0:#function_body}
|
||||
}
|
||||
|
||||
snippet funtitle
|
||||
#=== FUNCTION ===============================================================
|
||||
# NAME: ${1:function_name}
|
||||
# DESCRIPTION: ${0:One line to give a brief description.}
|
||||
#==============================================================================
|
||||
|
||||
snippet GPL2
|
||||
#=== LICENSE ================================================================
|
||||
# ${1:One line to give the program's name and a brief description.}
|
||||
# Copyright (C) `strftime("%Y")` ${2:`g:snips_author`}
|
||||
#
|
||||
# This script 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/>.
|
||||
#==============================================================================
|
||||
|
127
snippets/systemverilog.snippets
Normal file
127
snippets/systemverilog.snippets
Normal file
@ -0,0 +1,127 @@
|
||||
# if statement
|
||||
snippet if
|
||||
if (${1}) begin
|
||||
${0}
|
||||
end
|
||||
# If/else statements
|
||||
snippet ife
|
||||
if (${1}) begin
|
||||
${2}
|
||||
end
|
||||
else begin
|
||||
${1}
|
||||
end
|
||||
# Else if statement
|
||||
snippet eif
|
||||
else if (${1}) begin
|
||||
${0}
|
||||
end
|
||||
#Else statement
|
||||
snippet el
|
||||
else begin
|
||||
${0}
|
||||
end
|
||||
# While statement
|
||||
snippet wh
|
||||
while (${1}) begin
|
||||
${0}
|
||||
end
|
||||
# Repeat Loop
|
||||
snippet rep
|
||||
repeat (${1}) begin
|
||||
${0}
|
||||
end
|
||||
# Foreach Loopo
|
||||
snippet fe
|
||||
foreach (${1}) begin
|
||||
${0}
|
||||
end
|
||||
# Do-while statement
|
||||
snippet dowh
|
||||
do begin
|
||||
${0}
|
||||
end while (${1});
|
||||
# Case statement
|
||||
snippet case
|
||||
case (${1})
|
||||
{$2}: begin
|
||||
${0}
|
||||
end
|
||||
default: begin
|
||||
end
|
||||
endcase
|
||||
# CaseZ statement
|
||||
snippet casez
|
||||
casez (${1})
|
||||
{$2}: begin
|
||||
${0}
|
||||
end
|
||||
default: begin
|
||||
end
|
||||
endcase
|
||||
# Combinational always block
|
||||
snippet alc
|
||||
always_comb begin ${1:: statement_label}
|
||||
${0}
|
||||
end $1
|
||||
# Sequential logic
|
||||
snippet alff
|
||||
always_ff @(posedge ${1:clk}) begin ${2:: statement_label}
|
||||
${0}
|
||||
end $2
|
||||
# Latched logic
|
||||
snippet all
|
||||
always_latch begin ${1:: statement_label}
|
||||
${0}
|
||||
end $1
|
||||
# Module block
|
||||
snippet mod
|
||||
module ${1:module_name} (${2});
|
||||
${0}
|
||||
endmodule : $1
|
||||
# Class
|
||||
snippet cl
|
||||
class ${1:class_name};
|
||||
// data or class properties
|
||||
${0}
|
||||
|
||||
// initialization
|
||||
function new();
|
||||
endfunction : new
|
||||
|
||||
endclass : $1
|
||||
# Typedef structure
|
||||
snippet types
|
||||
typedef struct {
|
||||
${0}
|
||||
} ${1:name_t};
|
||||
# Program block
|
||||
snippet prog
|
||||
program ${1:program_name} ();
|
||||
${0}
|
||||
endprogram : $1
|
||||
# Interface block
|
||||
snippet intf
|
||||
interface ${1:program_name} ();
|
||||
// nets
|
||||
${0}
|
||||
// clocking
|
||||
|
||||
// modports
|
||||
|
||||
endinterface : $1
|
||||
# Clocking Block
|
||||
snippet clock
|
||||
clocking ${1:clocking_name} @(${2:posedge} ${3:clk});
|
||||
${0}
|
||||
endclocking : $1
|
||||
# Covergroup construct
|
||||
snippet cg
|
||||
covergroup ${1:group_name} @(${2:posedge} ${3:clk});
|
||||
${0}
|
||||
endgroup : $1
|
||||
# Package declaration
|
||||
snippet pkg
|
||||
package ${1:package_name};
|
||||
${0}
|
||||
endpackage : $1
|
Loading…
Reference in New Issue
Block a user