Add config.org + replace setup-editing/general.el
This commit is contained in:
parent
ae07ba56ef
commit
3abf958cc8
7 changed files with 454 additions and 325 deletions
|
|
@ -1,134 +0,0 @@
|
|||
(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)
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
(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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue