Skip to content

Instantly share code, notes, and snippets.

@xjackk
Last active July 13, 2017 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xjackk/ef2c34b1ba22a7aec28d to your computer and use it in GitHub Desktop.
Save xjackk/ef2c34b1ba22a7aec28d to your computer and use it in GitHub Desktop.
.emacs config file
;; Jack's emacs config
;; 8/14/14 ~
;; "change will come"
;;; Code:
; testing theme
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/caroline-theme/")
;;(add-to-list 'load-path "~/.emacs.d/themes/caroline-theme/")
;;(load-theme 'caroline t)
;; load theme customization
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/moe-theme/") ;; theme loading
(add-to-list 'load-path "~/.emacs.d/themes/moe-theme/")
(require 'moe-theme)
(setq moe-theme-highlight-buffer-id nil)
(moe-light)
;; Cask
;; Starting to use Cask for dependency management.
;;(require 'cask "~/.cask/cask.el")
;;(cask-initialize)
;; load paths for vendor "mode" addons
(add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
(add-to-list 'auto-mode-alist '("\\.moon$" . moonscript-mode))
(add-to-list 'auto-mode-alist '("\\.less\\'" . less-css-mode))
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.cshtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'load-path "~/.emacs.d/vendor/coffee-mode")
(add-to-list 'load-path "~/.emacs.d/vendor/jade-mode") ;; jade mode kk
(add-to-list 'load-path "~/.emacs.d/vendor/functionlist.el") ;; check this eh
(add-to-list 'load-path "~/.emacs.d/vendor/erc-desktop-notifications") ;; erc-desktop-notifcations
(add-to-list 'load-path "~/.emacs.d/vendor/moonscript-mode") ; moonscript syntax
(add-to-list 'load-path "~/.emacs.d/vendor/less-css-mode") ; less css syntax
(add-to-list 'load-path "~/.emacs.d/vendor/markdown-mode") ; markdown syntax
(add-to-list 'load-path "~/.emacs.d/vendor/ace-jump-mode") ; jump mode
(add-to-list 'load-path "~/.emacs.d/vendor/twittering-mode") ; twittering mode
(add-to-list 'load-path "~/.emacs.d/vendor/csharp-mode") ; c# mode
(add-to-list 'load-path "~/.emacs.d/vendor/alert") ; alerts!
(add-to-list 'load-path "~/.emacs.d/vendor/helm") ;; helm!
(add-to-list 'load-path "~/.emacs.d/vendor/jquery-doc.el") ;; jquery docs
(add-to-list 'load-path "~/.emacs.d/vendor/omnisharp-emacs") ;; Omnisharp for Emacs!
(add-to-list 'load-path "~/.emacs.d/vendor/use-package") ;; use-package
;; TAB SIZE
(setq tab-width 4)
(require 'helm-config)
(helm-mode 1) ;; global helm mode
(helm-autoresize-mode t) ;; auto resize
;; display time in emacs
(display-time-mode 1)
(menu-bar-mode -99) ;; menu bar hide!
;; ‘C-mouse-3 to access as a popup menu
;; display paren matching
(show-paren-mode 1)
;; ERC notifications!
;;(add-to-list 'erc-modules 'notifications)
;;(erc-update-modules)
;;(erc-notifications-enable) ;; erc notifyc
;;(erc-notifications-mode 1) ;; annd we enable it
;;(erc-update-modules)
; autoload for markdown editing
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
;; fixing ansi-term with zsh
(setq system-uses-terminfo nil)
;; quick fix for ansi-term for autocomplete (yassnippet blocks it... oh well)
(add-hook 'term-mode-hook (lambda()
(setq yas-dont-activate t)))
; shift select awesome
(setq org-support-shift-select t)
; set css tab indenting
(setq css-indent-offset 2)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)
;; global flycheck!
(add-hook 'after-init-hook #'global-flycheck-mode)
;; global company mode
(add-hook 'after-init-hook 'global-company-mode)
;; adding jQuery Docs
(add-hook 'coffee-mode-hook 'jquery-doc-setup)
(add-hook 'js2-mode 'jquery-doc-setup)
; omni-sharp hook add for C#!
(add-hook 'csharp-mode-hook 'omnisharp-mode)
(setq initial-scratch-message nil)
(setq org-directory "~/VT/")
(setq org-default-notes-file "~/VT/refile.org")
;; Capture templates for: TODO tasks, Notes, appointments, phone calls, meetings, and org-protocol
(setq org-capture-templates
(quote (("t" "todo" entry (file "~/VT/refile.org")
"* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
("r" "respond" entry (file "~/VT/refile.org")
"* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
("n" "note" entry (file "~/VT/refile.org")
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
("j" "Journal" entry (file+datetree "~/VT/refile.org")
"* %?\n%U\n" :clock-in t :clock-resume t)
("w" "org-protocol" entry (file "~/VT/refile.org")
"* TODO Review %c\n%U\n" :immediate-finish t)
("m" "Meeting" entry (file "~/VT/refile.org")
"* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
("p" "Phone call" entry (file "~/VT/refile.org")
"* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
("h" "Habit" entry (file "~/VT/refile.org")
"* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
;; gnus desktop notify helper
(setq gnus-desktop-notify-function 'gnus-desktop-notify-exec
gnus-desktop-notify-exec-program "growlnotify -a Emacs.app -m")
(gnus-desktop-notify-mode)
(gnus-demon-add-scanmail)
; org to markdown exporting
(eval-after-load "org"
'(require 'ox-md nil t))
;; require "modes"
(require 'cc-mode)
;;(require 'gnus-desktop-notify) ;; desktop notify
(require 'alert) ;; alerts!
(require 'jquery-doc)
(require 'web-mode) ;; web-mode!
(require 'csharp-mode) ;; c# mode baby
(require 'less-css-mode)
(require 'erc) ;; erc
(require 'ace-jump-mode)
(require 'coffee-mode)
(require 'package)
(require 'org)
;;(require 'org-remember)
(require 'moonscript-mode)
(require 'moonscriptrepl-mode)
(require 'twittering-mode)
;;(require 'alpaca)
(require 'flycheck)
(require 'jade-mode) ; jade mode idiot
(require 'use-package) ;; "Use Package" - Github Module
; cperl-mode defalias !
(defalias 'perl-mode 'cperl-mode)
;; Perl6 Mode
(use-package perl6-mode
:ensure t
:defer t)
;; Perl6 Flycheck shit
(use-package flycheck
:ensure t
:defer t
:init (add-hook 'prog-mode-hook 'flycheck-mode)
:config
(use-package flycheck-perl6
:ensure t))
;; *** PerlySense Config ***
;; The PerlySense prefix key (unset only if needed, like for \C-o)
;;(global-unset-key "\C-o")
;;(setq ps/key-prefix "\C-o")
;; *** PerlySense load (don't touch) ***
;;(setq ps/external-dir (shell-command-to-string "perly_sense external_dir"))
;;(if (string-match "Devel.PerlySense.external" ps/external-dir)
;; (progn
;; (message
;; "PerlySense elisp files at (%s) according to perly_sense, loading..."
;; ps/external-dir)
;; (setq load-path (cons
;; (expand-file-name
;; (format "%s/%s" ps/external-dir "emacs")
;; ) load-path))
;; (load "perly-sense")
;; )
;; (message "Could not identify PerlySense install dir.
;;Is Devel::PerlySense installed properly?
;;Does 'perly_sense external_dir' give you a proper directory? (%s)" ps/external-dir)
;; )
; Control how emacs deals with backup files
(setq backup-directory-alist `(("." . "~/.filesaves")))
; set c-mode for all .go and .cmd type files
(setq auto-mode-alist (cons '("\\.text$" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.txt$" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.doc$" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.awk$" . awk-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.perl$" . perl-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pl$" . perl-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.C$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cpp$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cxx$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.tcl$" . tcl-mode) auto-mode-alist))
(display-time-mode 1) ; display time, duh!
;; yasnippet loading (:
(add-to-list 'load-path "~/.emacs.d/elpa/yasnippet-0.9.0.1/")
(require 'yasnippet)
(yas-global-mode 1)
;; auto-complete c-headers
(add-to-list 'load-path "~/.emacs.d/vendor/auto-complete-c")
(defun my:ac-c-headers-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers))
(add-hook 'c++-mode-hook 'my:ac-c-headers-init)
(add-hook 'c-mode-hook 'my:ac-c-headers-init)
;; require auto-complete
(require 'auto-complete-config)
;;(ac-config-default)
;;(ac-set-trigger-key "TAB")
;;(ac-set-trigger-key "<tab>")
; ---- CSS/HTML/LESS PLUGINS -----
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq less-css-compile-at-save t)
(setq css-indent-offset 2)
(setq css-tab-size 2)
; ---- END CSS/LESS PLUGINS -----
; ----- C Code PLUGINS -----
(setq-default c-basic-offset 2 c-default-style "linux")
(setq-default tab-width 2 indent-tabs-mode t)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
; ----- END C Code PLUGINS -----
;; Setting default size for emacs
(add-to-list 'default-frame-alist '(height . 67))
(add-to-list 'default-frame-alist '(width . 209))
;; Show line-number in the mode line
(line-number-mode 1)
;; Show column-number in the mode line
(column-number-mode 1)
;; Company Mode Documentation Popup
(company-quickhelp-mode 1)
; ---- CUSTOM VARS -----
(custom-set-variables
;; custom-set-variables 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.
'(column-number-mode t)
'(cperl-close-paren-offset -4)
'(cperl-continued-statement-offset 4)
'(cperl-indent-level 2)
'(cperl-indent-parens-as-block t)
'(cperl-tab-always-indent t)
'(custom-safe-themes
(quote
("fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" default)))
'(erc-modules
(quote
(autojoin button completion fill irccontrols list log match menu move-to-prompt netsplit networks noncommands notify notifications readonly ring stamp track)))
'(org-agenda-custom-commands
(quote
(("d" todo "DELEGATED" nil)
("c" todo "DONE|DEFERRED|CANCELLED" nil)
("w" todo "WAITING" nil)
("W" agenda ""
((org-agenda-ndays 21)))
("A" agenda ""
((org-agenda-skip-function
(lambda nil
(org-agenda-skip-entry-if
(quote notregexp)
"\\=.*\\[#A\\]")))
(org-agenda-ndays 1)
(org-agenda-overriding-header "Today's Priority #A tasks: ")))
("u" alltodo ""
((org-agenda-skip-function
(lambda nil
(org-agenda-skip-entry-if
(quote scheduled)
(quote deadline)
(quote regexp)
"
]+>")))
(org-agenda-overriding-header "Unscheduled TODO entries: "))))))
'(org-agenda-files (quote ("~/VT/todo.org")))
'(org-agenda-ndays 7)
'(org-agenda-show-all-dates t)
'(org-agenda-skip-deadline-if-done t)
'(org-agenda-skip-scheduled-if-done t)
'(org-agenda-start-on-weekday nil)
'(org-deadline-warning-days 14)
'(org-default-notes-file "~/VT/notes.org")
'(org-fast-tag-selection-single-key (quote expert))
'(org-remember-store-without-prompt t)
'(org-remember-templates
(quote
((116 "* TODO %?
%u" "~/VT/todo.org" "Tasks")
(110 "* %u %?" "~/VT/notes.org" "Notes"))))
'(org-reverse-note-order t)
'(remember-annotation-functions (quote (org-remember-annotation)))
'(remember-handler-functions (quote (org-remember-handler)))
'(scroll-bar-mode nil)
'(tool-bar-mode nil))
;; C# mode helper!
(defun my-csharp-mode-hook ()
(electric-pair-mode 1))
(add-hook 'csharp-mode-hook 'my-csharp-mode-hook)
; ---- 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.
)
;; default font
(set-default-font "Inconsolata 9")
;; stop startup message from appearing blah
(setq inhibit-startup-message t)
;number lines baby
(global-linum-mode t)
(defun copy-file-path ()
"Put the current file name on the clipboard"
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
(file-name-directory default-directory)
(buffer-file-name))))
(when filename
(x-select-text filename))))
(defun eshell/clear ()
"Clear the eshell buffer."
(let ((inhibit-read-only t))
(erase-buffer)
(eshell-send-input)))
; ---- JS PLUGINS -----
(setq tab-width 2)
(setq coffee-tab-width 2)
(setq js-indent-level 2)
; ---- END JS PLUGINS -----
;; ---- START MAIL SETTINGS ----- ;;
;; Configure Outbound Mail
;; Tell the program who you are..
(setq user-full-name "jrK")
(setq user-mail-address "jaaacckz1@gmail.com")
(require 'smtpmail)
; fixing gnutls and shit please
(setq gnutls-algorithm-priority "NORMAL:%COMPAT")
;;Tell Emacs to use GNUTLS instead of STARTTLS
;;to authenticate when sending mail.
(setq starttls-use-gnutls t)
;;Tell Emacs about your mail server and credentials
(setq send-mail-function 'smtpmail-send-it
message-send-mail-function 'smtpmail-send-it
smtpmail-starttls-credentials
'(("smtp.gmail.com" 587 nil nil))
smtpmail-auth-credentials
(expand-file-name "~/.authinfo")
smtpmail-default-smtp-server "smtp.gmail.com"
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-smtp-service 587
smtpmail-debug-info t)
(require 'smtpmail)
;; Perl Newsgroup, yo
; load `message' now so I can override functions
(require 'message)
(defun message-check-news-syntax ()
"Check the syntax of the message."
(and
(save-excursion
(save-restriction
(widen)
(and
;; We narrow to the headers and check them first.
(save-excursion
(save-restriction
(message-narrow-to-headers)
(message-check-news-header-syntax)))
;; Check the body.
(message-check-news-body-syntax))))
; missin ya
(y-or-n-p "Post the message? ")
))
;; ---- END MAIL SETTINGS ---- ;;
(defun sudo-edit (&optional arg)
"Edit currently visited file as root.
With a prefix ARG prompt for a file to visit.
Will also prompt for a file to visit if current
buffer is not visiting a file."
(interactive "P")
(if (or arg (not buffer-file-name))
(find-file (concat "/sudo:root@localhost:"
(ido-read-file-name "Find file(as root): ")))
(find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))
(defun eshell/clear ()
"Clear the eshell buffer babygirl."
(let ((inhibit-read-only t))
(erase-buffer)
(eshell-send-input)))
;; okay, sendmail shit
(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "/usr/local/bin/msmtp")
(setq gnus-permanently-visible-groups ".*")
;;; Set some sane defaults for VM’s replies and forwarding
(setq
vm-forwarding-subject-format "[forwarded from %F] %s"
vm-forwarding-digest-type "rfc934"
vm-in-reply-to-format nil
vm-included-text-attribution-format
"On %w, %m %d, %y at %h (%z), %F wrote:n"
vm-reply-subject-prefix "Re: "
vm-mail-header-from "jrK <jaaacckz1@gmail.com>"
)
;; ---- END MAIL SETTINGS ---- ;;
;; Custom Keybinds (Command is super key)
(global-set-key (kbd "s-<right>") 'move-end-of-line ) ; Command + Right Arrow // End of Line
(global-set-key (kbd "s-<left>") 'move-beginning-of-line ) ; Command + Left Arrow // Beginning of Line
(global-set-key (kbd "s-o") 'mail-other-frame ) ; Command + "O" // Opens Mail
(global-set-key (kbd "M-s-t") 'other-window ) ; Command + "t" // other window
(global-set-key (kbd "M-s-r") 'previous-multiframe-window) ; Command + "r" // previous window
(global-set-key (kbd "s-l") 'list-buffers ) ; Command + "l" // Buffer list
(global-set-key (kbd "H-j") 'switch-to-buffer-other-window ) ; FN + "J" // Swap Buffers
(global-set-key (kbd "s-k") 'delete-window ) ; FN + "k" // Kill window
(global-set-key (kbd "H-k") 'kill-buffer ) ; FN + "k" // Kill Buffer
(global-set-key (kbd "S-s-<return>") 'ansi-term) ; Shell
(global-set-key (kbd "H-n") 'split-window-below) ; Split Window Below (vertical)
(global-set-key (kbd "s-P") 'magit-status) ; magit git system
(global-set-key (kbd "s-o") 'org-agenda) ; org mode agenda
(global-set-key (kbd "s-g") 'goto-line) ; go to a specific line
(global-set-key (kbd "M-O") 'copy-file-path) ; copies file path to clipboard
(global-set-key (kbd "C-c a") 'org-agenda) ; org agenda
(global-set-key (kbd "C-c C-c") 'coffee-compile-file) ; compile coffee file
(global-set-key (kbd "C-c 0") 'ace-jump-mode) ; jump mode (:
(global-set-key (kbd "C-c c") 'org-capture) ; launch org capture
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files) ; helm find files
(global-set-key (kbd "C-x C-k k") 'helm-show-kill-ring) ; showing helm kill ring
(global-set-key (kbd "<backtab>") 'company-complete) ; company mode autocomplete
(global-set-key (kbd "C-x -") 'shrink-window) ; resize window reconfigure
(global-set-key (kbd "C-SPC") 'set-mark-command) ; set marker
(global-set-key (kbd "C-o") 'open-line) ; open line, duh
(provide '.emacs)
;;; .emacs ends here
;; Jack's emacs config
;; 8/14/14 ~
;; "change will come"
;;; Code:
;; Caroline-theme
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/caroline-theme/")
;;(add-to-list 'load-path "~/.emacs.d/themes/caroline-theme/")
;;(load-theme 'caroline t)
;; solaris theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/emacs-color-theme-solarized")
(add-to-list 'load-path "~/.emacs.d/themes/emacs-color-theme-solarized")
(load-theme 'solarized-light t)
;; load theme paths
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/moe-theme.el/") ;; theme loading
;;(add-to-list 'load-path "~/.emacs.d/themes/moe-theme.el/")
;;(require 'moe-theme)
;;(setq moe-theme-highlight-buffer-id nil)
;;(moe-light)
;; ansi-term odd characters fix
(setq system-uses-terminfo nil)
;; add this afer (moe-"x")
;;(moe-theme-set-color 'w/b)
;; auto load for alpaca ayyy
(autoload 'alpaca-after-find-file "alpaca" nil t)
(add-hook 'find-file-hooks 'alpaca-after-find-file)
;; load paths for vendor "mode" addons
(add-to-list 'auto-mode-alist '("\\.\\([pP][Llm]\\|al\\)\\'" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("perl5" . cperl-mode))
(add-to-list 'interpreter-mode-alist '("miniperl" . cperl-mode))
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.cshtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.hbs\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("\\.t" . cperl-mode))
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))
(add-to-list 'auto-mode-alist '("\\.moon$" . moonscript-mode))
(add-to-list 'auto-mode-alist '("\\.less\\'" . less-css-mode))
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
;; use web-mode for .jsx files
(add-to-list 'auto-mode-alist '("\\.jsx$" . web-mode))
(add-to-list 'auto-mode-alist '("Cakefile" . coffee-mode))
(add-to-list 'load-path "~/.emacs.d/vendor/coffee-mode") ;; coffee-script
(add-to-list 'load-path "~/.emacs.d/vendor/ac-coffee") ;; coffee auto complete
(add-to-list 'load-path "~/.emacs.d/vendor/jade-mode") ;; jade mode kk
(add-to-list 'load-path "~/.emacs.d/vendor/moonscript-mode") ; moonscript syntax
(add-to-list 'load-path "~/.emacs.d/vendor/less-css-mode") ; less css syntax
(add-to-list 'load-path "~/.emacs.d/vendor/markdown-mode") ; markdown syntax
(add-to-list 'load-path "~/.emacs.d/vendor/ace-jump-mode") ; jump mode
(add-to-list 'load-path "~/.emacs.d/vendor/twittering-mode") ; twittering mode
(add-to-list 'load-path "~/.emacs.d/vendor/alpaca") ; alpaca, which allows GNU PGP crypto
(add-to-list 'load-path "~/.emacs.d/vendor/alert") ; alerts!
(add-to-list 'load-path "~/.emacs.d/vendor/helm") ;; helm!
(add-to-list 'load-path "~/.emacs.d/vendor/omnisharp-emacs") ;; Omnisharp for Emacs!
(require 'helm-config)
(helm-mode 1) ;; global helm mode
(helm-autoresize-mode t) ;; auto resize
(add-hook 'term-mode-hook (lambda()
(setq yas-dont-activate t)))
;; display options
(display-time-mode 1)
(display-battery-mode 1)
;; display paren matching
(show-paren-mode 1)
; osx ispell help
(setq ispell-program-name "/usr/local/bin/ispell")
; autoload for markdown editing
(autoload 'markdown-mode "markdown-mode"
"Major mode for editing Markdown files" t)
; shift select awesome
(setq org-support-shift-select t)
(setq shift-select-mode t) ;; shift select mode
; set css tab indenting
(setq css-indent-offset 2)
;; webmode html indentation
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
;; osx hyper keyset (fix for desktop maybe)
(setq ns-function-modifier 'hyper) ; set Mac's Fn key to Hyper
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(when (< emacs-major-version 24)
;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")))
(package-initialize)
;; global flycheck!
(add-hook 'after-init-hook #'global-flycheck-mode)
(global-flycheck-mode) ;; global flycheck!
;; global company mode!
(add-hook 'after-init-hook 'global-company-mode)
; omni-sharp hook add for C#!
;;(add-hook 'csharp-mode-hook 'omnisharp-mode)
; fucking get rid of stupid login message
(setq initial-scratch-message nil)
(setq org-directory "~/VT/")
(setq org-default-notes-file "~/VT/refile.org")
;; Capture templates for: TODO tasks, Notes, appointments, phone calls, meetings, and org-protocol
(setq org-capture-templates
(quote (("t" "todo" entry (file "~/VT/refile.org")
"* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)
("r" "respond" entry (file "~/VT/refile.org")
"* NEXT Respond to %:from on %:subject\nSCHEDULED: %t\n%U\n%a\n" :clock-in t :clock-resume t :immediate-finish t)
("n" "note" entry (file "~/VT/refile.org")
"* %? :NOTE:\n%U\n%a\n" :clock-in t :clock-resume t)
("j" "Journal" entry (file+datetree "~/VT/refile.org")
"* %?\n%U\n" :clock-in t :clock-resume t)
("w" "org-protocol" entry (file "~/VT/refile.org")
"* TODO Review %c\n%U\n" :immediate-finish t)
("m" "Meeting" entry (file "~/VT/refile.org")
"* MEETING with %? :MEETING:\n%U" :clock-in t :clock-resume t)
("p" "Phone call" entry (file "~/VT/refile.org")
"* PHONE %? :PHONE:\n%U" :clock-in t :clock-resume t)
("h" "Habit" entry (file "~/VT/refile.org")
"* NEXT %?\n%U\n%a\nSCHEDULED: %(format-time-string \"<%Y-%m-%d %a .+1d/3d>\")\n:PROPERTIES:\n:STYLE: habit\n:REPEAT_TO_STATE: NEXT\n:END:\n"))))
;; gnus desktop notify helper
(setq gnus-desktop-notify-function 'gnus-desktop-notify-exec
gnus-desktop-notify-exec-program "growlnotify -a Emacs.app -m")
(gnus-desktop-notify-mode)
(gnus-demon-add-scanmail)
; org to markdown exporting
(eval-after-load "org"
'(require 'ox-md nil t))
;; require "modes"
(require 'cc-mode)
(require 'js2-mode)
(require 'gnus-desktop-notify) ;; desktop notify
(require 'alert) ;; alerts!
(require 'csharp-mode) ;; c# mode baby
(require 'less-css-mode)
(require 'ace-jump-mode)
(require 'coffee-mode)
(require 'ac-coffee) ;; coffee autocomplete
(require 'package)
(require 'org)
;;(require 'org-remember)
(require 'moonscript-mode)
(require 'moonscriptrepl-mode)
(require 'twittering-mode)
(require 'alpaca)
(require 'flycheck)
(require 'jade-mode) ; jade mode
(require 'use-package) ;; "Use Package" - Github Module
; cperl-mode defalias !
(defalias 'perl-mode 'cperl-mode)
;; Perl6 Mode
(use-package perl6-mode
:ensure t
:defer t)
;; Perl6 Flycheck shit
(use-package flycheck
:ensure t
:defer t
:init (add-hook 'prog-mode-hook 'flycheck-mode)
:config
(use-package flycheck-perl6
:ensure t))
; Control how emacs deals with backup files
(setq backup-directory-alist `(("." . "~/.filesaves")))
; set c-mode for all .go and .cmd type files
(setq auto-mode-alist (cons '("\\.text$" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.txt$" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.doc$" . text-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.awk$" . awk-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.perl$" . perl-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.pl$" . perl-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.C$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cpp$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.cxx$" . c++-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.tcl$" . tcl-mode) auto-mode-alist))
(display-time-mode 1) ; display time, duh!
;; yasnippet loading (:
(add-to-list 'load-path "~/.emacs.d/elpa/yasnippet-0.9.0.1/")
(require 'yasnippet)
(yas-global-mode 1)
;; auto-complete c-headers
(add-to-list 'load-path "~/.emacs.d/vendor/auto-complete-c")
(defun my:ac-c-headers-init ()
(require 'auto-complete-c-headers)
(add-to-list 'ac-sources 'ac-source-c-headers))
(add-hook 'c++-mode-hook 'my:ac-c-headers-init)
(add-hook 'c-mode-hook 'my:ac-c-headers-init)
;; require auto-complete
(require 'auto-complete-config)
(ac-config-default)
;;(ac-set-trigger-key "TAB")
;;(ac-set-trigger-key "<tab>")
; ----- C Code PLUGINS -----
(setq-default c-basic-offset 2 c-default-style "linux")
(setq-default tab-width 2 indent-tabs-mode t)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)
; ----- END C Code PLUGINS -----
;; Setting default size for emacs
(add-to-list 'default-frame-alist '(height . 67))
(add-to-list 'default-frame-alist '(width . 209))
;; Show line-number in the mode line
(line-number-mode 1)
;; Show column-number in the mode line
(column-number-mode 1)
; ---- CUSTOM VARS -----
(custom-set-variables
;; custom-set-variables 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.
'(column-number-mode t)
'(cperl-close-paren-offset -4)
'(cperl-continued-statement-offset 2)
'(cperl-indent-level 2)
'(cperl-indent-parens-as-block t)
'(cperl-tab-always-indent t)
'(custom-safe-themes
(quote
("fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "1e7e097ec8cb1f8c3a912d7e1e0331caeed49fef6cff220be63bd2a6ba4cc365" default)))
'(flycheck-error-line ((t (:underline f))))
'(markdown-command "/usr/local/bin/markdown")
'(org-agenda-custom-commands
(quote
(("d" todo "DELEGATED" nil)
("c" todo "DONE|DEFERRED|CANCELLED" nil)
("w" todo "WAITING" nil)
("W" agenda ""
((org-agenda-ndays 21)))
("A" agenda ""
((org-agenda-skip-function
(lambda nil
(org-agenda-skip-entry-if
(quote notregexp)
"\\=.*\\[#A\\]")))
(org-agenda-ndays 1)
(org-agenda-overriding-header "Today's Priority #A tasks: ")))
("u" alltodo ""
((org-agenda-skip-function
(lambda nil
(org-agenda-skip-entry-if
(quote scheduled)
(quote deadline)
(quote regexp)
"
]+>")))
(org-agenda-overriding-header "Unscheduled TODO entries: "))))))
'(org-agenda-files (quote ("~/VT/todo.org")))
'(org-agenda-ndays 7)
'(org-agenda-show-all-dates t)
'(org-agenda-skip-deadline-if-done t)
'(org-agenda-skip-scheduled-if-done t)
'(org-agenda-start-on-weekday nil)
'(org-deadline-warning-days 14)
'(org-default-notes-file "~/VT/notes.org")
'(org-fast-tag-selection-single-key (quote expert))
'(org-remember-store-without-prompt t)
'(org-remember-templates
(quote
((116 "* TODO %?
%u" "~/VT/todo.org" "Tasks")
(110 "* %u %?" "~/VT/notes.org" "Notes"))))
'(org-reverse-note-order t)
'(package-selected-packages
(quote
(tide exec-path-from-shell json-mode js2-mode web-mode use-package perl6-mode org omnisharp magit gnus-desktop-notify flycheck-perl6 company ac-clang)))
'(remember-annotation-functions (quote (org-remember-annotation)))
'(remember-handler-functions (quote (org-remember-handler)))
'(scroll-bar-mode nil)
'(shift-select-mode t)
'(tool-bar-mode nil))
;; C# mode helper!
(defun my-csharp-mode-hook ()
"Csharp shit."
(electric-pair-mode 1))
(add-hook 'csharp-mode-hook 'my-csharp-mode-hook)
; ---- 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.
)
; default font
(set-default-font "Inconsolata 12")
;; stop startup message from appearing blah
(setq inhibit-startup-message t)
;number lines baby
(global-linum-mode t)
(defun copy-file-path ()
"Put the current file name on the clipboard."
(interactive)
(let ((filename (if (equal major-mode 'dired-mode)
(file-name-directory default-directory)
(buffer-file-name))))
(when filename
(x-select-text filename))))
(defun eshell/clear ()
"Clear the eshell buffer."
(let ((inhibit-read-only t))
(erase-buffer)
(eshell-send-input)))
; ---- JS PLUGINS -----
(defun setup-tide-mode ()
;; this is a docstring you fuckhead (-:"
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
;; company is an optional dependency. You have to
;; install it separately via package-install
;; `M-x package-install [ret] company`
(company-mode +1))
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
;; formats the buffer before saving
(add-hook 'before-save-hook 'tide-format-before-save)
(add-hook 'typescript-mode-hook #'setup-tide-mode)
;(setq tab-width 2)
(setq coffee-tab-width 2)
(setq js-indent-level 2)
;; disable jshint since we prefer eslint checking
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(javascript-jshint)))
;; use eslint with web-mode for jsx files
(flycheck-add-mode 'javascript-eslint 'web-mode)
; customize flycheck temp file prefix
(setq-default flycheck-temp-prefix ".flycheck")
;; disable json-jsonlist checking for json files
(setq-default flycheck-disabled-checkers
(append flycheck-disabled-checkers
'(json-jsonlist)))
;; https://github.com/purcell/exec-path-from-shell
;; only need exec-path-from-shell on OSX
;; this hopefully sets up path and other vars better
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
;; adjust indents for web-mode to 2 spaces
(defun my-web-mode-hook ()
"Hooks for Web mode. Adjust indents"
;;; http://web-mode.org/
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2))
(add-hook 'web-mode-hook 'my-web-mode-hook)
;; for better jsx syntax-highlighting in web-mode
;; - courtesy of Patrick @halbtuerke
(defadvice web-mode-highlight-part (around tweak-jsx activate)
(if (equal web-mode-content-type "jsx")
(let ((web-mode-enable-part-face nil))
ad-do-it)
ad-do-it))
; ---- END JS PLUGINS -----
;; ---- START MAIL SETTINGS ----- ;;
;; Configure Outbound Mail
(setq user-full-name "jrK")
(setq user-mail-address "jaaacckz1@gmail.com")
(require 'smtpmail)
; fixing gnutls and shit please
(setq gnutls-algorithm-priority "NORMAL:%COMPAT")
;;Tell Emacs to use GNUTLS instead of STARTTLS
;;to authenticate when sending mail.
(setq starttls-use-gnutls t)
;; okay, sendmail shit
(setq message-send-mail-function 'message-send-mail-with-sendmail)
(setq sendmail-program "/usr/local/bin/msmtp")
(setq gnus-permanently-visible-groups ".*")
;;; Set some sane defaults for VM’s replies and forwarding
(setq
vm-forwarding-subject-format "[forwarded from %F] %s"
vm-forwarding-digest-type "rfc934"
vm-in-reply-to-format nil
vm-included-text-attribution-format
"On %w, %m %d, %y at %h (%z), %F wrote:n"
vm-reply-subject-prefix "Re: "
vm-mail-header-from "jrK <jaaacckz1@gmail.com>"
)
;; ---- END MAIL SETTINGS ---- ;;
;; Custom Keybinds (Command is super key)
(global-set-key (kbd "s-<right>") 'move-end-of-line ) ; Command + Right Arrow // End of Line
(global-set-key (kbd "s-<left>") 'move-beginning-of-line ) ; Command + Left Arrow // Beginning of Line
(global-set-key (kbd "s-o") 'mail-other-frame ) ; Command + "O" // Opens Mail
(global-set-key (kbd "s-t") 'other-window ) ; Command + "t" // other window
(global-set-key (kbd "s-l") 'list-buffers ) ; Command + "l" // Buffer list
(global-set-key (kbd "H-j") 'switch-to-buffer-other-window ) ; FN + "J" // Swap Buffers
(global-set-key (kbd "s-k") 'delete-window ) ; FN + "k" // Kill window
(global-set-key (kbd "H-k") 'kill-buffer ) ; FN + "k" // Kill Buffer
(global-set-key (kbd "S-s-<return>") 'ansi-term) ; Shell
(global-set-key (kbd "H-n") 'split-window-below) ; Split Window Below (vertical)
(global-set-key (kbd "s-P") 'magit-status) ; magit git system
(global-set-key (kbd "s-o") 'org-agenda) ; org mode agenda
(global-set-key (kbd "s-g") 'goto-line) ; go to a specific line
(global-set-key (kbd "M-O") 'copy-file-path) ; copies file path to clipboard
(global-set-key (kbd "C-c a") 'org-agenda) ; org agenda
(global-set-key (kbd "C-c C-c") 'coffee-compile-file) ; compile coffee file
(global-set-key (kbd "C-c 0") 'ace-jump-mode) ; jump mode (:
(global-set-key (kbd "C-c c") 'org-capture) ; launch org capture
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files) ; helm find files
(global-set-key (kbd "C-x C-k k") 'helm-show-kill-ring) ; showing helm kill ring
(global-set-key (kbd "s-T") 'mode-line-other-buffer) ; previous buffer in other window
(global-set-key (kbd "C-<tab>") 'company-complete) ; company-mode complete
(global-set-key (kbd "<backtab>") 'company-complete) ; company-mode complete
(global-set-key (kbd "s-r") 'previous-multiframe-window) ; command + "r" // reverse window
(global-set-key (kbd "C-x s-x") 'company-show-doc-buffer) ; show documentation in buffer
(global-set-key (kbd "C-x _") 'shrink-window) ; shrink window
(provide '.emacs)
;;; .emacs ends here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment