;; trivial settings (setq visible-bell t) (setq inhibit-startup-message t) (setq kill-ring-max 200) (setq default-fill-column 60) (setq scroll-margin 3 scroll-conservatively 10000) (setq default-major-mode 'text-mode) (show-paren-mode t) (setq show-paren-style 'parentheses) (setq frame-title-format "emacs@%b") (auto-image-file-mode) (global-font-lock-mode t) ;; Show LINE and COLUMN NUMBER (line-number-mode t) (column-number-mode t) ;; Version control (setq version-control t) (setq kept-new-versions 3) (setq delete-old-versions t) (setq kept-old-versions 2) (setq dired-kept-versions 1) (setq user-full-name "Baiyu Li") (setq user-mail-address "baiyu.li@gmail.com") ;; browse-kill-ring (require 'browse-kill-ring) (global-set-key [(control c)(k)] 'browse-kill-ring) (browse-kill-ring-default-keybindings) ;; tabber (require 'tabbar) (tabbar-mode) ;; (global-set-key (kbd "") 'tabbar-backward-group) ;; (global-set-key (kbd "") 'tabbar-forward-group) (global-set-key (kbd "<C-M-left>") 'tabbar-backward) (global-set-key (kbd "<C-M-right>") 'tabbar-forward) ;; mmm (autoload 'mmm-mode "mmm-mode" "Multiple Major Modes" t) (autoload 'mmm-parse-buffer "mmm-mode" "Automatic MMM-ification" t) ;; php-mode (autoload 'php-mode "php-mode") ;; html-helper-mode (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t) ;; insert blanks instead of the Tab character (setq-default indent-tabs-mode nil) (setq default-tab-width 4) (setq tab-stop-list ()) ;; (setq outline-minor-mode-prefix [(control o)]) (load "desktop") (desktop-load-default) (desktop-read) ;; (autoload 'table-insert "table" "WYGIWYS table editor") ;;; Match parenthesis (global-set-key "\C-x\C-p" 'match-paren) (defun match-paren (arg) "Go to the matching paren if on a paren; otherwise issue a warn." (interactive "p") (cond ((looking-at "\s(") (forward-list 1) (backward-char 1)) ((looking-at "\s)") (forward-char 1) (backward-list 1)) ; (t (self-insert-command (or arg 1)))) (t (error "No parenthesis found")))) ;; Able to VIEW COMPRESSED (.gz and .z) FILES directly (auto-compression-mode) ;; Some general KEY BINDINGS (global-set-key "\C-x\C-g" 'goto-line) (global-set-key "\M-o" 'occur) (global-set-key "\C-c\C-c" 'comment-region) ;; Count lines, words and characters in a region (defun wc-on-region (start end) (interactive "r") (let ((words 0) (lines 0) (chars 0)) (save-excursion (goto-char start) (while (< (point) end) (forward-word 1) (setq words (1+ words)))) (setq lines (count-lines start end) chars (- end start)) (message "Region has %d lines; %d words; %d characters." lines words chars))) (global-set-key "\C-x\w" 'wc-on-region) ;; uncomment-region (defun my-uncomment-region (point-min point-max) (interactive "r") (comment-region point-min point-max -1)) (global-set-key "\C-c\C-u" 'my-uncomment-region) (display-time) ;;; (global-set-key [(control ?.)] 'ska-point-to-register) (global-set-key [(control ?,)] 'ska-jump-to-register) (defun ska-point-to-register() "Store cursorposition _fast_ in a register. Use ska-jump-to-register to jump back to the stored position." (interactive) (setq zmacs-region-stays t) (point-to-register 8)) (defun ska-jump-to-register() "Switches between current cursorposition and position that was stored with ska-point-to-register." (interactive) (setq zmacs-region-stays t) (let ((tmp (point-marker))) (jump-to-register 8) (set-register 8 tmp))) (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. '(c-basic-offset 4) '(emacsw32-max-frames t) '(emacsw32-mode t) '(emacsw32-style-frame-title t) '(htmlize-view-print-visible t t) '(outline-minor-mode t) '(recentf-mode t) '(swbuff-y-mode t) '(w32-meta-style (quote w32-lr)) '(w32-print-menu-show-print nil) '(w32-print-menu-show-ps-print nil) '(w32shell-shell (quote cmd))) (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. ) (require 'setnu)