eamcs vim双剑合并及需求帮助

    大部分编程还是在VC下面,但是一直想要更为强大的编辑能力。网上有看到说世界上有三种编辑器:vim、emacs和其它。于是分别尝试了下,vim上手到也还容易,快捷键短,三种模式很是喜欢,emacs居然上不了手,于是用了若干年vim。vim曾经尝试自己去配置配置,总是出这出那问题,没有耐心在编辑器上折腾,发现了exvim,于是安份用了很长时间。直到看到推荐spf13套件,用起来甚为方便,方便自己再加点配置及插件,于是用了spf13,在mac下看rails源码到也甚为舒服,不过我最近突发奇想想看看现在windows下能不能做rails开发了,居然没啥问题,gem,bundle运行妥妥的。但是spf13编辑rb文件,一输入'.'后就宕了,让人郁闷啊。以前看过一篇《钗黛双收:若你也同Vim难割舍,却又看Emacs情切切》,也无意找到篇文章Windows下安装Emacs的最佳方法 解决不知道在那加配置文件的难题,于是用Emacs和Vim双剑合并了,在加点其他配置编辑方面算是能接受使用了。不过,这几天学习Rails,有一个问题还是让我抓狂,就是在编辑sass、slim文件自动缩进的问题,我使用了auto-indent-mode,并设置tab-width默认为2,在ruby、c++缩进方面挺好的,就是sass、slim总是不能够正确缩进,手工按tab居然不是按2个空格来缩进,使用:w居然把当前选中行缩进了,还有自动补全方面也是很不足,在这需求帮助,贴上自己的配置文件,大部分编辑情况下还是不错的。
(setenv "HOME" "D:/Tools/Emacs-24.2")
(setenv "PATH" "D:/Tools/Emacs-24.2")

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

;; add extra store
(require 'package)
(add-to-list 'package-archives
             '("marmalade" . "http://marmalade-repo.org/packages/") t)
(package-initialize)

;; this can auto install missing plugins
(when (not package-archive-contents)
  (package-refresh-contents))

;; add in your own as you wish:
(defvar my-package '(starter-kit
                     starter-kit-bindings
                     starter-kit-eshell
                     starter-kit-lisp
                     starter-kit-js
                     starter-kit-ruby
                     auto-complete
                     auto-indent-mode
                     autopair
                     markdown-mode
                     python-mode
                     coffee-mode
                     sass-mode
                     scss-mode
                     slim-mode
                     tabbar
                     tabbar-ruler
                     yasnippet
                     bm
                     smex
                     magit
                     color-theme
                     color-theme-monokai)
  "A list of packages to ensure are installed at launch.")

(dolist (p my-package)
  (when (not (package-installed-p p))
    (package-install p)))

;; auto-complete
(require 'auto-complete-config)
(global-auto-complete-mode t)
(setq-default ac-sources '(ac-source-words-in-same-mode-buffers))
(add-hook 'emacs-lisp-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-symbols)))
(add-hook 'auto-complete-mode-hook (lambda () (add-to-list 'ac-sources 'ac-source-filename)))
(set-face-background 'ac-candidate-face "lightgray")
(set-face-underline 'ac-candidate-face "darkgray")
(set-face-background 'ac-selection-face "steelblue")
(define-key ac-completing-map "\M-n" 'ac-next)
(define-key ac-completing-map "\M-p" 'ac-previous)
(setq ac-auto-start t)
(setq ac-dwim t)

;; yasnippet
(require 'yasnippet)
(yas-global-mode 1)

;; scss
(setq scss-compile-at-save nil)

;; slim
;;(require 'slim-mode)

;; magit
(require 'magit)

;; tabbar
(require 'tabbar)

;; auto-indent-mode
(setq auto-indent-on-visit-file t)
(require 'auto-indent-mode)
(auto-indent-global-mode)

;; autopair
(require 'autopair)
;;(autopair-global-mode)

;; theme
(require 'color-theme)
(color-theme-monokai)

;; basic settings
(fset 'yse-or-no-p 'y-or-n-p)

(setq-default make-backup-files nil)
(setq auto-save-default nil)
(setq innibit-startup-message t)
(setq initial_scratch-message "")

;;(setq-default comment-style 'indent)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)

(global-linum-mode t)
(ido-mode t)
(auto-image-file-mode t)
(delete-selection-mode t)

;;(column-number-mode t)
;;(show-paren-mode t)
;;(menu-bar-mode t)
;;(scroll-bar-mode -1)
;;(tool-bar-mode -1)
;;(blink-cursor-mode -1)
;;(set-fringe-style -1)
;;(tooltip-mode -1)

;; other package
;; vimpulse
(add-to-list 'load-path "~/.emacs.d/vimpulse")
(require 'vimpulse)

;; vimpulse-plugins
(add-to-list 'load-path "~/.emacs.d/vimpulse-plugins")
(require 'vimpulse-cjk)
(require 'vimpulse-operator-comment)
;;(require 'vimpulse-operator-moccur)
(require 'vimpulse-relative-linum)
(require 'vimpulse-textobj-between)

;; auto-complete-clang
(add-to-list 'load-path "~/.emacs.d/auto-complete-clang")
(require 'auto-complete-clang)

(setq ac-clang-auto-save t)
(setq ac-auto-start t)
(setq ac-quick-help-delay 0.5)
(column-number-mode t)
;; (ac-set-trigger-key "TAB")
(define-key ac-mode-map  [(control tab)] 'auto-complete)
(defun my-ac-config ()
  (setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
  (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
  ;; (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
  (add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
  (add-hook 'css-mode-hook 'ac-css-mode-setup)
  (add-hook 'auto-complete-mode-hook 'ac-common-setup)
  (global-auto-complete-mode t))
(defun my-ac-cc-mode-setup ()
  (setq ac-sources (append '(ac-source-clang ac-source-yasnippet) ac-sources)))
(add-hook 'c-mode-common-hook 'my-ac-cc-mode-setup)
;; ac-source-gtags
(my-ac-config)

;; ide-skel
(require 'ide-skel)
(partial-completion-mode)
(icomplete-mode)

;; code
(setq default-buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;; shortcut
(global-set-key [(control p)] 'tabbar-backward)
(global-set-key [(control n)] 'tabbar-forward)

(global-set-key [f4] 'ide-skel-proj-find-files-by-regexp)
(global-set-key [f5] 'ide-skel-proj-grep-files-by-regexp)
(global-set-key [f10] 'ide-skel-toggle-left-view-window)
(global-set-key [f11] 'ide-skel-toggle-bottom-view-window)
(global-set-key [f12] 'ide-skel-toggle-right-view-window)

(global-set-key [C-f1] 'package-list-packages)
(global-set-key [C-f3] 'revert-buffer)
(global-set-key [C-f4] 'kill-this-buffer)
(global-set-key [C-f5] 'shell)
(global-set-key [C-f6] 'magit-status)

;; emacs auto save
(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-indent-next-pair-timer-geo-mean (quote ((default 0.0005 0))))
 '(blink-cursor-mode nil)
 '(column-number-mode t)
 '(fringe-mode (quote (nil . 0)) nil (fringe))
 '(menu-bar-mode t)
 '(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.
 '(tabbar-button-highlight ((t (:inherit tabbar-button))))
 '(tabbar-default ((t (:inherit variable-pitch :background "gray82" :foreground "gray50" :height 0.8))))
 '(tabbar-highlight ((t nil)))
 '(tabbar-selected ((t (:inherit tabbar-default :background "white" :foreground "blue" :box (:line-width 1 :color "black")))))
 '(tabbar-separator ((t (:inherit tabbar-default :height 0.2))))
 '(tabbar-unselected ((t (:inherit tabbar-default :background "gray72" :foreground "black" :box (:line-width 1 :color "black"))))))
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值