Last active
July 16, 2021 17:26
-
-
Save ftrain/8443721 to your computer and use it in GitHub Desktop.
a nice .emacs for when you are on a terminal. Respects scroll wheel events. Very useful when run inside of tmux and combined with this tmuxconf: https://gist.github.com/ftrain/8443744
This file contains hidden or 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
;; .emacs | |
;;; uncomment this line to disable loading of "default.el" at startup | |
;; (setq inhibit-default-init t) | |
;; enable visual feedback on selections | |
(setq transient-mark-mode t) | |
;; default to better frame titles | |
(setq frame-title-format | |
(concat "%b - emacs@" (system-name))) | |
;; default to unified diffs | |
(setq diff-switches "-u") | |
;; always end a file with a newline | |
;(setq require-final-newline 'query) | |
;;; uncomment for CJK utf-8 support for non-Asian users | |
;; (require 'un-define) | |
(require 'xt-mouse) | |
(xterm-mouse-mode) | |
(require 'mouse) | |
(xterm-mouse-mode t) | |
(defun track-mouse (e)) | |
(setq mouse-wheel-follow-mouse 't) | |
(defvar alternating-scroll-down-next t) | |
(defvar alternating-scroll-up-next t) | |
(defun alternating-scroll-down-line () | |
(interactive "@") | |
(when alternating-scroll-down-next | |
; (run-hook-with-args 'window-scroll-functions ) | |
(scroll-down-line)) | |
(setq alternating-scroll-down-next (not alternating-scroll-down-next))) | |
(defun alternating-scroll-up-line () | |
(interactive "@") | |
(when alternating-scroll-up-next | |
; (run-hook-with-args 'window-scroll-functions) | |
(scroll-up-line)) | |
(setq alternating-scroll-up-next (not alternating-scroll-up-next))) | |
(global-set-key (kbd "<mouse-4>") 'alternating-scroll-down-line) | |
(global-set-key (kbd "<mouse-5>") 'alternating-scroll-up-line) | |
;; Compile to JS on every save. | |
(add-hook 'after-save-hook | |
'(lambda () | |
(when (string-match "\\.coffee$" buffer-file-name) | |
(coffee-compile-file)))) | |
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/") | |
("marmalade" . "http://marmalade-repo.org/packages/") | |
("melpa" . "http://melpa.milkbox.net/packages/"))) | |
(package-initialize) | |
;(elpy-enable) | |
(put 'downcase-region 'disabled nil) | |
(put 'upcase-region 'disabled nil) |
I use cua mode. With C-RET you can start a visual selection. (=cua-set-rectangle-mark)
@louwers, do you mean for mouse-drag selection?
Thank you, it saved my time. And how to scroll quickly if I have a file with many lines like more than 1000 lines.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any ideas on how to get real-time visual selection feedback, which vim has?