;;; init-misc.el --- Miscellaneous customizations -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (keymap-global-set "" #'keyboard-escape-quit) (keymap-global-set "C-S-f" #'occur) (keymap-global-set "C-h" #'my-replace-string) (keymap-global-set "C-q" #'save-buffers-kill-terminal) (keymap-global-set "C-s" #'save-buffer) (keymap-global-set "C-w" #'kill-this-buffer) (keymap-global-set "C-x C-b" #'switch-to-buffer) (keymap-global-set "C-y" #'undo-redo) (keymap-global-unset "C-x C-c") (keymap-global-unset "C-x C-z") (keymap-global-unset "M-") (setq auto-save-default nil) (setq confirm-kill-emacs #'y-or-n-p) (setq create-lockfiles nil) (setq font-lock-maximum-decoration 1) (setq frame-resize-pixelwise t) ; Prevent gap caused by no menu bar. (setq frame-title-format "Emacs") (setq inhibit-startup-screen t) (setq initial-scratch-message nil) (setq make-backup-files nil) (setq minibuffer-default-prompt-format "") (setq mouse-drag-copy-region nil) (setq mouse-wheel-progressive-speed nil) (setq mouse-wheel-scroll-amount '(20)) (setq pop-up-windows nil) (setq scroll-preserve-screen-position t) (setq select-enable-clipboard t) (setq sentence-end-double-space nil) (setq split-height-threshold nil) (setq split-width-threshold 0) (setq uniquify-buffer-name-style 'post-forward-angle-brackets) (setq-default cursor-type 'bar) (setq-default fill-column 80) (setq-default line-spacing 1) ; Increase line spacing by 1px. (setq-default truncate-lines t) (column-number-mode 1) (menu-bar-mode -1) (prefer-coding-system 'utf-8) (scroll-bar-mode -1) (server-start) ; Needed for emacsclient. (show-paren-mode -1) (set-frame-font "Liberation Mono 11" nil t) (tool-bar-mode -1) (defun my-add-node-modules-path () "Add current project's Node.js modules to variable `exec-path'. This function replaces the package add-node-modules-path, which I stopped using only because I try to avoid dependencies." (let ((project-path (locate-dominating-file default-directory "node_modules"))) (when project-path (let ((bin-path (concat project-path "node_modules/.bin"))) (setq-local exec-path (append exec-path (list bin-path))))))) (defun my-insert-tab () "Insert tab character. http://xahlee.info/emacs/emacs/emacs_tabs_space_indentation_setup.html" (interactive) (insert "\t")) (defun my-replace-string () "Replace string in region or entire buffer." (interactive) (if (use-region-p) (call-interactively #'replace-string) (save-excursion (goto-char (point-min)) (call-interactively #'replace-string)))) (defalias 'my-align-in-region #'align-regexp) (defalias 'my-delete-file #'delete-file) (defalias 'my-describe-face #'describe-face) (defalias 'my-display-line-numbers-mode #'display-line-numbers-mode) (defalias 'my-fill-region #'fill-region) (defalias 'my-list-faces #'list-faces-display) (defalias 'my-list-packages #'list-packages) (defalias 'my-load-file #'load-file) (defalias 'my-load-theme #'load-theme) (defalias 'my-package-autoremove #'package-autoremove) (defalias 'my-rectable-mark-mode #'rectangle-mark-mode) (defalias 'my-search-in-buffers #'multi-occur-in-matching-buffers) (defalias 'my-sort-lines #'sort-lines) (defalias 'my-toggle-truncate-lines #'toggle-truncate-lines) (provide 'init-misc) ;;; init-misc.el ends here