Added zathura, added org to ranger rifle, configured emacs

clean_emacs
TuDatTr 2020-11-12 18:20:18 +01:00
parent a178a08c1f
commit fd3a4ad0f8
165 changed files with 177 additions and 1216 deletions

1
.gitignore vendored
View File

@ -22,4 +22,5 @@ emacs/.emacs.d/*
*.log
*.pdf
vim/.vim/bundle/*
vim/.vim/plugged/*
vim/.vim/.netrwhist

View File

@ -107,6 +107,7 @@ exec --no-startup-id conky -c ~/.conky/syclo-crimson-bottomleft.conkyrc
exec --no-startup-id dunst
exec --no-startup-id ~/.scripts/startup.sh
exec --no-startup-id llk
exec --no-startup-id emacs --daemon
###############################################################################
################################# Keybindings #################################

View File

@ -4,8 +4,8 @@
# Define the "editor" for text files as first action
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php|rs|go|html = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php|rs|go|html = "$PAGER" -- "$@"
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php|rs|go|org = ${VISUAL:-$EDITOR} -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php|rs|go|org = "$PAGER" -- "$@"
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"

View File

@ -0,0 +1,3 @@
set selection-clipboard clipboard
set guioptions none

View File

@ -7,7 +7,7 @@ l:/home/tuan/Local
c:/home/tuan/Documents/CTF
t:/home/tuan/Templates
w:/home/tuan/workspace_l/Projects
k:/home/tuan/Documents/CTF/TryHackMe/VulnUniversity
k:/home/tuan/Documents/Uni/Studium/2017&2018 Wintersemester/Rechnerstrukturen und Betriebssysteme [4,0]/Rechnerstrukturen
q:/home/tuan/.nextcloud/Quick Drop
':/home/tuan/.dotfiles/emacs/.emacs.d
':/home/tuan/.dotfiles/vim/.vim
e:/home/tuan/Documents/CTF/TryHackMe/Ice/2_Recon

View File

@ -5,155 +5,205 @@
* Preface
Before installing and using emacs, emacs should be run as a daemon.
This decreases the loading times of the editor enormously and enables you to return to your former emacs session at any time.
To do this you first need to make sure =emacs --daemon= is run during the start up.
To access the daemonized emacs you can either run =emacsclient -t= to use it in the terminal or simply =emacsclient= if you want to use the GUI version.
To do this you first need to make sure ~emace --daemon~ is run during the start up.
To access the daemonized emacs you can either run ~emacsclient -t~ to use it in the terminal or simply ~emacsclient~ if you want to use the GUI version.
* Package installation
** Preperation
Initialize Emacs builtin package system and add the [[https://melpa.org][melpa]]-package repository.
#+BEGIN_SRC emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
#+END_SRC
#+begin_src emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)
#+end_src
** Package installation
** Installation
*** [[https://github.com/jwiegley/use-package][use-package]]
~A use-package declaration for simplifying your .emacs~
=A use-package declaration for simplifying your .emacs=
#+BEGIN_SRC emacs-lisp
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
#+begin_src emacs-lisp
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
#+END_SRC
(require 'use-package)
(setq use-package-always-ensure t)
#+end_src
*** [[https://github.com/myrjola/diminish.el][diminish]]
~Diminished modes are minor modes with no modeline display~
=Diminished modes are minor modes with no modeline display=
#+BEGIN_SRC emacs-lisp
(use-package diminish)
#+END_SRC
#+begin_src emacs-lisp
(use-package diminish)
#+end_src
*** [[https://github.com/emacscollective/no-littering][no-littering]]
~Help keeping ~/.emacs.d clean~
=Help keeping ~/.emacs.d clean=
#+BEGIN_SRC emacs-lisp
(use-package no-littering)
#+END_SRC
#+begin_src emacs-lisp
(use-package no-littering)
#+end_src
*** [[https://github.com/emacs-evil/evil][evil]]/[[https://github.com/emacs-evil/evil-collection][evil-collection]]
~The extensible vi layer for Emacs.~
~A set of keybindings for evil-mode~
=The extensible vi layer for Emacs.=
=A set of keybindings for evil-mode=
#+BEGIN_SRC emacs-lisp
(use-package evil
:init
(setq evil-want-keybinding nil)
:config
(evil-mode 1)
(setq evil-search-module 'evil-search))
#+begin_src emacs-lisp
(use-package evil
:init
(setq evil-want-keybinding nil)
:config
(evil-mode 1)
(setq evil-search-module 'evil-search))
(use-package evil-collection
:config
(evil-collection-init))
#+END_SRC
(use-package evil-collection
:config
(evil-collection-init))
#+end_src
*** [[https://github.com/abo-abo/swiper][Ivy/Counsil/Swiper]]
~Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!~
*** [[https://github.com/abo-abo/swiper][Ivy]]/[[https://github.com/abo-abo/swiper][Counsil]]/[[https://github.com/abo-abo/swiper][Swiper]]
=Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!=
#+BEGIN_SRC emacs-lisp
(use-package prescient)
#+begin_src emacs-lisp
(use-package prescient)
(use-package ivy-prescient
:config
(ivy-prescient-mode 1))
(use-package ivy-prescient
:config
(ivy-prescient-mode 1))
(use-package ivy)
(use-package ivy)
(use-package counsel
:diminish counsel-mode
:config
(counsel-mode 1))
(use-package counsel
:diminish counsel-mode
:config
(counsel-mode 1))
(use-package swiper
:bind (("C-s" . 'swiper)))
#+END_SRC
(use-package swiper
:bind (("C-s" . 'swiper)))
#+end_src
*** [[https://magit.vc/][Magit]]
=A Git Porcelain inside Emacs.=
#+begin_src emacs-lisp
(use-package magit)
#+end_src
*** [[https://www.gnu.org/software/auctex/][AUCTeX]]
=an extensible package for writing and formatting TeX files.=
#+begin_src emacs-lisp
(use-package auctex
:defer t
:config
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(setq TeX-PDF-mode t))
#+end_src
*** [[https://github.com/yjwen/org-reveal][ox-reveal]]
~Exports Org-mode contents to Reveal.js HTML presentation.~
=Exports Org-mode contents to Reveal.js HTML presentation.=
#+BEGIN_SRC emacs-lisp
(use-package ox-reveal)
#+END_SRC
#+begin_src emacs-lisp
(use-package ox-reveal)
#+end_src
*** [[https://github.com/marsmining/ox-twbs][ox-twbs]]
~Export org-mode docs as HTML compatible with Twitter Bootstrap.~
=Export org-mode docs as HTML compatible with Twitter Bootstrap.=
#+BEGIN_SRC emacs-lisp
(use-package ox-twbs)
#+END_SRC
#+begin_src emacs-lisp
(use-package ox-twbs)
#+end_src
*** [[https://github.com/sabof/org-bullets][org-bullets]]
~utf-8 bullets for org-mode~
=utf-8 bullets for org-mode=
#+BEGIN_SRC emacs-lisp
(use-package org-bullets)
#+END_SRC
#+begin_src emacs-lisp
(use-package org-bullets)
#+end_src
*** [[https://elpa.gnu.org/packages/rainbow-mode.html][rainbow-mode]]
=Colorize color names in buffers=
#+begin_src emacs-lisp
(use-package rainbow-mode)
#+end_src
*** [[https://github.com/Fanael/rainbow-delimiters][rainbow-delimiters]]
=Emacs rainbow delimiters mode=
#+begin_src emacs-lisp
(use-package rainbow-delimiters)
#+end_src
*** [[https://github.com/joaotavora/yasnippet][yasnippet]]
=A template system for Emacs=
#+begin_src emacs-lisp
(use-package yasnippet)
#+end_src
* Appearance
This section is for appearance customization. Either via packages or manually.
** [[https://github.com/kuanyui/moe-theme.el][moe-theme]]
~A customizable colorful eye-candy theme for Emacser. Moe, moe, kyun!~
=A customizable colorful eye-candy theme for Emacser. Moe, moe, kyun!=
#+BEGIN_SRC emacs-lisp
(use-package moe-theme
:config
(moe-dark))
#+END_SRC
#+begin_src emacs-lisp
(use-package moe-theme
:config
(moe-dark))
#+end_src
** Transparent Emacs
Makes the default color of the background of emacs the same as the terminals color.
This is kind of a janky solution, but it works.
#+BEGIN_SRC emacs-lisp
(add-hook 'window-setup-hook
'(lambda ()
(set-face-background 'default "unspecified-bg")))
#+END_SRC
#+begin_src emacs-lisp
(add-hook 'window-setup-hook
'(lambda ()
(set-face-background 'default "unspecified-bg")))
#+end_src
** Menubar
Remove the menu-bar at the top of the screen for better immersion.
#+BEGIN_SRC emacs-lisp
(menu-bar-mode -1)
#+END_SRC
#+begin_src emacs-lisp
(menu-bar-mode -1)
#+end_src
* Emacs Configuration
** Symbolic Links
Follow symlinks without asking for confirmation.
#+BEGIN_SRC emacs-lisp
(setq vc-follow-symlinks t)
#+END_SRC
#+begin_src emacs-lisp
(setq vc-follow-symlinks t)
#+end_src
* Mode Configuration
** Org-Mode
Always unfold every section in org files.
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook #'org-show-all)
#+END_SRC
Enable org-bullets and hide leading stars.
#+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook
(lambda ()
(org-bullets-mode 1)))
#+END_SRC
#+begin_src emacs-lisp
(add-hook 'org-mode-hook
(lambda ()
(org-bullets-mode 1)))
#+end_src
Enables specific languages for org-babel, so those languages can be used and compiled in code blocks and disable the compilation concirmation. The code afterwords enables proper indentation inside those source blocks.
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(C . t)
(makefile . t)
(shell . t)
(latex . t)
(python . t)))
(setq org-confirm-babel-evaluate nil)
(setq org-src-tab-acts-natively t)
#+end_src

View File

@ -1,17 +1,2 @@
(org-babel-load-file "~/.emacs.d/config.org")
(put 'upcase-region 'disabled nil)
(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.
'(package-selected-packages
'(ox-reveal ox-hugo theme-magic use-package ox-twbs org-bullets no-littering moe-theme ivy-prescient evil-collection diminish counsel)))
(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.
'(org-hide ((t (:foreground "#000000")))))

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: cerr
# key: err
# --
cerr << $0;

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: cin
# key: cin
# --
cin >> $0;

View File

@ -1,8 +0,0 @@
# -*- 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}"};

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: fori
# key: fori
# --
for (${1:auto }${2:it} = ${3:var}.begin(); $2 != $3.end(); ++$2) {
$0
}

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: io
# key: io
# --
#include <iostream>

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; -*-
#contributor: Xah Lee (XahLee.org)
#name: add-hook
#key: add-hook
#key: ah
# --
(add-hook '${1:name}-hook ${2:'${3:function}})$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: apr_assert
# key: apr_assert
# --
if (Globals.useAssertions) {
${1:assert ..};
}

View File

@ -1,5 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: assert
# key: as
# --
assert ${1:expression};

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: assertEquals
# key: ae
# group: test
# --
Assert.assertEquals($1, $2);
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: cls
# key: cls
# --
class ${1:Class} {
$0
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: constructor
# key: c
# --
public ${1:Class} (${2:args}) {
$0
}

View File

@ -1,8 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: define test method
# key: dt
# --
@Test
public void test${1:Name}() throws Exception {
$0
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: doc
# key: /*
# --
/**
* ${1:documentation}
*/

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: equals
# key: eq
# --
public boolean equals(${1:Class} other) {
$0
}

View File

@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# name: file_class
# key: file
# --
public class ${1:`(file-name-base
(or (buffer-file-name)
(buffer-name)))`} {
$0
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: for
# key: for
# --
for (${1:int i = 0}; ${2:i < N}; ${3:i++}) {
$0
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: fori
# key: fori
# --
for (${1:Object el} : ${2:iterator}) {
$0
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: getter
# key: g
# --
public ${1:int} get${2:Field}() {
return ${3:field};
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: if
# key: if
# --
if (${1:condition}) {
$0
}

View File

@ -1,10 +0,0 @@
# -*- mode: snippet -*-
# name: ife
# key: ife
# --
if (${1:cond}) {
$2
}
else {
$3
}

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: import
# key: imp
# --
import ${1:System.};
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: iterator
# key: iterator
# --
public Iterator<${1:type}> iterator() {
$0
}

View File

@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# name: javadoc
# key: doc
# --
/**
* $0
*
*/

View File

@ -1,5 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: lambda
# key: \
# --
(${1:args}) -> ${2:expression};

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: main
# key: main
# --
public static void main(String[] args) {
$0
}

View File

@ -1,11 +0,0 @@
# contributor: L. Guruprasad <lgp171188@gmail.com>
# name: main_class
# key: main_class
# --
class `(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`
{
public static void main(String args[])
{
$0
}
}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: method
# key: m
# --
${1:public} ${2:void} ${3:name}(${4:args}) {
$0
}

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: new
# key: new
# --
${1:Type} ${2:obj} = new ${3:Constr}(${4:args});
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: override
# key: o
# --
@Override
$0

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: param
# key: param
# --
@param ${1:paramater} $0

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: printf
# key: printf
# --
System.out.printf("$0%n");

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: println
# key: pr
# --
System.out.println("${1:text}");
$0

View File

@ -1,5 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: return
# key: r
# --
return $0

View File

@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# name: test
# key: test
# --
@Test
public void test_${1:Case}() {
$0
}

View File

@ -1,12 +0,0 @@
# -*- mode: snippet -*-
# name: testClass
# key: tc
# --
import junit.framework.*;
import junit.textui.*;
public class Test${1:Class} extends TestCase {
protected void setUp() {
$0
}
}

View File

@ -1,6 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: this
# key: .
# --
this.$1 = $1;
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: toString
# key: toStr
# --
public String toString() {
$0
}

View File

@ -1,11 +0,0 @@
# -*- mode: snippet -*-
# name: try
# key: try
# --
try {
$0
}
catch (${1:Throwable e}) {
${2:System.out.println("Error " + e.getMessage());
e.printStackTrace();}
}

View File

@ -1,5 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: value
# key: val
# --
final ${1:int} ${2:n} = $0;

View File

@ -1,11 +0,0 @@
# -*- mode: snippet -*-
# name: Template of polls for FS
# key: fspoll
# --
\begin{tabular}{ccc}
\toprule
Ja & Nein & Enthaltung \\\\
\midrule
3 & 1 & 9 \\\\
\bottomrule
\end{tabular}

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: item
# key: -
# --
\item $0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: itemize
# key: it
# --
\begin{itemize}
\item $0
\end{itemize}

View File

@ -1,15 +0,0 @@
# -*- mode: snippet -*-
# name: full template of moderncv class
# key: moderncv
# --
\documentclass[${1:options}]{moderncv}
\firstname{$3}
\familyname{$4}
\moderncvstyle{${5:casual}}
\moderncvcolor{${6:blue}}
\begin{document}
$0
\end{document}

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: moderncv-cvcomputer
# key: cvcomp
# --
\cvcomputer{${1:category}}{${2:programs}}{${3:category}}{${3:programs}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: moderncv-cventry
# key: cventry
# --
\cventry{${1:year}}{${2:job}}{${3:employer}}{${4:city}}{${5:description}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: moderncv-cvlanguage
# key: cvlang
# --
\cvlanguage{${1:language}}{${2:skill-level}}{${3:comment}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: moderncv-cvline
# key: cvline
# --
\cvline{${1:hobby}}{${2:Description}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: moderncv-cvlistdoubleitem
# key: cvditem
# --
\cvlistdoubleitem{${1:item}}{${2:item}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: moderncv-cvlistitem
# key: cvitem
# --
\cvlistitem{${1:item}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: section
# key: sec
# --
\section{${1:name}}
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: subsec
# key: sub
# --
\subsection{${1:name}}
$0

View File

@ -1,16 +0,0 @@
# -*- mode: snippet -*-
# name: template
# key: template
# --
\documentclass{article}[12pt]
\usepackage{titling}
\usepackage[onehalfspacing]{setspace}
\usepackage[a4paper, left=2.5cm, right=2cm, top=2cm, bottom=2cm]{geometry}
\usepackage{hyperref}
\usepackage[ngerman]{babel}
\usepackage{datetime}
\pagenumbering{gobble}
\fontfamily{sans}
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: usepackage
# key: use
# --
\usepackage{${1:name}}
$0

View File

@ -0,0 +1,12 @@
CC = gcc
CFLAGS =
RM = rm
TARGET = $0
all: ${TARGET}
${TARGET}: ${TARGET}.c
${CC} ${CFLAGS} -o ${TARGET} ${TARGET}.c
clean:
${RM} ${TARGET}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; -*-
#contributor: Xah Lee (XahLee.org)
#name: add-hook
#key: add-hook
#key: ah
# --
(add-hook '${1:name}-hook ${2:'${3:function}})$0

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: color
# key: col
# --
\color{$0}

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: elisp
# key: elisp_
# --
#+BEGIN_SRC emacs-lisp
$0
#+END_SRC

View File

@ -0,0 +1,7 @@
# -*- mode: snippet -*-
# name: source block
# key: src
# --
#+BEGIN_SRC $0
$1
#+END_SRC

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: transitions
# key: tran
# --
S_{$1}\rightarrow{}S_{$2}
$0

View File

@ -1 +0,0 @@
prog-mode

View File

@ -1,39 +0,0 @@
(require 'yasnippet)
(defvar yas-text)
(defun python-split-args (arg-string)
"Split a python argument string into ((name, default)..) tuples"
(mapcar (lambda (x)
(split-string x "[[:blank:]]*=[[:blank:]]*" t))
(split-string arg-string "[[:blank:]]*,[[:blank:]]*" t)))
(defun python-args-to-docstring ()
"return docstring format for the python arguments in yas-text"
(let* ((indent (concat "\n" (make-string (current-column) 32)))
(args (python-split-args yas-text))
(max-len (if args (apply 'max (mapcar (lambda (x) (length (nth 0 x))) args)) 0))
(formatted-args (mapconcat
(lambda (x)
(concat (nth 0 x) (make-string (- max-len (length (nth 0 x))) ? ) " -- "
(if (nth 1 x) (concat "\(default " (nth 1 x) "\)"))))
args
indent)))
(unless (string= formatted-args "")
(mapconcat 'identity (list "Keyword Arguments:" formatted-args) indent))))
(defun python-args-to-docstring-numpy ()
"return docstring format for the python arguments in yas-text"
(let* ((args (python-split-args yas-text))
(format-arg (lambda(arg)
(concat (nth 0 arg) " : " (if (nth 1 arg) ", optional") "\n")))
(formatted-params (mapconcat format-arg args "\n"))
(formatted-ret (mapconcat format-arg (list (list "out")) "\n")))
(unless (string= formatted-params "")
(mapconcat 'identity
(list "\nParameters\n----------" formatted-params
"\nReturns\n-------" formatted-ret)
"\n"))))
(add-hook 'python-mode-hook
'(lambda () (set (make-local-variable 'yas-indent-line) 'fixed)))

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: __contains__
# key: cont
# group: dunder methods
# --
def __contains__(self, el):
$0

View File

@ -1,9 +0,0 @@
# -*- mode: snippet -*-
# name: __enter__
# key: ent
# group: dunder methods
# --
def __enter__(self):
$0
return self

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: __exit__
# key: ex
# group: dunder methods
# --
def __exit__(self, type, value, traceback):
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: __getitem__
# key: getit
# group: dunder methods
# --
def __getitem__(self, ${1:key}):
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: __len__
# key: len
# group: dunder methods
# --
def __len__(self):
$0

View File

@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# name: __new__
# key: new
# group: dunder methods
# --
def __new__(mcs, name, bases, dct):
$0
return type.__new__(mcs, name, bases, dct)

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: __setitem__
# key: setit
# group: dunder methods
# --
def __setitem__(self, ${1:key}, ${2:val}):
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: all
# key: all
# --
__all__ = [
$0
]

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: arg
# key: arg
# group: argparser
# --
parser.add_argument('-$1', '--$2',
$0)

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: arg_positional
# key: arg
# group: argparser
# --
parser.add_argument('${1:varname}', $0)

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assert
# key: ass
# group: testing
# --
assert $0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertEqual
# key: ae
# group: testing
# --
self.assertEqual($1, $2)

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertFalse
# key: af
# group: testing
# --
self.assertFalse($0)

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertIn
# key: ai
# group: testing
# --
self.assertIn(${1:member}, ${2:container})

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertNotEqual
# key: ane
# group: testing
# --
self.assertNotEqual($1, $2)

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assetNotIn
# key: an
# group: testing
# --
self.assertNotIn(${1:member}, ${2:container})

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertRaises
# key: ar
# group: testing
# --
self.assertRaises(${1:Exception}, ${2:fun})

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertRaises
# key: ar
# --
with self.assertRaises(${1:Exception}):
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: assertTrue
# key: at
# group: testing
# --
self.assertTrue($0)

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: celery pdb
# key: cdb
# group: debug
# --
from celery.contrib import rdb; rdb.set_trace()

View File

@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# name: classmethod
# key: cm
# group: object oriented
# --
@classmethod
def ${1:meth}(cls, $2):
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: class
# key: cls
# group: object oriented
# --
class ${1:class}:
$0

View File

@ -1,14 +0,0 @@
# -*- mode: snippet -*-
# name: dec
# key: dec
# group : definitions
# --
def ${1:decorator}(func):
$2
def _$1(*args, **kwargs):
$3
ret = func(*args, **kwargs)
$4
return ret
return _$1

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: deftest
# key: dt
# group: testing
# --
def test_${1:long_name}(self):
$0

View File

@ -1,7 +0,0 @@
# -*- mode: snippet; require-final-newline: nil -*-
# name: django_test_class
# key: tcs
# group: testing
# --
class ${1:Model}Test(TestCase):
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: doc
# key: d
# --
"""$0
"""

View File

@ -1,8 +0,0 @@
# -*- mode: snippet -*-
# name: doctest
# key: doc
# group: testing
# --
>>> ${1:function calls}
${2:desired output}
$0

View File

@ -1,5 +0,0 @@
# -*- mode: snippet -*-
# name: embed
# key: embed
# --
from IPython import embed; embed()

View File

@ -1,7 +0,0 @@
# -*- mode: snippet -*-
# name: __eq__
# key: eq
# group: dunder methods
# --
def __eq__(self, other):
return self.$1 == other.$1

View File

@ -1,6 +0,0 @@
# name: for ... in ... : ...
# key: for
# group : control structure
# --
for ${var} in ${collection}:
$0

View File

@ -1,6 +0,0 @@
# -*- mode: snippet -*-
# name: from
# key: from
# group : general
# --
from ${1:lib} import ${2:funs}

Some files were not shown because too many files have changed in this diff Show More