Skip to content

Instantly share code, notes, and snippets.

@bsmithgall
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save bsmithgall/3116f60244aafea5c8c2 to your computer and use it in GitHub Desktop.

Select an option

Save bsmithgall/3116f60244aafea5c8c2 to your computer and use it in GitHub Desktop.
emacs/tmux dotfiles for barebones setup
;; Turn off mouse interface early in startup to avoid display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;; Handle backups
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Go back to where I was
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file (expand-file-name ".places" user-emacs-directory))
;; Only use spaces
(setq-default indent-tabs-mode nil)
;; Set JS line numbers to 2
(setq js-indent-level 2)
;; line numbers
(global-linum-mode 1)
(setq linum-format "%4d \u2502")
;; misc stuff
(when (> emacs-major-version 21)
(ido-mode t)
(setq ido-enable-prefix nil
ido-enable-flex-matching t
ido-create-new-buffer 'always
ido-use-filename-at-point 'guess
ido-max-prospects 10))
(auto-compression-mode t)
(show-paren-mode 1)
(recentf-mode 1)
(setq x-select-enable-clipboard t)
(add-to-list 'load-path "~/.emacs.d/")
set -g prefix C-t
unbind C-b
bind C-t send-prefix
setw -g mode-key emacs
set -g default-terminal "screen-256color"
;; For emacs 24 use with prelude.
;; Turn off mouse interface early in startup to avoid display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
;; Load up the solarized theme
(load-theme 'solarized-dark t)
;; Play nice with the clipboard
(setq x-select-enable-clipboard t)
;; Quick keyboard shortcut for recent files
(global-set-key (kbd "C-c C-f RET") 'recentf-open-files)
;; Handle backup location
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
;; Only use spaces
(setq-default indent-tabs-mode nil)
;; Set JS line numbers to 2
(setq js-indent-level 2)
;; Turn off the bell
(setq visible-bell t)
;; Turn on line numbers for programming modes
(add-hook 'prog-mode-hook 'linum-mode)
;; Turn on linum mode for markdown
(add-hook 'markdown-mode-hook
(lambda ()
(linum-mode)))
;; Turn on web mode
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
;; Set indentation on web mode stuff to two
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
;; Turn on sr-speedbar
(require 'sr-speedbar)
(global-set-key (kbd "C-c C-c RET") 'sr-speedbar-toggle)
(sr-speedbar-open)
;; Magit mode shortcut
(global-set-key (kbd "C-x g") 'magit-status)
;; Indentation and buffer cleanup
(defun untabify-buffer ()
(interactive)
(untabify (point-min) (point-max)))
(defun indent-buffer ()
(interactive)
(indent-region (point-min) (point-max)))
(defun cleanup-buffer ()
"Perform a bunch of operations on the whitespace content of a buffer."
(interactive)
(indent-buffer)
(untabify-buffer)
(delete-trailing-whitespace))
(defun cleanup-region (beg end)
"Remove tmux artifacts from region."
(interactive "r")
(dolist (re '("\\\\│\·*\n" "\W*│\·*"))
(replace-regexp re "" nil beg end)))
(global-set-key (kbd "C-x M-t") 'cleanup-region)
(global-set-key (kbd "C-c n") 'cleanup-buffer)
(setq-default show-trailing-whitespace t)
;; Turn on autopair
(require 'autopair)
;; Turn on autocomplete
(require 'auto-complete-config)
(ac-config-default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment