181
emacs/.emacs
Normal file
181
emacs/.emacs
Normal file
@@ -0,0 +1,181 @@
|
||||
;;; package --- summary
|
||||
;; auctex -- installed -- Integrated environment for *TeX*
|
||||
;; dummyparens -- installed -- paranthesis auto-pairing and wrapping
|
||||
;; elpy -- installed -- Emacs Python Development Environment
|
||||
;; flycheck -- installed -- On-the-fly syntax checking
|
||||
;; forest-blue-theme -- installed -- Emacs theme with a dark background
|
||||
;; google-this -- installed -- A set of functions and bindings to google under point
|
||||
;; nyan-mode -- installed -- Nyan Cat shows position in current buffer in mode-line.
|
||||
;; rainbow-mode -- installed -- Colorize color names in buffers
|
||||
;; company -- dependency -- Modular text completion framework
|
||||
;; dash -- dependency -- A modern list library for Emacs
|
||||
;; epl -- dependency -- Emacs Package Library
|
||||
;; find-file-in-project -- dependency -- Find file/directory for review Diff/Patch/Commit efficiently everywhere
|
||||
;; highlight-indentation -- dependency -- Minor modes for highlight indentation
|
||||
;; ivy -- dependency -- Incremental Vertical completYon
|
||||
;; pkg-info -- dependency -- Information about packages
|
||||
;; popup -- dependency -- Visual Popup User Interface
|
||||
;; pyvenv -- dependency -- Python virtual environment interface
|
||||
;; s -- dependency -- The long lost Emacs string manipulation library.
|
||||
;; yasnippet -- dependency -- Yet another snippet extension for Emacs.
|
||||
|
||||
;;; Code:
|
||||
(package-initialize)
|
||||
|
||||
;; Package Repos
|
||||
(when (>= emacs-major-version 24)
|
||||
(require 'package)
|
||||
(add-to-list
|
||||
'package-archives
|
||||
; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
|
||||
'("melpa" . "http://melpa.milkbox.net/packages/")
|
||||
'("elpy" . "http://jorgenschaefer.github.io/packages/")
|
||||
)
|
||||
)
|
||||
;; Global functions
|
||||
|
||||
; Copy and Paste
|
||||
; https://github.com/Boruch-Baum
|
||||
(defun my-copy-to-xclipboard(arg)
|
||||
(interactive "P")
|
||||
(cond
|
||||
((not (use-region-p))
|
||||
(message "Nothing to yank to X-clipboard"))
|
||||
((and (not (display-graphic-p))
|
||||
(/= 0 (shell-command-on-region
|
||||
(region-beginning) (region-end) "xsel -i -b")))
|
||||
(error "Is program `xsel' installed?"))
|
||||
(t
|
||||
(when (display-graphic-p)
|
||||
(call-interactively 'clipboard-kill-ring-save))
|
||||
(message "Yanked region to X-clipboard")
|
||||
(when arg
|
||||
(kill-region (region-beginning) (region-end)))
|
||||
(deactivate-mark))))
|
||||
|
||||
(defun my-cut-to-xclipboard()
|
||||
(interactive)
|
||||
(my-copy-to-xclipboard t))
|
||||
|
||||
(defun my-paste-from-xclipboard()
|
||||
"Uses shell command `xsel -o' to paste from x-clipboard. With
|
||||
one prefix arg, pastes from X-PRIMARY, and with two prefix args,
|
||||
pastes from X-SECONDARY."
|
||||
(interactive)
|
||||
(if (display-graphic-p)
|
||||
(clipboard-yank)
|
||||
(let*
|
||||
((opt (prefix-numeric-value current-prefix-arg))
|
||||
(opt (cond
|
||||
((= 1 opt) "b")
|
||||
((= 4 opt) "p")
|
||||
((= 16 opt) "s"))))
|
||||
(insert (shell-command-to-string (concat "xsel -o -" opt))))))
|
||||
|
||||
;; Theme
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(custom-safe-themes
|
||||
(quote
|
||||
("66881e95c0eda61d34aa7f08ebacf03319d37fe202d68ecf6a1dbfd49d664bc3" default)))
|
||||
'(dp-pairs
|
||||
(quote
|
||||
(("(" ")" nil)
|
||||
("[" "]" nil)
|
||||
("{" "}" dp-brace-post-handler))))
|
||||
'(elpy-dedicated-shells t)
|
||||
'(elpy-shell-display-buffer-after-send t)
|
||||
'(global-font-lock-mode t)
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(auto-complete nyan-mode google-this dummyparens flycheck rainbow-mode elpy auctex forest-blue-theme))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(font-latex-bold-face ((t (:foreground "brightcyan"))))
|
||||
'(font-latex-sedate-face ((t (:foreground "brightcyan"))))
|
||||
'(font-lock-comment-face ((t (:foreground "color-142"))))
|
||||
'(font-lock-doc-face ((t (:foreground "color-83"))))
|
||||
'(font-lock-keyword-face ((t (:foreground "brightcyan" :weight bold))))
|
||||
'(font-lock-type-face ((t (:foreground "green"))))
|
||||
'(highlight-indentation-face ((t (:background "green")))))
|
||||
|
||||
|
||||
;; Functions:
|
||||
; Load Theme
|
||||
(load-theme 'forest-blue t)
|
||||
|
||||
; Python
|
||||
(elpy-enable)
|
||||
(defalias 'workon 'pyvenv-workon)
|
||||
(workon "~/.virtualenv/default")
|
||||
|
||||
(defun pyexec ()
|
||||
"Execute the python program in an external terminal."
|
||||
(interactive)
|
||||
(when buffer-file-name
|
||||
(shell-command (concat "termite --hold -e \"python " buffer-file-name "\""))
|
||||
)
|
||||
)
|
||||
|
||||
; C++
|
||||
(defun cppexec ()
|
||||
"Execute the cpp program in an external terminal."
|
||||
(interactive)
|
||||
(when buffer-file-name
|
||||
(shell-command (concat "termite -e \"g++ " buffer-file-name "\""))
|
||||
(shell-command (concat "termite --hold -e \"./a.out\""))
|
||||
)
|
||||
)
|
||||
|
||||
; LaTeX
|
||||
(require 'tex)
|
||||
(setq TeX-auto-save t)
|
||||
(setq TeX-parse-self t)
|
||||
(setq-default TeX-master nil)
|
||||
|
||||
(fset 'next-section
|
||||
(lambda (&optional arg) "Next section." (interactive "p") (kmacro-exec-ring-item (quote ("\\sec
|
||||
" 0 "%d")) arg)))
|
||||
(fset 'prev-section
|
||||
(lambda (&optional arg) "Previous section" (interactive "p") (kmacro-exec-ring-item (quote ("\\sec
|
||||
" 0 "%d")) arg)))
|
||||
|
||||
; Yasnippet
|
||||
(setq yas-snippet-dirs
|
||||
'("~/.emacs.d/snippets" ;; personal snippets/copied ones
|
||||
)
|
||||
)
|
||||
|
||||
;; Modes
|
||||
(show-paren-mode 1)
|
||||
(menu-bar-mode -1)
|
||||
(google-this-mode 1)
|
||||
(nyan-mode 1)
|
||||
(TeX-global-PDF-mode t)
|
||||
(yas-global-mode t)
|
||||
(global-dummyparens-mode)
|
||||
(add-hook 'after-init-hook #'global-flycheck-mode)
|
||||
|
||||
;; Custom Keybinds
|
||||
(global-set-key (kbd "C-c C-w") 'my-cut-to-xclipboard)
|
||||
(global-set-key (kbd "C-c M-w") 'my-copy-to-xclipboard)
|
||||
(global-set-key (kbd "C-c M-y") 'my-paste-from-xclipboard)
|
||||
(global-set-key (kbd "C-x g") 'google-this-mode-submap)
|
||||
(eval-after-load 'latex
|
||||
'(define-key LaTeX-mode-map (kbd "C-c n") 'next-section))
|
||||
(eval-after-load 'latex
|
||||
'(define-key LaTeX-mode-map (kbd "C-c p") 'prev-section))
|
||||
(eval-after-load 'cc-mode
|
||||
'(define-key c++-mode-map (kbd "C-c C-c") 'cppexec))
|
||||
(eval-after-load 'elpy
|
||||
'(define-key elpy-mode-map (kbd "C-c C-c") 'pyexec)
|
||||
)
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
1
emacs/.emacs.d/snippets/c++-mode/.yas-parents
Normal file
1
emacs/.emacs.d/snippets/c++-mode/.yas-parents
Normal file
@@ -0,0 +1 @@
|
||||
cc-mode
|
||||
12
emacs/.emacs.d/snippets/c++-mode/.yas-setup.el
Normal file
12
emacs/.emacs.d/snippets/c++-mode/.yas-setup.el
Normal file
@@ -0,0 +1,12 @@
|
||||
(require 'yasnippet)
|
||||
|
||||
(defun yas-c++-class-name (str)
|
||||
"Search for a class name like `DerivedClass' in STR
|
||||
(which may look like `DerivedClass : ParentClass1, ParentClass2, ...')
|
||||
|
||||
If found, the class name is returned, otherwise STR is returned"
|
||||
(yas-substr str "[^: ]*"))
|
||||
|
||||
(defun yas-c++-class-method-declare-choice ()
|
||||
"Choose and return the end of a C++11 class method declaration"
|
||||
(yas-choose-value '(";" " = default;" " = delete;")))
|
||||
BIN
emacs/.emacs.d/snippets/c++-mode/.yas-setup.elc
Normal file
BIN
emacs/.emacs.d/snippets/c++-mode/.yas-setup.elc
Normal file
Binary file not shown.
8
emacs/.emacs.d/snippets/c++-mode/acl
Normal file
8
emacs/.emacs.d/snippets/c++-mode/acl
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: accumulate
|
||||
# key: acl
|
||||
# --
|
||||
auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0, [](int total, $2) {
|
||||
$3
|
||||
});
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/acm
Normal file
6
emacs/.emacs.d/snippets/c++-mode/acm
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: accumulate
|
||||
# key: acm
|
||||
# --
|
||||
auto sum = std::accumulate(std::begin(${1:container}), std::end($1), 0);
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/ajf
Normal file
9
emacs/.emacs.d/snippets/c++-mode/ajf
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: adjacent_find
|
||||
# key: ajf
|
||||
# --
|
||||
auto pos = std::adjacent_find(std::begin(${1:container}), std::end($1));
|
||||
if (pos != std::end($1)) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
10
emacs/.emacs.d/snippets/c++-mode/alo
Normal file
10
emacs/.emacs.d/snippets/c++-mode/alo
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: all_of
|
||||
# key: alo
|
||||
# --
|
||||
if (std::all_of(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
})) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
10
emacs/.emacs.d/snippets/c++-mode/ano
Normal file
10
emacs/.emacs.d/snippets/c++-mode/ano
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: any_of
|
||||
# key: ano
|
||||
# --
|
||||
if (std::any_of(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
})) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/assert
Normal file
5
emacs/.emacs.d/snippets/c++-mode/assert
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: assert
|
||||
# key: ass
|
||||
# --
|
||||
assert($0);
|
||||
5
emacs/.emacs.d/snippets/c++-mode/beginend
Normal file
5
emacs/.emacs.d/snippets/c++-mode/beginend
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name : v.begin(), v.end()
|
||||
# key: beginend
|
||||
# --
|
||||
${1:v}.begin(), $1.end
|
||||
7
emacs/.emacs.d/snippets/c++-mode/boost_require
Normal file
7
emacs/.emacs.d/snippets/c++-mode/boost_require
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: boost_require
|
||||
# key: req
|
||||
# group: boost
|
||||
# --
|
||||
BOOST_REQUIRE( ${1:condition} );
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/cerr
Normal file
5
emacs/.emacs.d/snippets/c++-mode/cerr
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: cerr
|
||||
# key: err
|
||||
# --
|
||||
cerr << $0;
|
||||
5
emacs/.emacs.d/snippets/c++-mode/cin
Normal file
5
emacs/.emacs.d/snippets/c++-mode/cin
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: cin
|
||||
# key: cin
|
||||
# --
|
||||
cin >> $0;
|
||||
11
emacs/.emacs.d/snippets/c++-mode/class
Normal file
11
emacs/.emacs.d/snippets/c++-mode/class
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: class
|
||||
# key: cls
|
||||
# --
|
||||
class ${1:Name}
|
||||
{
|
||||
public:
|
||||
${1:$(yas/substr yas-text "[^: ]*")}();
|
||||
${2:virtual ~${1:$(yas/substr yas-text "[^: ]*")}();}
|
||||
};
|
||||
$0
|
||||
44
emacs/.emacs.d/snippets/c++-mode/class11
Normal file
44
emacs/.emacs.d/snippets/c++-mode/class11
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: class11
|
||||
# key: cls11
|
||||
# group: c++11
|
||||
# uuid: d7c41f87-9b8a-479d-bb12-89f4cbdd46a7
|
||||
# contributor: Ved Vyas
|
||||
# desc: Snippet for C++11 classes based on c++-mode/class. Allows for Rule of
|
||||
# [0, All]. A choice between ";", " = default;", and " = delete;" is presented
|
||||
# for each method. The methods and some of the optional keywords/specifiers are
|
||||
# exposed as fields that users can easily skip-and-clear.
|
||||
# Hackish query-replace-regexp to renumber non-mirror fields in the region
|
||||
# between public and protected (can use N as a field number in the snippet):
|
||||
# \${[0-9N]*:\([^\$]\) -> ${\,(+ 2 \#):\1
|
||||
# References:
|
||||
# 1. http://en.cppreference.com/w/cpp/language/rule_of_three#Rule_of_five
|
||||
# 2. https://en.wikipedia.org/wiki/Rule_of_three_%28C%2B%2B_programming%29#Example_in_C.2B.2B
|
||||
# 3. http://stackoverflow.com/a/4782927
|
||||
# --
|
||||
class ${1:Name}
|
||||
{
|
||||
public:
|
||||
${2: ${3://! Default constructor
|
||||
}${1:$(yas-c++-class-name yas-text)}()${4:;$(yas-c++-class-method-declare-choice)}
|
||||
|
||||
}${5: ${6://! Copy constructor
|
||||
}${1:$(yas-c++-class-name yas-text)}(const ${1:$(yas-c++-class-name yas-text)} &other)${7:;$(yas-c++-class-method-declare-choice)}
|
||||
|
||||
}${8: ${9://! Move constructor
|
||||
}${1:$(yas-c++-class-name yas-text)}(${1:$(yas-c++-class-name yas-text)} &&other)${10: noexcept}${11:;$(yas-c++-class-method-declare-choice)}
|
||||
|
||||
}${12: ${13://! Destructor
|
||||
}${14:virtual }~${1:$(yas-c++-class-name yas-text)}()${15: noexcept}${16:;$(yas-c++-class-method-declare-choice)}
|
||||
|
||||
}${17: ${18://! Copy assignment operator
|
||||
}${1:$(yas-c++-class-name yas-text)}& operator=(const ${1:$(yas-c++-class-name yas-text)} &other)${19:;$(yas-c++-class-method-declare-choice)}
|
||||
|
||||
}${20: ${21://! Move assignment operator
|
||||
}${1:$(yas-c++-class-name yas-text)}& operator=(${1:$(yas-c++-class-name yas-text)} &&other)${22: noexcept}${23:;$(yas-c++-class-method-declare-choice)}
|
||||
|
||||
}$0
|
||||
|
||||
protected:
|
||||
private:
|
||||
};
|
||||
8
emacs/.emacs.d/snippets/c++-mode/cni
Normal file
8
emacs/.emacs.d/snippets/c++-mode/cni
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: count_if
|
||||
# key: cni
|
||||
# --
|
||||
auto n = std::count_if(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
});
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/cnt
Normal file
6
emacs/.emacs.d/snippets/c++-mode/cnt
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: count
|
||||
# key: cnt
|
||||
# --
|
||||
auto n = std::count(std::begin(${1:container}), std::end($1), $2);
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/const_[]
Normal file
8
emacs/.emacs.d/snippets/c++-mode/const_[]
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: const_[]
|
||||
# key: c[
|
||||
# --
|
||||
const ${1:Type}& operator[](${2:int index}) const
|
||||
{
|
||||
$0
|
||||
}
|
||||
8
emacs/.emacs.d/snippets/c++-mode/constructor
Normal file
8
emacs/.emacs.d/snippets/c++-mode/constructor
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: constructor
|
||||
# key: ct
|
||||
# --
|
||||
${1:Class}::$1(${2:args}) ${3: : ${4:init}}
|
||||
{
|
||||
$0
|
||||
}
|
||||
8
emacs/.emacs.d/snippets/c++-mode/cout
Normal file
8
emacs/.emacs.d/snippets/c++-mode/cout
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# contributor: York Zhao <gtdplatform@gmail.com>
|
||||
# name: cout
|
||||
# key: cout
|
||||
# --
|
||||
`(progn (goto-char (point-min)) (unless (re-search-forward
|
||||
"^using\\s-+namespace std;" nil 'no-errer) "std::"))
|
||||
`cout << $0${1: << "${2:\n}"};
|
||||
6
emacs/.emacs.d/snippets/c++-mode/cpb
Normal file
6
emacs/.emacs.d/snippets/c++-mode/cpb
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: copy_backward
|
||||
# key: cpb
|
||||
# --
|
||||
std::copy_backward(std::begin(${1:container}), std::end($1), std::end($1));
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/cpi
Normal file
9
emacs/.emacs.d/snippets/c++-mode/cpi
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: copy_if
|
||||
# key: cpi
|
||||
# --
|
||||
std::copy_if(std::begin(${1:container}), std::end($1), std::begin($2),
|
||||
[]($3) {
|
||||
$4
|
||||
});
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/cpn
Normal file
6
emacs/.emacs.d/snippets/c++-mode/cpn
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: copy_n
|
||||
# key: cpn
|
||||
# --
|
||||
std::copy_n(std::begin(${1:container}), $2, std::end($1));
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/cpp
Normal file
5
emacs/.emacs.d/snippets/c++-mode/cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: cpp
|
||||
# key: cpp
|
||||
# --
|
||||
#include "`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`.h"
|
||||
6
emacs/.emacs.d/snippets/c++-mode/cpy
Normal file
6
emacs/.emacs.d/snippets/c++-mode/cpy
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: copy
|
||||
# key: cpy
|
||||
# --
|
||||
std::copy(std::begin(${1:container}), std::end($1), std::begin($2));
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/cstd
Normal file
5
emacs/.emacs.d/snippets/c++-mode/cstd
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: cstd
|
||||
# key: cstd
|
||||
# --
|
||||
#include <cstdlib>
|
||||
5
emacs/.emacs.d/snippets/c++-mode/d+=
Normal file
5
emacs/.emacs.d/snippets/c++-mode/d+=
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d+=
|
||||
# key: d+=
|
||||
# --
|
||||
${1:MyClass}& operator+=(${2:const $1 &});
|
||||
5
emacs/.emacs.d/snippets/c++-mode/d_operator
Normal file
5
emacs/.emacs.d/snippets/c++-mode/d_operator
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d_operator<<
|
||||
# key: <<
|
||||
# --
|
||||
friend std::ostream& operator<<(std::ostream&, const ${1:Class}&);
|
||||
5
emacs/.emacs.d/snippets/c++-mode/d_operator[]
Normal file
5
emacs/.emacs.d/snippets/c++-mode/d_operator[]
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d_operator[]
|
||||
# key: [
|
||||
# --
|
||||
${1:Type}& operator[](${2:int index});
|
||||
5
emacs/.emacs.d/snippets/c++-mode/d_operator[]_const
Normal file
5
emacs/.emacs.d/snippets/c++-mode/d_operator[]_const
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d_operator[]_const
|
||||
# key: c[
|
||||
# --
|
||||
const ${1:Type}& operator[](${2:int index}) const;
|
||||
5
emacs/.emacs.d/snippets/c++-mode/d_operator_istream
Normal file
5
emacs/.emacs.d/snippets/c++-mode/d_operator_istream
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d_operator>>
|
||||
# key: >>
|
||||
# --
|
||||
friend std::istream& operator>>(std::istream&, const ${1:Class}&);
|
||||
5
emacs/.emacs.d/snippets/c++-mode/d_operator_ostream
Normal file
5
emacs/.emacs.d/snippets/c++-mode/d_operator_ostream
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: d_operator<<
|
||||
# key: <<
|
||||
# --
|
||||
friend std::ostream& operator<<(std::ostream&, const ${1:Class}&);
|
||||
5
emacs/.emacs.d/snippets/c++-mode/delete
Normal file
5
emacs/.emacs.d/snippets/c++-mode/delete
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: delete
|
||||
# key: dl
|
||||
# --
|
||||
delete ${1:pointer};
|
||||
5
emacs/.emacs.d/snippets/c++-mode/delete[]
Normal file
5
emacs/.emacs.d/snippets/c++-mode/delete[]
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: delete[]
|
||||
# key: dla
|
||||
# --
|
||||
delete[] ${1:arr};
|
||||
7
emacs/.emacs.d/snippets/c++-mode/doc
Normal file
7
emacs/.emacs.d/snippets/c++-mode/doc
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: doc
|
||||
# key: doc
|
||||
# --
|
||||
/**
|
||||
* $0
|
||||
*/
|
||||
5
emacs/.emacs.d/snippets/c++-mode/dynamic_casting
Normal file
5
emacs/.emacs.d/snippets/c++-mode/dynamic_casting
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: dynamic_casting
|
||||
# key: cast
|
||||
# --
|
||||
check_and_cast<${1:Type} *>(${2:msg});
|
||||
7
emacs/.emacs.d/snippets/c++-mode/enum
Normal file
7
emacs/.emacs.d/snippets/c++-mode/enum
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: enum
|
||||
# key: enum
|
||||
# --
|
||||
enum ${1:NAME}{
|
||||
$0
|
||||
};
|
||||
8
emacs/.emacs.d/snippets/c++-mode/eql
Normal file
8
emacs/.emacs.d/snippets/c++-mode/eql
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: equal
|
||||
# key: eql
|
||||
# --
|
||||
if (std::equal(std::begin(${1:container}), std::end($1), std::begin($2))) {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/erm
Normal file
6
emacs/.emacs.d/snippets/c++-mode/erm
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: remove
|
||||
# key: erm
|
||||
# --
|
||||
${1:container}.erase(std::remove(std::begin($1), std::end($1), $2), std::end($1));
|
||||
$0
|
||||
10
emacs/.emacs.d/snippets/c++-mode/ffo
Normal file
10
emacs/.emacs.d/snippets/c++-mode/ffo
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find_first_of
|
||||
# key: ffo
|
||||
# --
|
||||
auto pos = std::find_first_of(std::begin(${1:container}), std::end($1),
|
||||
std::begin($2), std::end($3));
|
||||
if (pos != std::end($1)) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/fil
Normal file
6
emacs/.emacs.d/snippets/c++-mode/fil
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: fill
|
||||
# key: fil
|
||||
# --
|
||||
std::fill(std::begin(${1:container}), std::end($1), $2);
|
||||
$0
|
||||
11
emacs/.emacs.d/snippets/c++-mode/fin
Normal file
11
emacs/.emacs.d/snippets/c++-mode/fin
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find_if_not
|
||||
# key: fin
|
||||
# --
|
||||
auto pos = std::find_if_not(std::begin(${1:container}), std::end($1),[]($2) {
|
||||
$3
|
||||
});
|
||||
if (pos != std::end($1)) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/fixture
Normal file
9
emacs/.emacs.d/snippets/c++-mode/fixture
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: fixture
|
||||
# key: fixt
|
||||
# --
|
||||
BOOST_FIXTURE_TEST_SUITE( ${1:name}, ${2:Fixture} )
|
||||
|
||||
$0
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
6
emacs/.emacs.d/snippets/c++-mode/fln
Normal file
6
emacs/.emacs.d/snippets/c++-mode/fln
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: fill_n
|
||||
# key: fln
|
||||
# --
|
||||
std::fill_n(std::begin(${1:container}), $2, $3);
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/fnd
Normal file
9
emacs/.emacs.d/snippets/c++-mode/fnd
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find
|
||||
# key: fnd
|
||||
# --
|
||||
auto pos = std::find(std::begin(${1:container}), std::end($1), $2);
|
||||
if (pos != std::end($1)) {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
10
emacs/.emacs.d/snippets/c++-mode/fne
Normal file
10
emacs/.emacs.d/snippets/c++-mode/fne
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find_end
|
||||
# key: fne
|
||||
# --
|
||||
auto pos = std::find_std::end(std::begin(${1:container}), std::end($1),
|
||||
std::begin($2), std::end($3));
|
||||
if (pos != std::end($1)) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
11
emacs/.emacs.d/snippets/c++-mode/fni
Normal file
11
emacs/.emacs.d/snippets/c++-mode/fni
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: find_if
|
||||
# key: fni
|
||||
# --
|
||||
auto pos = std::find_if(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
});
|
||||
if (pos != std::end($1)) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
7
emacs/.emacs.d/snippets/c++-mode/fori
Normal file
7
emacs/.emacs.d/snippets/c++-mode/fori
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: fori
|
||||
# key: fori
|
||||
# --
|
||||
for (${1:auto }${2:it} = ${3:var}.begin(); $2 != $3.end(); ++$2) {
|
||||
$0
|
||||
}
|
||||
8
emacs/.emacs.d/snippets/c++-mode/fre
Normal file
8
emacs/.emacs.d/snippets/c++-mode/fre
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: for_each
|
||||
# key: fre
|
||||
# --
|
||||
std::for_each(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
});
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/friend
Normal file
5
emacs/.emacs.d/snippets/c++-mode/friend
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: friend
|
||||
# key: fr
|
||||
# --
|
||||
friend $0;
|
||||
5
emacs/.emacs.d/snippets/c++-mode/fun_declaration
Normal file
5
emacs/.emacs.d/snippets/c++-mode/fun_declaration
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: fun_declaration
|
||||
# key: f
|
||||
# --
|
||||
${1:type} ${2:name}(${3:args})${4: const};
|
||||
8
emacs/.emacs.d/snippets/c++-mode/gnn
Normal file
8
emacs/.emacs.d/snippets/c++-mode/gnn
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: generate_n
|
||||
# key: gnn
|
||||
# --
|
||||
std::generate_n(std::begin(${1:container}), $2, []($3) {
|
||||
$4
|
||||
});
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/gnr
Normal file
8
emacs/.emacs.d/snippets/c++-mode/gnr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: generate
|
||||
# key: gnr
|
||||
# --
|
||||
std::generate(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
});
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/gtest
Normal file
6
emacs/.emacs.d/snippets/c++-mode/gtest
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: gtest
|
||||
# key: gtest
|
||||
# group: testing
|
||||
# --
|
||||
#include <gtest/gtest.h>
|
||||
5
emacs/.emacs.d/snippets/c++-mode/ignore
Normal file
5
emacs/.emacs.d/snippets/c++-mode/ignore
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: ignore
|
||||
# key: ignore
|
||||
# --
|
||||
${1:std::}cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
||||
8
emacs/.emacs.d/snippets/c++-mode/ihp
Normal file
8
emacs/.emacs.d/snippets/c++-mode/ihp
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: is_heap
|
||||
# key: ihp
|
||||
# --
|
||||
if (std::is_heap(std::begin(${1:container}), std::end($1))) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/ihu
Normal file
9
emacs/.emacs.d/snippets/c++-mode/ihu
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: is_heap_until
|
||||
# key: ihu
|
||||
# --
|
||||
auto pos = std::is_heap_until(std::begin(${1:container}), std::end($1));
|
||||
if (pos != std::end($1)) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/inline
Normal file
5
emacs/.emacs.d/snippets/c++-mode/inline
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: inline
|
||||
# key: il
|
||||
# --
|
||||
inline $0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/io
Normal file
5
emacs/.emacs.d/snippets/c++-mode/io
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: io
|
||||
# key: io
|
||||
# --
|
||||
#include <iostream>
|
||||
8
emacs/.emacs.d/snippets/c++-mode/ipr
Normal file
8
emacs/.emacs.d/snippets/c++-mode/ipr
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: is_permutation
|
||||
# key: ipr
|
||||
# --
|
||||
if (std::is_permutation(std::begin(${1:container}), std::end($1), std::begin($2))) {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
10
emacs/.emacs.d/snippets/c++-mode/ipt
Normal file
10
emacs/.emacs.d/snippets/c++-mode/ipt
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: is_partitioned
|
||||
# key: ipt
|
||||
# --
|
||||
if (std::is_partitioned(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
})) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/iss
Normal file
8
emacs/.emacs.d/snippets/c++-mode/iss
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: is_sorted
|
||||
# key: iss
|
||||
# --
|
||||
if (std::is_sorted(std::begin(${1:container}), std::end($1))) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/isu
Normal file
9
emacs/.emacs.d/snippets/c++-mode/isu
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: is_sorted_until
|
||||
# key: isu
|
||||
# --
|
||||
auto pos = std::is_sorted_until(std::begin(${1:container}), std::end($1));
|
||||
if (pos != std::end($1)) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/ita
Normal file
6
emacs/.emacs.d/snippets/c++-mode/ita
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: iota
|
||||
# key: ita
|
||||
# --
|
||||
std::iota(std::begin(${1:container}), std::end($1), $2);
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/iterator
Normal file
5
emacs/.emacs.d/snippets/c++-mode/iterator
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: iterator
|
||||
# key: iter
|
||||
# --
|
||||
${1:std::}${2:vector<int>}::iterator ${3:iter};
|
||||
6
emacs/.emacs.d/snippets/c++-mode/ltr
Normal file
6
emacs/.emacs.d/snippets/c++-mode/ltr
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: transform
|
||||
# key: ltr
|
||||
# --
|
||||
${1:container}.erase(0, $1.find_first_not_of(" \t\n\r"));
|
||||
$0
|
||||
7
emacs/.emacs.d/snippets/c++-mode/lwr
Normal file
7
emacs/.emacs.d/snippets/c++-mode/lwr
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: transform
|
||||
# key: lwr
|
||||
# --
|
||||
std::transform(std::begin(${1:container}), std::end($1), std::begin($1), [](char c) {
|
||||
return std::tolower(c);});
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/lxc
Normal file
9
emacs/.emacs.d/snippets/c++-mode/lxc
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: lexigraphical_compare
|
||||
# key: lxc
|
||||
# --
|
||||
if (std::lexigraphical_compare(std::begin(${1:container}), std::end($1),
|
||||
std::begin($2), std::end($3)) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
5
emacs/.emacs.d/snippets/c++-mode/map
Normal file
5
emacs/.emacs.d/snippets/c++-mode/map
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: map
|
||||
# key: map
|
||||
# --
|
||||
std::map<${1:type1}$0> ${2:var};
|
||||
8
emacs/.emacs.d/snippets/c++-mode/member_function
Normal file
8
emacs/.emacs.d/snippets/c++-mode/member_function
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: member_function
|
||||
# key: mf
|
||||
# --
|
||||
${1:type} ${2:Class}::${3:name}(${4:args})${5: const}
|
||||
{
|
||||
$0
|
||||
}
|
||||
6
emacs/.emacs.d/snippets/c++-mode/mkh
Normal file
6
emacs/.emacs.d/snippets/c++-mode/mkh
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: make_heap
|
||||
# key: mkh
|
||||
# --
|
||||
std::make_heap(std::begin(${1:container}), std::end($1));
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/mme
Normal file
6
emacs/.emacs.d/snippets/c++-mode/mme
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: minmax_element
|
||||
# key: mme
|
||||
# --
|
||||
auto minmax = std::minmax_element(std::begin(${1:container}), std::end($1));
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/mne
Normal file
6
emacs/.emacs.d/snippets/c++-mode/mne
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: min_element
|
||||
# key: mne
|
||||
# --
|
||||
auto pos = std::min_element(std::begin(${1:container}), std::end($1));
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/module
Normal file
8
emacs/.emacs.d/snippets/c++-mode/module
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: module
|
||||
# key: mod
|
||||
# --
|
||||
class ${1:Class} : public cSimpleModule
|
||||
{
|
||||
$0
|
||||
}
|
||||
6
emacs/.emacs.d/snippets/c++-mode/mpb
Normal file
6
emacs/.emacs.d/snippets/c++-mode/mpb
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: move_backward
|
||||
# key: mpb
|
||||
# --
|
||||
std::move_backward(std::begin(${1:container}), std::end($1), std::end($1));
|
||||
$0
|
||||
7
emacs/.emacs.d/snippets/c++-mode/mrg
Normal file
7
emacs/.emacs.d/snippets/c++-mode/mrg
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: merge
|
||||
# key: mrg
|
||||
# --
|
||||
std::merge(std::begin(${1:container}), std::end($1),
|
||||
std::begin($2), std::end($3), std::begin($4));
|
||||
$0
|
||||
11
emacs/.emacs.d/snippets/c++-mode/msm
Normal file
11
emacs/.emacs.d/snippets/c++-mode/msm
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: mismatch
|
||||
# key: msm
|
||||
# --
|
||||
auto values = std::mismatch(std::begin(${1:container}), std::end($1), std::begin($1));
|
||||
if (values.first == std::end($1)) {
|
||||
$2
|
||||
} else {
|
||||
$3
|
||||
}
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/mxe
Normal file
6
emacs/.emacs.d/snippets/c++-mode/mxe
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: max_element
|
||||
# key: mxe
|
||||
# --
|
||||
auto pos = std::max_element(std::begin(${1:container}), std::end($1));
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/namespace
Normal file
9
emacs/.emacs.d/snippets/c++-mode/namespace
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: namespace
|
||||
# key: ns
|
||||
# --
|
||||
namespace ${1:Namespace} {
|
||||
|
||||
`yas/selected-text`
|
||||
|
||||
} // $1
|
||||
10
emacs/.emacs.d/snippets/c++-mode/nno
Normal file
10
emacs/.emacs.d/snippets/c++-mode/nno
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: none_of
|
||||
# key: nno
|
||||
# --
|
||||
if (std::none_of(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
})) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
4
emacs/.emacs.d/snippets/c++-mode/ns
Normal file
4
emacs/.emacs.d/snippets/c++-mode/ns
Normal file
@@ -0,0 +1,4 @@
|
||||
#name : namespace ...
|
||||
# key: ns
|
||||
# --
|
||||
namespace
|
||||
6
emacs/.emacs.d/snippets/c++-mode/nth
Normal file
6
emacs/.emacs.d/snippets/c++-mode/nth
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: nth_element
|
||||
# key: nth
|
||||
# --
|
||||
std::nth_element(std::begin(${1:container}), std::end($1), std::end($1));
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/nxp
Normal file
8
emacs/.emacs.d/snippets/c++-mode/nxp
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: next_permutation
|
||||
# key: nxp
|
||||
# --
|
||||
if (std::next_permutation(std::begin(${1:container}), std::end($1))) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/oit
Normal file
8
emacs/.emacs.d/snippets/c++-mode/oit
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: copy
|
||||
# key: oit
|
||||
# --
|
||||
std::copy(std::begin(${1:container}), std::end($1), std::ostream_iterator<$2>{
|
||||
%\istd::cout, "$3"
|
||||
});
|
||||
$0
|
||||
9
emacs/.emacs.d/snippets/c++-mode/operator!=
Normal file
9
emacs/.emacs.d/snippets/c++-mode/operator!=
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator!=
|
||||
# key: !=
|
||||
# group: operator overloading
|
||||
# --
|
||||
bool ${1:MyClass}::operator!=(const $1 &other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
11
emacs/.emacs.d/snippets/c++-mode/operator+
Normal file
11
emacs/.emacs.d/snippets/c++-mode/operator+
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator+
|
||||
# key: +
|
||||
# group: operator overloading
|
||||
# --
|
||||
${1:MyClass} $1::operator+(const $1 &other)
|
||||
{
|
||||
$1 result = *this;
|
||||
result += other;
|
||||
return result;
|
||||
}
|
||||
10
emacs/.emacs.d/snippets/c++-mode/operator+=
Normal file
10
emacs/.emacs.d/snippets/c++-mode/operator+=
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator+=
|
||||
# key: +=
|
||||
# group: operator overloading
|
||||
# --
|
||||
${1:MyClass}& $1::operator+=(${2:const $1 &rhs})
|
||||
{
|
||||
$0
|
||||
return *this;
|
||||
}
|
||||
14
emacs/.emacs.d/snippets/c++-mode/operator=
Normal file
14
emacs/.emacs.d/snippets/c++-mode/operator=
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator=
|
||||
# key: =
|
||||
# where this is a reference to myself
|
||||
# group: operator overloading
|
||||
# --
|
||||
${1:MyClass}& $1::operator=(const $1 &rhs)
|
||||
{
|
||||
// Check for self-assignment!
|
||||
if (this == &rhs)
|
||||
return *this;
|
||||
$0
|
||||
return *this;
|
||||
}
|
||||
9
emacs/.emacs.d/snippets/c++-mode/operator==
Normal file
9
emacs/.emacs.d/snippets/c++-mode/operator==
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator==
|
||||
# key: ==
|
||||
# group: operator overloading
|
||||
# --
|
||||
bool ${1:MyClass}::operator==(const $1 &other) const
|
||||
{
|
||||
$0
|
||||
}
|
||||
9
emacs/.emacs.d/snippets/c++-mode/operator[]
Normal file
9
emacs/.emacs.d/snippets/c++-mode/operator[]
Normal file
@@ -0,0 +1,9 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator[]
|
||||
# key: []
|
||||
# group: operator overloading
|
||||
# --
|
||||
${1:Type}& operator[](${2:int index})
|
||||
{
|
||||
$0
|
||||
}
|
||||
10
emacs/.emacs.d/snippets/c++-mode/operator_istream
Normal file
10
emacs/.emacs.d/snippets/c++-mode/operator_istream
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator>>
|
||||
# key: >>
|
||||
# group: operator overloading
|
||||
# --
|
||||
std::istream& operator>>(std::istream& is, const ${1:Class}& ${2:c})
|
||||
{
|
||||
$0
|
||||
return is;
|
||||
}
|
||||
10
emacs/.emacs.d/snippets/c++-mode/operator_ostream
Normal file
10
emacs/.emacs.d/snippets/c++-mode/operator_ostream
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: operator<<
|
||||
# key: <<
|
||||
# group: operator overloading
|
||||
# --
|
||||
std::ostream& operator<<(std::ostream& os, const ${1:Class}& ${2:c})
|
||||
{
|
||||
$0
|
||||
return os;
|
||||
}
|
||||
5
emacs/.emacs.d/snippets/c++-mode/ostream
Normal file
5
emacs/.emacs.d/snippets/c++-mode/ostream
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: ostream
|
||||
# key: os
|
||||
# --
|
||||
#include <ostream>
|
||||
10
emacs/.emacs.d/snippets/c++-mode/pack
Normal file
10
emacs/.emacs.d/snippets/c++-mode/pack
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: pack
|
||||
# key: pack
|
||||
# --
|
||||
void cNetCommBuffer::pack(${1:type})
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
$0
|
||||
6
emacs/.emacs.d/snippets/c++-mode/phh
Normal file
6
emacs/.emacs.d/snippets/c++-mode/phh
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: push_heap
|
||||
# key: phh
|
||||
# --
|
||||
std::push_heap(std::begin(${1:container}), std::end($1));
|
||||
$0
|
||||
11
emacs/.emacs.d/snippets/c++-mode/ppt
Normal file
11
emacs/.emacs.d/snippets/c++-mode/ppt
Normal file
@@ -0,0 +1,11 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: partition_point
|
||||
# key: ppt
|
||||
# --
|
||||
auto pos = std::partition_point(std::begin(${1:container}), std::end($1), []($2) {
|
||||
$3
|
||||
});
|
||||
if (pos != std::end($1)) {
|
||||
$4
|
||||
}
|
||||
$0
|
||||
7
emacs/.emacs.d/snippets/c++-mode/private
Normal file
7
emacs/.emacs.d/snippets/c++-mode/private
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: private
|
||||
# key: pr
|
||||
# expand-env: ((yas-also-auto-indent-first-line t))
|
||||
# --
|
||||
private:
|
||||
$0
|
||||
7
emacs/.emacs.d/snippets/c++-mode/protected
Normal file
7
emacs/.emacs.d/snippets/c++-mode/protected
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: protected
|
||||
# key: pt
|
||||
# expand-env: ((yas-also-auto-indent-first-line t))
|
||||
# --
|
||||
protected:
|
||||
$0
|
||||
8
emacs/.emacs.d/snippets/c++-mode/prp
Normal file
8
emacs/.emacs.d/snippets/c++-mode/prp
Normal file
@@ -0,0 +1,8 @@
|
||||
# -*- mode: snippet -*-
|
||||
# name: prev_permutation
|
||||
# key: prp
|
||||
# --
|
||||
if (std::prev_permutation(std::begin(${1:container}), std::end($1))) {
|
||||
$2
|
||||
}
|
||||
$0
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user