Commits

William B committed 0df9ead

mimic some vim functionality and flyspell setup

Comments (0)

Files changed (1)

 
 (setq ido-everywhere t)
 (ido-mode 1) 
+
+
+;;
+;; Vim emulated functionality
+;;
+
+(defun vi-open-line-above ()
+    "Insert a newline above the current line and put point at beginning."
+    (interactive)
+    (unless (bolp)
+        (beginning-of-line))
+    (newline)
+    (forward-line -1)
+    (indent-according-to-mode))
+
+(defun vi-open-line-below ()
+    "Insert a newline below the current line and put point at beginning."
+    (interactive)
+    (unless (eolp)
+        (end-of-line))
+    (newline-and-indent))
+
+(defun vi-open-line (&optional abovep)
+    "Insert a newline below the current line and put point at beginning. With a prefix argument,
+    insert a newline above the current line."
+    (interactive "P")
+    (if abovep
+        (vi-open-line-above)
+    (vi-open-line-below)))
+
+;; M-o open line below C-M-o open line above
+(define-key global-map (kbd "M-o") 'vi-open-line)
+
+
+;;
+;; Flyspell
+;;
+
+;; IMPORTANT: ensure aspell and dictionaries of choice are installed
+;; and on windows add aspell bin to path
+;; Win32: http://aspell.net/win32/
+
+(custom-set-variables
+    '(ispell-list-command "--list")
+    '(flyspell-issue-message-flag nil)
+    '(ispell-dictionary "british")
+    '(ispell-program-name "aspell"))
+
+;; easy spell check
+(global-set-key (kbd "<f8>") 'ispell-word)
+(global-set-key (kbd "C-S-<f8>") 'flyspell-mode)
+(global-set-key (kbd "C-M-<f8>") 'flyspell-buffer)
+(global-set-key (kbd "C-<f8>") 'flyspell-check-previous-highlighted-word)
+(defun flyspell-check-next-highlighted-word ()
+    "Custom function to spell check next highlighted word"
+    (interactive)
+    (flyspell-goto-next-error)
+    (ispell-word)
+)
+(global-set-key (kbd "M-<f8>") 'flyspell-check-next-highlighted-word)
+