added key binding and functions
This commit is contained in:
parent
66fb478e9a
commit
9ea95f9fd2
|
@ -1,5 +1,5 @@
|
|||
auto-save-list/
|
||||
config/
|
||||
elpa/
|
||||
emacs-for-python/
|
||||
ac-comphist.dat
|
||||
key-bindings-work.el
|
||||
|
|
26
init.el
26
init.el
|
@ -5,18 +5,10 @@
|
|||
(expand-file-name (concat user-emacs-directory "../"))
|
||||
"The user's home directory.")
|
||||
|
||||
(defvar user-projects-dir
|
||||
(expand-file-name (concat user-home-directory "Projects/"))
|
||||
"The directory containing the user's checked out source code.")
|
||||
|
||||
(defvar user-custom-modes-dir
|
||||
(expand-file-name (concat user-emacs-directory "custom-modes/"))
|
||||
"The directory containing the user's custom modes.")
|
||||
|
||||
(defvar user-dropbox-directory
|
||||
(expand-file-name (concat user-home-directory "Dropbox/"))
|
||||
"The user's Dropbox root directory.")
|
||||
|
||||
(add-to-list 'load-path user-emacs-directory)
|
||||
|
||||
;; Global config ===============================================================
|
||||
|
@ -77,20 +69,24 @@
|
|||
;; =============================================================================
|
||||
(setq ropemacs-global-prefix "C-x /") ;; avoid conflict with p4 global prefix
|
||||
(load-file (concat user-emacs-directory "emacs-for-python/epy-init.el"))
|
||||
(require 'epy-setup) ;; It will setup other loads, it is required!
|
||||
(require 'epy-python) ;; If you want the python facilities [optional]
|
||||
(require 'epy-completion) ;; If you want the autocompletion settings [optional]
|
||||
(require 'epy-editing) ;; For configurations related to editing [optional]
|
||||
(require 'epy-bindings) ;; For my suggested keybindings [optional]
|
||||
(require 'epy-nose) ;; For nose integration
|
||||
(require 'epy-setup)
|
||||
(require 'epy-python)
|
||||
(require 'epy-completion)
|
||||
(require 'epy-editing)
|
||||
(require 'epy-bindings)
|
||||
(require 'epy-nose)
|
||||
(epy-setup-checker "pyflakes %f")
|
||||
(epy-setup-ipython)
|
||||
;; line hightlighting
|
||||
(global-hl-line-mode t)
|
||||
(set-face-background 'hl-line "black")
|
||||
(set-face-background 'hl-line "#073642")
|
||||
;; identation highlighting
|
||||
;; (require 'highlight-indentation)
|
||||
;; (add-hook 'python-mode-hook 'highlight-indentation)
|
||||
;; disable auto-pairing
|
||||
;;(setq skeleton-pair nil)
|
||||
(add-hook 'python-mode-hook (lambda ()
|
||||
(local-set-key "\C-c\C-c" 'syl-python-compile)))
|
||||
|
||||
;; Custom modes ================================================================
|
||||
(load-file (concat user-custom-modes-dir "heartbeat-cursor.el"))
|
||||
|
|
57
my-funcs.el
57
my-funcs.el
|
@ -1,41 +1,8 @@
|
|||
(defun minimap-toggle ()
|
||||
"Toggle minimap for current buffer."
|
||||
(defun syl-python-compile ()
|
||||
"Use compile to run python programs"
|
||||
(interactive)
|
||||
(if (null minimap-bufname)
|
||||
(minimap-create)
|
||||
(minimap-kill)))
|
||||
|
||||
(defun z:mac-p ()
|
||||
"Truthy if the host OS is a Mac."
|
||||
(string-match "apple-darwin" system-configuration))
|
||||
|
||||
(defun z:deduplicate-all-lines-region (start end)
|
||||
"Find duplicate lines in region START to END keeping first occurrence."
|
||||
(z:uniquify-all-lines-region start end))
|
||||
|
||||
(defun log-edit-mode ()
|
||||
"HACK: Ergoemacs doesn't load properly unless this function is defined."
|
||||
nil)
|
||||
|
||||
(defun z:deduplicate-all-lines-buffer ()
|
||||
"Delete duplicate lines in buffer and keep first occurrence."
|
||||
(z:uniquify-all-lines-buffer))
|
||||
|
||||
(defun z:uniquify-all-lines-region (start end)
|
||||
"Find duplicate lines in region START to END keeping first occurrence."
|
||||
(interactive "*r")
|
||||
(save-excursion
|
||||
(let ((end (copy-marker end)))
|
||||
(while
|
||||
(progn
|
||||
(goto-char start)
|
||||
(re-search-forward "^\\(.*\\)\n\\(\\(.*\n\\)*\\)\\1\n" end t))
|
||||
(replace-match "\\1\n\\2")))))
|
||||
|
||||
(defun z:uniquify-all-lines-buffer ()
|
||||
"Delete duplicate lines in buffer and keep first occurrence."
|
||||
(interactive "*")
|
||||
(z:uniquify-all-lines-region (point-min) (point-max)))
|
||||
(compile (concat "python " (buffer-name))))
|
||||
(setq compilation-scroll-output t)
|
||||
|
||||
(defun z:set-transparency (value)
|
||||
"Sets the transparency of the frame window. 0=transparent/100=opaque"
|
||||
|
@ -75,20 +42,4 @@
|
|||
(set-window-start w2 s1)
|
||||
(setq i (1+ i))))))))
|
||||
|
||||
(defun z:smart-beginning-of-line ()
|
||||
"Move point to first non-whitespace character or beginning-of-line.
|
||||
|
||||
Move point to the first non-whitespace character on this line.
|
||||
If point was already at that position, move point to beginning of line."
|
||||
(interactive) ; Use (interactive "^") in Emacs 23 to make shift-select work
|
||||
(let ((oldpos (point)))
|
||||
(beginning-of-line-text)
|
||||
(and (= oldpos (point))
|
||||
(beginning-of-line))))
|
||||
|
||||
(defun z:vagrant-shell ()
|
||||
(interactive)
|
||||
(let ((default-directory "/vagrant:/home/vagrant/projects"))
|
||||
(shell "*vagrant-root*")))
|
||||
|
||||
(provide 'my-funcs)
|
||||
|
|
|
@ -1,58 +1,2 @@
|
|||
;;;; zane-keys.el --- Keyboard shortcuts.
|
||||
;;;;
|
||||
;;;; http://www.masteringemacs.org/articles/2011/02/08/mastering-key-bindings-emacs/
|
||||
;;;; http://www.gnu.org/software/emacs/elisp/html_node/Key-Binding-Conventions.html
|
||||
;;;; http://code.google.com/p/ergoemacs/wiki/adoption
|
||||
;
|
||||
;(setq mac-command-modifier 'meta)
|
||||
;(setq mac-option-modifier 'alt)
|
||||
;
|
||||
;;; hash table to store the old key bindings
|
||||
;(setq old-key-bindings (make-hash-table :test 'equal))
|
||||
;
|
||||
;;; shows a hint about the change of the key binding
|
||||
;(defun show-hint-old-kbind (key)
|
||||
; (let ((function-symbol (gethash key old-key-bindings)))
|
||||
; (beep)
|
||||
; (message "You typed: %s. For %s, use %s."
|
||||
; key
|
||||
; function-symbol
|
||||
; (mapcar 'key-description (where-is-internal function-symbol)))))
|
||||
;
|
||||
;;; turns off a key binding, leaving a hint for the unbound command
|
||||
;(defmacro global-unset-key-leave-hint (key)
|
||||
; `(let ((function-symbol (global-key-binding ,key)))
|
||||
; (when function-symbol
|
||||
; (puthash ,key function-symbol old-key-bindings)
|
||||
; (global-set-key (kbd ,key) (lambda() (interactive) (show-hint-old-kbind ,key))))))
|
||||
;
|
||||
;(global-unset-key (kbd "C-x C-k"))
|
||||
;
|
||||
;(global-set-key (kbd "C-s") 'save-buffer)
|
||||
;(global-set-key (kbd "C-w") 'close-current-buffer)
|
||||
;
|
||||
;(global-set-key (kbd "C-c C-a") 'align-regexp)
|
||||
;;(global-set-key (kbd "C-c C-o") 'sort-lines)
|
||||
;(global-set-key (kbd "C-x y") 'bury-buffer)
|
||||
;(if (z:mac-p) (global-set-key (kbd "M-RET") 'ns-toggle-fullscreen)) ; http://www.stratospark.com/blog/2010/fullscreen_emacs_on_osx.html
|
||||
;;; (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
|
||||
;
|
||||
;;; Tab key
|
||||
;;; http://stackoverflow.com/questions/1792326/how-do-i-bind-a-command-to-c-i-without-changing-tab
|
||||
;(keyboard-translate ?\C-i ?\H-i)
|
||||
;
|
||||
;;; Unset M-SPC because it's used by Alfred.app
|
||||
;(global-unset-key (kbd "M-SPC"))
|
||||
;(global-unset-key (kbd "M-TAB"))
|
||||
;
|
||||
;(global-unset-key (kbd "C-x RET"))
|
||||
;(add-hook 'term-exec-hook
|
||||
; (lambda ()
|
||||
; (set-buffer-process-coding-system 'utf-8-unix
|
||||
; 'utf-8-unix)))
|
||||
;
|
||||
;;; Occur
|
||||
;;; http://www.masteringemacs.org/articles/2011/07/20/searching-buffers-occur-mode/
|
||||
;(define-key isearch-mode-map (kbd "C-o") 'isearch-occur)
|
||||
|
||||
(provide 'my-keybindings)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
(autoload 'autopair-global-mode "autopair" nil t)
|
||||
(autopair-global-mode)
|
||||
(add-hook 'lisp-mode-hook #'(lambda () (setq autopair-dont-activate t)))
|
|
@ -9,8 +9,6 @@
|
|||
(defvar z:my-packages
|
||||
'(
|
||||
ace-jump-mode
|
||||
auto-complete
|
||||
autopair
|
||||
eproject
|
||||
erlang
|
||||
evil
|
||||
|
|
Loading…
Reference in New Issue