Created
October 27, 2009 00:58
-
-
Save miyucy/219197 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; vimのモードラインを読み込む | |
(defun load-vim-modeline-1 (matches) | |
(when matches | |
(dolist (match (split-string (match-string-no-properties 4))) | |
(when (or (string-match "^\\(tabstop\\|ts\\)=\\([0-9]+\\)$" match) | |
(string-match "^\\(shiftwidth\\|sw\\)=\\([0-9]+\\)$" match)) | |
(setq tab-width (string-to-number (match-string-no-properties 2 match)))) | |
(when (string-match "^\\(softtabstop\\|sts\\)=\\([0-9]+\\)$" match) | |
(setq tab-width (string-to-number (match-string-no-properties 2 match))) | |
(setq indent-tabs-mode nil)) | |
(if (string-match "^\\(no\\)?\\(expandtab\\|et\\)$" match) | |
(if (string-equal "no" (match-string-no-properties 1 match)) | |
(setq indent-tabs-mode t) | |
(setq indent-tabs-mode nil)))))) | |
(defun load-vim-modeline () | |
(save-excursion | |
(goto-char (point-min)) | |
(load-vim-modeline-1 (re-search-forward "\\(.+\\)?[ \t]\\(vim?\\|ex\\): *?\\(set? \\)? *\\(.*\\) *?" (min 3000 (buffer-size)) t)) | |
(goto-char (point-max)) | |
(load-vim-modeline-1 (re-search-backward "\\(.+\\)?[ \t]\\(vim?\\|ex\\): *?\\(set? \\)? *\\(.*\\) *?" (min 3000 (buffer-size)) t)))) | |
;; (remove-hook 'find-file-hook 'load-vim-modeline) | |
(add-hook 'find-file-hook 'load-vim-modeline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment