mirror of
https://github.com/balkian/dotfiles.git
synced 2024-12-22 08:38:12 +00:00
Better emacs config
This commit is contained in:
parent
bc8b9f26d7
commit
5b443ec699
@ -7,6 +7,11 @@ Xft.antialias: true
|
||||
Xft.rgba: rgb
|
||||
Xft.hinting: true
|
||||
Xft.hintstyle: hintfull
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
! Emacs settings
|
||||
!-------------------------------------------------------------------------------
|
||||
!Emacs.font: DejaVu Sans Mono-10
|
||||
|
||||
!-------------------------------------------------------------------------------
|
||||
! URxvt settings
|
||||
|
25
emacs.d/config/config-dired.el
Normal file
25
emacs.d/config/config-dired.el
Normal file
@ -0,0 +1,25 @@
|
||||
(defun ergoemacs-open-in-external-app ()
|
||||
"Open the current file or dired marked files in external app."
|
||||
(interactive)
|
||||
(let ( doIt
|
||||
(myFileList
|
||||
(cond
|
||||
((string-equal major-mode "dired-mode") (dired-get-marked-files))
|
||||
(t (list (buffer-file-name))) ) ) )
|
||||
|
||||
(setq doIt (if (<= (length myFileList) 5)
|
||||
t
|
||||
(y-or-n-p "Open more than 5 files?") ) )
|
||||
|
||||
(when doIt
|
||||
(cond
|
||||
((string-equal system-type "windows-nt")
|
||||
(mapc (lambda (fPath) (w32-shell-execute "open" (replace-regexp-in-string "/" "\\" fPath t t)) ) myFileList)
|
||||
)
|
||||
((string-equal system-type "darwin")
|
||||
(mapc (lambda (fPath) (shell-command (format "open \"%s\"" fPath)) ) myFileList) )
|
||||
((string-equal system-type "gnu/linux")
|
||||
(mapc (lambda (fPath) (let ((process-connection-type nil)) (start-process "" nil "xdg-open" fPath)) ) myFileList) ) ) ) ) )
|
||||
|
||||
(define-key dired-mode-map (kbd "e") 'ergoemacs-open-in-external-app)
|
||||
(provide 'config-dired)
|
@ -1,36 +1,67 @@
|
||||
;;
|
||||
;; Evil and keybindings
|
||||
;;
|
||||
;;; config-evil.el --- Configuration for evil and its keybindings
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(evil-mode)
|
||||
(require 'evil-nerd-commenter)
|
||||
(require 'evil-leader)
|
||||
(require 'evil-matchit)
|
||||
(require 'evil-nerd-commenter)
|
||||
(require 'evil-surround)
|
||||
(require 'evil-jumper)
|
||||
|
||||
;; Evil global modes
|
||||
(global-evil-matchit-mode 1)
|
||||
(global-evil-jumper-mode)
|
||||
(global-evil-surround-mode 1)
|
||||
|
||||
;; Evil global modes config
|
||||
(evilnc-default-hotkeys)
|
||||
(setq evil-default-cursor t)
|
||||
|
||||
;; Exclude modes from evil mode
|
||||
;; Evil global modes
|
||||
(global-evil-matchit-mode 1)
|
||||
(global-evil-surround-mode 1)
|
||||
(global-evil-jumper-mode)
|
||||
(global-evil-leader-mode)
|
||||
|
||||
;; exclude modes from evil mode
|
||||
(add-to-list 'evil-emacs-state-modes 'git-rebase-mode)
|
||||
(add-to-list 'evil-emacs-state-modes 'undo-tree-visualizer-mode)
|
||||
(add-to-list 'evil-emacs-state-modes 'neotree-mode)
|
||||
(add-to-list 'evil-emacs-state-modes 'dired-mode)
|
||||
|
||||
(defun next-code-buffer ()
|
||||
;;; Avoid special buffers when cycling through windows
|
||||
;;; http://stackoverflow.com/questions/14323516/make-emacs-next-buffer-skip-messages-buffer
|
||||
(interactive)
|
||||
(let (( bread-crumb (buffer-name) ))
|
||||
(next-buffer)
|
||||
(while
|
||||
(and
|
||||
(string-match-p "^\*" (buffer-name))
|
||||
(not ( equal bread-crumb (buffer-name) )) )
|
||||
(next-buffer))))
|
||||
|
||||
(defun previous-code-buffer ()
|
||||
(interactive)
|
||||
(let (( bread-crumb (buffer-name) ))
|
||||
(previous-buffer)
|
||||
(while
|
||||
(and
|
||||
(string-match-p "^\*" (buffer-name))
|
||||
(not ( equal bread-crumb (buffer-name) )) )
|
||||
(previous-buffer))))
|
||||
;;
|
||||
;; Evil keys
|
||||
;; cool jumping
|
||||
(evil-leader/set-leader "<SPC>")
|
||||
|
||||
(define-key evil-normal-state-map (kbd "[b") 'evil-next-buffer)
|
||||
(define-key evil-normal-state-map (kbd "]b") 'evil-prev-buffer)
|
||||
(define-key evil-normal-state-map (kbd "[b") 'previous-code-buffer)
|
||||
(define-key evil-normal-state-map (kbd "]b") 'next-code-buffer)
|
||||
(define-key evil-normal-state-map (kbd "s") 'evil-ace-jump-char-mode)
|
||||
(define-key evil-normal-state-map (kbd ",d") 'neotree-toggle)
|
||||
(define-key evil-normal-state-map (kbd ",u") 'undo-tree-visualize)
|
||||
|
||||
(define-key evil-normal-state-map (kbd "C-c +") 'evil-numbers/inc-at-pt)
|
||||
(define-key evil-normal-state-map (kbd "C-c -") 'evil-numbers/dec-at-pt)
|
||||
|
||||
(add-hook 'neotree-mode-hook
|
||||
(lambda ()
|
||||
(define-key evil-normal-state-local-map (kbd "TAB") 'neotree-enter)
|
||||
(define-key evil-normal-state-local-map (kbd "SPC") 'neotree-enter)
|
||||
(define-key evil-normal-state-local-map (kbd "q") 'neotree-hide)
|
||||
(define-key evil-normal-state-local-map (kbd "RET") 'neotree-enter)))
|
||||
|
||||
(provide 'config-evil)
|
||||
;;; config-evil.el ends here
|
||||
|
@ -1,37 +1,80 @@
|
||||
;;; Helm
|
||||
(helm-mode 1)
|
||||
;;; config-file -- Helm configuration
|
||||
;;; Commentary:
|
||||
;;; The slowest part is actually loading helm-projectile
|
||||
;;; Code:
|
||||
|
||||
(require 'helm)
|
||||
(require 'helm-config)
|
||||
(require 'helm-grep)
|
||||
(require 'helm-locate)
|
||||
(require 'helm-misc)
|
||||
(require 'projectile)
|
||||
(require 'helm-projectile)
|
||||
(require 'helm-locate)
|
||||
(require 'helm-config)
|
||||
(require 'helm-misc)
|
||||
(require 'helm-locate)
|
||||
(setq helm-quick-update t)
|
||||
(setq helm-bookmark-show-location t)
|
||||
(setq helm-buffers-fuzzy-matching t)
|
||||
|
||||
;;; Save current position to mark ring
|
||||
(add-hook 'helm-goto-line-before-hook 'helm-save-current-pos-to-mark-ring)
|
||||
|
||||
;; Config
|
||||
;; Better helm fonts
|
||||
(set-face-attribute 'helm-selection nil :background "gold" :foreground "black")
|
||||
|
||||
;;; Keyboard mappings
|
||||
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebihnd tab to do persistent action
|
||||
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
|
||||
(define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
|
||||
(define-key helm-grep-mode-map (kbd "<return>") 'helm-grep-mode-jump-other-window)
|
||||
(define-key helm-grep-mode-map (kbd "n") 'helm-grep-mode-jump-other-window-forward)
|
||||
(define-key helm-grep-mode-map (kbd "p") 'helm-grep-mode-jump-other-window-backward)
|
||||
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
|
||||
(global-set-key (kbd "C-x b") 'helm-mini)
|
||||
(global-set-key (kbd "C-x C-f") 'helm-find-files)
|
||||
(global-set-key (kbd "C-h SPC") 'helm-all-mark-rings)
|
||||
(global-set-key (kbd "C-c h o") 'helm-occur)
|
||||
|
||||
;; Better helm fonts
|
||||
(set-face-attribute 'helm-selection nil :background "gold" :foreground "black")
|
||||
(define-key helm-grep-mode-map (kbd "<return>") 'helm-grep-mode-jump-other-window)
|
||||
(define-key helm-grep-mode-map (kbd "n") 'helm-grep-mode-jump-other-window-forward)
|
||||
(define-key helm-grep-mode-map (kbd "p") 'helm-grep-mode-jump-other-window-backward)
|
||||
|
||||
;;; Evil helm
|
||||
(define-key evil-normal-state-map (kbd "C-p") 'helm-mini)
|
||||
(define-key evil-normal-state-map (kbd "SPC") 'helm-M-x)
|
||||
(define-key evil-normal-state-map (kbd ",f") 'helm-occur)
|
||||
(evil-leader/set-key "<SPC>" 'helm-M-x)
|
||||
(define-key evil-normal-state-map (kbd ",f") 'helm-swoop)
|
||||
(define-key evil-normal-state-map (kbd ",a") 'helm-ag)
|
||||
(define-key evil-normal-state-map (kbd ",p") 'helm-show-kill-ring)
|
||||
(define-key evil-normal-state-map (kbd ",y") 'helm-show-kill-ring)
|
||||
|
||||
;;; Keyboard
|
||||
(global-set-key (kbd "M-x") 'helm-M-x)
|
||||
(define-key helm-map (kbd "C-w") 'backward-kill-word)
|
||||
(define-key helm-map (kbd "C-w") 'backward-kill-word)
|
||||
|
||||
;; use helm to list eshell history
|
||||
(add-hook 'eshell-mode-hook
|
||||
#'(lambda ()
|
||||
(define-key eshell-mode-map (kbd "M-l") 'helm-eshell-history)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; PACKAGE: helm-swoop ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Locate the helm-swoop folder to your path
|
||||
(require 'helm-swoop)
|
||||
;; Change the keybinds to whatever you like :)
|
||||
(global-set-key (kbd "C-c h o") 'helm-swoop)
|
||||
(global-set-key (kbd "C-c s") 'helm-multi-swoop-all)
|
||||
;; When doing isearch, hand the word over to helm-swoop
|
||||
(define-key isearch-mode-map (kbd "M-i") 'helm-swoop-from-isearch)
|
||||
;; From helm-swoop to helm-multi-swoop-all
|
||||
(define-key helm-swoop-map (kbd "M-i") 'helm-multi-swoop-all-from-helm-swoop)
|
||||
;; Save buffer when helm-multi-swoop-edit complete
|
||||
(setq helm-multi-swoop-edit-save t)
|
||||
;; If this value is t, split window inside the current window
|
||||
(setq helm-swoop-split-with-multiple-windows t)
|
||||
;; Split direcion. 'split-window-vertically or 'split-window-horizontally
|
||||
(setq helm-swoop-split-direction 'split-window-vertically)
|
||||
;; If nil, you can slightly boost invoke speed in exchange for text color
|
||||
(setq helm-swoop-speed-or-color t)
|
||||
|
||||
(helm-mode 1)
|
||||
(provide 'config-helm)
|
||||
|
||||
;;; config-helm.el ends here
|
||||
|
@ -1,6 +1,9 @@
|
||||
(require 'org)
|
||||
(require 'evil-org)
|
||||
(define-key global-map "\C-cl" 'org-store-link)
|
||||
(define-key global-map "\C-ca" 'org-agenda)
|
||||
(evil-leader/set-key "a" 'org-agenda)
|
||||
|
||||
(setq org-log-done t)
|
||||
|
||||
(setq org-directory "~/Dropbox/org")
|
||||
@ -13,6 +16,5 @@
|
||||
(define-key global-map "\C-cc" 'org-capture)
|
||||
|
||||
(setq org-clock-persist 'history)
|
||||
(org-clock-persistence-insinuate)
|
||||
|
||||
(provide 'config-org)
|
||||
|
154
emacs.d/init.el
154
emacs.d/init.el
@ -1,12 +1,13 @@
|
||||
; BalkEmacs --- My emacs configuration
|
||||
;;; BalkEmacs --- My emacs configuration
|
||||
;;; Commentary:
|
||||
|
||||
;;; Config that needs to be loaded before require
|
||||
(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.
|
||||
'(custom-safe-themes (quote ("c3c0a3702e1d6c0373a0f6a557788dfd49ec9e66e753fb24493579859c8e95ab" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))))
|
||||
'(custom-safe-themes (quote ("8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" "31a01668c84d03862a970c471edbd377b2430868eccf5e8a9aec6831f1a0908d" "1297a022df4228b81bc0436230f211bad168a117282c20ddcba2db8c6a200743" "c3c0a3702e1d6c0373a0f6a557788dfd49ec9e66e753fb24493579859c8e95ab" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
@ -14,7 +15,6 @@
|
||||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
|
||||
;;; Config that needs to be loaded before require
|
||||
(setq evil-want-C-u-scroll t)
|
||||
|
||||
;;; Code:
|
||||
@ -52,17 +52,23 @@
|
||||
; escreen ; screen for emacs, C-\ C-h
|
||||
evil
|
||||
evil-jumper
|
||||
evil-leader
|
||||
evil-matchit
|
||||
evil-nerd-commenter
|
||||
evil-numbers
|
||||
evil-org-mode
|
||||
evil-surround
|
||||
exec-path-from-shell
|
||||
fill-column-indicator
|
||||
flycheck
|
||||
gist
|
||||
git-gutter-fringe
|
||||
guide-key
|
||||
helm
|
||||
helm-ag
|
||||
helm-projectile
|
||||
helm-pydoc
|
||||
helm-swoop
|
||||
jedi
|
||||
magit
|
||||
markdown-mode
|
||||
@ -77,7 +83,11 @@
|
||||
smart-mode-line
|
||||
switch-window ; takes over C-x o
|
||||
undo-tree
|
||||
vimrc-mode
|
||||
volatile-highlights
|
||||
yaml-mode
|
||||
yasnippet
|
||||
zygospore
|
||||
; zencoding-mode ; http://www.emacswiki.org/emacs/ZenCoding
|
||||
;; color-theme-solarized
|
||||
;; color-theme-tango)) ; check out color-theme-olarized
|
||||
@ -95,7 +105,6 @@
|
||||
|
||||
(el-get 'sync my:el-get-packages)
|
||||
|
||||
(set-default-font "DejaVu Sans Mono")
|
||||
|
||||
;;(color-theme-solarized-dark)
|
||||
;(load-theme 'soothe t)
|
||||
@ -103,31 +112,39 @@
|
||||
(load-theme 'molokai t)
|
||||
|
||||
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
|
||||
|
||||
(add-hook 'after-init-hook #'global-flycheck-mode)
|
||||
(setq flycheck-temp-prefix ".flycheck")
|
||||
|
||||
;;(require 'autopair)
|
||||
;;(autopair-global-mode) ;; to enable in all buffers
|
||||
|
||||
;;(setq completion-cycle-threshold t)
|
||||
|
||||
(defun toggle-current-window-dedication ()
|
||||
(interactive)
|
||||
(let* ((window (selected-window))
|
||||
(dedicated (window-dedicated-p window)))
|
||||
(set-window-dedicated-p window (not dedicated))
|
||||
(message "Window %sdedicated to %s"
|
||||
(if dedicated "no longer " "")
|
||||
(buffer-name))))
|
||||
;;; Neotree
|
||||
(require 'neotree)
|
||||
(setq projectile-switch-project-action 'neotree-projectile-action)
|
||||
(when neo-persist-show
|
||||
(add-hook 'popwin:before-popup-hook
|
||||
(lambda () (setq neo-persist-show nil)))
|
||||
(add-hook 'popwin:after-popup-hook
|
||||
(lambda () (setq neo-persist-show t))))
|
||||
|
||||
(global-set-key [pause] 'toggle-current-window-dedication)
|
||||
;;; Popwin
|
||||
(require 'popwin)
|
||||
(popwin-mode)
|
||||
|
||||
;;; Linum
|
||||
(require 'linum)
|
||||
(set-face-attribute 'linum nil :height 100 :foreground "#666")
|
||||
(setq linum-format " %d ")
|
||||
(set-face-background 'hl-line-face "gray18")
|
||||
(add-hook 'prog-mode-hook 'linum-mode)
|
||||
(setq linum-format 'dynamic)
|
||||
(set-face-attribute 'linum nil :height 90)
|
||||
|
||||
(setq highlight-color "#232323")
|
||||
|
||||
;;; Show column number
|
||||
(column-number-mode)
|
||||
|
||||
;;; Highlight line
|
||||
(global-hl-line-mode)
|
||||
(set-face-background 'hl-line highlight-color)
|
||||
|
||||
;;; Flycheck
|
||||
(add-hook 'after-init-hook #'global-flycheck-mode)
|
||||
(setq flycheck-temp-prefix ".flycheck")
|
||||
|
||||
;; (global-linum-mode 1)
|
||||
;; (setq linum-mode-inhibit-modes-list '(eshell-mode
|
||||
@ -143,7 +160,7 @@
|
||||
;; (unless (member major-mode linum-mode-inhibit-modes-list)
|
||||
;; ad-do-it))
|
||||
;; (ad-activate 'linum-on)
|
||||
(add-hook 'prog-mode-hook 'linum-mode)
|
||||
(add-hook 'prog-mode-hook 'fci-mode)
|
||||
|
||||
;; (require 'powerline)
|
||||
;; (powerline-center-evil-theme)
|
||||
@ -154,7 +171,7 @@
|
||||
(display-time-mode t)
|
||||
|
||||
;;; Global emacs settings
|
||||
;; Disable splash screen
|
||||
;; disable splash screen
|
||||
(setq inhibit-splash-screen t)
|
||||
(setq truncate-partial-width-windows nil)
|
||||
(set-default 'truncate-lines nil)
|
||||
@ -162,6 +179,8 @@
|
||||
(setq-default indent-tabs-mode nil)
|
||||
(setq tab-width 4)
|
||||
(setq default-tab-width 4);
|
||||
;; Show info about available commands
|
||||
(setq guide-key/guide-key-sequence '("SPC" ","))
|
||||
|
||||
;; Separate Configs
|
||||
(add-to-list 'load-path (concat user-emacs-directory "config"))
|
||||
@ -173,17 +192,14 @@
|
||||
(require 'config-evil)
|
||||
(require 'config-org)
|
||||
(require 'config-secret)
|
||||
|
||||
;;; popwin
|
||||
(require 'popwin)
|
||||
(require 'config-dired)
|
||||
|
||||
;;; Global modes
|
||||
(tool-bar-mode -1)
|
||||
(global-hl-line-mode)
|
||||
(tool-bar-mode 0)
|
||||
(savehist-mode 1)
|
||||
(show-paren-mode t)
|
||||
(popwin-mode 1)
|
||||
(yas-global-mode 1)
|
||||
(guide-key-mode 1)
|
||||
|
||||
;;; Specific modes
|
||||
;; (autoload 'markdown-mode "markdown-mode"
|
||||
@ -192,7 +208,6 @@
|
||||
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
|
||||
|
||||
|
||||
;;
|
||||
;; Global Keybindings
|
||||
;;
|
||||
@ -200,9 +215,9 @@
|
||||
(global-set-key "\C-x\C-k" 'kill-region)
|
||||
(global-set-key [escape] 'keyboard-escape-quit)
|
||||
(define-key helm-map (kbd "C-w") 'backward-kill-word)
|
||||
(global-set-key (kbd "C-x 1") 'zygospore-toggle-delete-other-windows)
|
||||
|
||||
;; Don't clover my folders
|
||||
|
||||
(setq
|
||||
backup-by-copying t ; don't clobber symlinks
|
||||
delete-old-versions t
|
||||
@ -224,7 +239,10 @@
|
||||
;;; Columns
|
||||
(require 'fill-column-indicator)
|
||||
(setq fci-rule-column 79)
|
||||
(fringe-mode '(1 . 1))
|
||||
(setq fci-rule-color highlight-color)
|
||||
(setq fci-rule-width 3)
|
||||
|
||||
(fringe-mode '(5 . 5))
|
||||
|
||||
(eval-after-load 'magit
|
||||
'(progn
|
||||
@ -233,7 +251,8 @@
|
||||
(set-face-background 'magit-item-highlight "black")))
|
||||
|
||||
;; Fix Scrolling in tmux
|
||||
(defun my-terminal-config (&optional frame)
|
||||
;; Set the default font too
|
||||
(defun client-config (&optional frame)
|
||||
"Establish settings for the current terminal."
|
||||
(if (not frame) ;; The initial call.
|
||||
(xterm-mouse-mode 1)
|
||||
@ -243,17 +262,70 @@
|
||||
(xterm-mouse-mode 1))))
|
||||
;; Evaluate both now (for non-daemon emacs) and upon frame creation
|
||||
;; (for new terminals via emacsclient).
|
||||
(my-terminal-config)
|
||||
(add-hook 'after-make-frame-functions 'my-terminal-config)
|
||||
(client-config)
|
||||
(add-hook 'after-make-frame-functions 'client-config)
|
||||
|
||||
(defun toggle-current-window-dedication ()
|
||||
(interactive)
|
||||
(let* ((window (selected-window))
|
||||
(dedicated (window-dedicated-p window)))
|
||||
(set-window-dedicated-p window (not dedicated))
|
||||
(message "Window %sdedicated to %s"
|
||||
(if dedicated "no longer " "")
|
||||
(buffer-name))))
|
||||
|
||||
(global-set-key [insert] 'toggle-current-window-dedication)
|
||||
|
||||
|
||||
;; Disable copying to the clipboard
|
||||
;; (setq x-select-enable-clipboard nil)
|
||||
;; (setq x-select-enable-primary t)
|
||||
|
||||
;;; Neotree
|
||||
(setq projectile-switch-project-action 'neotree-projectile-action)
|
||||
|
||||
;;; Dired
|
||||
;;; Show human sizes in dired
|
||||
(setq-default dired-listing-switches "-alhv")
|
||||
|
||||
(defalias 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;;; Winner
|
||||
;;; History of visited windows
|
||||
;;; C-<left>, C-<right>
|
||||
(when (fboundp 'winner-mode)
|
||||
(winner-mode 1))
|
||||
|
||||
(exec-path-from-shell-initialize)
|
||||
|
||||
(require 'git-gutter-fringe)
|
||||
(setq git-gutter-fr:side 'right-fringe)
|
||||
|
||||
;; set a default font
|
||||
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10"))
|
||||
;; emacs doesn't actually save undo history with revert-buffer
|
||||
;; see http://lists.gnu.org/archive/html/bug-gnu-emacs/2011-04/msg00151.html
|
||||
;; fix that.
|
||||
(defun revert-buffer-keep-history (&optional IGNORE-AUTO NOCONFIRM PRESERVE-MODES)
|
||||
(interactive)
|
||||
|
||||
(setq tmp (point))
|
||||
;; tell Emacs the modtime is fine, so we can edit the buffer
|
||||
(clear-visited-file-modtime)
|
||||
|
||||
;; insert the current contents of the file on disk
|
||||
(widen)
|
||||
(delete-region (point-min) (point-max))
|
||||
(insert-file-contents (buffer-file-name))
|
||||
|
||||
;; mark the buffer as not modified
|
||||
(not-modified)
|
||||
(set-visited-file-modtime)
|
||||
(goto-char tmp)
|
||||
)
|
||||
|
||||
(setq revert-buffer-function 'revert-buffer-keep-history)
|
||||
|
||||
(require 'recentf)
|
||||
(recentf-mode 1)
|
||||
(setq recentf-max-saved-items 300)
|
||||
(setq recentf-max-menu-items 20)
|
||||
|
||||
|
||||
(provide '.emacs)
|
||||
|
2
zshrc
2
zshrc
@ -48,7 +48,7 @@ autoload -U zmv
|
||||
alias mmv='noglob zmv -W'
|
||||
alias e='myemacs -nw'
|
||||
alias ew='myemacs -n'
|
||||
export ALTERNATE_EDITOR=/usr/bin/emacs EDITOR="myemacs -nw" VISUAL="myemacs -nw"
|
||||
export ALTERNATE_EDITOR=/usr/bin/vim EDITOR="vim" VISUAL="vim"
|
||||
|
||||
PYTHONSTARTUP=~/.pythonrc.py
|
||||
export PYTHONSTARTUP
|
||||
|
Loading…
Reference in New Issue
Block a user