diff options
Diffstat (limited to 'templates')
27 files changed, 0 insertions, 304 deletions
diff --git a/templates/auto-insert/.yas-setup.el b/templates/auto-insert/.yas-setup.el deleted file mode 100644 index ed5d6b9..0000000 --- a/templates/auto-insert/.yas-setup.el +++ /dev/null @@ -1,73 +0,0 @@ -;;; .yas-setup.el --- Utility functions for c-mode -*- lexical-binding: t; -*- - -;; Copyright (C) 2018 Benj Bellon - -;; Author: Benj Bellon <benj@benj-ad1> -;; Keywords: c - -;; 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 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 <https://www.gnu.org/licenses/>. - -;;; Commentary: - -;; As description - -;;; Code: -(require 'dash) - -(defun fetch-project-path (root-dir) - "Retrieve path from project's root-dir to file as list. -NOTE: The closest parent root-dir is considered the root. -ROOT-DIR: the root directory with no path delimiters." - (let* ((full-path (locate-dominating-file buffer-file-name root-dir))) - (if full-path - (let* ((proj-root-dir (nth 1 (reverse (split-string full-path "/")))) - (full-path-list (cons proj-root-dir - (-flatten (cdr (-split-on proj-root-dir (split-string buffer-file-name "/"))))))) - - ;; turn dashes into underscores - (mapcar (lambda (x) (replace-regexp-in-string "-" "_" x)) - full-path-list)) - nil) - )) - -(defun build-include-guard-header (root-dir) - "Create a full include guard header for c files. -If the path cannot be found, just use the filename. -ROOT-DIR: the root directory with no path delimiters. -FORMAT: PROJDIR_FULL_PATH_TO_FILE_H" - (if (fetch-project-path root-dir) - (let* ((path-no-file (reverse (cdr (reverse (fetch-project-path root-dir))))) - (file-no-ext (car (split-string (car (reverse (fetch-project-path root-dir))) "\\." t)))) - (concat - (mapconcat 'identity - (mapcar 'upcase - (reverse (cons file-no-ext (reverse path-no-file)))) "_") - "_H") - ) - ;; no lazy evaluation, so just do it here - (concat - (upcase - (car (-filter (lambda (x) (not (s-blank? x))) - (split-string - (car (reverse (split-string buffer-file-name "/"))) - "\\.")))) - "_H") - )) - -(defun git-include-guard-path () - "Build include guard headers for git projects." - (build-include-guard-header ".git")) - -(provide '.yas-setup) -;;; .yas-setup.el ends here diff --git a/templates/auto-insert/template.c b/templates/auto-insert/template.c deleted file mode 100644 index d9afc65..0000000 --- a/templates/auto-insert/template.c +++ /dev/null @@ -1,7 +0,0 @@ -/* - * @file `(buffer-name)` - * @brief $0 - * - * @author `user-full-name` - * @date `(format-time-string "%Y-%m-%d")` - */ diff --git a/templates/auto-insert/template.cc b/templates/auto-insert/template.cc deleted file mode 100644 index d9afc65..0000000 --- a/templates/auto-insert/template.cc +++ /dev/null @@ -1,7 +0,0 @@ -/* - * @file `(buffer-name)` - * @brief $0 - * - * @author `user-full-name` - * @date `(format-time-string "%Y-%m-%d")` - */ diff --git a/templates/auto-insert/template.h b/templates/auto-insert/template.h deleted file mode 100644 index 408e09d..0000000 --- a/templates/auto-insert/template.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @file `(buffer-name)` - * @brief $1 - * - * $2 - * - * @author `user-full-name` - * @date `(format-time-string "%Y-%m-%d")` - */ - -#ifndef `(git-include-guard-path)` -#define `(git-include-guard-path)` - -$0 - -#endif diff --git a/templates/auto-insert/template.hh b/templates/auto-insert/template.hh deleted file mode 100644 index 408e09d..0000000 --- a/templates/auto-insert/template.hh +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @file `(buffer-name)` - * @brief $1 - * - * $2 - * - * @author `user-full-name` - * @date `(format-time-string "%Y-%m-%d")` - */ - -#ifndef `(git-include-guard-path)` -#define `(git-include-guard-path)` - -$0 - -#endif diff --git a/templates/snippets/c++-mode/doxycomments b/templates/snippets/c++-mode/doxycomments deleted file mode 120000 index 62fd598..0000000 --- a/templates/snippets/c++-mode/doxycomments +++ /dev/null @@ -1 +0,0 @@ -../doxygen/doxycomments
\ No newline at end of file diff --git a/templates/snippets/c-mode/doxycomments b/templates/snippets/c-mode/doxycomments deleted file mode 120000 index 62fd598..0000000 --- a/templates/snippets/c-mode/doxycomments +++ /dev/null @@ -1 +0,0 @@ -../doxygen/doxycomments
\ No newline at end of file diff --git a/templates/snippets/c-mode/headerDEF b/templates/snippets/c-mode/headerDEF deleted file mode 100644 index a07587b..0000000 --- a/templates/snippets/c-mode/headerDEF +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: headerDEF -# key: #if -# -- -#ifndef -#define - -#endif
\ No newline at end of file diff --git a/templates/snippets/clojure-mode/defn b/templates/snippets/clojure-mode/defn deleted file mode 100644 index 0907e4a..0000000 --- a/templates/snippets/clojure-mode/defn +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: defn -# key: defn -# -- -defn ${1:name} - "${2:docstring}" - [${3:arg-list}] - $0
\ No newline at end of file diff --git a/templates/snippets/clojure-mode/let b/templates/snippets/clojure-mode/let deleted file mode 100644 index 426caa2..0000000 --- a/templates/snippets/clojure-mode/let +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: let -# key: let -# -- -let [$0] diff --git a/templates/snippets/doxygen/doxycomments b/templates/snippets/doxygen/doxycomments deleted file mode 100644 index 94209bc..0000000 --- a/templates/snippets/doxygen/doxycomments +++ /dev/null @@ -1,48 +0,0 @@ -# -*- mode: snippet -*- -# name: doxcomments -# key: dox -# type: command -# -- -;; Command to generate doxygen comments for c functions - -(defun flatten (ls) - "Implements standard flatten function" - (cond - ((atom ls) (list ls)) - ((null (cdr ls)) (flatten (car ls))) - (t (append (flatten (car ls)) (flatten (cdr ls)))))) - -(defun find-retval () - "Returns the return value of the next parsed function" - (interactive) - (let ((struct-type "struct")) - (search-forward "(" nil t) - (move-beginning-of-line nil) - (let ((return-type (thing-at-point 'symbol))) - (if (string= return-type struct-type) - "NOT_IMPLEMENTED" - return-type)))) - -(defun find-args () - "Returns a list of function args for the next parsed function" - (interactive) - (let* ((struct-type "struct") - (start (search-forward "(" nil t)) - (end (search-forward ")" nil t)) - (args-string (buffer-substring-no-properties start (1- end))) - (args (mapcar 'string-trim-left (split-string args-string "," t)))) - (mapcar (lambda (x) (car (reverse x))) (mapcar 'split-string args)))) - -(let* ((retval (find-retval)) - (args (find-args)) - (args-len (length args)) - (brief "@brief $1\n *") - (params (mapcar (lambda (x) (format "@param: %s ${%d:}" (cdr x) (car x))) - (mapcar* 'cons - (mapcar '1+ (number-sequence 1 args-len)) - args))) - (retval (format "@return %s $0" retval)) - (snippet-text (mapconcat 'identity (flatten (list "/**" brief params (concat "\n * " retval))) - "\n * "))) - (move-beginning-of-line nil) - (yas-expand-snippet (concat snippet-text "\n*/\n"))) diff --git a/templates/snippets/org-mode/blockquote b/templates/snippets/org-mode/blockquote deleted file mode 100644 index 82a837c..0000000 --- a/templates/snippets/org-mode/blockquote +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: blockquote -# key: > -# -- -#+begin_quote -$0 -#+end_quote
\ No newline at end of file diff --git a/templates/snippets/org-mode/codeblock b/templates/snippets/org-mode/codeblock deleted file mode 100644 index 88ddca4..0000000 --- a/templates/snippets/org-mode/codeblock +++ /dev/null @@ -1,7 +0,0 @@ -# -*- mode: snippet -*- -# name: codeblock -# key: ``` -# -- -#+begin_src $1 -$0 -#+end_src
\ No newline at end of file diff --git a/templates/snippets/org-mode/screenplay-block-left b/templates/snippets/org-mode/screenplay-block-left deleted file mode 100644 index e825b88..0000000 --- a/templates/snippets/org-mode/screenplay-block-left +++ /dev/null @@ -1,6 +0,0 @@ -# key: "l -# name: screenplay-block-left -# -- -#+BEGIN_SCREENPLAY_LEFT -$0 -#+END_SCREENPLAY_LEFT
\ No newline at end of file diff --git a/templates/snippets/org-mode/screenplay-block-right b/templates/snippets/org-mode/screenplay-block-right deleted file mode 100644 index 84b7136..0000000 --- a/templates/snippets/org-mode/screenplay-block-right +++ /dev/null @@ -1,6 +0,0 @@ -# key: "r -# name: screenplay-block-right -# -- -#+BEGIN_SCREENPLAY_RIGHT -$0 -#+END_SCREENPLAY_RIGHT
\ No newline at end of file diff --git a/templates/snippets/python-mode/import_from b/templates/snippets/python-mode/import_from deleted file mode 100644 index 767f344..0000000 --- a/templates/snippets/python-mode/import_from +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: import_from -# key: from -# -- -from $1 import $0 diff --git a/templates/snippets/python-mode/lambda b/templates/snippets/python-mode/lambda deleted file mode 100644 index 08b268b..0000000 --- a/templates/snippets/python-mode/lambda +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: lambda -# key: lam -# -- -lambda ${1:x}: $0
\ No newline at end of file diff --git a/templates/snippets/python-mode/print b/templates/snippets/python-mode/print deleted file mode 100644 index 2392fbd..0000000 --- a/templates/snippets/python-mode/print +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: print -# key: print -# -- -print("$0")
\ No newline at end of file diff --git a/templates/snippets/python-mode/print format b/templates/snippets/python-mode/print format deleted file mode 100644 index 704cb53..0000000 --- a/templates/snippets/python-mode/print format +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: print format -# key: printf -# -- -print("$1".format($0))
\ No newline at end of file diff --git a/templates/snippets/python-mode/script b/templates/snippets/python-mode/script deleted file mode 100644 index 3113da9..0000000 --- a/templates/snippets/python-mode/script +++ /dev/null @@ -1,10 +0,0 @@ -# -*- mode: snippet -*- -# name: script -# key: script -# -- -#!/usr/bin/env python -def main(): - ${1:pass} - -if __name__ == '__main__': - main()
\ No newline at end of file diff --git a/templates/snippets/rustic-mode/assert b/templates/snippets/rustic-mode/assert deleted file mode 100644 index 4d823f3..0000000 --- a/templates/snippets/rustic-mode/assert +++ /dev/null @@ -1,4 +0,0 @@ -me : assert -#key : as -# -- -assert!(${1:truth}); diff --git a/templates/snippets/rustic-mode/assert_eq b/templates/snippets/rustic-mode/assert_eq deleted file mode 100644 index 18e9e8b..0000000 --- a/templates/snippets/rustic-mode/assert_eq +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -#name : assert_eq -#key : ase -# -- -assert_eq!(${1:a}, ${2:b}); diff --git a/templates/snippets/rustic-mode/derive_debug b/templates/snippets/rustic-mode/derive_debug deleted file mode 100644 index 6d64312..0000000 --- a/templates/snippets/rustic-mode/derive_debug +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: derive-debug -# key: debug -# -- -#[derive(Debug)] diff --git a/templates/snippets/rustic-mode/print_debug b/templates/snippets/rustic-mode/print_debug deleted file mode 100644 index 5ae259f..0000000 --- a/templates/snippets/rustic-mode/print_debug +++ /dev/null @@ -1,5 +0,0 @@ -# -*- mode: snippet -*- -# name: println!("{:#?}", value); -# key: log -# -- -println!("{:#?}", ${1:value}); diff --git a/templates/snippets/rustic-mode/test b/templates/snippets/rustic-mode/test deleted file mode 100644 index 837276f..0000000 --- a/templates/snippets/rustic-mode/test +++ /dev/null @@ -1,8 +0,0 @@ -# -*- mode: snippet -*- -# name: test -# key: test -# -- -#[test] -fn it_works() { - assert_eq!(2 + 2, 4); -} diff --git a/templates/snippets/sql-mode/primitive-return-function b/templates/snippets/sql-mode/primitive-return-function deleted file mode 100644 index bb7e79e..0000000 --- a/templates/snippets/sql-mode/primitive-return-function +++ /dev/null @@ -1,13 +0,0 @@ -# key: fnp -# name: Create function with primitive return value. -# -- -drop function if exists $1(); -create or replace function $1( - $0 -) -returns $2 as $$ -declare -begin - -end; -$$ language plpgsql;
\ No newline at end of file diff --git a/templates/snippets/sql-mode/record-return-fuction b/templates/snippets/sql-mode/record-return-fuction deleted file mode 100644 index a3894c4..0000000 --- a/templates/snippets/sql-mode/record-return-fuction +++ /dev/null @@ -1,18 +0,0 @@ -# key: fn -# name: create a function which returns a full record -# -- -drop type if exists $1_ret cascade; -create type $1_ret as ( - $2 -); - -drop function if exists $1(); -create or replace function $1( - $3 -) -returns setof $1_ret as $$ -declare -begin - $0 -end; -$$ language plpgsql; |
