开发工具 eamcs vim 双修及寻求帮助

yuanchunfa · 2013年01月11日 · 最后由 yuanchunfa 回复于 2013年02月12日 · 5741 次阅读

在 Ruby China 收集了不少配置,在这里也放出自己的配置及寻求帮助。这几天开始动手写点 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"))))))

😌为什么不用 subl2 呢?

找找有没有 sass-mode 和 slim-mode,有的话应该装一下就好;木有只能自己动手配置了

以前 vim 配的好复杂支持好多功能,几年下来现在反而用最基本的。所以这些高级功能和配置和问题都不知道咯,也没问题咯。

#2 楼 @dotnil 都装了,用 package 装的,高亮都没有问题,就是缩进头疼啊

#1 楼 @hellfig 用过一段时间,Vim 模式弱了

emacs + evil

#7 楼 @alcarx 后面是转 evil,evil 的插件更多,其中 surround 是主要选择 evil 的原因。evil 不配置下没有 vimpulse 好用。

(setq css-indent-offset 2) 加上

10 楼 已删除
需要 登录 后方可回复, 如果你还没有账号请 注册新账号