Skip to content

Instantly share code, notes, and snippets.

@marceloslacerda
Created September 12, 2013 13:45
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 marceloslacerda/6537638 to your computer and use it in GitHub Desktop.
Save marceloslacerda/6537638 to your computer and use it in GitHub Desktop.
my emacs config
(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.
'(auto-save-file-name-transforms (quote ((".*" "temporary-file-directory" t))))
'(backup-directory-alist nil)
'(blink-cursor-mode nil)
'(browse-url-browser-function (quote browse-url-firefox))
'(bubbles-game-theme (quote easy))
'(bubbles-graphics-theme (quote circles))
'(column-number-mode t)
'(confirm-kill-emacs (quote yes-or-no-p))
'(custom-enabled-themes (quote (wombat)))
'(dired-listing-switches "-lh")
'(dired-use-ls-dired t)
'(doc-view-continuous nil)
'(erc-autojoin-mode t)
'(erc-button-mode t)
'(erc-fill-mode t)
'(erc-irccontrols-mode t)
'(erc-list-mode t)
'(erc-match-mode t)
'(erc-menu-mode t)
'(erc-move-to-prompt-mode t)
'(erc-netsplit-mode t)
'(erc-networks-mode t)
'(erc-nick "msl09")
'(erc-noncommands-mode t)
'(erc-pcomplete-mode t)
'(erc-readonly-mode t)
'(erc-ring-mode t)
'(erc-stamp-mode t)
'(erc-track-minor-mode t)
'(erc-track-mode t)
'(eshell-banner-load-hook nil)
'(eshell-cmpl-cycle-completions t)
'(eshell-cmpl-expand-before-complete t)
'(eshell-hist-ignoredups t)
'(global-auto-revert-mode t)
'(ido-enable-flex-matching t)
'(indent-tabs-mode t)
'(inhibit-startup-screen t)
'(initial-buffer-choice nil)
'(initial-scratch-message nil)
'(line-move-visual t)
'(package-archives
(quote
(("marmelade" . "http://marmalade-repo.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/"))))
'(read-quoted-char-radix 16)
'(shift-select-mode nil)
'(standard-indent 2)
'(tab-width 8)
'(tool-bar-mode nil)
'(tramp-mode t)
'(visible-bell t)
'(x-select-enable-clipboard t))
(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.
'(term-color-blue ((t (:background "dark blue" :foreground "dark blue"))))
'(term-color-red ((t (:background "brown4" :foreground "brown4")))))
(savehist-mode 1)
;;(add-to-list 'load-path "/home/marcelo/workspace/scala-mode2/")
;;(require 'scala-mode2)
;; Change title bar to ~/file-directory if the current buffer is a
;; real file or buffer name if it is just a buffer.
(setq frame-title-format
'(:eval
(if buffer-file-name
(replace-regexp-in-string
(getenv "HOME") "~"
(file-name-directory buffer-file-name))
(buffer-name))))
;; Preserve the owner and group of the file you're editing
(setq backup-by-copying-when-mismatch t)
;; Set up recentf so I can get a list of recent files when I start
(recentf-mode 1)
;;(recentf-open-files nil "*Recent Files*")
(setq recentf-max-saved-items 1200)
(put 'downcase-region 'disabled nil)
(message "Deleting old backup files...")
(let ((week (* 60 60 24 7))
(current (float-time (current-time))))
(dolist (file (directory-files temporary-file-directory t))
(when (and (backup-file-name-p file)
(> (- current (float-time (fifth (file-attributes file))))
week))
(message "%s" file)
(delete-file file))))
(defun comint-delchar-or-eof-or-kill-buffer (arg)
(interactive "p")
(if (null (get-buffer-process (current-buffer)))
(kill-buffer)
(comint-delchar-or-maybe-eof arg)))
(add-hook 'shell-mode-hook
(lambda ()
(define-key shell-mode-map
(kbd "C-d") 'comint-delchar-or-eof-or-kill-buffer)))
;; Also auto refresh dired, but be quiet about it
(setq global-auto-revert-non-file-buffers t)
(setq auto-revert-verbose nil)
(fset 'clear-buffer
(lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217788 67108896 134217790 134217848 100 101 108 101 tab 114 101 tab 103 tab return] 0 "%d")) arg)))
(defun bash-term ()
(interactive)
(ansi-term "bash"))
(global-set-key (kbd "C-c C-a") 'bash-term)
(put 'upcase-region 'disabled nil)
(defun dotemacs ()
(interactive)
(find-file "~/.emacs"))
(add-to-list 'load-path "~/.emacs.d/elpa/no-easy-keys-1.0.2/")
(global-set-key (kbd "C-.") 'delete-backward-char)
(global-set-key (kbd "C-x k") 'kill-this-buffer)
;; Behave like vi's o command
(defun open-next-line (arg)
"Move to the next line and then opens a line.
See also `newline-and-indent'."
(interactive "p")
(end-of-line)
(open-line arg)
(next-line 1)
)
(global-set-key (kbd "C-o") 'open-next-line)
;; Behave like vi's O command
(defun open-previous-line (arg)
"Open a new line before the current one.
See also `newline-and-indent'."
(interactive "p")
(beginning-of-line)
(open-line arg)
)
(global-set-key (kbd "M-o") 'open-previous-line)
(global-set-key (kbd "M-k") 'kill-whole-line)
(setq make-backup-files nil)
(defun cclive-it (url)
"Gets a video from a URL with cclive"
(interactive "sURL: ")
(async-shell-command (format "cclive -c %s" url) "cclive-out"))
(global-set-key (kbd "C-c c") 'cclive-it)
(setq ring-bell-function (lambda ()
(call-process-shell-command "xset led 3; xset -led 3" nil 0 nil)))
(defun msl09-js-hook ()
(setq indent-tabs-mode nil))
(add-hook 'js-mode-hook 'msl09-js-hook)
(defun msl09-html-hook ()
(local-set-key (kbd "RET") 'newline-and-indent)
(local-set-key (kbd ">") (lambda ()
(interactive)
(self-insert-command 1)
(indent-for-tab-command)))
(local-set-key (kbd "C-c s") 'html-span)
(local-set-key (kbd "C-c d") 'html-div))
(define-skeleton html-span
"HTML span tag with id attribute."
"Id: "
"<span id=\"" str "\""
">" _ "</span>")
(define-skeleton html-div
"HTML div tag with id attribute."
"Id: "
"<div id=\"" str "\""
">" _ "</div>")
(add-hook 'html-mode-hook 'msl09-html-hook)
;(require 'notmuch)
(package-initialize)
(elpy-enable)
(defadvice ansi-term (after advise-ansi-term-coding-system)
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'ansi-term)
(require 'ido)
(ido-mode t)
(smex-initialize)
(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "M-X") 'smex-major-mode-commands)
;; This is your old M-x.
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
;; you can select the key you prefer to
(define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
(global-undo-tree-mode)
;;setting to make it so you don't need to provide a full yes or no response
(defalias 'yes-or-no-p 'y-or-n-p)
;;auto fill mode for all text buffers
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(show-paren-mode 1)
(global-set-key (kbd "C-c o") 'occur)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment