Skip to content

Instantly share code, notes, and snippets.

@iMagesh
Created November 19, 2013 10:59
Show Gist options
  • Save iMagesh/7543717 to your computer and use it in GitHub Desktop.
Save iMagesh/7543717 to your computer and use it in GitHub Desktop.
Laptop emacs setting
(setq inhibit-startup-message t) ;; Removes startup message
(setq-default indent-tabs-mode nil)
(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-default t)
'(cua-mode t nil (cua-base))
'(delete-auto-save-files t)
'(font-use-system-font t)
'(fringe-mode 0 nil (fringe))
'(javascript-indent-level 2)
'(ruby-indent-level 2)
'(show-paren-mode t)
'(standard-indent 6)
'(text-mode-hook (quote (text-mode-hook-identify)))
'(tool-bar-mode t)
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(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 ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 120 :width normal :foundry "apple" :family "Monaco")))))
(add-to-list 'load-path "/etc/emacs/site-start.d/")
;;Karl Landstram's javascript mode
(add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
(autoload 'javascript-mode "javascript" nil t)
;; Put autosave files (ie #foo#) in one place, *not*
;; scattered all over the file system!
(defvar autosave-dir
(concat "/tmp/emacs_autosaves/" (user-login-name) "/"))
(make-directory autosave-dir t)
(defun auto-save-file-name-p (filename)
(string-match "^#.*#$" (file-name-nondirectory filename)))
(defun make-auto-save-file-name ()
(concat autosave-dir
(if buffer-file-name
(concat "#" (file-name-nondirectory buffer-file-name) "#")
(expand-file-name
(concat "#%" (buffer-name) "#")))))
;; comment region
(global-set-key "\M-2" `comment-region)
;; uncomment region
(global-set-key "\M-3" `uncomment-region)
;; replace-regexp
(global-set-key "\M-&" `replace-regexp)
;; replace-string
(global-set-key "\C-r" `replace-string)
;;indent-region
;;(global-set-key [\C-\M-\] `indent-region)
(global-set-key "\C-l" `goto-line)
;;CSS http://mewde.googlecode.com/files/css-mode.el
(add-to-list 'auto-mode-alist '("\\.css\\'" . css-mode))
(autoload 'css-mode "css-mode" nil t)
;;Karl Landstram's javascript mode
(add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
(autoload 'javascript-mode "javascript" nil t)
;; Remote file editing via ssh
(add-to-list 'load-path "~/.emacs.d/tramp/lisp/")
(require 'tramp)
(setq tramp-default-method "ssh")
;; Save existing buffers while exit and reopen it next time
(desktop-save-mode 1)
(desktop-load-default)
;; Start emacs full screen
(defun toggle-fullscreen ()
(interactive)
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0))
)
(toggle-fullscreen)
;; Markdown-mode
(autoload 'markdown-mode "markdown-mode.el"
"Major mode for editing Markdown files" t)
(setq auto-mode-alist
(cons '("\\.md" . markdown-mode) auto-mode-alist))
;; Tabs
(tabbar-mode)
;; Tabs in single group
(setq tabbar-buffer-groups-function
(lambda ()
(list "All"))) ;; code by Peter Barabas
;; emacs-rails
;;(setq load-path (cons "/etc/site-start.d/emacs-rails" load-path))
;; (require 'rails)
;; Rinari
(add-to-list 'load-path "/etc/emacs/site-start.d/rinari")
(require 'rinari)
;; Haml mode
;; (add-hook 'haml-mode-hook 'rinari-minor-mode)
;; (add-to-list 'load-path "/etc/emacs/site-start.d/haml-mode")
;; (add-to-list 'auto-mode-alist '("\\.html.haml\\'" . haml-mode))
(autoload 'haml-mode "haml-mode" nil t)
(add-hook 'haml-mode-hook
'(lambda ()
(setq indent-tabs-mode nil)
(define-key haml-mode-map "\C-m" 'newline-and-indent)))
;; Interactively Do Things (highly recommended, but not strictly required)
(require 'ido)
(ido-mode t)
;; auto-refresh all buffers when file changed
(global-auto-revert-mode t)
;; avoid backup files
;; (add-hook 'dired-load-hook
;; (lambda ()
;; (require 'dired-x)))
(add-to-list 'load-path "/etc/emacs/site-start.d/auto-complete")
(require 'auto-complete)
(global-auto-complete-mode t)
;; auto-fill remove
;;(auto-fill)
;;(remove-hook 'text-mode-hook 'turn-on-auto-fill)
;; Remember the milk
(add-to-list 'load-path "/etc/emacs/site-start.d/simple-rtm/lisp")
(autoload 'simple-rtm-mode "simple-rtm" "Interactive mode for Remember The Milk" t)
(eval-after-load 'simple-rtm
'(progn
(display-simple-rtm-tasks-mode t)))
(add-hook 'simple-rtm-mode-hook 'color-theme-emacs-nw)
;; emacs backup files
(setq backup-directory-alist `(("." . "~/emacs-bkup")))
;;; rhtml-mode
(add-to-list 'load-path "/etc/emacs/site-start.d/rhtml")
(require 'rhtml-mode)
(add-hook 'rhtml-mode-hook
(lambda () (rinari-launch)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment