Showing posts with label emacs. Show all posts
Showing posts with label emacs. Show all posts

Wednesday, July 09, 2014

emacs: saves all the backup into a single folder

A nice settings suggested in http://www.emacswiki.org/emacs/BackupDirectory to get all your backup files created by emacs in a single folder, to do this I setup the following settings:
;; Put all backups in a folder
(setq
 backup-by-copying t
 backup-directory-alist `(("." . "~/.emacs_saves"))
 delete-old-versions t
 kept-new-versions 6
 kept-old-versions 2
 version-control t)

Thursday, March 29, 2012

emacs: Cycle windows backward

To cycle windows in emacs you can use the shortcut c-x o that executes the command other-window. Now to cycle windows in the reverse order you need to execute the command other-window with argument -1 (other-window accepts integer as argument, being the number of windows to jump). So I added this code to my .ecmas file:
;; cycle windows in reverse order
(defun prev-window ()
  (interactive)
  (other-window -1)
)
(global-set-key (kbd "C-x p") 'prev-window)
This will create the command prev-window and assign the shortcut C-x p to this function. Note: C-x p is by default assigned to narrow-to-page, a function I never used... This Idea I found it originally in Quora.com

Resize windows in emacs

To easily resize windows in emacs I added the following key shortcuts:
;; * \author Pedro Parracho   
;; Resizing windows using alt-arrow
 (global-set-key (kbd "\033[1;9D") 'shrink-window-horizontally) ;;alt-left: code ^[[1;9D                                                    
 (global-set-key (kbd "\033[1;9C") 'enlarge-window-horizontally) ;; alt-right: code ^[[1;9C                                                 
 (global-set-key (kbd "\033[1;9A") 'shrink-window) ;; alt-up: code ^[[1;9A                                                                  
 (global-set-key (kbd "\033[1;9B") 'enlarge-window) ;; alt-down: code ^[[1;9B                                                               
Now alt-arrow will change the window size by a step.

Monday, March 26, 2012

Swap two characters in emacs

To transpose 2 characters the emacs command is transpose-chars and the shortcut is C-t.
For words the command is transpose-words and the shortcut is M-t.