SHARE
TWEET

Untitled

vfclists Jul 29th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;; main init.el
  2.  
  3. (setq emacs-config-basedir (file-name-directory user-init-file))
  4. (message "user-init-file: %s" user-init-file)
  5. (message "emacs-config-basedir: %s" emacs-config-basedir)
  6. (setq emacs-conf-dir (expand-file-name "emacs-config-01" emacs-config-basedir))
  7. (add-to-list 'load-path emacs-conf-dir)
  8. ;; (require 'keybindings)
  9. (message "user-login-name: %s" user-login-name)
  10.  
  11.  
  12. ;; melpa configuration - need to decide who this should be organized
  13. (require 'package)
  14. (let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
  15.                     (not (gnutls-available-p))))
  16.        (url (concat (if no-ssl "http" "https") "://melpa.org/packages/")))
  17.   (add-to-list 'package-archives (cons "melpa" url) t))
  18. (when (< emacs-major-version 24)
  19.   ;; For important compatibility libraries like cl-lib
  20.   (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")))
  21. (package-initialize)
  22.  
  23. ;; helm - copied from installation notes, it will eventually change
  24. (message "required helm-config")
  25. ;; initial configuration from https://tuhdo.github.io/helm-intro.html
  26. (require 'helm)
  27. (require 'helm-config)
  28.  
  29. ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
  30. ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
  31. ;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
  32. (global-set-key (kbd "C-c h") 'helm-command-prefix)
  33. (global-unset-key (kbd "C-x c"))
  34.  
  35. (when (executable-find "curl")
  36.   (setq helm-google-suggest-use-curl-p t))
  37.  
  38. (setq helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
  39.       helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
  40.       helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
  41.       helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
  42.       helm-ff-file-name-history-use-recentf t
  43.       helm-echo-input-in-header-line t)
  44.  
  45.  
  46. (defun spacemacs//helm-hide-minibuffer-maybe ()
  47.   "Hide minibuffer in Helm session if we use the header line as input field."
  48.   (when (with-helm-buffer helm-echo-input-in-header-line)
  49.     (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
  50.       (overlay-put ov 'window (selected-window))
  51.       (overlay-put ov 'face
  52.                    (let ((bg-color (face-background 'default nil)))
  53.                      `(:background ,bg-color :foreground ,bg-color)))
  54.       (setq-local cursor-type nil))))
  55.  
  56.  
  57. (add-hook 'helm-minibuffer-set-up-hook
  58.           'spacemacs//helm-hide-minibuffer-maybe)
  59.  
  60. (setq helm-autoresize-max-height 0)
  61. (setq helm-autoresize-min-height 20)
  62. (helm-autoresize-mode 1)
  63. (helm-mode 1)
  64.  
  65. (require 'helm-descbinds)
  66. (helm-descbinds-mode)
  67.  
  68. ;; helm related key bindings - may have to be entered in a different section or block
  69. (global-set-key (kbd "C-x C-f") 'helm-find-files)
  70.  
  71. ;; Enable projectile - based on https://tuhdo.github.io/helm-projectile.html
  72. (projectile-global-mode)
  73. (setq projectile-completion-system 'helm)
  74. (helm-projectile-on)
  75.  
  76.                                         ; enter fixes for addition of files from previous session to show up in C-x C-f
  77. (require 'recentf)
  78. (recentf-mode 1)
  79. (setq recentf-max-saved-items 50)
  80. (setq recentf-max-menu-items 20)
  81. (setq-default recent-save-file "~/.emacs.d/recentf")
  82. (run-at-time (current-time) 300 'recentf-save-list)
  83.  
  84. ;; helm related keys
  85. (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
  86. (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
  87. (define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z
  88.  
  89. ;; evil-mode configuration
  90. ; (add-to-list 'load-path "~/.emacs.d/evil")
  91. (require 'evil)
  92. (evil-mode 1)
  93.  
  94. ; enable evil-org
  95. (require 'evil-org)
  96. (add-hook 'org-mode-hook 'evil-org-mode)
  97. (evil-org-set-key-theme '(navigation insert textobjects additional))
  98. ; use line below to add all themes
  99. ; (evil-org-set-key-theme '(textobjects insert navigation additional shift todo heading))
  100.  
  101. ;; which key configuration
  102. ; adding to load path is probably unnecessary as install from melpa
  103. (require 'which-key)
  104. (which-key-mode)
  105.  
  106. ;;
  107. (add-to-list 'load-path "~/.emacs.d/rca_config/")
  108. (load "keybindings")
  109. (load "rca_misc_functions")
  110.  
  111. (rca-key-bindings)
  112.  
  113. (setq custom-file "~/.emacs.d/custom.el")
  114. (if
  115.     (file-exists-p custom-file)
  116.     (load custom-file)
  117.   )
  118.  
  119. ;; add show-paren-mode for parenthesis to be highlighted
  120. ;; smartparens will come later
  121. (show-paren-mode 1)
  122.  
  123. ;; fontify source code blocks in org
  124. ; may be disabled at runtime until export syntax-highlighting is fixed
  125. (setq org-src-fontify-natively t)
  126.  
  127. (require 'use-package)
  128.  
  129. (use-package command-log-mode
  130.   :ensure t
  131.   :config
  132.   (global-command-log-mode)
  133.   )
  134.  
  135.  
  136. ;; keybindings
  137. (defun rca-key-bindings()
  138.  
  139.   ;; Fix SHIFT + arrow keys inside screen/tmux
  140.   (define-key input-decode-map "\e[1;2A" [S-up])
  141.   (define-key input-decode-map "\e[1;2B" [S-down])
  142.   (define-key input-decode-map "\e[1;2C" [S-right])
  143.   (define-key input-decode-map "\e[1;2D" [S-left])
  144.  
  145.   ;; Fix ALT + arrow keys inside screen/tmux
  146.   (define-key input-decode-map "\e[1;3A" [M-up])
  147.   (define-key input-decode-map "\e[1;3B" [M-down])
  148.   (define-key input-decode-map "\e[1;3C" [M-right])
  149.   (define-key input-decode-map "\e[1;3D" [M-left])
  150.  
  151.   ;; Fix CTRL + arrow keys inside screen/tmux
  152.   (define-key input-decode-map "\e[1;5A" [C-up])
  153.   (define-key input-decode-map "\e[1;5B" [C-down])
  154.   (define-key input-decode-map "\e[1;5C" [C-right])
  155.   (define-key input-decode-map "\e[1;5D" [C-left])
  156.   )
  157.  
  158. (provide 'rca-key-bindings)
  159.  
  160. ;; rca_misc_functions
  161.  
  162.  
  163. ;; indent whole buffer from - http://emacsblog.org/2007/01/17/indent-whole-buffer/
  164. (defun rca-iwb ()
  165.   "indent whole buffer"
  166.   (interactive)
  167.   (delete-trailing-whitespace)
  168.   (indent-region (point-min) (point-max) nil)
  169.   (untabify (point-min) (point-max)))
RAW Paste Data
Pastebin PRO Autumn Special!
Get 40% OFF on Pastebin PRO accounts!
Top