Browse Source

Added automated package install, extreme navigation

* Missing packages should automatically install at startup
* Dired narrow for quicker dired navigation
* Extreme navigation options for using arrow keys and iy-go-to-char
master
macoymadson@gmail.com 4 years ago
parent
commit
f664ad932d
  1. 14
      Emacs/core-settings.el
  2. 4
      Emacs/keybinds.el
  3. 32
      Emacs/navigation.el
  4. 61
      Emacs/packages.el

14
Emacs/core-settings.el

@ -1,18 +1,4 @@
;; Enable MELPA
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
;; TODO: Test if melpa still works
;; (package-initialize)
;; Some settings from http://ergoemacs.org/emacs/emacs_make_modern.html
;; make cursor movement stop in between camelCase words. (don't)

4
Emacs/keybinds.el

@ -185,6 +185,9 @@
(define-key dired-mode-map (kbd "S-<return>") 'dired-find-file)
;; Was dired-up-directory
(define-key dired-mode-map (kbd "<backspace>") (lambda () (interactive) (find-alternate-file "..")))
(when (require 'dired-narrow)
(define-key dired-mode-map (kbd "f") 'dired-narrow-fuzzy))
)
;; Compilation mode customizations
@ -270,3 +273,4 @@
:lighter " M")
(my-keys-minor-mode 1)

32
Emacs/navigation.el

@ -70,6 +70,34 @@
;; Go to char. This is like avy quick jump but instead just goes to the next one, not any onscreen
(when (require 'iy-go-to-char)
(global-set-key (kbd "C-n") 'iy-go-to-char)
(global-set-key (kbd "C-S-n") 'iy-go-to-char-backward)
(define-key iy-go-to-char-keymap (kbd "C-g") 'iy-go-to-char-done)
(defun macoy-iy-go-to-char-regular-mode ()
(interactive)
(global-set-key (kbd "<left>") 'left-char)
(global-set-key (kbd "<right>") 'right-char)
(global-set-key (kbd "C-n") 'iy-go-to-char)
(global-set-key (kbd "C-S-n") 'iy-go-to-char-backward))
(macoy-iy-go-to-char-regular-mode)
;;
;; Extreme keymappings
;; Keys which shouldn't be for the general user because they're confusing
(defun macoy-iy-go-to-char-extreme-mode ()
(interactive)
(global-set-key (kbd "<left>") 'iy-go-to-char-backward)
(global-set-key (kbd "<right>") 'iy-go-to-char)
(defun macoy-iy-go-to-char-left-done ()
(interactive)
(iy-go-to-char-done)
(left-char))
(defun macoy-iy-go-to-char-right-done ()
(interactive)
(iy-go-to-char-done)
(right-char))
(define-key iy-go-to-char-keymap (kbd "<left>") 'macoy-iy-go-to-char-left-done)
(define-key iy-go-to-char-keymap (kbd "<right>") 'macoy-iy-go-to-char-right-done)
(global-set-key (kbd "C-n") 'right-char)
(global-set-key (kbd "C-S-n") 'left-char))
(when (string-equal (user-login-name) "mmadson")
(macoy-iy-go-to-char-extreme-mode))
)

61
Emacs/packages.el

@ -0,0 +1,61 @@
;; Handle installing packages
;; Enable MELPA
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
(add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))
;; TODO: Test if melpa still works
;; (package-initialize)
;; Install uninstalled packages
(let* ((package--builtins nil)
(packages
'(adaptive-wrap
ag
alect-themes
auto-complete
avy
base16-theme
better-defaults
clang-format
darktooth-theme
diminish
dired-narrow
dsvn
engine-mode
expand-region
flx-ido
ido-vertical-mode
ivy
ivy-xref
iy-go-to-char
keyfreq
magit
marmalade-demo
multiple-cursors
powerline
projectile
rainbow-mode
simpleclip
smex
smooth-scrolling
sublime-themes
swiper
web-beautify
web-mode
xah-find
yasnippet
zenburn-theme
)))
(ignore-errors
(let ((packages (remove-if 'package-installed-p packages)))
(when packages
(package-refresh-contents)
(mapc 'package-install packages)))))
Loading…
Cancel
Save