-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds emacs config, git hooks, and minor changes
- Loading branch information
rzjnzk
committed
Jun 5, 2019
1 parent
9a0e687
commit 2360c2a
Showing
76 changed files
with
3,322 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# `~/.emacs.d/` | ||
|
||
## Setup | ||
|
||
1) Run emacs to install any missing packages | ||
2) Setup C++ company-mode auto completions | ||
a) Install cmake on system | ||
b) Setup irony: `M-x irony-install-server` | ||
|
||
## Notes | ||
|
||
End each `~/.emacs.d/lisp/\*.el` with | ||
`(provide 'file-name)` | ||
|
||
In `init.el` for each `~/.emacs.d/lisp/\*.el` in order of execution write | ||
`(require 'file-name)` or `(use-package file-name :ensure nil)` | ||
|
||
## TODO | ||
|
||
- consider having a max columns per line of 80, though measured from the first non-whitespace character as to make the code more readable, though allow for loger indented blocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
; unbind buffer menu popup | ||
(global-set-key (kbd "C-<mouse-1>") nil) | ||
|
||
(global-set-key (kbd "C-d") 'helm-M-x) | ||
|
||
;; NOTE: "C-_" -> "ctrl+<backspace>" or "ctrl+/" | ||
(global-set-key (kbd "C-<backspace>") 'backward-kill-word) | ||
|
||
;; BEGIN unbind in all modes before cua-mode rebind | ||
|
||
;; NOTE: if there is no selection, the line should be selected before running 'kill-ring-save ('copy') | ||
;; TODO: check if 'kill-ring-save will work if the copied selection is alter, and if it copies to the clipboard on windows GUI Emacs, note that this is the desired behaviour | ||
(global-set-key (kbd "C-c") nil) ; 'kill-ring-save | ||
(global-set-key (kbd "C-v") nil) ; 'yank | ||
|
||
;; END unbind in all modes before cua-mode rebind | ||
|
||
; cua mode | ||
(cua-mode t) | ||
(setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands | ||
(transient-mark-mode 1) ;; No region when it is not highlighted | ||
(setq cua-keep-region-after-copy t) ;; Standard Windows behaviour | ||
|
||
; (global-set-key (kbd "C-x") 'kill-region) | ||
(global-set-key (kbd "C-z") 'undo) ; already bound with cua-mode | ||
; (require 'redo) ; fails | ||
; (global-set-key (kbd "C-y") 'redo) ; fails | ||
|
||
; save | ||
(global-set-key (kbd "C-s") | ||
(lambda () | ||
(interactive) | ||
(delete-trailing-whitespace) | ||
; TODO: format code | ||
(save-buffer) | ||
) | ||
) | ||
|
||
(global-set-key (kbd "C-f") 'isearch-forward) | ||
(global-set-key (kbd "C-w") 'delete-window) | ||
(global-set-key (kbd "C-S-w") 'save-buffers-kill-emacs) | ||
|
||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) | ||
(global-set-key (kbd "<ESC>") 'keyboard-escape-quit) | ||
|
||
(global-set-key (kbd "C-/") 'comment-or-uncomment-region) | ||
|
||
; navigate windows | ||
(global-set-key (kbd "M-<right>") 'windmove-right) | ||
(global-set-key (kbd "M-<left>") 'windmove-left) | ||
(global-set-key (kbd "M-<up>") 'windmove-up) | ||
(global-set-key (kbd "M-<down>") 'windmove-down) | ||
|
||
; mouse support in terminal | ||
(unless window-system | ||
(require 'mouse) | ||
(xterm-mouse-mode t) | ||
|
||
; TODO: fails | ||
(global-set-key (kbd "<mouse-4>") | ||
(lambda () | ||
(interactive) | ||
(scroll-down 3) | ||
) | ||
) | ||
|
||
; TODO: fails | ||
(global-set-key (kbd "<mouse-5>") | ||
(lambda () | ||
(interactive) | ||
(scroll-up 3) | ||
) | ||
) | ||
|
||
(defun track-mouse (e)) | ||
(setq mouse-sel-mode t) | ||
) | ||
|
||
(provide 'init-global-key-map) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(define-key input-decode-map "^[[Z" [S-TAB]) | ||
(define-key input-decode-map "^[[Z" [S-<tab>]) | ||
(define-key input-decode-map "^[[Z" [<backtab>]) | ||
|
||
(provide 'init-input-decode-map) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
;; BEGIN add package repositories | ||
|
||
(require 'package) | ||
|
||
(setq | ||
package-archives | ||
'( | ||
("gnu elpa" . "https://elpa.gnu.org/packages/") | ||
("elpa" . "http://tromey.com/elpa/") | ||
("melpa stable" . "https://stable.melpa.org/packages/") | ||
("melpa" . "https://melpa.org/packages/") | ||
("marmalade" . "http://marmalade-repo.org/packages/") | ||
) | ||
|
||
;; package-archive-priorities | ||
;; '( | ||
;; ("gnu elpa" . 5) | ||
;; ("elpa" . 4) | ||
;; ("melpa stable" . 3) | ||
;; ("melpa" . 2) | ||
;; ("marmalade" . 1) | ||
;; ) | ||
;; | ||
;; You want to configure package-archive-priorities. The default is to get the most recent version of all available versions in all archives --- which will always be Melpa's. By setting package-archive-priorities, you instruct package.el to pick the most recent version in the first archive containing the package in the order you provide. | ||
) | ||
|
||
;; END add package repositories | ||
|
||
(package-initialize) | ||
|
||
;; BEGIN specify and install missing packages | ||
|
||
;; fetch the list of packages available | ||
(unless package-archive-contents | ||
(package-refresh-contents) | ||
) | ||
|
||
;; install the missing packages | ||
(dolist | ||
(package | ||
'( | ||
;; elisp bug hunter | ||
bug-hunter | ||
xah-css-mode | ||
;; snippets | ||
yasnippet | ||
;; TODO: learn what this can do | ||
projectile | ||
;; TODO: learn what this does | ||
use-package | ||
;; file explorer | ||
neotree | ||
minimap | ||
; ;; dated auto complete | ||
; auto-complete | ||
;; better auto complete | ||
company | ||
company-quickhelp | ||
rtags | ||
company-rtags | ||
;rtags-helm | ||
;; rainbow delimiters ({[ | ||
rainbow-delimiters | ||
; ;; auto delimiter closer | ||
; ;; TODO: unavailable | ||
; electric-pair | ||
;; TODO: figure out what this is | ||
feebleline | ||
;; > BEGIN themes | ||
atom-one-dark-theme | ||
one-themes | ||
smart-mode-line-atom-one-dark-theme | ||
;; < END themes | ||
;; bottom status line customisation | ||
smart-mode-line | ||
;; git change per-line gutter | ||
git-gutter | ||
;; git integration | ||
magit | ||
;; command auto-complete | ||
helm | ||
;; helm third pary support | ||
helm-core | ||
;; | ||
helm-gtags | ||
;; jump to searched characters | ||
ace-jump-mode | ||
;; syntax checker | ||
flymake | ||
|
||
all-the-icons | ||
|
||
doom-themes | ||
solaire-mode | ||
|
||
irony | ||
company-irony | ||
flycheck-irony | ||
|
||
rainbow-mode | ||
|
||
;;doom-modeline | ||
|
||
fringe-helper | ||
git-gutter-fringe | ||
|
||
markdown-mode | ||
) | ||
) | ||
|
||
(unless (package-installed-p package) | ||
(package-install package) | ||
) | ||
) | ||
|
||
;; END specify and install missing packages | ||
|
||
(provide 'init-packages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
(setq inhibit-startup-message t) | ||
(menu-bar-mode -1) | ||
(tool-bar-mode -1) | ||
(scroll-bar-mode -1) | ||
|
||
;; reduces lag on windows emacs gui | ||
(setq inhibit-compacting-font-caches t) | ||
(setq-default | ||
scroll-margin 0 | ||
scroll-conservatively 10000 | ||
scroll-preserve-screen-position t | ||
mouse-wheel-progressive-speed nil | ||
) | ||
|
||
;; Change all yes/no prompts to y/n | ||
(defalias 'yes-or-no-p 'y-or-n-p) | ||
;; Disable native UI prompts | ||
(defalias 'y-or-n-p (lambda (&rest _) t)) | ||
(setq-default confirm-kill-emacs nil) | ||
(setq-default use-dialog-box nil) | ||
|
||
;; window configuration | ||
(add-hook 'window-configuration-change-hook | ||
(lambda () | ||
; ; change the vertical window seperater character | ||
; (let ((display-table (or buffer-display-table standard-display-table))) | ||
; (set-display-table-slot display-table 5 ?│) ;; or ┃ | ||
; (set-window-display-table (selected-window) display-table) | ||
; ) | ||
|
||
; ; make the vertical boarder a solid coloured block char | ||
; (set-face-background 'vertical-border "grey") | ||
; (set-face-foreground 'vertical-border (face-background 'vertical-border)) | ||
|
||
; add left and right window single-character margins | ||
;(set-window-margins (car (get-buffer-window-list (current-buffer) nil t)) 1 1) | ||
) | ||
) | ||
|
||
;; cursor position in mode bar (line/column) | ||
(setq line-number-mode t) | ||
(setq column-number-mode t) | ||
;; line number margin | ||
(global-linum-mode t) | ||
;; NOTE: the number is the number of columns reserved for higher orders of magnitude, the `d` is the digit, and the space is a padding space | ||
;; NOTE: doom-themes seems to automatically insert a padding space to the right of the digit | ||
;; NOTE: `\u2502` can be used for a vertical line | ||
(setq linum-format " %4d") | ||
|
||
;; Highlight text cursor line | ||
(global-hl-line-mode 1) | ||
|
||
;; Partially hide text cursor for non active buffers | ||
;; TODO: check if this is working | ||
(setq-default cursor-in-non-selected-windows nil) | ||
|
||
;; Disable bell sound | ||
(setq ring-bell-function 'ignore) | ||
|
||
;; (set-face-attribute 'default nil :height 140) | ||
;; (add-to-list 'default-frame-alist '(font . "Consolas-14")) | ||
;; (set-face-attribute 'default t :font "Consolas-16" | ||
|
||
(if (eq system-type 'windows-nt) | ||
(setq default-frame-alist '((font . "Consolas-13"))) | ||
) | ||
|
||
;;(set-window-margins (selected-window) 1 1) | ||
;;(set-window-margins 5 5) | ||
;; (add-hook! '+popup-buffer-mode-hook | ||
;; (set-window-margins (selected-window) 1 1)) | ||
|
||
(setq-default cursor-type '(bar . 1)) | ||
|
||
;; Hide the cursor in inactive buffers (e.g. NERDTree buffer) | ||
(setq-default cursor-in-non-selected-windows nil) | ||
|
||
;; Maxamise emacs window on startup | ||
(add-to-list 'default-frame-alist '(fullscreen . maximized)) |
Oops, something went wrong.