Modular init.el - navigation config

This commit is contained in:
Kashish Sharma 2015-11-25 02:43:50 +05:30
parent 9528bdc6ca
commit da6f95bb95
2 changed files with 73 additions and 71 deletions

72
contrapunctus/cp-nav.el Normal file
View File

@ -0,0 +1,72 @@
;;;; Hacks for better navigation
;; 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)))
(global-set-key (kbd "M-t M-t") 'find-tag-no-prompt-other-window)
(global-set-key (kbd "M-t M-g") 'find-tag-no-prompt)
(global-set-key (kbd "M-t M-p") 'pop-tag-mark)
(global-set-key (kbd "M-t M-f") 'find-tag)
(global-set-key (kbd "M-t M-s") 'tags-search)
(global-set-key (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
(global-set-key (kbd "C-x C-1") 'delete-other-windows)
(global-set-key (kbd "C-x C-2") 'split-window-below)
(global-set-key (kbd "C-x C-3") 'split-window-right)
(global-set-key (kbd "C-x C-0") 'delete-window)
(global-set-key (kbd "C-x C-4 C-f") 'find-file-other-window)
;(global-set-key (kbd "C-`") 'point-to-register)
;(global-set-key (kbd "C-'") 'jump-to-register)
(global-set-key (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 contrapunctus-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 contrapunctus-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 contrapunctus-kill-buffer ()
"Kill the current buffer without prompting."
(interactive)
(kill-buffer nil))

72
init.el
View File

@ -110,79 +110,9 @@
(load "cp-editing")
(load "cp-nav")
;;;; 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)))
(global-set-key (kbd "M-t M-t") 'find-tag-no-prompt-other-window)
(global-set-key (kbd "M-t M-g") 'find-tag-no-prompt)
(global-set-key (kbd "M-t M-p") 'pop-tag-mark)
(global-set-key (kbd "M-t M-f") 'find-tag)
(global-set-key (kbd "M-t M-s") 'tags-search)
(global-set-key (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
(global-set-key (kbd "C-x C-1") 'delete-other-windows)
(global-set-key (kbd "C-x C-2") 'split-window-below)
(global-set-key (kbd "C-x C-3") 'split-window-right)
(global-set-key (kbd "C-x C-0") 'delete-window)
(global-set-key (kbd "C-x C-4 C-f") 'find-file-other-window)
;(global-set-key (kbd "C-`") 'point-to-register)
;(global-set-key (kbd "C-'") 'jump-to-register)
(global-set-key (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 contrapunctus-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 contrapunctus-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 contrapunctus-kill-buffer ()
"Kill the current buffer without prompting."
(interactive)
(kill-buffer nil))
(global-set-key (kbd "M-<f2>") 'compile)
(global-set-key (kbd "<f2> p") 'grep)
(global-set-key (kbd "<f2> o") 'find-grep)