Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (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.
- '(browse-url-browser-function (quote browse-url-generic))
- '(browse-url-generic-program "firefox")
- '(column-number-mode t)
- '(display-time-mode t)
- '(ibus-python-shell-command-name "python2")
- '(scroll-bar-mode (quote right))
- '(show-paren-mode t)
- '(tool-bar-mode nil))
- (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 103 :width normal :foundry "unknown" :family "DejaVu Sans Mono")))))
- (add-to-list 'load-path "/home/favadi/.emacs.d/site-lisp/")
- ;; Load external file
- ;; (load "~/.erc_init.el")
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Appearance;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ; make whitespace-mode use just basic coloring
- (setq whitespace-style (quote
- ( spaces tabs newline space-mark tab-mark newline-mark)))
- ;; make whitespace-mode use “¶” for newline and “▷” for tab.
- ;; together with the rest of its defaults
- (setq whitespace-display-mappings
- '(
- (space-mark 32 [183] [46]) ; normal space, ·
- (space-mark 160 [164] [95])
- (space-mark 2208 [2212] [95])
- (space-mark 2336 [2340] [95])
- (space-mark 3616 [3620] [95])
- (space-mark 3872 [3876] [95])
- (newline-mark 10 [182 10]) ; newlne, ¶
- (tab-mark 9 [9655 9] [92 9]) ; tab, ▷
- ))
- ;; Hightlight code beetween {}
- (setq show-paren-style 'expression)
- ;;Color theme
- ;; (add-to-list 'load-path "/usr/share/emacs/site-lisp/themes/color-theme-example.el")
- ;; ;(load-file "/home/diep/.emacs.d/themes/awesome.el")
- ;; (require 'color-theme)
- ;; (eval-after-load "color-theme"
- ;; '(progn
- ;; (color-theme-initialize)
- ;; (color-theme-emacs21)))
- ;; (setq color-theme-is-global t)
- ;;Turn off toolbar and menubar
- ;;(menu-bar-mode -1)
- ;;(tool-bar-mode -1)
- ;; turn on highlighting current line
- (global-hl-line-mode 1)
- ;; show (line, column) on mode line
- (column-number-mode 1)
- ;; (global-visual-line-mode 1) ; 1 for on, 0 for off.
- (line-number-mode 1)
- (require 'linum)
- ;; Number lines in all modes
- (global-linum-mode 1)
- ;; Apply numbering to specific modes (example for lisp-mode) [cannot use with global-linum-mode]
- ;;(add-hook 'lisp-mode-hook (lambda () (linum-mode 1)))
- (setq-default indent-tabs-mode nil)
- (setq-default tab-width 4)
- (setq indent-line-function 'insert-tab)
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Navigating;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Easy Buffer Switch
- ;;(require 'ebs)
- ;; (ebs-initialize)
- ;; (global-set-key [(control tab)] 'ebs-switch-buffer)
- (iswitchb-mode nil)
- ;;Switch Beeewen Windows
- (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)
- ;;Resize Windows
- (global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
- (global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
- (global-set-key (kbd "S-C-<down>") 'shrink-window)
- (global-set-key (kbd "S-C-<up>") 'enlarge-window)
- ;;Use ibuffer
- (define-key global-map "\C-x\C-b" 'ibuffer)
- ;; ;; path-to-anything is the path which has the 'anything' we just cloned
- ;; (add-to-list 'load-path "~/.emacs.d/site-lisp/anything/anything-config")
- ;; (require 'anything-config)
- ;; (global-set-key (kbd "C-x b")
- ;; (lambda() (interactive)
- ;; (anything
- ;; :prompt "Switch to: "
- ;; :candidate-number-limit 10 ;; up to 10 of each
- ;; :sources
- ;; '( anything-c-source-buffers ;; buffers
- ;; anything-c-source-recentf ;; recent files
- ;; anything-c-source-bookmarks ;; bookmarks
- ;; anything-c-source-files-in-current-dir+ ;; current dir
- ;; anything-c-source-locate)))) ;; use 'locate'
- ;; (global-set-key (kbd "C-c I") ;; i -> info
- ;; (lambda () (interactive)
- ;; (anything
- ;; :prompt "Info about: "
- ;; :candidate-number-limit 3
- ;; :sources
- ;; '( anything-c-source-info-libc ;; glibc docs
- ;; anything-c-source-man-pages ;; man pages
- ;; anything-c-source-info-emacs)))) ;; emacs
- ;; (add-hook 'emacs-lisp-mode-hook
- ;; (lambda()
- ;; ;; other stuff...
- ;; ;; ...
- ;; ;; put useful info under C-c i
- ;; (local-set-key (kbd "C-c i")
- ;; (lambda() (interactive)
- ;; (anything
- ;; :prompt "Info about: "
- ;; :candidate-number-limit 5
- ;; :sources
- ;; '( anything-c-source-emacs-functions
- ;; anything-c-source-emacs-variables
- ;; anything-c-source-info-elisp
- ;; anything-c-source-emacs-commands
- ;; anything-c-source-emacs-source-defun
- ;; anything-c-source-emacs-lisp-expectations
- ;; anything-c-source-emacs-lisp-toplevels
- ;; anything-c-source-emacs-functions-with-abbrevs
- ;; anything-c-source-info-emacs))))))
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Editing;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Visual Undo Redo
- (require 'redo+)
- (global-set-key (kbd "C-+") 'redo)
- (setq undo-no-redo t)
- ;; Set undo, redo shortcuts
- (global-set-key (kbd "C-z") 'undo) ; Ctrl+z
- (global-set-key (kbd "C-S-z") 'redo) ; Ctrl+Shift+z
- ;; Set undo, redo shortcuts
- (global-set-key (kbd "C-z") 'undo) ; Ctrl+z
- (global-set-key (kbd "C-S-z") 'redo) ; Ctrl+Shift+z
- (delete-selection-mode 1) ; delete selected text when typing
- ;; ;; Ibus-el setup
- ;; (require 'ibus)
- ;; ;; Turn on ibus-mode automatically after loading .emacs
- ;; (add-hook 'after-init-hook 'ibus-mode-on)
- ;; ;; Choose your key to toggle input status:
- ;; (global-set-key (kbd "C-`") 'ibus-toggle)
- ;; ;;change cursor color depending on IBus status
- ;; (setq ibus-cursor-color '("red" "white" "limegreen"))
- ;; ;; Use C-SPC for Set Mark command
- ;; (ibus-define-common-key ?\C-\s nil)
- ;; ;; Use C-x M-i toggle ibus mode.
- ;; (global-set-key (kbd "C-x M-i") 'ibus-mode)
- ;; Whole line or region mode
- (put 'kill-ring-save 'interactive-form
- '(interactive
- (if (use-region-p)
- (list (region-beginning) (region-end))
- (list (line-beginning-position) (line-beginning-position 2)))))
- (put 'kill-region 'interactive-form
- '(interactive
- (if (use-region-p)
- (list (region-beginning) (region-end))
- (list (line-beginning-position) (line-beginning-position 2)))))
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Programming;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; Original idea from
- ;; http://www.opensubscriber.com/message/[email protected]/10971693.html
- (defun comment-dwim-line (&optional arg)
- "Replacement for the comment-dwim command.
- If no region is selected and current line is not blank and we are not at the end of the line, then comment current line.
- Replaces default behaviour of comment-dwim, when it inserts comment at the end of the line."
- (interactive "*P")
- (comment-normalize-vars)
- (if (and (not (region-active-p)) (not (looking-at "[ \t]*$")))
- (comment-or-uncomment-region (line-beginning-position) (line-end-position))
- (comment-dwim arg)))
- (global-set-key "\M-;" 'comment-dwim-line)
- ;; Auto-complete
- (add-to-list 'load-path "/usr/share/emacs/site-lisp/auto-complete")
- (require 'auto-complete-config)
- (add-to-list 'ac-dictionary-directories "/usr/share/emacs/site-lisp/auto-complete/ac-dict")
- (ac-config-default)
- ;;AutoPairs
- ;; (add-to-list 'load-path "~/.emacs.d/site-lisp") ;; comment if autopair.el is in standard load path
- (require 'autopair)
- (autopair-global-mode) ;; enable autopair in all buffers
- ;; Python setting
- ;; Emacs python mode
- (autoload 'python-mode "python-mode.el" "Python mode." t)
- (setq auto-mode-alist (append '(("/*.\.py$" . python-mode)) auto-mode-alist))
- ;; Yasnippet
- (add-to-list 'load-path "/usr/share/emacs/site-lisp/yas")
- (require 'yasnippet) ;; not yasnippet-bundle
- (yas/initialize)
- (yas/load-directory "/usr/share/emacs/site-lisp/yas/snippets")
- ;;Ropemacs
- (require 'pymacs)
- (pymacs-load "ropemacs" "rope-")
- ;; End Python setting
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Dired;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- (require 'dired)
- (define-key global-map "\C-x\C-j" 'dired-jump)
- ; deleting files goes to OS's trash folder
- (setq delete-by-moving-to-trash t) ; “t” for true, “nil” for false
- ;; allow dired to be able to delete or copy a whole dir.
- ;; “always” means no asking. “top” means ask once. Any other symbol means ask each and every time for a dir and subdir.
- (setq dired-recursive-copies (quote top))
- (setq dired-recursive-deletes (quote top))
- ;; Now, when you have dired of different dir in 2 panes, and when you press C to copy, the other dir in the split pane will be default destination.
- (setq dired-dwim-target t)
- ;; Make dired use the same buffer for viewing directory, instead of spawning many
- (add-hook 'dired-mode-hook
- (lambda ()
- (define-key dired-mode-map (kbd "<return>")
- 'dired-find-alternate-file) ; was dired-advertised-find-file
- (define-key dired-mode-map (kbd "^")
- (lambda () (interactive) (find-alternate-file "..")))
- ; was dired-up-directory
- ))
- ;; Hiding Hidden Files in Emacs dired
- (require 'dired-x)
- (setq dired-omit-files "^\\...+$")
- (add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EMMS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;; (require 'emms-setup)
- ;; (emms-standard)
- ;; (emms-default-players)
- ;; ;; Show the current track each time EMMS
- ;; ;; starts to play a track with "NP : "
- ;; (add-hook 'emms-player-started-hook 'emms-show)
- ;; (setq emms-show-format "NP: %s")
- ;; ;; When asked for emms-play-directory,
- ;; ;; always start from this one
- ;; (setq emms-source-file-default-directory "~/zic/")
- ;; ;; Want to use alsa with mpg321 ?
- ;; (setq emms-player-mpg321-parameters '("-o" "alsa"))
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Misc.;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;;Tetris setting
- (defadvice tetris-end-game (around zap-scores activate)
- (save-window-excursion ad-do-it))
- ;;Setting for Org Mode
- ;; The following lines are always needed. Choose your own keys.
- (require 'org-install)
- (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
- (global-set-key "\C-cl" 'org-store-link)
- (global-set-key "\C-cc" 'org-capture)
- (global-set-key "\C-ca" 'org-agenda)
- (global-set-key "\C-cb" 'org-iswitchb)
- (setq org-agenda-files (list "~/Dropbox/org/Work.org"
- "~/Dropbox/org/Personal.org"
- "~/Dropbox/org/Misc.org"))
- (setq org-log-done t)
- ;; W3m
- (setq browse-url-browser-function 'w3m-browse-url)
- (autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t)
- ;; optional keyboard short-cut
- (global-set-key "\C-xm" 'browse-url-at-point)
- ;; Set starting day to sunday
- (setq calendar-week-start-day 1)
- (put 'dired-find-alternate-file 'disabled nil)
- ;; Setting for deft (a not taking mode)
- ;; (require 'deft)
- ;; (setq deft-extension "txt")
- ;; (setq deft-directory "~/Dropbox/deft-notes/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement