dotemacs/contrapunctus/cp-nav.el

91 lines
2.9 KiB
EmacsLisp

;;;; Navigation improvements
(add-to-list 'load-path "~/.emacs.d/elisp-git/window-numbering/")
;; Vim-style prompt-less tag jumping
;; http://stackoverflow.com/questions/12074897/automatically-jump-to-tag-in-emacs
(global-unset-key (kbd "M-t"))
(defun find-tag-no-prompt-other-window ()
"Jump to the tag at point in the other window without prompting."
(interactive)
(find-tag-other-window (find-tag-default)))
(defun find-tag-no-prompt ()
"Jump to the tag at point without prompting."
(interactive)
(find-tag (find-tag-default)))
(cp-set-keys
:bindings
`((,(kbd "M-t M-t") find-tag-no-prompt-other-window)
(,(kbd "M-t M-g") find-tag-no-prompt)
(,(kbd "M-t M-p") pop-tag-mark)
(,(kbd "M-t M-f") find-tag)
(,(kbd "M-t M-s") tags-search)
(,(kbd "M-t M-c") tags-loop-continue)))
(require 'view)
(global-set-key (kbd "C-v") 'View-scroll-half-page-forward)
(global-set-key (kbd "M-v") 'View-scroll-half-page-backward)
;; (global-set-key (kbd "M-v") 'scroll-down)
;; (global-set-key (kbd "C-v") 'scroll-up)
;;;; Need to make maps for
;;;; mark-* commands (-sexp, -page, -word, etc)
;;;; mark ring
;;;; Other custom keys
(cp-set-keys
:bindings
`((,(kbd "C-x C-1") delete-other-windows)
(,(kbd "C-x C-2") split-window-below)
(,(kbd "C-x C-3") split-window-right)
(,(kbd "C-x C-0") delete-window)
(,(kbd "C-x C-4 C-f") find-file-other-window)
(,(kbd "C-`") point-to-register)
(,(kbd "C-'") jump-to-register)
(,(kbd "C-x C-d") dired-jump)))
(require 'dired)
(define-key dired-mode-map (kbd "b") 'dired-up-directory)
(add-hook 'dired-mode-hook 'visual-line-mode)
;(global-set-key (kbd "C-,") 'string-rectangle 'TAB)
(global-unset-key (kbd "C-x d"))
;; (require 'dired-toggle-sudo)
;; (define-key dired-mode-map (kbd "C-c C-s") 'dired-toggle-sudo)
;; (eval-after-load 'tramp
;; '(progn
;; ;; Allow to use: /sudo:user@host:/path/to/file
;; (add-to-list 'tramp-default-proxies-alist
;; '(".*" "\\`.+\\'" "/ssh:%h:"))))
(global-set-key (kbd "C-x df") 'delete-frame)
;;;; make-frame key is after Helm's config
;(setq compilation-read-command nil)
(defun cp-open-init ()
"Open the init.el file."
(interactive)
(find-file "~/.emacs.d/init.el"))
;; todo - store current file name → kill the buffer →
;; find-file-literally with the stored filename. also, find out if you
;; can open it without modes but with the proper encoding.
(defun cp-fcf-literally ()
"Find the current file literally. Like find-file-literally but
does not prompt for a file name."
(interactive)
(find-file-literally (buffer-file-name)))
(defun cp-kill-buffer ()
"Kill the current buffer without prompting."
(interactive)
(kill-buffer nil))
(require 'win-switch)
(global-set-key "\C-xo" 'win-switch-dispatch)
(win-switch-setup-keys-ijkl)
(setq win-switch-idle-time 0.5)
(setq win-switch-other-window-first nil)
;(setq win-switch-other-window-first nil)
(require 'window-numbering)
(window-numbering-mode 1)