Added cutting/copying of whole lines, added mwim, added folding.

This commit is contained in:
tastytea 2019-03-19 20:49:29 +01:00
parent cdb408bc41
commit 2fb16ecd40
1 changed files with 32 additions and 11 deletions

43
init.el
View File

@ -1,5 +1,9 @@
;;; .emacs --- tastytea's .emacs file.
;;; init.el --- tastytea's Emacs init file.
;;; Commentary:
;;; I am using this file with Emacs 26, but most of it will probably work with
;;; Emacs 24 and above.
;;; Code:
;;;;;;;;;;;;;;;;;;;; Packages ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -76,6 +80,17 @@
;; kept-old-versions 2
version-control t)
;; Region commands act on the current line if no text is visually selected
;; https://www.emacswiki.org/emacs/WholeLineOrRegion
(do-all-symbols (symbol)
(when (and (commandp symbol t)
(string-match-p "-region$\\|kill-ring-save" (symbol-name symbol)))
(put symbol 'interactive-form
'(interactive
(if (use-region-p)
(list (region-beginning) (region-end))
(list (line-beginning-position) (line-beginning-position 2)))))))
;;;;;;;;;;;;;;;;;;;; Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Next/Previous buffer
(global-set-key (kbd "C-c <left>") 'previous-buffer)
@ -236,18 +251,23 @@
:bind
("C-c c" . smart-comment))
;; Toggle betweeen beginning of line and beginning of code
(defun beginning-of-line-or-indentation ()
"Move to beginning of line, or indentation."
(interactive)
(if (bolp)
(back-to-indentation)
(beginning-of-line)))
(global-set-key (kbd "<home>") 'beginning-of-line-or-indentation)
;; Toggle betweeen beginning/end of line and beginning/end of code
(use-package mwim
:bind
("<home>" . mwim-beginning-of-line-or-code)
("<end>" . mwim-end-of-line-or-code))
;; Auto-type closing brackets
(electric-pair-mode t)
;; Folding
(hs-minor-mode)
(use-package fold-dwim
:bind
("<f7>" . fold-dwim-toggle)
("C-c f" . fold-dwim-toggle))
;;;;;;;;;;;;;;;;;;;; Appearance ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Theme
;; (unless slow-computer
@ -482,10 +502,11 @@
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(ido-sort-mtime ido-sort-mtime-mode doom-themes doom-modeline all-the-icons zenburn-theme use-package tabbar-ruler spaceline smart-comment realgud projectile popup nginx-mode neotree multiple-cursors monokai-theme markdown-mode magit irony-eldoc hl-todo flycheck-rtags flycheck-irony flx-ido fill-column-indicator crontab-mode counsel company-rtags company-nginx company-irony-c-headers company-irony company-flx cmake-ide benchmark-init base16-theme autothemer auto-package-update adoc-mode))))
(mwim fold-dwim ido-sort-mtime ido-sort-mtime-mode doom-themes doom-modeline all-the-icons zenburn-theme use-package tabbar-ruler spaceline smart-comment realgud projectile popup nginx-mode neotree multiple-cursors monokai-theme markdown-mode magit irony-eldoc hl-todo flycheck-rtags flycheck-irony flx-ido fill-column-indicator crontab-mode counsel company-rtags company-nginx company-irony-c-headers company-irony company-flx cmake-ide benchmark-init base16-theme autothemer auto-package-update adoc-mode))))
(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.
)
'(tabbar-selected (nil :background "#333638" :foreground "LightGray" :family "Sans Serif" :bold t))
'(tabbar-unselected (nil :background "#1C1E1F" :foreground "DarkGray" :family "Sans Serif" :italic t)))