Compare commits
No commits in common. "master" and "config_v1.0" have entirely different histories.
master
...
config_v1.
30 changed files with 644 additions and 2978 deletions
26
.gitignore
vendored
26
.gitignore
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
custom.el
|
|
||||||
backups
|
|
||||||
eshell
|
|
||||||
elpaca
|
|
||||||
|
|
||||||
eln-cache
|
|
||||||
elpa
|
|
||||||
org-roam.db
|
|
||||||
transient
|
|
||||||
|
|
||||||
# projectile
|
|
||||||
projectile*
|
|
||||||
|
|
||||||
# savehist file
|
|
||||||
history
|
|
||||||
|
|
||||||
# recentf file
|
|
||||||
recentf
|
|
||||||
|
|
||||||
session*
|
|
||||||
|
|
||||||
# .org converted files
|
|
||||||
config*.el
|
|
||||||
|
|
||||||
# Tramp connection file
|
|
||||||
tramp
|
|
||||||
14
README.md
Normal file
14
README.md
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# emacs
|
||||||
|
My personal emacs configuration
|
||||||
|
|
||||||
|
It is mostly based on tuhdo's emacs ide demo: https://github.com/tuhdo/emacs-c-ide-demo
|
||||||
|
|
||||||
|
This configuration requires the installation of :
|
||||||
|
- the GNU global package (for gtags)
|
||||||
|
- clang (for ivory)
|
||||||
|
- cmake (for ivory)
|
||||||
|
- llvm-libs (for cmake, somehow not a dependency on Manjaro when installing cmake)
|
||||||
|
- Use python-pip to install jedi, flake8, importmagic and autopep8 (for elpy)
|
||||||
|
- ditaa (for ascii to image generation in org-mode)
|
||||||
|
|
||||||
|
When first checking out this config, run irony-install-server to make and install the irony-server.
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
config.org
|
|
||||||
8
cheat-sheet.txt
Normal file
8
cheat-sheet.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
C-M-Space : smartparens wrapping
|
||||||
|
C-c C-c : calculator (see init.el)
|
||||||
|
C-h k <key-sequence>: lookup key sequence
|
||||||
|
C-x 0 : close current window
|
||||||
|
C-q <tab> : insert a <tab>
|
||||||
|
M-x (un)tabify : (replace) tabs
|
||||||
|
M-x describe-bindings : list of all mapped keys/commands
|
||||||
|
M-p : fill-paragraph, works for doxygen as well
|
||||||
1252
config.org
1252
config.org
File diff suppressed because it is too large
Load diff
1608
config_old.org
1608
config_old.org
File diff suppressed because it is too large
Load diff
22
custom/setup-autocompletion.el
Normal file
22
custom/setup-autocompletion.el
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
(add-hook 'after-init-hook 'global-company-mode)
|
||||||
|
|
||||||
|
;; Add irony as company-backend
|
||||||
|
(eval-after-load 'company
|
||||||
|
'(add-to-list 'company-backends 'company-irony))
|
||||||
|
|
||||||
|
;; Add irony as flycheck hook
|
||||||
|
(eval-after-load 'flycheck
|
||||||
|
'(add-hook 'flycheck-mode-hook 'flycheck-irony-setup))
|
||||||
|
|
||||||
|
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
|
||||||
|
(add-hook 'irony-mode-hook 'irony-eldoc)
|
||||||
|
|
||||||
|
;; Add irony-, flycheck-, company-mode to c-mode
|
||||||
|
(add-hook 'c-mode-hook 'irony-mode)
|
||||||
|
(add-hook 'c-mode-hook 'flycheck-mode)
|
||||||
|
(add-hook 'c-mode-hook 'company-mode)
|
||||||
|
|
||||||
|
;; Set tab to autocomplete or indent depending on context
|
||||||
|
(global-set-key (kbd "<tab>") 'company-indent-or-complete-common)
|
||||||
|
|
||||||
|
(provide 'setup-autocompletion)
|
||||||
48
custom/setup-coding.el
Normal file
48
custom/setup-coding.el
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
;; make angry face to get my attention
|
||||||
|
(setq prog-modes '(c++-mode python-mode erlang-mode java-mode c-mode emacs-lisp-mode scheme-mode prog-mode))
|
||||||
|
(make-face 'font-lock-angry-face)
|
||||||
|
(modify-face 'font-lock-angry-face "Red" "Yellow" nil t nil t nil nil)
|
||||||
|
|
||||||
|
;; Add keywords to recognize to angry face
|
||||||
|
(mapc (lambda (mode)
|
||||||
|
(font-lock-add-keywords
|
||||||
|
mode
|
||||||
|
'(("\\<\\(FIXME\\)" 1 'font-lock-angry-face t)))
|
||||||
|
)
|
||||||
|
prog-modes)
|
||||||
|
(mapc (lambda (mode)
|
||||||
|
(font-lock-add-keywords
|
||||||
|
mode
|
||||||
|
'(("\\<\\(TODO\\)" 1 'font-lock-angry-face t)))
|
||||||
|
)
|
||||||
|
prog-modes)
|
||||||
|
|
||||||
|
;; default coding style
|
||||||
|
(setq c-default-style "linux")
|
||||||
|
|
||||||
|
;; sane indentation offset
|
||||||
|
(setq c-basic-offset 4)
|
||||||
|
|
||||||
|
;; Tab-space strategy
|
||||||
|
;; we use spaces, deal with it
|
||||||
|
(setq-default indent-tabs-mode nil)
|
||||||
|
|
||||||
|
;; Enable subword mode for handling CamelCase format
|
||||||
|
(global-subword-mode t)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Python ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(require 'py-autopep8)
|
||||||
|
(elpy-enable)
|
||||||
|
|
||||||
|
(setq elpy-modules (delq 'elpy-module-flycheck elpy-modules))
|
||||||
|
(add-hook 'elpy-mode-hook 'flycheck-mode)
|
||||||
|
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Magit (git) ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(global-set-key (kbd "C-c m") 'magit-status)
|
||||||
|
|
||||||
|
(provide 'setup-coding)
|
||||||
10
custom/setup-cursors.el
Normal file
10
custom/setup-cursors.el
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
(require 'multiple-cursors)
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-x r a") 'mc/edit-lines)
|
||||||
|
(global-set-key (kbd "C-x r e") 'mc/edit-ends-of-lines)
|
||||||
|
|
||||||
|
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
||||||
|
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
||||||
|
(global-set-key (kbd "C-c C->") 'mc/mark-all-like-this)
|
||||||
|
|
||||||
|
(provide 'setup-cursors)
|
||||||
17
custom/setup-dashboard.el
Normal file
17
custom/setup-dashboard.el
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
(require 'dashboard)
|
||||||
|
|
||||||
|
(dashboard-setup-startup-hook)
|
||||||
|
|
||||||
|
;; Set the startup message
|
||||||
|
(setq dashboard-banner-logo-title "")
|
||||||
|
|
||||||
|
;; Set the banner
|
||||||
|
(setq dashboard-startup-banner 'logo)
|
||||||
|
(setq dashboard-items '((recents . 10)
|
||||||
|
(bookmarks . 5)
|
||||||
|
))
|
||||||
|
|
||||||
|
;; Enable recent files
|
||||||
|
(recentf-mode 1)
|
||||||
|
|
||||||
|
(provide 'setup-dashboard)
|
||||||
134
custom/setup-editing.el
Normal file
134
custom/setup-editing.el
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
(setq global-mark-ring-max 5000 ; increase mark ring to contains 5000 entries
|
||||||
|
mark-ring-max 5000 ; increase kill ring to contains 5000 entries
|
||||||
|
mode-require-final-newline t ; add a newline to end of file
|
||||||
|
)
|
||||||
|
|
||||||
|
(setq kill-ring-max 5000 ; increase kill-ring capacity
|
||||||
|
kill-whole-line t ; if NIL, kill whole line and move the next line up
|
||||||
|
)
|
||||||
|
|
||||||
|
;; show column numbers
|
||||||
|
(setq column-number-mode 1)
|
||||||
|
|
||||||
|
;; Remove scroll-bar, tool-bar and menu-bar
|
||||||
|
(scroll-bar-mode -1)
|
||||||
|
(tool-bar-mode -1)
|
||||||
|
(menu-bar-mode -1)
|
||||||
|
|
||||||
|
;; set appearance of a tab that is represented by 4 spaces
|
||||||
|
(setq-default tab-width 4)
|
||||||
|
|
||||||
|
;; automatically indent when press RET
|
||||||
|
(global-set-key (kbd "RET") 'newline-and-indent)
|
||||||
|
|
||||||
|
;; Map query-replace-regexp to an easier key
|
||||||
|
(global-set-key (kbd "C-x r r") 'query-replace-regexp)
|
||||||
|
|
||||||
|
;; Map query-replace-regexp to an easier key
|
||||||
|
(global-set-key (kbd "M-p") 'fill-paragraph)
|
||||||
|
|
||||||
|
;; Delete trailing whitespace when saving file
|
||||||
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||||
|
|
||||||
|
;; show whitespace in diff-mode
|
||||||
|
(add-hook 'diff-mode-hook (lambda ()
|
||||||
|
(setq-local whitespace-style
|
||||||
|
'(face
|
||||||
|
tabs
|
||||||
|
tab-mark
|
||||||
|
spaces
|
||||||
|
space-mark
|
||||||
|
trailing
|
||||||
|
indentation::space
|
||||||
|
indentation::tab
|
||||||
|
newline
|
||||||
|
newline-mark))
|
||||||
|
(whitespace-mode 1)))
|
||||||
|
|
||||||
|
;; Package: undo-tree -- saner, imo, undo with C-/
|
||||||
|
(require 'undo-tree)
|
||||||
|
(global-undo-tree-mode)
|
||||||
|
|
||||||
|
;; Package: volatile-highlights --- show changes by "undo/yanks/..."
|
||||||
|
(require 'volatile-highlights)
|
||||||
|
(volatile-highlights-mode t)
|
||||||
|
|
||||||
|
;;; Package: iedit --- Replace occurences of symbol and highlight them
|
||||||
|
(require 'iedit)
|
||||||
|
|
||||||
|
;; Package: smartparens --- smart way to handle (), {}, ...
|
||||||
|
(require 'smartparens-config)
|
||||||
|
(setq sp-base-key-bindings 'paredit)
|
||||||
|
(setq sp-autoskip-closing-pair 'always)
|
||||||
|
(setq sp-hybrid-kill-entire-symbol nil)
|
||||||
|
(sp-use-paredit-bindings)
|
||||||
|
|
||||||
|
(show-smartparens-global-mode +1)
|
||||||
|
(smartparens-global-mode 1)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; keybinding management smartparens ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; cl-package contains the loop macro
|
||||||
|
(require 'cl)
|
||||||
|
|
||||||
|
(defmacro def-pairs (pairs)
|
||||||
|
`(progn
|
||||||
|
,@(loop for (key . val) in pairs
|
||||||
|
collect
|
||||||
|
`(defun ,(read (concat
|
||||||
|
"wrap-with-"
|
||||||
|
(prin1-to-string key)
|
||||||
|
"s"))
|
||||||
|
(&optional arg)
|
||||||
|
(interactive "p")
|
||||||
|
(sp-wrap-with-pair ,val)))))
|
||||||
|
|
||||||
|
(def-pairs ((paren . "(")
|
||||||
|
(bracket . "[")
|
||||||
|
(brace . "{")
|
||||||
|
(single-quote . "'")
|
||||||
|
(double-quote . "\"")
|
||||||
|
(underscore . "_")
|
||||||
|
(back-quote . "`")))
|
||||||
|
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c (") 'wrap-with-parens)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c [") 'wrap-with-brackets)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c {") 'wrap-with-braces)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c '") 'wrap-with-single-quotes)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c \"") 'wrap-with-double-quotes)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c _") 'wrap-with-underscores)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c `") 'wrap-with-back-quotes)
|
||||||
|
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c s r") 'sp-rewrap-sexp)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-c s u") 'sp-unwrap-sexp)
|
||||||
|
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-f") 'sp-forward-sexp)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-b") 'sp-backward-sexp)
|
||||||
|
|
||||||
|
;; TODO: in manjaro this selects keyboard-layout or something
|
||||||
|
;;(define-key smartparens-mode-map (kbd "C-M-k") 'sp-kill-sexp)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-w") 'sp-copy-sexp)
|
||||||
|
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-n") 'sp-next-sexp)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-p") 'sp-previous-sexp)
|
||||||
|
|
||||||
|
;; TODO: for some reason this does not work
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-a") 'sp-beginning-of-sexp)
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-e") 'sp-end-of-sexp)
|
||||||
|
|
||||||
|
(define-key smartparens-mode-map (kbd "C-M-h") 'mark-defun)
|
||||||
|
|
||||||
|
(smartparens-global-mode t)
|
||||||
|
|
||||||
|
|
||||||
|
;; Package: comment-dwim-2 --- replacement for built-in comment-dwim, more comment features
|
||||||
|
(require 'comment-dwim-2)
|
||||||
|
(global-set-key (kbd "M-;") 'comment-dwim-2)
|
||||||
|
|
||||||
|
|
||||||
|
;; Package: yasnippet --- code template system
|
||||||
|
(require 'yasnippet)
|
||||||
|
(yas-global-mode 1)
|
||||||
|
|
||||||
|
(provide 'setup-editing)
|
||||||
7
custom/setup-expand-region.el
Normal file
7
custom/setup-expand-region.el
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
(require 'expand-region)
|
||||||
|
|
||||||
|
(pending-delete-mode t)
|
||||||
|
|
||||||
|
(global-set-key (kbd "C-=") 'er/expand-region)
|
||||||
|
|
||||||
|
(provide 'setup-expand-region)
|
||||||
36
custom/setup-gdb.el
Normal file
36
custom/setup-gdb.el
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
(setq gdb-many-windows 1)
|
||||||
|
|
||||||
|
;; Select a register number which is unlikely to get used elsewere
|
||||||
|
(defconst egdbe-windows-config-register 313465989
|
||||||
|
"Internal used")
|
||||||
|
|
||||||
|
(defvar egdbe-windows-config nil)
|
||||||
|
|
||||||
|
(defun set-egdbe-windows-config ()
|
||||||
|
(interactive)
|
||||||
|
(setq egdbe-windows-config (window-configuration-to-register egdbe-windows-config-register)))
|
||||||
|
|
||||||
|
(defun egdbe-restore-windows-config ()
|
||||||
|
(interactive)
|
||||||
|
(jump-to-register egdbe-windows-config-register))
|
||||||
|
|
||||||
|
(defun egdbe-start-gdb (&optional gdb-args)
|
||||||
|
""
|
||||||
|
(interactive)
|
||||||
|
(set-egdbe-windows-config)
|
||||||
|
(call-interactively 'gdb))
|
||||||
|
|
||||||
|
(defun egdbe-quit ()
|
||||||
|
"finish."
|
||||||
|
(interactive)
|
||||||
|
(gud-basic-call "quit")
|
||||||
|
(egdbe-restore-windows-config))
|
||||||
|
|
||||||
|
(defun egdbe-gud-mode-hook ()
|
||||||
|
""
|
||||||
|
(local-unset-key (kbd "q"))
|
||||||
|
(local-set-key (kbd "q") 'egdbe-quit))
|
||||||
|
|
||||||
|
(add-hook 'gud-mode-hook 'egdbe-gud-mode-hook)
|
||||||
|
|
||||||
|
(provide 'setup-gdb)
|
||||||
62
custom/setup-general.el
Normal file
62
custom/setup-general.el
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
(global-set-key [f9] 'start-kbd-macro)
|
||||||
|
(global-set-key [f10] 'end-kbd-macro)
|
||||||
|
(global-set-key [f11] 'call-last-kbd-macro)
|
||||||
|
|
||||||
|
;; Package zygospore --- revert C-x 1 by pressing C-x 1 again
|
||||||
|
;; TODO: Doesn't work with sr-speedbar
|
||||||
|
(global-set-key (kbd "C-x 1") 'zygospore-toggle-delete-other-windows)
|
||||||
|
|
||||||
|
;; Set 'M-g' to 'goto-line', it's faster and what we usually want
|
||||||
|
(global-set-key (kbd "M-g") 'goto-line)
|
||||||
|
|
||||||
|
;; Set 'C-x r i' to 'string-insert-rectangle'
|
||||||
|
;; Easier than using 'M-x' and searching for it.
|
||||||
|
(global-set-key (kbd "C-x r i") 'string-insert-rectangle)
|
||||||
|
|
||||||
|
;; set garbage collection to higher value
|
||||||
|
;; see http://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
|
||||||
|
(setq gc-cons-threshold 100000000)
|
||||||
|
|
||||||
|
;; important yes-or-no questions can be answered with y-or-n
|
||||||
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||||
|
|
||||||
|
;; maximize Emacs at startup
|
||||||
|
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||||
|
|
||||||
|
;; Move one window back command
|
||||||
|
(global-set-key (kbd "\C-x p") 'previous-multiframe-window)
|
||||||
|
|
||||||
|
;; Use C-x o to switch to other frame when using multi-monitor
|
||||||
|
(global-set-key (kbd "C-x o") 'next-multiframe-window)
|
||||||
|
|
||||||
|
;; set my theme
|
||||||
|
(load-theme 'wombat)
|
||||||
|
|
||||||
|
;; highlight line (hl-line)
|
||||||
|
(global-hl-line-mode 1)
|
||||||
|
(set-face-background hl-line-face "dark slate grey")
|
||||||
|
|
||||||
|
;; smart mode line
|
||||||
|
(setq sml/no-confirm-load-theme t)
|
||||||
|
(setq sml/theme 'powerline)
|
||||||
|
(sml/setup)
|
||||||
|
|
||||||
|
;; enable disabled commands
|
||||||
|
(put 'narrow-to-page 'disabled nil)
|
||||||
|
(put 'narrow-to-region 'disabled nil)
|
||||||
|
|
||||||
|
;; quick function to kill all other buffers
|
||||||
|
(defun kill-other-buffers ()
|
||||||
|
"Kill all other buffers."
|
||||||
|
(interactive)
|
||||||
|
(mapc 'kill-buffer
|
||||||
|
(delq (current-buffer)
|
||||||
|
(remove-if-not 'buffer-file-name (buffer-list)))))
|
||||||
|
|
||||||
|
;; screw with vi(m)-users
|
||||||
|
(defconst wq "This is not vi! Use C-x C-c instead.")
|
||||||
|
(defconst w "This is not vi! Use C-x C-s instead.")
|
||||||
|
(defconst q! "This is EMACS not vi! Use C-x C-c instead.")
|
||||||
|
(defconst wq! "This is EMACS not vi! Use C-x C-c instead.")
|
||||||
|
|
||||||
|
(provide 'setup-general)
|
||||||
19
custom/setup-helm-gtags.el
Normal file
19
custom/setup-helm-gtags.el
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
(require 'helm-gtags)
|
||||||
|
|
||||||
|
;; Enable helm-gtags-mode in languages that GNU Global supports
|
||||||
|
(add-hook 'c-mode-hook 'helm-gtags-mode)
|
||||||
|
(add-hook 'c++-mode-hook 'helm-gtags-mode)
|
||||||
|
(add-hook 'python-mode-hook 'helm-gtags-mode)
|
||||||
|
(add-hook 'java-mode-hook 'helm-gtags-mode)
|
||||||
|
(add-hook 'asm-mode-hook 'helm-gtags-mode)
|
||||||
|
|
||||||
|
;; customize behaviour
|
||||||
|
(custom-set-variables
|
||||||
|
'(helm-gtags-auto-update t))
|
||||||
|
|
||||||
|
(global-set-key (kbd "M-.") 'helm-gtags-find-tag-from-here)
|
||||||
|
(global-set-key (kbd "M-,") 'helm-gtags-pop-stack)
|
||||||
|
(global-set-key (kbd "C-c C-f") 'helm-gtags-find-files)
|
||||||
|
(global-set-key (kbd "C-c g f") 'helm-gtags-parse-file)
|
||||||
|
|
||||||
|
(provide 'setup-helm-gtags)
|
||||||
50
custom/setup-helm.el
Normal file
50
custom/setup-helm.el
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
(require 'helm)
|
||||||
|
(require 'helm-config)
|
||||||
|
|
||||||
|
;; replace vanilla commands with helm commands
|
||||||
|
(global-set-key (kbd "M-x") 'helm-M-x)
|
||||||
|
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
|
||||||
|
(global-set-key (kbd "C-x b") 'helm-mini)
|
||||||
|
;; In vanilla, this is mapped to show-buffers, but I don't use that so map it to helm-mini as well
|
||||||
|
(global-set-key (kbd "C-x C-b") 'helm-mini)
|
||||||
|
(global-set-key (kbd "C-x C-f") 'helm-find-files)
|
||||||
|
|
||||||
|
;; rebind tab to do persistent action
|
||||||
|
;; we use helm-execute-persistent-action more than helm-select-action (default for <tab>)
|
||||||
|
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
|
||||||
|
;; make TAB work in terminal
|
||||||
|
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
|
||||||
|
;; remap helm-select-action: lists actions
|
||||||
|
(define-key helm-map (kbd "C-z") 'helm-select-action)
|
||||||
|
|
||||||
|
;; remap calculator
|
||||||
|
(global-set-key (kbd "C-c C-c") 'helm-calcul-expression)
|
||||||
|
|
||||||
|
;; TODO: experiment with mark ring (breadcrumbs something?)
|
||||||
|
;; TODO: experiment with helm-regexp (build and test regexes)
|
||||||
|
;; TODO: remember helm-top (helm interface for top program)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; PACKAGE: helm-swoop ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Locate the helm-swoop folder to your path
|
||||||
|
(require 'helm-swoop)
|
||||||
|
|
||||||
|
;; replace vanilla I-search with helm-swoop
|
||||||
|
(global-set-key (kbd "C-s") 'helm-swoop)
|
||||||
|
|
||||||
|
;; From helm-swoop to helm-multi-swoop-all
|
||||||
|
;;(define-key helm-swoop-map (kbd "M-s") 'helm-multi-swoop-all-from-helm-swoop)
|
||||||
|
(define-key helm-swoop-map (kbd "C-s") 'helm-multi-swoop-all-from-helm-swoop)
|
||||||
|
;; TODO: find out how to switch from multi-swoop to swoop back again
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Next 2 lines make sure when using helm-swoop only the current window/buffer is affected ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; If this value is t, split window inside the current window
|
||||||
|
(setq helm-swoop-split-with-multiple-windows t)
|
||||||
|
|
||||||
|
;; Split direcion. 'split-window-vertically or 'split-window-horizontally
|
||||||
|
(setq helm-swoop-split-direction 'split-window-vertically)
|
||||||
|
|
||||||
|
(provide 'setup-helm)
|
||||||
28
custom/setup-org.el
Normal file
28
custom/setup-org.el
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
(require 'org)
|
||||||
|
|
||||||
|
(define-key global-map "\C-cl" 'org-store-link)
|
||||||
|
(define-key global-map "\C-ca" 'org-agenda)
|
||||||
|
|
||||||
|
;; when ending TODO (C-C C-t) end with a note + timestamp
|
||||||
|
(setq org-log-done 'note)
|
||||||
|
;; Specify root dir to search for agenda files, TODOs, ...
|
||||||
|
(setq org-agenda-files '("~/org"))
|
||||||
|
;; Add extra states for keywords
|
||||||
|
(setq org-todo-keywords
|
||||||
|
'((sequence "TODO" "IN-PROGRESS" "WAITING" "DONE")))
|
||||||
|
|
||||||
|
(setq org-export-with-sub-superscripts nil)
|
||||||
|
|
||||||
|
;; Preserve indentation in SRC blocks
|
||||||
|
(setq org-src-preserve-indentation t)
|
||||||
|
|
||||||
|
;; Specify which languages are allowed to run inside org-mode
|
||||||
|
(org-babel-do-load-languages
|
||||||
|
'org-babel-load-languages '(
|
||||||
|
(ditaa . t))
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Tell org where to look for ditaa
|
||||||
|
(setq org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_10.jar")
|
||||||
|
|
||||||
|
(provide 'setup-org)
|
||||||
11
custom/setup-speedbar.el
Normal file
11
custom/setup-speedbar.el
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
;; Package: sr-speedbar
|
||||||
|
(require 'sr-speedbar)
|
||||||
|
;; (add-hook 'emacs-startup-hook (lambda () ; Open sr speedbar on startup
|
||||||
|
;; (sr-speedbar-open)
|
||||||
|
;; ))
|
||||||
|
(setq speedbar-show-unknown-files t) ; Enable speedbar to show all files
|
||||||
|
(setq speedbar-use-images nil) ; use text for buttons
|
||||||
|
(setq sr-speedbar-right-side nil) ; put on left side
|
||||||
|
(setq sr-speedbar-width 40)
|
||||||
|
|
||||||
|
(provide 'setup-speedbar)
|
||||||
25
custom/setup-windows.el
Normal file
25
custom/setup-windows.el
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
;; Windows performance tweaks
|
||||||
|
;;
|
||||||
|
(when (boundp 'w32-pipe-read-delay)
|
||||||
|
(setq w32-pipe-read-delay 0))
|
||||||
|
;; Set the buffer size to 64K on Windows (from the original 4K)
|
||||||
|
(when (boundp 'w32-pipe-buffer-size)
|
||||||
|
(setq irony-server-w32-pipe-buffer-size (* 64 1024)))
|
||||||
|
|
||||||
|
;; Set pipe delay to 0 to reduce latency of irony
|
||||||
|
(setq w32-pipe-read-delay 0)
|
||||||
|
|
||||||
|
;; From "setting up irony mode on Windows" :
|
||||||
|
;; Make sure the path to clang.dll is in emacs' exec_path and shell PATH.
|
||||||
|
(setenv "PATH"
|
||||||
|
(concat
|
||||||
|
"C:\\msys64\\usr\\bin" ";"
|
||||||
|
"C:\\msys64\\mingw64\\bin" ";"
|
||||||
|
(getenv "PATH")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(setq exec-path (append '("c:/msys64/usr/bin" "c:/alt/msys64/mingw64/bin")
|
||||||
|
exec-path))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'setup-windows)
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
;;; early-init.el --- Early Init -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
;; Early init configuration for Emacs Solo
|
|
||||||
;;
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
|
|
||||||
;; Only care about errors in *Messages* buffer
|
|
||||||
(setq warning-minimum-level :error)
|
|
||||||
|
|
||||||
;; We control when packages are enabled
|
|
||||||
(setq package-enable-at-startup nil)
|
|
||||||
|
|
||||||
(provide 'early-init)
|
|
||||||
|
|
||||||
;;; early-init.el ends here
|
|
||||||
158
init.el
158
init.el
|
|
@ -1,28 +1,152 @@
|
||||||
;;; init.el --- Init -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
|
;; add the custom dir to our load path
|
||||||
|
(add-to-list 'load-path "~/.emacs.d/custom")
|
||||||
|
|
||||||
;;; Commentary:
|
;; add melpa-stable to package-archives
|
||||||
;;; Load init files
|
;; IMPORTANT: add (require 'package), else package-archives is not declared (void-variable)
|
||||||
|
(require 'package)
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
|
||||||
|
|
||||||
|
(add-to-list 'package-archives
|
||||||
|
'("melpa" . "http://melpa.milkbox.net/packages/") t)
|
||||||
|
|
||||||
;;; Code:
|
;; MUST be called after package-archives is updated
|
||||||
|
;; Else the automated installation logic is not able to install missing packages
|
||||||
|
(package-initialize)
|
||||||
|
|
||||||
;;; Increase garbage collection threshold during init but leave it to the default value after
|
;; my required packages
|
||||||
;;; There are a LOT of articles/sites/... discussing this:
|
(defconst my-packages
|
||||||
;;; https://bling.github.io/blog/2016/01/18/why-are-you-changing-gc-cons-threshold/
|
'(
|
||||||
;;; https://jonnay.github.io/emagicians-starter-kit/Emagician-Base.html
|
undo-tree
|
||||||
;;; ...
|
volatile-highlights
|
||||||
(let ((gc-cons-threshold most-positive-fixnum))
|
smartparens
|
||||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
iedit
|
||||||
;; This is the actual config file. It is omitted if it doesn't exist so emacs won't refuse to launch.
|
zygospore
|
||||||
(defvar my-config-file (expand-file-name "config.org" user-emacs-directory))
|
comment-dwim-2
|
||||||
|
yasnippet
|
||||||
|
yasnippet-snippets
|
||||||
|
sr-speedbar
|
||||||
|
company
|
||||||
|
irony
|
||||||
|
irony-eldoc
|
||||||
|
company-irony
|
||||||
|
flycheck-irony
|
||||||
|
elpy
|
||||||
|
py-autopep8
|
||||||
|
magit
|
||||||
|
org
|
||||||
|
smart-mode-line
|
||||||
|
smart-mode-line-powerline-theme
|
||||||
|
helm
|
||||||
|
helm-gtags
|
||||||
|
helm-swoop
|
||||||
|
helm-company
|
||||||
|
dashboard
|
||||||
|
multiple-cursors
|
||||||
|
expand-region
|
||||||
|
))
|
||||||
|
|
||||||
(when (file-readable-p my-config-file)
|
;; function to install new packages
|
||||||
(org-babel-load-file (expand-file-name my-config-file)))
|
(defun install-packages ()
|
||||||
|
"Install all required packages."
|
||||||
|
(interactive)
|
||||||
|
(unless package-archive-contents
|
||||||
|
(package-refresh-contents))
|
||||||
|
(dolist (package my-packages)
|
||||||
|
(unless (package-installed-p package)
|
||||||
|
(package-install package))))
|
||||||
|
|
||||||
(load custom-file :no-error-if-file-is-missing)
|
;; install packages if not yet installed
|
||||||
|
(install-packages)
|
||||||
|
|
||||||
|
;; setup general
|
||||||
|
(require 'setup-general)
|
||||||
|
|
||||||
|
;; setup general editing settings
|
||||||
|
(require 'setup-editing)
|
||||||
|
|
||||||
|
;; setup org
|
||||||
|
(require 'setup-org)
|
||||||
|
|
||||||
|
;; setup coding
|
||||||
|
(require 'setup-coding)
|
||||||
|
|
||||||
|
;; setup helm
|
||||||
|
(require 'setup-helm)
|
||||||
|
(require 'setup-helm-gtags)
|
||||||
|
|
||||||
|
;; setup speedbar
|
||||||
|
(require 'setup-speedbar)
|
||||||
|
|
||||||
|
;; setup autocompletion
|
||||||
|
(require 'setup-autocompletion)
|
||||||
|
|
||||||
|
;; setup Windows if our bootloader is Windows
|
||||||
|
(if (eq system-type 'windows-nt)
|
||||||
|
(require 'setup-windows)
|
||||||
)
|
)
|
||||||
|
|
||||||
(provide 'init)
|
;; setup dashboard
|
||||||
|
(require 'setup-dashboard)
|
||||||
|
|
||||||
|
;; setup gdb
|
||||||
|
(require 'setup-gdb)
|
||||||
|
|
||||||
|
;; setup multiple cursors
|
||||||
|
(require 'setup-cursors)
|
||||||
|
|
||||||
|
;; setup expand-region
|
||||||
|
(require 'setup-expand-region)
|
||||||
|
|
||||||
|
;; start emacs server
|
||||||
|
(server-start)
|
||||||
|
|
||||||
|
(custom-set-variables
|
||||||
|
;; custom-set-variables was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
'(ansi-color-faces-vector
|
||||||
|
[default default default italic underline success warning error])
|
||||||
|
'(ansi-color-names-vector
|
||||||
|
["#757575" "#CD5542" "#4A8F30" "#7D7C21" "#4170B3" "#9B55C3" "#68A5E9" "gray43"])
|
||||||
|
'(custom-safe-themes
|
||||||
|
(quote
|
||||||
|
("84d2f9eeb3f82d619ca4bfffe5f157282f4779732f48a5ac1484d94d5ff5b279" "c74e83f8aa4c78a121b52146eadb792c9facc5b1f02c917e3dbb454fca931223" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" "938d8c186c4cb9ec4a8d8bc159285e0d0f07bad46edf20aa469a89d0d2a586ea" "6de7c03d614033c0403657409313d5f01202361e35490a3404e33e46663c2596" "ed317c0a3387be628a48c4bbdb316b4fa645a414838149069210b66dd521733f" "1db337246ebc9c083be0d728f8d20913a0f46edc0a00277746ba411c149d7fe5" default)))
|
||||||
|
'(fci-rule-color "#2e2e2e")
|
||||||
|
'(global-company-mode t)
|
||||||
|
'(package-selected-packages
|
||||||
|
(quote
|
||||||
|
(ample-zen-theme ample-theme magit irony-eldoc elpy irony helm-swoop helm)))
|
||||||
|
'(vc-annotate-background "#3b3b3b")
|
||||||
|
'(vc-annotate-color-map
|
||||||
|
(quote
|
||||||
|
((20 . "#dd5542")
|
||||||
|
(40 . "#CC5542")
|
||||||
|
(60 . "#fb8512")
|
||||||
|
(80 . "#baba36")
|
||||||
|
(100 . "#bdbc61")
|
||||||
|
(120 . "#7d7c61")
|
||||||
|
(140 . "#6abd50")
|
||||||
|
(160 . "#6aaf50")
|
||||||
|
(180 . "#6aa350")
|
||||||
|
(200 . "#6a9550")
|
||||||
|
(220 . "#6a8550")
|
||||||
|
(240 . "#6a7550")
|
||||||
|
(260 . "#9b55c3")
|
||||||
|
(280 . "#6CA0A3")
|
||||||
|
(300 . "#528fd1")
|
||||||
|
(320 . "#5180b3")
|
||||||
|
(340 . "#6380b3")
|
||||||
|
(360 . "#DC8CC3"))))
|
||||||
|
'(vc-annotate-very-old-color "#DC8CC3"))
|
||||||
|
(custom-set-faces
|
||||||
|
;; custom-set-faces was added by Custom.
|
||||||
|
;; If you edit it by hand, you could mess it up, so be careful.
|
||||||
|
;; Your init file should contain only one such instance.
|
||||||
|
;; If there is more than one, they won't work right.
|
||||||
|
)
|
||||||
|
|
||||||
|
(provide 'init)
|
||||||
;;; init.el ends here
|
;;; init.el ends here
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: Make a define
|
|
||||||
# key: def
|
|
||||||
# --
|
|
||||||
|
|
||||||
#define ${1:mydefine$(upcase yas-text)} $2
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
# name: for with loop variable
|
# name: for with loop variable
|
||||||
# key: fori
|
# key: fori
|
||||||
# --
|
# --
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
for (${1:size_t i = 0}; ${2:i < N}; ${3:++i}) {
|
for (${1:i = 0}; ${2:i < N}; ${3:++i}) {
|
||||||
$0
|
$0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
#name : #ifndef XXX; #define XXX; #endif
|
|
||||||
# key: header
|
|
||||||
# --
|
|
||||||
|
|
||||||
#ifndef ${1:_`(upcase (file-name-nondirectory (file-name-sans-extension (or (buffer-file-name) ""))))`_H_}
|
|
||||||
#define $1
|
|
||||||
|
|
||||||
$0
|
|
||||||
|
|
||||||
#endif /* $1 */
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: kaboom
|
|
||||||
# key: kb
|
|
||||||
# --
|
|
||||||
|
|
||||||
char (*__kaboom)[sizeof($1)] = 1;
|
|
||||||
9
snippets/c-mode/oncekl
Normal file
9
snippets/c-mode/oncekl
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
#name : #ifndef XXX; #define XXX; #endif
|
||||||
|
# key: oncekl
|
||||||
|
# --
|
||||||
|
#ifndef ${1:`(upcase (file-name-nondirectory (file-name-sans-extension (or (buffer-file-name) ""))))`_H_}
|
||||||
|
#define $1
|
||||||
|
|
||||||
|
$0
|
||||||
|
|
||||||
|
#endif /* $1 */
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: Start emacs source block
|
|
||||||
# key: se
|
|
||||||
# --
|
|
||||||
|
|
||||||
#+BEGIN_SRC emacs-lisp
|
|
||||||
${1}
|
|
||||||
#+END_SRC
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: Filetags
|
|
||||||
# key: ft
|
|
||||||
# --
|
|
||||||
|
|
||||||
#+FILETAGS: :$1:
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: Org source code block
|
|
||||||
# key: s
|
|
||||||
# --
|
|
||||||
|
|
||||||
#+BEGIN_SRC
|
|
||||||
${1}
|
|
||||||
#+END_SRC
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
# -*- mode: snippet -*-
|
|
||||||
# name: Git commit message template
|
|
||||||
# key: bac
|
|
||||||
# --
|
|
||||||
|
|
||||||
Before this commit,
|
|
||||||
${1}
|
|
||||||
|
|
||||||
After this commit,
|
|
||||||
${2}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue