Extends emacs config to support evil-mode
This commit is contained in:
		
							parent
							
								
									74968572d9
								
							
						
					
					
						commit
						e7b312ec56
					
				
					 3 changed files with 112 additions and 36 deletions
				
			
		
							
								
								
									
										120
									
								
								configs/.emacs
									
										
									
									
									
								
							
							
						
						
									
										120
									
								
								configs/.emacs
									
										
									
									
									
								
							| 
						 | 
					@ -1,32 +1,112 @@
 | 
				
			||||||
 | 
					 | 
				
			||||||
;; Added by Package.el.  This must come before configurations of
 | 
					 | 
				
			||||||
;; installed packages.  Don't delete this line.  If you don't want it,
 | 
					 | 
				
			||||||
;; just comment it out by adding a semicolon to the start of the line.
 | 
					 | 
				
			||||||
;; You may delete these explanatory comments.
 | 
					 | 
				
			||||||
(package-initialize)
 | 
					(package-initialize)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(require 'package)
 | 
					(require 'package)
 | 
				
			||||||
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
 | 
					(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
 | 
				
			||||||
(custom-set-variables
 | 
					(custom-set-variables
 | 
				
			||||||
 ;; custom-set-variables was added by Custom.
 | 
					 '(mouse-wheel-mode nil)
 | 
				
			||||||
 ;; If you edit it by hand, you could mess it up, so be careful.
 | 
					 | 
				
			||||||
 ;; Your init file should contain only one such instance.
 | 
					 | 
				
			||||||
 ;; If there is more than one, they won't work right.
 | 
					 | 
				
			||||||
 '(package-selected-packages
 | 
					 '(package-selected-packages
 | 
				
			||||||
   (quote
 | 
					   (quote
 | 
				
			||||||
    (helm magit dockerfile-mode elixir-mode elm-mode ack))))
 | 
					    (evil helm-swoop iedit vimrc-mode helm-ispell transpose-frame helm-projectile helm-ack nyan-mode alchemist helm magit dockerfile-mode elixir-mode elm-mode ack))))
 | 
				
			||||||
(custom-set-faces
 | 
					(custom-set-faces)
 | 
				
			||||||
 ;; custom-set-faces was added by Custom.
 | 
					 | 
				
			||||||
 ;; If you edit it by hand, you could mess it up, so be careful.
 | 
					 | 
				
			||||||
 ;; Your init file should contain only one such instance.
 | 
					 | 
				
			||||||
 ;; If there is more than one, they won't work right.
 | 
					 | 
				
			||||||
 )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Colorscheme
 | 
				
			||||||
(load-theme 'wombat)
 | 
					(load-theme 'wombat)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Emacs backup files
 | 
				
			||||||
 | 
					(setq-default make-backup-files nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; NyanCat progress bar
 | 
				
			||||||
 | 
					;; (nyan-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Enable autocompletion
 | 
				
			||||||
 | 
					(add-hook 'after-init-hook 'global-company-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Helm Settings
 | 
					;; Helm Settings
 | 
				
			||||||
;; Use helm M-x instead of native M-x
 | 
					(require 'helm)
 | 
				
			||||||
 | 
					(require 'helm-config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-c h") 'helm-command-prefix)
 | 
				
			||||||
 | 
					(global-unset-key (kbd "C-x c"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(global-set-key (kbd "M-x") 'helm-M-x)
 | 
					(global-set-key (kbd "M-x") 'helm-M-x)
 | 
				
			||||||
(global-set-key (kbd "C-x C-f") 'helm-find-files)
 | 
					(global-set-key (kbd "C-x C-f") 'helm-projectile)
 | 
				
			||||||
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)
 | 
					(global-set-key (kbd "M-y") 'helm-show-kill-ring)
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-x b") 'helm-mini)
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-c h o") 'helm-swoop)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(setq helm-buffers-fuzzy-matching t
 | 
				
			||||||
 | 
					      helm-recentf-fuzzy-match    t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(setq helm-semantic-fuzzy-match t
 | 
				
			||||||
 | 
					      helm-imenu-fuzzy-match    t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(setq helm-locate-fuzzy-match t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(helm-mode 1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Projectile Settings
 | 
				
			||||||
 | 
					(projectile-mode)
 | 
				
			||||||
 | 
					(setq projectile-completion-system 'helm)
 | 
				
			||||||
 | 
					(helm-projectile-on)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(setq projectile-switch-project-action 'helm-projectile)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Alchemist Settings
 | 
				
			||||||
 | 
					(add-hook 'elixir-mode-hook 'alchemist-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Buffer scrolling functions
 | 
				
			||||||
 | 
					(global-set-key (kbd "M-n") (lambda () (interactive) (scroll-up 1) (next-line 1)))
 | 
				
			||||||
 | 
					(global-set-key (kbd "M-p") (lambda () (interactive) (scroll-down 1) (previous-line 1)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Window movement
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-c w f") 'windmove-right)
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-c w b") 'windmove-left)
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-c w p") 'windmove-up)
 | 
				
			||||||
 | 
					(global-set-key (kbd "C-c w n") 'windmove-down)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; General Settings
 | 
				
			||||||
 | 
					;; Hide the menu-bar
 | 
				
			||||||
 | 
					(setq ns-auto-hide-menu-bar t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Use non-native fullscreen
 | 
				
			||||||
 | 
					(setq ns-use-native-fullscreen nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Native App Settings
 | 
				
			||||||
 | 
					(tool-bar-mode -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Disable GUI scrollbars
 | 
				
			||||||
 | 
					(scroll-bar-mode -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Use spaces instead of tabs
 | 
				
			||||||
 | 
					(setq-default indent-tabs-mode nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Change font settings
 | 
				
			||||||
 | 
					(add-to-list 'default-frame-alist '(font . "Hasklig"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun bootstrap-evil-mode()
 | 
				
			||||||
 | 
					  "Custom evil-mode boostrapping"
 | 
				
			||||||
 | 
					  (interactive)
 | 
				
			||||||
 | 
					  (evil-mode)
 | 
				
			||||||
 | 
					  (define-key evil-insert-state-map (kbd "j k") 'evil-force-normal-state)
 | 
				
			||||||
 | 
					  (define-key evil-normal-state-map (kbd "H") 'evil-beginning-of-line)
 | 
				
			||||||
 | 
					  (define-key evil-normal-state-map (kbd "L") 'evil-end-of-line))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Line Numbers in margin for source code mode
 | 
				
			||||||
 | 
					;; (add-hook 'prog-mode-hook 'linum-mode)
 | 
				
			||||||
 | 
					(add-hook 'prog-mode-hook 'bootstrap-evil-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Add transparency
 | 
				
			||||||
 | 
					(set-frame-parameter (selected-frame) 'alpha '(90 . 50))
 | 
				
			||||||
 | 
					(add-to-list 'default-frame-alist '(alpha . (90 . 50)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Full-screen as Command <CR>
 | 
				
			||||||
 | 
					(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,10 +4,6 @@ export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:/usr/loca
 | 
				
			||||||
export EDITOR=$(which vim)
 | 
					export EDITOR=$(which vim)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Adds a newline after the prompt to increase linespace for commands.
 | 
					 | 
				
			||||||
PS1="${PS1}
 | 
					 | 
				
			||||||
   "
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
echo "Welcome back, $USER"
 | 
					echo "Welcome back, $USER"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# display the space available on each mounted Volume
 | 
					# display the space available on each mounted Volume
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pc_settings_path="$HOME/pc_settings"
 | 
					pc_settings_path="${HOME}/pc_settings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
config_files=( \
 | 
					config_files=( \
 | 
				
			||||||
| 
						 | 
					@ -9,30 +9,30 @@ config_files=( \
 | 
				
			||||||
  ".tmux.conf" \
 | 
					  ".tmux.conf" \
 | 
				
			||||||
  ".ctags" \
 | 
					  ".ctags" \
 | 
				
			||||||
  ".vimrc" \
 | 
					  ".vimrc" \
 | 
				
			||||||
 | 
					  ".emacs" \
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for i in {0..3}; do
 | 
					for i in {1..5}; do
 | 
				
			||||||
    cf="${config_files[i]}"
 | 
					    cf="${config_files[i]}"
 | 
				
			||||||
    echo "\"$cf\": "
 | 
					    echo "\"${cf}\": "
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ -f "$HOME/$cf" ] && [ ! -L "$HOME/$cf" ]; then
 | 
					    if [ -f "${HOME}/${cf}" ] && [ ! -L "${HOME}/${cf}" ]; then
 | 
				
			||||||
        echo -n "Backing up $cf ... " && \
 | 
					        echo -n "Backing up ${cf} ... " && \
 | 
				
			||||||
        mv "$HOME/$cf" "$HOME/$cf.bak" && \
 | 
					        mv "${HOME}/${cf}" "${HOME}/${cf}.bak" && \
 | 
				
			||||||
        echo "Done."
 | 
					        echo "Done."
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ -L "$HOME/$cf" ]; then
 | 
					    if [ -L "${HOME}/${cf}" ]; then
 | 
				
			||||||
        if [ $(readlink "$HOME/$cf") = "$pc_settings_path/configs/$cf" ]; then
 | 
					        if [ $(readlink "${HOME}/${cf}") = "${pc_settings_path}/configs/${cf}" ]; then
 | 
				
			||||||
            echo "Already properly symlinked to \"$pc_settings_path/configs\"."
 | 
					            echo "Already properly symlinked to \"${pc_settings_path}/configs\"."
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            echo "Already symlinked but NOT to the proper location. Aborting..."
 | 
					            echo "Already symlinked but NOT to the proper location. Aborting..."
 | 
				
			||||||
        fi
 | 
					        fi
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        echo -n "Symlinking to $pc_settings_path/configs/$cf ... " && \
 | 
					        echo -n "Symlinking to ${pc_settings_path}/configs/${cf} ... " && \
 | 
				
			||||||
        ln -s "$pc_settings_path/configs/$cf" "$HOME/$cf" && \
 | 
					        ln -s "${pc_settings_path}/configs/${cf}" "${HOME}/${cf}" && \
 | 
				
			||||||
        echo "Done."
 | 
					        echo "Done."
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    echo ""
 | 
					    echo ""
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue