Skip to content

Commit

Permalink
recreate my emacs configuration repository
Browse files Browse the repository at this point in the history
  • Loading branch information
imonyse committed Oct 31, 2011
0 parents commit 61f1209
Show file tree
Hide file tree
Showing 33 changed files with 8,902 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
*.elc
*~
auto-save-list/
eshell/
elpa/
ac-comphist.dat

21 changes: 21 additions & 0 deletions .gitmodules
@@ -0,0 +1,21 @@
[submodule "vendor/coffee-mode"]
path = vendor/coffee-mode
url = git://github.com/defunkt/coffee-mode.git
[submodule "vendor/feature-mode"]
path = vendor/feature-mode
url = git://github.com/michaelklishin/cucumber.el.git
[submodule "vendor/rhtml-mode"]
path = vendor/rhtml-mode
url = https://github.com/eschulte/rhtml.git
[submodule "vendor/rinari"]
path = vendor/rinari
url = git@github.com:imonyse/rinari.git
[submodule "vendor/scss-mode"]
path = vendor/scss-mode
url = https://github.com/antonj/scss-mode.git
[submodule "vendor/textmate.el"]
path = vendor/textmate.el
url = git@github.com:imonyse/textmate.el.git
[submodule "vendor/magit"]
path = vendor/magit
url = git://github.com/magit/magit.git
5 changes: 5 additions & 0 deletions README.md
@@ -0,0 +1,5 @@
#My Emacs Configuration

$ git clone https://imonyse@github.com/imonyse/emacs.d.git
$ mv emacs.d .emacs.d
$ ln -s ~/.emacs.d/emacs.el .emacs
60 changes: 60 additions & 0 deletions custom.el
@@ -0,0 +1,60 @@
;; PATH
(when (equal system-type 'darwin)
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))
(push "/usr/local/bin" exec-path))

;; function that load third party library from vendor
(defun vendor (library)
(let* ((file (symbol-name library))
(normal (concat "~/.emacs.d/vendor/" file))
(suffix (concat normal ".el")))
(cond
((file-directory-p normal)
(add-to-list 'load-path normal)
(require library))
((file-directory-p suffix)
(add-to-list 'load-path suffix)
(require library))
((file-exists-p suffix) (require library)))))

;; custom functions
(defun jekyll-markdown-hook ()
(define-skeleton jekyll-code-highlight
"syntax highlight block for jekyll"
"language:"
"{% highlight "str" %}"\n
_ \n
"{% endhighlight %}")
(define-key (current-local-map) (kbd "C-c h") 'jekyll-code-highlight)
)
(add-hook 'markdown-mode-hook 'jekyll-markdown-hook)

(defun my-erb-mode-hook()
(define-skeleton rails-erb-print
"<%= %>"
nil
"<%= " _ " %>")
(define-key (current-local-map) (kbd "C->") 'rails-erb-print)
)
(add-hook 'rhtml-mode-hook 'my-erb-mode-hook)

(defun revert-all-buffers ()
"Refreshes all open buffers from their respective files."
(interactive)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (and (buffer-file-name) (not (buffer-modified-p)))
(revert-buffer t t t))))
(message "Refreshed open files.") )
(global-set-key (kbd "<f5>") 'revert-all-buffers)

(load-theme 'tango-dark)

;; default fonts
(when window-system
(set-default-font "Monaco-18")
(set-fontset-font (frame-parameter nil 'font)
'han '("WenQuanYi Micro Hei Mono" . "unicode-bmp")))

;; rvm shortcuts
(global-set-key (kbd "<f6>") 'rvm-activate-corresponding-ruby)
148 changes: 148 additions & 0 deletions emacs.el
@@ -0,0 +1,148 @@
(transient-mark-mode t)
(setq-default make-backup-files nil)
(setq inhibit-startup-message t)
(global-font-lock-mode t)
(setq x-select-enable-clipboard t)
(server-start)
(put 'set-goal-column 'disabled nil)
(setq truncate-partial-width-windows nil)
;; (setq ns-command-modifier 'meta)
(ns-toggle-toolbar nil)
(show-paren-mode 1)

(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)
(global-set-key [(control return)] 'ns-toggle-fullscreen)
(global-set-key (kbd "C-x <up>") 'windmove-up)
(global-set-key (kbd "C-x <down>") 'windmove-down)
(global-set-key (kbd "C-x <right>") 'windmove-right)
(global-set-key (kbd "C-x <left>") 'windmove-left)

(load "~/.emacs.d/custom.el")
(add-to-list 'load-path "~/.emacs.d/vendor")

;; yaml
(vendor 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))

;; rinari
(vendor 'rinari)

;; rhtml-mode
(vendor 'rhtml-mode)
(add-hook 'rhtml-mode-hook
(lambda ()
(rinari-launch)
(setq rhtml-indent-level 2)))

;; js.erb, javascript major mode, rinari as minor mode
(add-to-list 'auto-mode-alist '("\\.erb$" . rhtml-mode))

;; html
(add-hook 'html-mode-hook
(lambda()
(setq html-indent-level 2)))

;; RVM
(vendor 'rvm)
(rvm-use-default)
;; Ruby, Rake files are ruby, too, as are gemspecs, rackup files, etc.
(add-to-list 'auto-mode-alist '("\\.rake$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.gemspec$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.ru$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.builder$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.rjs$" . ruby-mode))
;; flymake for ruby
(add-hook 'ruby-mode-hook (lambda ()
(setq ruby-indent-level 2)
(vendor 'flymake-ruby)
(flymake-ruby-load)))

;; markdown
(vendor 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.markdown" . markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md" . markdown-mode))

;; textmate minor mode
(vendor 'textmate)
(textmate-mode)

;; CoffeeScript
(vendor 'coffee-mode)
(add-to-list 'auto-mode-alist '("\\.coffee$" . coffee-mode))
(add-to-list 'auto-mode-alist '("Cackefile" . coffee-mode))

;; Git
(vendor 'magit)
(global-set-key (kbd "C-;") 'magit-status)

;; cucumber
(vendor 'feature-mode)
;; optional configurations
;; default language if .feature doesn't have "# language: fi"
(setq feature-default-language "ruby")
;; point to cucumber languages.yml or gherkin i18n.yml to use
;; exactly the same localization your cucumber uses
;;(setq feature-default-i18n-file "/path/to/gherkin/gem/i18n.yml")
;; and load feature-mode
(add-to-list 'auto-mode-alist '("\.feature$" . feature-mode))

;; SCSS
(vendor 'scss-mode)
;; Rainbow, display text color on the background
(vendor 'rainbow-mode)
(add-hook 'scss-mode-hook
'(lambda ()
(setq scss-compile-at-save nil)
(rainbow-mode)))

;; CSS
(add-hook 'css-mode-hook
'(lambda ()
(setq css-mode-indent-depth 2)
(make-local-variable 'indent-line-function)
(setq indent-line-function 'css-indent)
(define-key css-mode-map "\C-ct" 'css-insert-section)))

(defun css-indent ()
(interactive)
(insert " "))

(defun css-insert-section (section)
"Inserts a kyle-style css section."
(interactive "sSection: ")
(insert "/*--------------------------------------------------------------------\n")
(insert (concat " @group " section "\n"))
(insert "--------------------------------------------------------------------*/\n")
(insert "\n")
(insert "\n")
(insert "\n")
(insert "/* @end */")
(forward-line -2))

;; auto-complete
(vendor 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete-config/ac-dict")
(ac-config-default)

;; javascript
(add-hook 'js-mode-hook
'(lambda ()
(vendor 'flymake-jslint)
(flymake-jslint-load)
(setq js-indent-level 2)))
(put 'upcase-region 'disabled nil)

;; emacs lisp
(add-hook 'emacs-lisp-mode-hook
'(lambda ()
(setq indent-tabs-mode nil
tab-width 4
c-basic-offset 4)))
74 changes: 74 additions & 0 deletions vendor/auto-complete-config/ac-dict/c++-mode
@@ -0,0 +1,74 @@
and
and_eq
asm
auto
bitand
bitor
bool
break
case
catch
char
class
compl
const
const_cast
continue
default
delete
do
double
dynamic_cast
else
enum
explicit
export
extern
false
float
for
friend
goto
if
inline
int
long
mutable
namespace
new
not
not_eq
operator
or
or_eq
private
protected
public
register
reinterpret_cast
return
short
signed
sizeof
static
static_cast
struct
switch
template
this
throw
true
try
typedef
typeid
typename
union
unsigned
using
virtual
void
volatile
wchar_t
while
xor
xor_eq
37 changes: 37 additions & 0 deletions vendor/auto-complete-config/ac-dict/c-mode
@@ -0,0 +1,37 @@
auto
_Bool
break
case
char
_Complex
const
continue
default
do
double
else
enum
extern
float
for
goto
if
_Imaginary
inline
int
long
register
restrict
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while

0 comments on commit 61f1209

Please sign in to comment.