1
0
mirror of https://github.com/amix/vimrc synced 2025-06-17 02:15:01 +08:00

Updated plugins

This commit is contained in:
Amir
2020-04-25 21:56:16 -04:00
parent d98c510eee
commit fef069af24
114 changed files with 4018 additions and 988 deletions

View File

@ -1,88 +1,70 @@
# cannot use /usr/bin/env because it does not support parameters (as -f)
snippet #! #!/usr/bin/awk -f
#!/usr/bin/awk -f
# @include is a gawk extension
snippet inc @include
@include "${1}"${0}
# @load is a gawk extension
snippet loa @load
@load "${1}"${0}
snippet beg BEGIN { ... }
BEGIN {
${0}
}
# BEGINFILE is a gawk extension
snippet begf BEGINFILE { ... }
BEGINFILE {
${0}
}
snippet end END { ... }
END {
${0}
}
# ENDFILE is a gawk extension
snippet endf ENDFILE { ... }
ENDFILE {
${0}
}
snippet pri print
print ${1:"${2}"}${0}
snippet printf printf
printf("${1:%s}\n", ${2})${0}
snippet ign IGNORECASE
IGNORECASE = ${1:1}
snippet if if {...}
if (${1}) {
${0:${VISUAL}}
}
snippet ife if ... else ...
if (${1}) {
${2:${VISUAL}}
} else {
${0}
}
snippet eif else if ...
else if (${1}) {
${0}
}
snippet el else {...}
else {
${0}
}
snippet wh while
while (${1}) {
${2}
}
snippet do do ... while
do {
${0}
} while (${1})
snippet for for
for (${2:i} = 0; i < ${1:n}; ${3:++i}) {
${0}
}
snippet fore for each
for (${1:i} in ${2:array}) {
${0}
}
# the switch is a gawk extension
snippet sw switch
switch (${1}) {
@ -93,10 +75,8 @@ snippet sw switch
${0}
break
}
# the switch is a gawk extension
snippet case case
case ${1}:
${0}
break

View File

@ -1,7 +1,7 @@
## Main
# main
snippet main
int main(int argc, const char *argv[])
int main(int argc, char *argv[])
{
${0}
return 0;

View File

@ -0,0 +1,59 @@
# 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 {
@override
Widget build(BuildContext context) {
return Container(
$2
);
}
}
# Flutter stateful widget
snippet stful
class $1 extends StatefulWidget {
@override
_$1State 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 {
@override
_$1State 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
);
}
}

View File

@ -21,9 +21,9 @@ snippet info
snippet imp
import ${0:Data.Text}
snippet import
import ${0:Data.Text}
import ${0:Data.Text}
snippet import2
import ${1:Data.Text} (${0:head})
import ${1:Data.Text} (${0:head})
snippet impq
import qualified ${1:Data.Text} as ${0:T}
snippet importq

View File

@ -327,7 +327,9 @@ snippet =>
(${1}) => {
${0:${VISUAL}}
}
snippet af
snippet af "() =>"
(${1}) => ${0:${VISUAL}}
snippet afb "() => {}"
(${1}) => {
${0:${VISUAL}}
}

View File

@ -89,14 +89,26 @@ snippet thr throw
${0}
# Messages
snippet in
info("${1}")
${0}
snippet @i
@info "${1}" ${0}
snippet wa
warn("${1}")
${0}
snippet @w
@warn "${1}" ${0}
snippet err
error("${1}")
${0}
snippet @e
@error "${1}" ${0}
snippet @d
@debug "${1}" ${0}
snippet @t @testset with @test
@testset "${1}" begin
${2}
@test ${0}
end
snippet @tt @testset with @test_throws
@testset "${1}" begin
${2}
@test_throws ${0}
end

View File

@ -63,6 +63,10 @@ snippet include
{% include '${0:snippet}' %}
snippet includewith
{% include '${1:snippet}', ${2:variable}: ${0:value} %}
snippet render
{% render '${0:snippet}' %}
snippet renderwith
{% render '${1:snippet}', ${2:variable}: ${0:value} %}
snippet section
{% section '${1:snippet}' %}
snippet raw

View File

@ -129,6 +129,12 @@ snippet img
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.

View File

@ -357,6 +357,10 @@ snippet dump
use Data::Dump qw(dump);
warn dump ${1:variable}
snippet ddp
use DDP;
p ${1:variable}
snippet subtest
subtest '${1: test_name}' => sub {
${2}

View File

@ -123,6 +123,8 @@ snippet ret
return ${0}
snippet .
self.
snippet sa self.attribute = attribute
self.${1:attribute} = $1
snippet try Try/Except
try:
${1:${VISUAL}}
@ -182,6 +184,10 @@ snippet ptpython
# 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()

View File

@ -32,6 +32,10 @@ snippet for
for (${1:item} in ${2:list}) {
${3}
}
snippet foreach
foreach (${1:item} = ${2:list}) {
${3}
}
# functions
snippet fun

View File

@ -0,0 +1,205 @@
#
# Snipmate Snippets for Pandoc Markdown
#
# Many snippets have starred versions, i.e., versions
# that end with an asterisk (`*`). These snippets use
# vim's `"*` register---i.e., the contents of the
# system clipboard---to insert text.
# Insert Title Block
snippet %%
% ${1:`Filename('', 'title')`}
% ${2:`g:snips_author`}
% ${3:`strftime("%d %B %Y")`}
${4}
snippet %%*
% ${1:`Filename('', @*)`}
% ${2:`g:snips_author`}
% ${3:`strftime("%d %b %Y")`}
${4}
# Insert Definition List
snippet ::
${1:term}
~ ${2:definition}
# Underline with `=`s or `-`s
snippet ===
`repeat('=', strlen(getline(line(".") - 1)))`
${1}
snippet ---
`repeat('-', strlen(getline(line(".") - 1)))`
${1}
# Links and their kin
# -------------------
#
# (These don't play very well with delimitMate)
#
snippet [
[${1:link}](http://${2:url} "${3:title}")${4}
snippet [*
[${1:link}](${2:`@*`} "${3:title}")${4}
snippet [:
[${1:id}]: http://${2:url} "${3:title}"
snippet [:*
[${1:id}]: ${2:`@*`} "${3:title}"
snippet [@
[${1:link}](mailto:${2:email})${3}
snippet [@*
[${1:link}](mailto:${2:`@*`})${3}
snippet [:@
[${1:id}]: mailto:${2:email} "${3:title}"
snippet [:@*
[${1:id}]: mailto:${2:`@*`} "${3:title}"
snippet ![
![${1:alt}](${2:url} "${3:title}")${4}
snippet ![*
![${1:alt}](${2:`@*`} "${3:title}")${4}
snippet ![:
![${1:id}]: ${2:url} "${3:title}"
snippet ![:*
![${1:id}]: ${2:`@*`} "${3:title}"
snippet [^:
[^${1:id}]: ${2:note}
snippet [^:*
[^${1:id}]: ${2:`@*`}
#
# library()
snippet req
require(${1:}, quietly = TRUE)
# If Condition
snippet if
if ( ${1:condition} )
{
${2:}
}
snippet el
else
{
${1:}
}
# Function
snippet fun
${1:funname} <- # ${2:}
function
(
${3:}
)
{
${4:}
}
# repeat
snippet re
repeat{
${2:}
if(${1:condition}) break
}
# matrix
snippet ma
matrix(NA, nrow = ${1:}, ncol = ${2:})
# data frame
snippet df
data.frame(${1:}, header = TRUE)
snippet cmdarg
args <- commandArgs(TRUE)
if (length(args) == 0)
stop("Please give ${1:}!")
if (!all(file.exists(args)))
stop("Couln't find input files!")
snippet getopt
require('getopt', quietly = TRUE)
opt_spec <- matrix(c(
'help', 'h', 0, "logical", "Getting help",
'file', 'f', 1, "character","File to process"
), ncol = 5, byrow = TRUE)
opt <- getopt(spec = opt_spec)
if ( !is.null(opt$help) || is.null(commandArgs()) ) {
cat(getopt(spec = opt_spec, usage = TRUE, command = "yourCmd"))
q(status=0)
}
# some inital value
if ( is.null(opt$???) ) { opt$??? <- ??? }
snippet optparse
require("optparse", quietly = TRUE)
option_list <-
list(make_option(c("-n", "--add_numbers"), action="store_true", default=FALSE,
help="Print line number at the beginning of each line [default]")
)
parser <- OptionParser(usage = "%prog [options] file", option_list=option_list)
arguments <- parse_args(parser, positional_arguments = TRUE)
opt <- arguments$options
if(length(arguments$args) != 1) {
cat("Incorrect number of required positional arguments\n\n")
print_help(parser)
stop()
} else {
file <- arguments$args
}
if( file.access(file) == -1) {
stop(sprintf("Specified file ( %s ) does not exist", file))
} else {
file_text <- readLines(file)
}
snippet #!
#!/usr/bin/env Rscript
snippet debug
# Development & Debugging, don't forget to uncomment afterwards!
#--------------------------------------------------------------------------------
#setwd("~/Projekte/${1:}")
#opt <- list(${2:}
# )
#--------------------------------------------------------------------------------
# Took from pandoc-plugin <<<<
# Underline with `=`s or `-`s
snippet #===
#`repeat('=', strlen(getline(line(".") - 1)))`
${1}
snippet #---
#`repeat('-', strlen(getline(line(".") - 1)))`
${1}
# >>>>
snippet r
\`\`\`{r ${1:chung_tag}, echo = FALSE ${2:options}}
${3:}
\`\`\`
snippet ri
\`{r ${1:}}\`
snippet copt
\`\`\` {r setup, echo = FALSE}
opts_chunk$set(fig.path='../figures/${1:}', cache.path='../cache/-'
, fig.align='center', fig.show='hold', par=TRUE)
#opts_knit$set(upload.fun = imgur_upload) # upload images
\`\`\`
# End of File ===================================================================
# vim: set noexpandtab:

View File

@ -0,0 +1 @@
extends html, javascript, css

View File

@ -289,7 +289,9 @@ snippet sum \sum^{}_{}
snippet lim \lim_{}
\\lim_{${1:n \\to \\infty}} ${0}
snippet frame frame environment
\\begin{frame}[${1:t}]{${2:title}}
\\begin{frame}[${1:t}]
\frametitle{${2:title}}
\framesubtitle{${3:subtitle}}
${0:${VISUAL}}
\\end{frame}
snippet block block environment

View File

@ -75,6 +75,16 @@ snippet prc
${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})