Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chalmagean committed Jun 13, 2015
1 parent 7d6a2ca commit f761447
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 27 deletions.
75 changes: 57 additions & 18 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,19 @@
(cd "~/")

;; Using MELPA for packages
(when (>= emacs-major-version 24)
(require 'package)
(when (>= emacs-major-version 24)
(setq package-archives '(("melpa" . "http://melpa.org/packages/")))))
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
;; (add-to-list 'package-archives
;; '("melpa-stable" . "http://stable.melpa.org/packages/") t)

;; Load necessary packages
(package-initialize)
(setq my-required-packages
(list 'magit
'solarized-theme
'diminish
'column-enforce-mode
'swiper ;; visual regex search
'expand-region
'wrap-region
Expand Down Expand Up @@ -77,6 +80,27 @@
;; or you can use M-x auto-revert-tail-mode
(add-to-list 'auto-mode-alist '("\\.log\\'" . auto-revert-mode))

(setq-default mode-line-position
'((-3 "%p") (size-indication-mode ("/" (-4 "%I")))
" "
(line-number-mode
("%l" (column-number-mode ":%c")))))

(setq-default mode-line-format
'("%e" mode-line-front-space
;; Standard info about the current buffer
mode-line-mule-info
mode-line-client
mode-line-modified
mode-line-remote
mode-line-frame-identification
mode-line-buffer-identification " " mode-line-position
;; Misc information, notably battery state and function name
" "
mode-line-misc-info
;; And the modes, which I don't really care for anyway
" " mode-line-modes mode-line-end-spaces))

;; for smooth scrolling and disabling the automatical recentering of emacs when moving the cursor
(setq scroll-margin 5
scroll-preserve-screen-position 1)
Expand Down Expand Up @@ -216,7 +240,7 @@
(tab-mark 9 [183 9] [92 9]) ; 9 TAB, MIDDLE DOT
))

;;(add-hook 'prog-mode-hook 'whitespace-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
(setq whitespace-global-modes '(not org-mode web-mode "Web" emacs-lisp-mode))
(global-whitespace-mode)

Expand Down Expand Up @@ -353,6 +377,21 @@ point reaches the beginning or end of the buffer, stop there."
(global-set-key [remap move-beginning-of-line]
'prelude-move-beginning-of-line)

;; Hide modes
(require 'diminish)
(diminish 'yas-minor-mode)
(diminish 'undo-tree-mode)
(diminish 'projectile-mode)
(diminish 'global-whitespace-mode)
(diminish 'visual-line-mode)
(diminish 'anzu-mode)
(diminish 'eldoc-mode)
(diminish 'hs-minor-mode)
(diminish 'yard-mode)
(diminish 'projectile-rails-mode)
(diminish 'ruby-refactor-mode)
(diminish 'ruby-mode)

(defun open-emacs-init-file()
"Opens the init.el file"
(interactive)
Expand All @@ -363,6 +402,8 @@ point reaches the beginning or end of the buffer, stop there."

(global-set-key (kbd "M-f") 'forward-to-word)
(global-set-key (kbd "M-F") 'forward-word)
(global-set-key (kbd "<f3>") 'hs-hide-block)
(global-set-key (kbd "<f4>") 'hs-show-block)

(global-set-key (kbd "C-c g x") 'git-extract-number-from-branch-name)
(global-set-key (kbd "C-c g s") 'magit-status)
Expand All @@ -377,16 +418,14 @@ point reaches the beginning or end of the buffer, stop there."
(global-set-key (kbd "C-c a") 'ag)
(global-set-key (kbd "C-c j") 'dired-jump)
(global-set-key (kbd "C-c d") 'duplicate-line)
;;(global-set-key (kbd "C-x b") 'helm-buffers-list)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "M-i") 'helm-imenu)
(global-set-key (kbd "C-x C-b") 'helm-buffer-list)
(global-set-key (kbd "C-x k") 'kill-this-buffer)
(global-set-key (kbd "C-c K") 'kill-buffer-and-window)
(global-set-key (kbd "C-c o") 'vi-open-line-below)
(global-set-key (kbd "C-c O") 'vi-open-line-above)
(global-set-key (kbd "C-c , s") 'rspec-verify-single)
(global-set-key (kbd "C-c , r") 'rspec-rerun)
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
(global-set-key (kbd "M-/") 'hippie-expand)
(global-set-key (kbd "M-<SPC>") 'cycle-spacing)
(global-set-key [(control ?.)] 'goto-last-change)
Expand All @@ -395,14 +434,16 @@ point reaches the beginning or end of the buffer, stop there."
(global-set-key (kbd "<up>") (ignore-error-wrapper 'windmove-up))
(global-set-key (kbd "<left>") (ignore-error-wrapper 'windmove-left))
(global-set-key (kbd "<right>") (ignore-error-wrapper 'windmove-right))
(global-set-key (kbd "S-<down>") 'shrink-window)
(global-set-key (kbd "S-<up>") 'enlarge-window)
(global-set-key (kbd "C-S-<up>") 'enlarge-window-horizontally)
(global-set-key (kbd "C-S-<down>") 'shrink-window-horizontally)
(define-key isearch-mode-map (kbd "C-<return>") 'isearch-exit-other-end)

;; Load a personal.el file if it exists
;; to be able to override stuff in here
(if (file-exists-p "~/.emacs.d/personal.el")
(load "personal"))

(server-start)
(load "~/.emacs.d/personal.el"))

(custom-set-variables
;; custom-set-variables was added by Custom.
Expand All @@ -416,11 +457,11 @@ point reaches the beginning or end of the buffer, stop there."
'(magit-emacsclient-executable "/usr/local/bin/emacsclient")
'(magit-restore-window-configuration t)
'(magit-server-window-for-commit nil)
'(magit-use-overlays nil)
'(rspec-spec-command "rspec")
'(rspec-use-bundler-when-possible nil)
'(rspec-use-rvm t)
'(rspec-use-spring-when-possible t)
'(scss-compile-at-save nil))
'(scss-compile-at-save nil)
'(sentence-end-double-space nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
Expand All @@ -440,8 +481,6 @@ point reaches the beginning or end of the buffer, stop there."
'(vertical-border ((((type tty)) (:inherit gray9))))
'(web-mode-html-attr-name-face ((t (:foreground "dark gray" :underline nil :weight normal))))
'(web-mode-html-tag-bracket-face ((t (:foreground "gray58" :underline nil :weight normal))))
'(web-mode-html-tag-face ((t (:foreground "dark cyan" :underline nil :weight normal))))
'(whitespace-newline ((t (:foreground "gray31" :weight thin))))
'(whitespace-space ((t nil))))
'(web-mode-html-tag-face ((t (:foreground "dark cyan" :underline nil :weight normal)))))
(put 'downcase-region 'disabled nil)
(put 'dired-find-alternate-file 'disabled nil)
13 changes: 13 additions & 0 deletions my-functions.el
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,16 @@ Assumes that the frame is only split into two."
(ignore-errors
(funcall fn)))))


;; Use M-x list-processes to get the running processes list
;;(define-key process-menu-mode-map (kbd "C-k") 'joaot/delete-process-at-point)

(defun joaot/delete-process-at-point ()
(interactive)
(let ((process (get-text-property (point) 'tabulated-list-id)))
(cond ((and process
(processp process))
(delete-process process)
(revert-buffer))
(t
(error "no process at point!")))))
9 changes: 1 addition & 8 deletions my-ido.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
ido-auto-merge-work-directories-length -1 ;; disable auto-merge (it's confusing)
ido-create-new-buffer 'always ;; create new files easily
ido-use-filename-at-point nil ;; don't try to be smart about what I want
ido-everywhere t
)

;; I like visual matching (colors)
Expand All @@ -27,13 +28,5 @@
(define-key ido-completion-map " " 'ido-exit-minibuffer)
))

;; Use C-w to go back up a dir to better match normal usage of C-w
;; - insert current file name with C-x C-w instead.
(define-key ido-file-completion-map (kbd "C-w") 'ido-delete-backward-updir)
(define-key ido-file-completion-map (kbd "C-x C-w") 'ido-copy-current-file-name)

;; disable auto searching for files unless called explicitly
(setq ido-auto-merge-delay-time 99999)

;; Ignore .DS_Store files with ido mode
(add-to-list 'ido-ignore-files "\\.DS_Store")
3 changes: 2 additions & 1 deletion my-magit.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@

;; Enable a right limit of 70 chars for git logs
(add-hook 'magit-log-edit-mode-hook 'turn-on-auto-fill)

(setq magit-last-seen-setup-instructions "1.4.0")
(setq magit-auto-revert-mode nil)
(provide 'my-magit)
26 changes: 26 additions & 0 deletions my-ruby.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@
;; Support for running rspec tests
(require 'rspec-mode)

;; -- GODAMMIT RUBY INDENTATION!!! --
;; don't indent parenthesis in a weird way
(setq ruby-align-chained-calls nil
ruby-align-to-stmt-keywords nil
ruby-deep-indent-paren nil
ruby-deep-indent-paren-style nil
ruby-use-smie nil)

(defadvice ruby-indent-line (after unindent-closing-paren activate)
"Indent sole parenthesis in loca's way."
(let ((column (current-column))
indent offset)
(save-excursion
(back-to-indentation)
(let ((state (syntax-ppss)))
(setq offset (- column (current-column)))
(when (and (eq (char-after) ?\))
(not (zerop (car state))))
(goto-char (cadr state))
(setq indent (current-indentation)))))
(when indent
(indent-line-to indent)
(when (> offset 0) (forward-char offset)))))
;; ------------------------------------

;; Turn on eldoc in ruby files to display info about the
;; method or variable at point
(add-hook 'ruby-mode-hook 'eldoc-mode)
Expand All @@ -65,6 +90,7 @@

(add-hook 'ruby-mode-hook
(lambda ()
(column-enforce-mode 1) ;; Enforce the 80 column rule
(hs-minor-mode 1) ;; Enables folding
(modify-syntax-entry ?: "."))) ;; Adds ":" to the word definition

Expand Down

0 comments on commit f761447

Please sign in to comment.