summaryrefslogtreecommitdiff
path: root/init/km-python.el
diff options
context:
space:
mode:
authorKyle Meyer <meyerkya@gmail.com>2013-01-12 12:44:44 -0500
committerKyle Meyer <meyerkya@gmail.com>2013-01-12 13:56:01 -0500
commit96ee4bd0bd7b5cc8a6d9ca918ede26e82a9b20a7 (patch)
tree9065fbcdd65c7c80dbc15859d9ea6dd8507b256d /init/km-python.el
parentf5b226cae165532ed34ffefd7d003d10d984f004 (diff)
downloademacs.d-96ee4bd0bd7b5cc8a6d9ca918ede26e82a9b20a7.tar.gz
glob init files files for loading
Diffstat (limited to 'init/km-python.el')
-rw-r--r--init/km-python.el34
1 files changed, 34 insertions, 0 deletions
diff --git a/init/km-python.el b/init/km-python.el
new file mode 100644
index 0000000..ce7aa53
--- /dev/null
+++ b/init/km-python.el
@@ -0,0 +1,34 @@
+(defun km/python-sysexit ()
+ (interactive)
+ (insert "sys.exit()"))
+
+(defun km/python-random-assignment ()
+ (interactive)
+ (km/insert-random-string 10)
+ (insert " = None"))
+
+(defun km/python-shebang ()
+ (interactive)
+ (km/shebang "python"))
+
+(defconst km/python-analysis-imports
+ "import sys
+import numpy as np
+import pandas as pd
+import matplotlib.pyplot as plt
+from matplotlib.ticker import MaxNLocator
+
+from colors import brew, fgry, bgry"
+ )
+
+(defun km/python-insert-analysis-imports ()
+ "Common imports for analysis scripts"
+ (interactive)
+ (insert km/python-analysis-imports))
+
+(defun km/python-hook ()
+ (local-set-key (kbd "C-c p r") 'km/python-random-assignment)
+ (local-set-key (kbd "C-c p e") 'km/python-sysexit)
+ (local-set-key (kbd "C-c p s") 'km/python-shebang)
+ (local-set-key (kbd "C-c p a") 'km/python-insert-analysis-imports))
+(add-hook 'python-mode-hook 'km/python-hook)