Created
July 5, 2016 01:22
-
-
Save calebreister/048b83b3125d97e1bc3924c2c9b7c80a to your computer and use it in GitHub Desktop.
Emacs and Nano configuration files with (mostly) matching key combinations.
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
(add-to-list 'load-path "~/.emacs.d/lisp") | |
(add-to-list 'default-frame-alist '(fullscreen . maximized)) | |
; Load modules | |
(load "sr-speedbar.elc") ;CEDET speedbar in current frame | |
(load "modeline-posn.elc") ;Show position of point | |
(load "doc-mode.elc") ;Doxygen mode | |
(load "lua-mode.elc") ;Lua mode | |
(load "markdown-mode.elc") ;Markdown mode | |
(load "bind-key.elc") ;Useful keybinding functions | |
(load "undo-tree.elc") | |
; Key bindings | |
; One of my priorities is to make this work in both terminal and X | |
; Some consoles may need to be configured to send \EOP (F1) when ^h is pressed | |
(global-set-key (kbd "M-c") 'compile) ;Compile | |
(global-set-key (kbd "M-s") 'isearch-backward) ;Reverse search | |
(global-set-key (kbd "C-r") 'replace-string) ;Replace string | |
; Window managment | |
(global-set-key (kbd "C-x p") 'windresize) ;Window resize mode | |
(global-set-key (kbd "C-p") 'other-window) ;Next window | |
(global-set-key (kbd "C-o") ;Previous window | |
(lambda () (interactive) (other-window -1))) | |
(global-set-key (kbd "M-p") 'ace-window) ;Switch window by number | |
(bind-keys* | |
; Navigation | |
("C-j" . backward-char) | |
("M-j" . backward-word) | |
("C-M-j" . move-beginning-of-line) | |
("C-l" . forward-char) | |
("M-l" . forward-word) | |
("C-M-l" . move-end-of-line) | |
("C-k" . previous-line) | |
("M-k" . scroll-down-command) | |
("C-M-k" . recenter-top-bottom) | |
("M-n" . scroll-up-command) | |
("C-M-n" . scroll-other-window) | |
; Kill/cut | |
("C-v" . kill-whole-line) | |
("M-v" . kill-sentence) | |
("C-M-v" . kill-sexp) | |
) | |
(global-unset-key (kbd "C-a")) | |
; Aliases | |
(defalias 'qrr 'query-replace-regexp) | |
(defalias 'lml 'list-matching-lines) | |
(defalias 'dml 'delete-matching-lines) | |
(defalias 'dnml 'delete-non-matching-lines) | |
(defalias 'dtw 'delete-trailing-whitespace) | |
(defalias 'sl 'sort-lines) | |
(defalias 'rr 'reverse-region) | |
(defalias 'rs 'replace-string) | |
(defalias 'g 'grep) | |
(defalias 'gf 'grep-find) | |
(defalias 'fd 'find-dired) | |
(defalias 'rb 'revert-buffer) | |
(defalias 'sh 'eshell) | |
(defalias 'fb 'flyspell-buffer) | |
(defalias 'cc 'calculator) | |
(defalias 'vlm 'visual-line-mode) | |
(defalias 'glm 'global-linum-mode) | |
(defalias 'sbt 'sr-speedbar-toggle) | |
; Major modes | |
(add-to-list 'auto-mode-alist '("\\.dox$" . c-mode)) ;Doxygen | |
(add-to-list 'auto-mode-alist '("\\.m$" . octave-mode)) ;Matlab/Octave | |
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode)) ;Lua files | |
(add-to-list 'interpreter-mode-alist '("lua" . lua-mode)) ;Lua interpreter | |
(add-to-list 'auto-mode-alist '("\\.md$" . markdown-mode)) ;Markdown | |
; Minor modes | |
(global-visual-line-mode) | |
(global-linum-mode) | |
(tool-bar-mode 0) | |
(column-number-mode) | |
(semantic-mode) | |
(global-semantic-idle-completions-mode) | |
(global-semantic-highlight-func-mode) | |
(global-semantic-decoration-mode) | |
(global-semantic-idle-summary-mode) | |
(global-semantic-stickyfunc-mode) | |
(global-undo-tree-mode) | |
; Highlight Doxygen comments in C files | |
(add-hook 'c-mode-common-hook 'doc-mode) | |
; Set compile command to run in ../ by default | |
(setq-default compile-command "make -C ../") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; C/C++ Style & Settings | |
(defun my-c-initialization-hook () | |
(define-key c-mode-base-map "\C-m" 'c-context-line-break)) | |
(add-hook 'c-initialization-hook 'my-c-initialization-hook) | |
; load my C/C++ style | |
(load "~/.emacs.d/cpp-style.el") | |
(require 'my-c-style) | |
(c-add-style "PERSONAL" my-c-style) | |
;; Customizations for all modes in CC Mode. | |
(defun my-c-mode-common-hook () | |
(c-set-style "PERSONAL") | |
(indent-tabs-mode nil) | |
(c-toggle-hungry-state 1)) | |
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(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. | |
'(ac-auto-show-menu nil) | |
'(ac-auto-start nil) | |
'(ansi-color-faces-vector | |
[default default default italic underline success warning error]) | |
'(column-number-mode t) | |
'(comment-inline-offset 2) | |
'(custom-enabled-themes (quote (tango-dark))) | |
'(folding-allow-overlays t) | |
'(folding-load-hook nil) | |
'(folding-mode-string " Fld") | |
'(idle-update-delay 0.1) | |
'(inhibit-startup-screen t) | |
'(linum-format "%4d") | |
'(show-paren-mode t) | |
'(speedbar-use-images nil) | |
'(speedbar-verbosity-level 2) | |
'(split-height-threshold 60) | |
'(split-width-threshold 60) | |
'(sr-speedbar-default-width 20) | |
'(srecode-map-load-path | |
(quote | |
("~/.emacs-pkg/cedet-1.1/cogre/templates/" "~/.emacs-pkg/cedet-1.1/srecode/templates/" "~/.srecode/"))) | |
'(tab-width 4) | |
'(tool-bar-mode nil) | |
'(tooltip-delay 0.7) | |
'(which-function-mode nil)) | |
(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. | |
'(default ((t (:family "Fira Mono" :foundry "CTDB" :slant normal :weight normal :height 90 :width normal))))) |
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
#Enable syntax highlighting | |
#include /usr/share/nano/*.nanorc | |
#Better syntax highlighting, requires nanos-syntax-highlighting-git from AUR | |
include /usr/share/nano-syntax-highlighting/*.nanorc | |
#Options | |
set mouse #Enable mouse support | |
set tabsize 4 #Set tab to be 4 spaces | |
set tabstospaces #Use spaces instead of tabs | |
set suspend #Enable ^z suspension | |
set smarthome | |
set autoindent | |
#Find/replace | |
bind ^S whereis main | |
bind M-S searchagain main | |
bind ^R replace main | |
#Undo/redo | |
unbind ^_ main #^_ = ^/ | |
bind ^_ undo main | |
unbind M-/ main | |
bind M-/ redo main | |
#Cursor movement | |
bind ^j left all | |
bind M-j prevword all | |
bind M-J home all | |
bind ^L right all | |
bind M-l nextword all | |
bind M-L end all | |
bind ^K up all | |
bind M-k prevpage all | |
bind M-n nextpage all | |
unbind M-> all | |
bind M-> lastline all | |
bind M-< firstline all | |
unbind ^p all | |
unbind ^f all | |
unbind ^b all | |
#Cut/copy | |
bind ^v cut all | |
bind ^y uncut all | |
bind M-w copytext all | |
#Other | |
bind ^g cancel all | |
bind M-; comment all | |
bind ^Space mark all | |
bind F1 help all | |
bind ^h help all | |
#Some consoles may need to be configured to send \EOP when ^h is pressed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment