2015-07-07 13:10:57 +01:00
|
|
|
;; Functions -------------------------------------------------
|
|
|
|
|
|
|
|
(defun fg42-reload ()
|
|
|
|
"Reload the entire FG42."
|
|
|
|
(interactive)
|
|
|
|
(load-file (concat (getenv "FG42_HOME") "/fg42-config.el")))
|
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
;;;###autoload
|
2015-07-09 12:05:26 +01:00
|
|
|
(defun extensions/editor-initialize ()
|
2015-07-07 12:25:06 +01:00
|
|
|
"Base plugin initialization."
|
|
|
|
(message "Initializing 'editor' extension.")
|
|
|
|
|
2016-11-21 08:19:35 +00:00
|
|
|
(require 'cheatsheet)
|
2015-07-22 08:13:20 +01:00
|
|
|
(require 'extensions/editor/utils)
|
2015-07-09 11:37:36 +01:00
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
;; Remove splash screen
|
|
|
|
(setq inhibit-splash-screen t)
|
|
|
|
|
|
|
|
;; scratch should be scratch
|
|
|
|
(setq initial-scratch-message nil)
|
|
|
|
|
|
|
|
|
2015-07-07 13:10:57 +01:00
|
|
|
;; Tramp configuration -------------------------------------
|
2015-07-07 12:25:06 +01:00
|
|
|
(setq tramp-default-method "ssh")
|
|
|
|
|
|
|
|
;; replace strings
|
|
|
|
(global-set-key (kbd "C-c M-s") 'replace-string)
|
|
|
|
|
|
|
|
;; Basic Key bindings
|
|
|
|
(global-set-key (kbd "\C-c m") 'menu-bar-mode)
|
|
|
|
|
|
|
|
;; Don't allow tab as indent
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
2015-07-11 13:06:02 +01:00
|
|
|
(ability indent-guides ()
|
|
|
|
"Show guides for indentations in code."
|
|
|
|
|
|
|
|
(indent-guide-global-mode)
|
|
|
|
|
|
|
|
(ability recursive-indent-guides ()
|
|
|
|
"Show recursive indents guides."
|
|
|
|
(setq indent-guide-recursive t))
|
|
|
|
|
|
|
|
(ability delayed-indent-guides ()
|
|
|
|
"Show indent guides with a delay."
|
|
|
|
(setq indent-guide-delay 0.3)))
|
|
|
|
|
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
;; Default indent width
|
|
|
|
(setq tab-width 2)
|
|
|
|
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
|
|
|
|
|
|
|
;; Enhancements ---------------------------------------------
|
|
|
|
|
|
|
|
;; Global configurations
|
|
|
|
(tool-bar-mode -1)
|
|
|
|
(scroll-bar-mode -1)
|
|
|
|
(setq x-select-enable-clipboard t)
|
|
|
|
(column-number-mode t)
|
|
|
|
|
|
|
|
;; linum mode
|
|
|
|
(global-linum-mode)
|
|
|
|
(setq linum-format " %3d ")
|
|
|
|
|
|
|
|
(menu-bar-mode -1)
|
|
|
|
(show-paren-mode t)
|
|
|
|
(cua-selection-mode t)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; expand-region -------------------------------------------
|
|
|
|
(global-set-key (kbd "C-=") 'er/expand-region)
|
|
|
|
|
|
|
|
;; Multiple cursor -----------------------------------------
|
|
|
|
;; multiple cursor configurations
|
|
|
|
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
|
|
|
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
|
|
|
(global-set-key (kbd "C-c C-SPC ") 'mc/mark-all-like-this)
|
|
|
|
|
2015-07-07 13:10:57 +01:00
|
|
|
;; Reload FG42
|
|
|
|
(define-key global-map (kbd "<f5>") 'fg42-reload)
|
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
;; Key Chord ------------------------------------------------
|
|
|
|
;; (require 'key-chord)
|
|
|
|
;; (key-chord-mode 1)
|
|
|
|
|
|
|
|
;; (key-chord-define-global "hj" 'undo)
|
|
|
|
;; (key-chord-define-global "kl" 'right-word)
|
|
|
|
;; (key-chord-define-global "sd" 'left-word)
|
|
|
|
;; (key-chord-define-global "m," 'forward-paragraph)
|
|
|
|
;; (key-chord-define-global "p[" 'backward-paragraph)
|
|
|
|
|
|
|
|
;; HideShow -------------------------------------------------------
|
|
|
|
(global-set-key (kbd "C-\-") 'hs-toggle-hiding)
|
|
|
|
(hs-minor-mode)
|
|
|
|
|
|
|
|
;; IDO configurations ---------------------------------------------
|
2015-07-21 10:02:28 +01:00
|
|
|
(with-ability ido
|
|
|
|
(require 'flx-ido)
|
|
|
|
(require 'ido-vertical-mode)
|
2015-07-07 12:25:06 +01:00
|
|
|
|
2015-07-21 10:02:28 +01:00
|
|
|
(ido-mode t)
|
|
|
|
(ido-everywhere t)
|
2015-07-22 06:30:33 +01:00
|
|
|
(ido-ubiquitous-mode 1)
|
|
|
|
|
|
|
|
(smex-initialize)
|
|
|
|
(global-set-key (kbd "M-x") 'smex)
|
|
|
|
|
2015-07-21 10:02:28 +01:00
|
|
|
(flx-ido-mode 1)
|
|
|
|
(setq ido-use-faces nil)
|
2016-08-23 09:43:13 +01:00
|
|
|
(setq ido-use-filename-at-point nil)
|
2015-07-22 06:30:33 +01:00
|
|
|
|
2015-07-21 10:02:28 +01:00
|
|
|
(setq ido-enable-flex-matching t)
|
|
|
|
(ido-vertical-mode 1))
|
2015-07-07 12:25:06 +01:00
|
|
|
|
2015-07-22 07:22:37 +01:00
|
|
|
|
2015-07-21 10:02:28 +01:00
|
|
|
;; Helm -----------------------------------------------------
|
|
|
|
(with-ability helm
|
|
|
|
|
|
|
|
(global-set-key (kbd "C-c h") 'helm-command-prefix)
|
|
|
|
(global-unset-key (kbd "C-x c"))
|
|
|
|
|
2015-07-22 08:13:20 +01:00
|
|
|
(define-key helm-map (kbd "<tab>")
|
|
|
|
'helm-execute-persistent-action)
|
|
|
|
(define-key helm-map (kbd "C-i")
|
|
|
|
'helm-execute-persistent-action)
|
|
|
|
(define-key helm-map (kbd "C-z")
|
|
|
|
'helm-select-action)
|
2015-07-21 10:02:28 +01:00
|
|
|
|
|
|
|
(when (executable-find "curl")
|
|
|
|
(setq helm-google-suggest-use-curl-p t))
|
|
|
|
|
2015-07-22 08:13:20 +01:00
|
|
|
(setq helm-split-window-in-side-p t
|
|
|
|
helm-move-to-line-cycle-in-source t
|
|
|
|
helm-ff-search-library-in-sexp t
|
|
|
|
helm-scroll-amount 8
|
2015-07-21 10:02:28 +01:00
|
|
|
helm-ff-file-name-history-use-recentf t)
|
|
|
|
|
|
|
|
(helm-mode 1))
|
|
|
|
|
2015-07-22 07:22:37 +01:00
|
|
|
;; Swiper ---------------------------------------------------
|
|
|
|
(ability swiper ()
|
|
|
|
"Replace default isearch with swiper"
|
2016-03-29 11:10:12 +01:00
|
|
|
(require 'ivy)
|
2015-07-22 07:22:37 +01:00
|
|
|
(ivy-mode 1)
|
2015-07-22 08:13:20 +01:00
|
|
|
|
2015-07-22 07:22:37 +01:00
|
|
|
(setq ivy-use-virtual-buffers t)
|
|
|
|
(global-set-key "\C-s" 'swiper)
|
|
|
|
(global-set-key "\C-r" 'swiper)
|
|
|
|
(global-set-key (kbd "C-c C-r") 'ivy-resume)
|
2015-07-22 08:13:20 +01:00
|
|
|
(global-set-key [f6] 'ivy-resume)
|
|
|
|
(with-ability ido
|
|
|
|
(global-set-key (kbd "C-x b") 'ido-switch-buffer)))
|
2015-07-22 07:22:37 +01:00
|
|
|
|
2015-07-21 10:02:28 +01:00
|
|
|
;; Session Management ---------------------------------------
|
2015-07-18 09:30:40 +01:00
|
|
|
(desktop-save-mode 1)
|
2015-07-07 12:25:06 +01:00
|
|
|
|
|
|
|
;; Backup files ---------------------------------------------
|
|
|
|
;; Put them in one nice place if possible
|
|
|
|
(if (file-directory-p "~/.backup")
|
|
|
|
(setq backup-directory-alist '(("." . "~/.backup")))
|
|
|
|
(make-directory "~/.backup"))
|
|
|
|
|
|
|
|
(setq backup-by-copying t ; Don't delink hardlinks
|
|
|
|
delete-old-versions t ; Clean up the backups
|
|
|
|
version-control t ; Use version numbers on backups,
|
|
|
|
kept-new-versions 3 ; keep some new versions
|
|
|
|
kept-old-versions 2) ; and some old ones, too
|
|
|
|
|
|
|
|
;; get rid of yes-or-no questions - y or n is enough
|
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
2015-07-22 08:13:20 +01:00
|
|
|
(setup-utils)
|
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
(setq my-path (file-name-directory load-file-name))
|
|
|
|
;; Load about submenu
|
|
|
|
(require 'extensions/editor/version)
|
|
|
|
(require 'extensions/editor/about)
|
2015-07-07 13:23:23 +01:00
|
|
|
(require 'extensions/editor/custom)
|
|
|
|
(require 'extensions/editor/session-management))
|
2015-07-22 08:13:20 +01:00
|
|
|
|
2015-07-07 12:25:06 +01:00
|
|
|
(provide 'extensions/editor/init)
|