2016-11-28 11:06:35 +00:00
|
|
|
;; Customizations --------------------------------------------
|
|
|
|
(defcustom fg42-todo-file "~/.TODO.org"
|
|
|
|
"Path to your TODO file. You can use a tramp address here as well."
|
|
|
|
:type 'string
|
|
|
|
:group 'fg42)
|
|
|
|
|
|
|
|
;; Hooks -----------------------------------------------------
|
|
|
|
(defvar fg42-before-open-todo-hook nil)
|
|
|
|
(defvar fg42-after-open-todo-hook nil)
|
2015-07-07 13:10:57 +01:00
|
|
|
|
2016-11-28 11:06:35 +00:00
|
|
|
;; Functions -------------------------------------------------
|
2015-07-07 13:10:57 +01:00
|
|
|
(defun fg42-reload ()
|
|
|
|
"Reload the entire FG42."
|
|
|
|
(interactive)
|
|
|
|
(load-file (concat (getenv "FG42_HOME") "/fg42-config.el")))
|
|
|
|
|
2016-11-28 11:06:35 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun fg42-open-todo ()
|
|
|
|
(interactive)
|
|
|
|
(run-hooks 'fg42-before-open-todo-hook)
|
|
|
|
(find-file fg42-todo-file)
|
|
|
|
(run-hooks 'fg42-after-open-todo-hook))
|
|
|
|
|
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
|
|
|
|
2016-11-21 08:22:49 +00:00
|
|
|
(cheatsheet-add :group '--HELP--
|
|
|
|
:key "C-?"
|
|
|
|
:description "Show this cheatsheet")
|
2017-03-22 20:50:05 +00:00
|
|
|
(cheatsheet-add :group '--Navigation--
|
2017-03-22 20:53:18 +00:00
|
|
|
:key "s-."
|
2017-03-22 20:50:05 +00:00
|
|
|
:description "Move a word to right")
|
|
|
|
(cheatsheet-add :group '--Navigation--
|
2017-03-22 20:53:18 +00:00
|
|
|
:key "s-,"
|
2017-03-22 20:50:05 +00:00
|
|
|
:description "Move a word to left")
|
|
|
|
(cheatsheet-add :group '--Navigation--
|
|
|
|
:key "s-p"
|
|
|
|
:description "Move back a paragraph")
|
|
|
|
(cheatsheet-add :group '--Navigation--
|
|
|
|
:key "s-n"
|
|
|
|
:description "Move forward by a paragraph")
|
|
|
|
|
2016-11-21 08:22:49 +00:00
|
|
|
(global-set-key (kbd "C-?") 'cheatsheet-show)
|
2017-03-22 20:53:18 +00:00
|
|
|
(global-set-key (kbd "s-.") 'right-word)
|
|
|
|
(global-set-key (kbd "s-,") 'left-word)
|
2017-03-22 20:50:05 +00:00
|
|
|
(global-set-key (kbd "s-n") 'forward-paragraph)
|
|
|
|
(global-set-key (kbd "s-p") 'backward-paragraph)
|
2016-11-21 08:22:49 +00: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)
|
|
|
|
|
|
|
|
|
2016-11-28 11:06:35 +00:00
|
|
|
|
2015-07-07 13:10:57 +01:00
|
|
|
;; Tramp configuration -------------------------------------
|
2016-11-28 11:06:35 +00:00
|
|
|
(ability tramp ()
|
|
|
|
(setq tramp-default-method "ssh")
|
2016-11-28 11:10:06 +00:00
|
|
|
(cheatsheet-add :group '--EDITOR--
|
|
|
|
:key "f9"
|
|
|
|
:description "Open up your todo file. checkout `fg42-todo-file` var and `fg42-open-todo` function.")
|
2016-11-28 11:06:35 +00:00
|
|
|
(global-set-key [f9] 'fg42-open-todo))
|
2015-07-07 12:25:06 +01:00
|
|
|
|
|
|
|
;; 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))
|
|
|
|
|
2016-11-21 11:59:37 +00:00
|
|
|
(ability ivy ()
|
|
|
|
"Completion using ivy."
|
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)
|
2016-11-21 12:50:25 +00:00
|
|
|
(global-set-key (kbd "C-c C-r") 'ivy-resume))
|
2016-11-21 11:59:37 +00:00
|
|
|
|
|
|
|
;; Swiper ---------------------------------------------------
|
|
|
|
(ability swiper (ivy)
|
|
|
|
"Replace default isearch with swiper"
|
|
|
|
(global-set-key "\C-s" 'swiper)
|
|
|
|
(global-set-key "\C-r" 'swiper))
|
|
|
|
;; (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)
|