update packages
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
(require 'yasnippet)
|
||||
(require 'yasnippet-snippets)
|
||||
|
||||
(add-hook 'bibtex-mode-hook #'yasnippet-snippets--no-indent)
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: proceedings
|
||||
# key: proceedings
|
||||
# author: Spenser Truex
|
||||
# --
|
||||
@mvproceedings{ ${title},
|
||||
title = {${title}},
|
||||
year = {${year}}${,
|
||||
editor = {${editor}}}${,
|
||||
volume = {${volume}}}${,
|
||||
series = {${series}}}${,
|
||||
address = {${address}}}${,
|
||||
month = {${month}}}${,
|
||||
organization = {${organization}}}${,
|
||||
publisher = {${publisher}}}${,
|
||||
note = {${note}}}
|
||||
}
|
||||
|
||||
$0
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: accumulate
|
||||
# key: acl
|
||||
# --
|
||||
auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0, [](int total, $2) {
|
||||
$3
|
||||
});
|
||||
$0
|
||||
@@ -1,5 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d_operator<<
|
||||
# key: <<
|
||||
# --
|
||||
friend std::ostream& operator<<(std::ostream&, const ${1:Name}&);
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: copy
|
||||
# key: oit
|
||||
# --
|
||||
std::copy(std::begin(${1:container}), std::end($1), std::ostream_iterator<$2>{
|
||||
%\istd::cout, "$3"
|
||||
});
|
||||
$0
|
||||
@@ -1,9 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: remove
|
||||
# key: rmv
|
||||
# --
|
||||
auto pos = std::remove(std::begin(${1:container}), std::end($1), $2);
|
||||
if (pos != std::end($1)) {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: cin
|
||||
# key: sti
|
||||
# --
|
||||
std::cin >>
|
||||
$0
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: cout
|
||||
# key: sto
|
||||
# --
|
||||
std::cout <<
|
||||
$0
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: vector
|
||||
# key: stv
|
||||
# --
|
||||
std::vector<$2> $3
|
||||
$0
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: generate_n
|
||||
# key: trm
|
||||
# --
|
||||
${1:container}.erase($1.find_last_not_of(" \t\n\r") + 1);
|
||||
$0
|
||||
@@ -1,9 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: transform
|
||||
# key: upr
|
||||
# --
|
||||
std::transform(std::begin(${1:container}), std::end($1), std::begin($1), [](char c) {
|
||||
return std::toupper(c);
|
||||
});
|
||||
$2
|
||||
$0
|
||||
@@ -2,7 +2,6 @@
|
||||
# name: do { ... } while (...)
|
||||
# key: do
|
||||
# --
|
||||
do
|
||||
{
|
||||
do {
|
||||
$0
|
||||
} while (${1:condition});
|
||||
@@ -10,4 +10,4 @@
|
||||
${3:*
|
||||
* ${4:Detailed description}
|
||||
*
|
||||
}*/
|
||||
}*/
|
||||
@@ -4,4 +4,4 @@
|
||||
# --
|
||||
for (${1:i = 0}; ${2:i < N}; ${3:++i}) {
|
||||
$0
|
||||
}
|
||||
}
|
||||
@@ -5,4 +5,4 @@
|
||||
# --
|
||||
for (${1:auto }${2:i} = ${3:0}; $2 < ${4:MAXIMUM}; ++$2) {
|
||||
$0
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
# name: if (...) { ... }
|
||||
# key: if
|
||||
# --
|
||||
if (${1:condition}) ${2:{
|
||||
if (${1:condition}) ${2:\{
|
||||
$0
|
||||
}}
|
||||
\}}
|
||||
@@ -1,6 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Alejandro Espinoza Esparza <aespinoza@structum.com.mx>
|
||||
# name: /// <param name="..."> ... </param>
|
||||
# name: /// <returns>$1</returns>
|
||||
# key: comment
|
||||
# --
|
||||
/// <returns>$1</returns>
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
-*- coding: utf-8 -*-
|
||||
Originally started by Xah Lee (xahlee.org) on 2009-02-22
|
||||
Released under GPL 3.
|
||||
|
||||
Feel free to add missing ones or modify existing ones to improve.
|
||||
|
||||
Those starting with “x-” are supposed to be idiom templates. Not sure it's very useful. They might start with “i-” or "id-" in the future.
|
||||
@@ -4,4 +4,4 @@
|
||||
# key: delete-directory
|
||||
# key: dd
|
||||
# --
|
||||
(delete-directory ${1:dicretory}${2: recursive})
|
||||
(delete-directory ${1:directory}${2: recursive})
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find and replace on region
|
||||
# contributor : Xah Lee
|
||||
# --
|
||||
(defun replace-html-chars-region (start end)
|
||||
"Replace “<” to “<” and other chars in HTML.
|
||||
This works on the current region."
|
||||
(interactive "r")
|
||||
(save-restriction
|
||||
(narrow-to-region start end)
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "&" nil t) (replace-match "&" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "<" nil t) (replace-match "<" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward ">" nil t) (replace-match ">" nil t))
|
||||
)
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: grab word under cursor
|
||||
# key: grabthing
|
||||
# contributor : Xah Lee
|
||||
# --
|
||||
(setq $0 (thing-at-point 'symbol))
|
||||
@@ -15,18 +15,18 @@
|
||||
${9:
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This file is free software; you can redistribute it and/or modify
|
||||
;; 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, or (at your option)
|
||||
;; any later version.
|
||||
;; 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.
|
||||
|
||||
;; For a full copy of the GNU General Public License
|
||||
;; see <http://www.gnu.org/licenses/>.
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: traversing a directory
|
||||
# contributor : Xah Lee
|
||||
# --
|
||||
;; apply a function to all files in a dir
|
||||
(require 'find-lisp)
|
||||
(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))
|
||||
@@ -1,18 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: process marked files in dired
|
||||
# key: x-dired
|
||||
# --
|
||||
;; idiom for processing a list of files in dired's marked files
|
||||
|
||||
;; suppose myProcessFile is your function that takes a file path
|
||||
;; and do some processing on the file
|
||||
|
||||
(defun dired-myProcessFile ()
|
||||
"apply myProcessFile function to marked files in dired."
|
||||
(interactive)
|
||||
(require 'dired)
|
||||
(mapc 'myProcessFile (dired-get-marked-files))
|
||||
)
|
||||
|
||||
;; to use it, type M-x dired-myProcessFile
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: a function that process a file
|
||||
# key: x-file
|
||||
# --
|
||||
(defun doThisFile (fpath)
|
||||
"Process the file at path FPATH ..."
|
||||
(let ()
|
||||
;; create temp buffer without undo record or font lock. (more efficient)
|
||||
;; first space in temp buff name is necessary
|
||||
(set-buffer (get-buffer-create " myTemp"))
|
||||
(insert-file-contents fpath nil nil nil t)
|
||||
|
||||
;; process it ...
|
||||
;; (goto-char 0) ; move to begining of file's content (in case it was open)
|
||||
;; ... do something here
|
||||
;; (write-file fpath) ;; write back to the file
|
||||
|
||||
(kill-buffer " myTemp")))
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: read lines of a file
|
||||
# key: x-file
|
||||
# --
|
||||
(defun read-lines (filePath)
|
||||
"Return a list of lines in FILEPATH."
|
||||
(with-temp-buffer
|
||||
(insert-file-contents filePath)
|
||||
(split-string
|
||||
(buffer-string) "\n" t)))
|
||||
|
||||
;; process all lines
|
||||
(mapc
|
||||
(lambda (aLine)
|
||||
(message aLine) ; do your stuff here
|
||||
)
|
||||
(read-lines "inputFilePath")
|
||||
)
|
||||
@@ -1,19 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: find and replace on region
|
||||
# key: x-find-replace
|
||||
# --
|
||||
(defun replace-html-chars-region (start end)
|
||||
"Replace “<” to “<” and other chars in HTML.
|
||||
This works on the current region."
|
||||
(interactive "r")
|
||||
(save-restriction
|
||||
(narrow-to-region start end)
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "&" nil t) (replace-match "&" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward "<" nil t) (replace-match "<" nil t))
|
||||
(goto-char (point-min))
|
||||
(while (search-forward ">" nil t) (replace-match ">" nil t))
|
||||
)
|
||||
)
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: grab buffer substring
|
||||
# key: x-grabstring
|
||||
# --
|
||||
(setq $0 (buffer-substring-no-properties myStartPos myEndPos))
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: grab word under cursor
|
||||
# key: x-grabthing
|
||||
# --
|
||||
(setq $0 (thing-at-point 'symbol))
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: traversing a directory
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# key: x-traverse_dir
|
||||
# --
|
||||
;; apply a function to all files in a dir
|
||||
(require 'find-lisp)
|
||||
(mapc 'my-process-file (find-lisp-find-files "~/myweb/" "\\.html$"))
|
||||
@@ -1,29 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: Xah Lee (XahLee.org)
|
||||
# name: Command that works on region or word
|
||||
# key: x-word-or-region
|
||||
# --
|
||||
;; example of a command that works on current word or text selection
|
||||
(defun down-case-word-or-region ()
|
||||
"Lower case the current word or text selection."
|
||||
(interactive)
|
||||
(let (pos1 pos2 meat)
|
||||
(if (and transient-mark-mode mark-active)
|
||||
(setq pos1 (region-beginning)
|
||||
pos2 (region-end))
|
||||
(setq pos1 (car (bounds-of-thing-at-point 'symbol))
|
||||
pos2 (cdr (bounds-of-thing-at-point 'symbol))))
|
||||
|
||||
; now, pos1 and pos2 are the starting and ending positions
|
||||
; of the current word, or current text selection if exists
|
||||
|
||||
;; put your code here.
|
||||
$0
|
||||
;; Some example of things you might want to do
|
||||
(downcase-region pos1 pos2) ; example of a func that takes region as args
|
||||
(setq meat (buffer-substring-no-properties pos1 pos2)) ; grab the text.
|
||||
(delete-region pos1 pos2) ; get rid of it
|
||||
(insert "newText") ; insert your new text
|
||||
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: current-date
|
||||
# key: dd
|
||||
# contributor : Kristof Molnar-Tatai <kristof.mlnr@gmail.com>
|
||||
# --
|
||||
`(format-time-string "%Y-%m-%d")`
|
||||
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: current-date-and-time
|
||||
# key: dt
|
||||
# --
|
||||
`(format-time-string "%Y-%m-%dT%H:%M:%S%:z")`
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Jimmy Wu <frozenthrone88@gmail.com>
|
||||
# name:<form method="..." id="..." action="..."></form>
|
||||
# key: form
|
||||
# name: form
|
||||
# --
|
||||
<form method="$1" id="$2" action="$3">
|
||||
$0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Jimmy Wu <frozenthrone88@gmail.com>
|
||||
# name:<script type="text/javascript">...</script>
|
||||
# key: script
|
||||
# name: script
|
||||
# --
|
||||
<script type="text/javascript">
|
||||
$0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Jimmy Wu <frozenthrone88@gmail.com>
|
||||
# name:<script type="text/javascript" src="..."></script>
|
||||
# key: script
|
||||
# name: script src
|
||||
# --
|
||||
<script type="text/javascript" src="$1"></script>
|
||||
@@ -6,7 +6,7 @@ class ${1:Class}${2: extends ${3:ParentClass}} {
|
||||
${4:constructor(${5:arg}) {
|
||||
${6:super(arg);}
|
||||
$7
|
||||
}}
|
||||
\}}
|
||||
|
||||
$0
|
||||
}
|
||||
@@ -1,9 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# uuid: 3d2ddcac-d8c0-4b56-81a7-523eb6621442
|
||||
# contributor: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
|
||||
# name: console.log (formatted)
|
||||
# key: clo
|
||||
# group: console
|
||||
# --
|
||||
|
||||
console.log('${1:object}', ${1:object})
|
||||
console.log('$1: ', ${1:object})
|
||||
5
lisp/yasnippet-snippets/snippets/js-mode/error
Normal file
5
lisp/yasnippet-snippets/snippets/js-mode/error
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet; require-final-newline: nil -*-
|
||||
# name: new error
|
||||
# key: err
|
||||
# --
|
||||
new Error(${1:message});
|
||||
@@ -6,5 +6,5 @@
|
||||
# --
|
||||
|
||||
for(let ${1:item} in ${2:object}) {
|
||||
${0}
|
||||
$0
|
||||
}
|
||||
@@ -6,5 +6,5 @@
|
||||
# --
|
||||
|
||||
for(let ${1:item} of ${2:object}) {
|
||||
${0}
|
||||
$0
|
||||
}
|
||||
@@ -6,5 +6,5 @@
|
||||
# --
|
||||
|
||||
${1:array}.forEach(${2:currentItem} => {
|
||||
${0}
|
||||
$0
|
||||
})
|
||||
@@ -6,5 +6,5 @@
|
||||
# --
|
||||
|
||||
${1:methodName} = (${2:params}) => {
|
||||
${0}
|
||||
$0
|
||||
}
|
||||
@@ -6,5 +6,5 @@
|
||||
# --
|
||||
|
||||
get ${1:propertyName}() {
|
||||
return this.${0}
|
||||
return this.${2:propertyName}
|
||||
}
|
||||
@@ -6,5 +6,5 @@
|
||||
# --
|
||||
|
||||
set ${1:propertyName}(${2:value}) {
|
||||
${0}
|
||||
$0
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: type-inline-comment
|
||||
# name: type-multiline-comment
|
||||
# key: *ty
|
||||
#condition: (= (js2-node-type (js2-node-at-point)) js2-COMMENT)
|
||||
# --
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: do
|
||||
# name: for
|
||||
# key: for
|
||||
# --
|
||||
(dotimes (${1:var} ${2:count-form})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: do
|
||||
# name: foreach
|
||||
# key: foreach
|
||||
# --
|
||||
(dolist (${1:var} ${2:list-form})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Unordered List
|
||||
# name: Unordered List -
|
||||
# contributor: Peng Deng <dengpeng@gmail.com>
|
||||
# key: -
|
||||
# --
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: Unordered List
|
||||
# name: Unordered List +
|
||||
# contributor: Peng Deng <dengpeng@gmail.com>
|
||||
# key: +
|
||||
# --
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor : Anders Bach Nielsen <abachn@abachn.net>
|
||||
# name:<form method="..." action="..."></form>
|
||||
# key: form
|
||||
# name: form
|
||||
# --
|
||||
<form method="$1" action="$2">
|
||||
$0
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
# name: src
|
||||
# key: <src
|
||||
# --
|
||||
#+BEGIN_SRC $1
|
||||
#+begin_src $1
|
||||
$0
|
||||
#+END_SRC
|
||||
#+end_src
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: USAMI Kenta <tadsan@zonu.me>
|
||||
# name: PHPDoc @property
|
||||
# key: *property
|
||||
# group: annotation
|
||||
# --
|
||||
* @property ${1:type} ${2:$variable} ${3:description}${0:
|
||||
*}
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: assertRaises
|
||||
# key: ar
|
||||
# name: assertRaisesWith
|
||||
# key: arw
|
||||
# --
|
||||
with self.assertRaises(${1:Exception}):
|
||||
$0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name:args
|
||||
# name: args
|
||||
# key: args
|
||||
# --
|
||||
if [ $# -lt ${1:2} ]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name : case
|
||||
# name: case
|
||||
# key: case
|
||||
# --
|
||||
case ${1:cond} in
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name : select
|
||||
# name: select
|
||||
# key: select
|
||||
# --
|
||||
select ${1:var} in ${2:stuff}; do
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
html-mode
|
||||
js-mode
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
(define-package "yasnippet-snippets" "20200606.1149" "Collection of yasnippet snippets"
|
||||
'((yasnippet "0.8.0")
|
||||
(s "1.12.0"))
|
||||
:commit "d5ef8ed2b34798c1576f2fbfed858ee5486d1792" :keywords
|
||||
'("snippets")
|
||||
:authors
|
||||
(define-package "yasnippet-snippets" "20210910.1959" "Collection of yasnippet snippets"
|
||||
'((yasnippet "0.8.0"))
|
||||
:commit "f50b4c16ca2a73fd04ebd301f0bf2f5ab6107d88" :authors
|
||||
'(("Andrea Crotti" . "andrea.crotti.0@gmail.com"))
|
||||
:maintainer
|
||||
'("Andrea Crotti" . "andrea.crotti.0@gmail.com"))
|
||||
'("Andrea Crotti" . "andrea.crotti.0@gmail.com")
|
||||
:keywords
|
||||
'("snippets")
|
||||
:url "https://github.com/AndreaCrotti/yasnippet-snippets")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
|
||||
;; Author: Andrea Crotti <andrea.crotti.0@gmail.com>
|
||||
;; Keywords: snippets
|
||||
;; Version: 0.2
|
||||
;; Package-Requires: ((yasnippet "0.8.0") (s "1.12.0"))
|
||||
;; Version: 1.0
|
||||
;; Package-Requires: ((yasnippet "0.8.0"))
|
||||
;; Keywords: convenience, snippets
|
||||
;; Homepage: https://github.com/AndreaCrotti/yasnippet-snippets
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user