• Stars
    star
    288
  • Rank 139,337 (Top 3 %)
  • Language
    Emacs Lisp
  • Created over 13 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Offer a *visual* way to choose a window to switch to

็›ฎๅฝ•

  1. What is switch-window
    1. Installation
    2. Configure and Usage
    3. Tips
      1. I want to select a window with "a-z" instead of "1-9".
      2. I want to let window to show bigger label.
      3. I want to hide window label when window's number < 3
      4. I want to select minibuffer with label "z".
      5. I want to auto resize a window when switch to it
      6. Switch-window seem to conflict with Exwm, how to do?
      7. I use text terminal, but I want bigger label.
      8. I want to use image or icon as label.
      9. `switch-window-shortcut-appearance' can't satisfy my need. how to do?
      10. Have any other similar package exist?
    4. Changelog
      1. 1.6.0 - 2018-06-06
      2. 1.5.0 - 2017-04-29
      3. 1.0.0 - 2015-01-14
      4. 0.11 - 2013-09-14
      5. 0.10 - 2011-06-19
      6. 0.9 - 2010-11-11 - emacs22 called, it wants some support
      7. 0.8 - 2010-09-13 - 999
      8. 0.7 - 2010-08-23 - window-dedicated-p
      9. 0.6 - 2010-08-12 - Minibuf-1
      10. 0.5 - 2010-08-08 - Polishing

What is switch-window

switch-window is an Emacs window switch tool, which offer a visual way to choose a window to switch to, delete, split or other operations.

img

Installation

  1. Config melpa source, please read: http://melpa.org/#/getting-started
  2. M-x package-install RET switch-window RET

Note: User can install switch-window with El-Get too.

Configure and Usage

(require 'switch-window)
(global-set-key (kbd "C-x o") 'switch-window)
(global-set-key (kbd "C-x 1") 'switch-window-then-maximize)
(global-set-key (kbd "C-x 2") 'switch-window-then-split-below)
(global-set-key (kbd "C-x 3") 'switch-window-then-split-right)
(global-set-key (kbd "C-x 0") 'switch-window-then-delete)

(global-set-key (kbd "C-x 4 d") 'switch-window-then-dired)
(global-set-key (kbd "C-x 4 f") 'switch-window-then-find-file)
(global-set-key (kbd "C-x 4 m") 'switch-window-then-compose-mail)
(global-set-key (kbd "C-x 4 r") 'switch-window-then-find-file-read-only)

(global-set-key (kbd "C-x 4 C-f") 'switch-window-then-find-file)
(global-set-key (kbd "C-x 4 C-o") 'switch-window-then-display-buffer)

(global-set-key (kbd "C-x 4 0") 'switch-window-then-kill-buffer)

When switch-window is enabled, user can use the below five keys:

key command description
"i" Move the border up
"k" Move the border down
"j" Move the border left
"l" Move the border right
"b" Balance windows
"SPC" Resume auto-resize

If you want to customize this feature, please see variable: `switch-window-extra-map'.

Note: if you use auto-resize window feature, you must know that when you execute above window operate commands, auto-resize feature will be disabled temporarily, you should use above "SPC" key to resume.

Tips

I want to select a window with "a-z" instead of "1-9".

(setq switch-window-shortcut-style 'qwerty)

Note: user can arrange qwerty shortcuts by variable `switch-window-qwerty-shortcuts'.

I want to let window to show bigger label.

The face of label is switch-window-label, user can change it :height with custiomize-face

I want to hide window label when window's number < 3

(setq switch-window-threshold 2)

I want to select minibuffer with label "z".

(setq switch-window-minibuffer-shortcut ?z)

I want to auto resize a window when switch to it

(setq switch-window-auto-resize-window t)
(setq switch-window-default-window-size 0.8) ;80% of frame size
(switch-window-mouse-mode) ;auto resize when switch window with mouse

Advanced usage:

(setq switch-window-auto-resize-window
      (lambda ()
        (equal (buffer-name) "*scratch*"))) ;when return t, run auto switch
(setq switch-window-default-window-size '(0.8 . 0.6)) ;80% width and 60% height of frame

By the way, you can use package golden-ratio also.

Switch-window seem to conflict with Exwm, how to do?

By default, switch-window get user's input with the help of function `read-event', this approach does not work well with Exwm (Emacs X window manager), user should set the below variable and use minibuffer to get input instead:

(setq switch-window-input-style 'minibuffer)

Note: if you use minibuffer to get input, the feature about `switch-window-minibuffer-shortcut' will not work well.

I use text terminal, but I want bigger label.

The only choice is using asciiart, which draw a bigger label with small ascii char.

(setq switch-window-shortcut-appearance 'asciiart)

img

I want to use image or icon as label.

  1. Prepare your label images, rename them to: 1.png โ€ฆ 9.png, a.png โ€ฆ z.png.

    You can use other image types supported by Emacs, please see: `image-types'.

  2. Put all above images to directory: `switch-window-image-directory'.

  3. Set variable: `switch-window-shortcut-appearance'

    (setq switch-window-shortcut-appearance 'image)
    

img

`switch-window-shortcut-appearance' can't satisfy my need. how to do?

All you should do is hacking you own label buffer function, for example: my-switch-window-label-buffer-function, and set the below variable:

(setq switch-window-label-buffer-function
      'my-switch-window-label-buffer-function)

Have any other similar package exist?

Changelog

1.6.0 - 2018-06-06

  1. Add switch-window-label face to control the appearance of label.
  2. Remove `switch-window-increase', use switch-window-label face instead.
  3. Show orig text with label: see `switch-window-background'
  4. Switch between frames: see `switch-window-multiple-frames'
  5. [incompatible] `switch-window-label-buffer-function''s arguments have changed, user should update when use it.

1.5.0 - 2017-04-29

  • Implement commands:
    1. switch-window-then-maximize
    2. switch-window-then-delete
    3. switch-window-then-split-below
    4. switch-window-then-split-right
    5. switch-window-then-split-horizontally
    6. switch-window-then-split-vertically
    7. switch-window-then-swap-buffer
  • Let switch-window work well with Exwm (Emacs X window manager).
  • User can customize switch-window label's appearance.

1.0.0 - 2015-01-14

  • Please fixme.

0.11 - 2013-09-14

  • restore point to end-of-buffer for windows where it was the case after switching, fixing an anoying bug.

0.10 - 2011-06-19

  • implement M-x delete-other-window (thanks developernotes on github)

0.9 - 2010-11-11 - emacs22 called, it wants some support

  • implement a propertize based hack to support emacs22

0.8 - 2010-09-13 - 999

  • Suport more than 9 windows (with a single key to type)
  • Use quail-keyboard-layout to choose single key labels for windows

0.7 - 2010-08-23 - window-dedicated-p

  • temporarily unset the window dedicated flag for displaying the numbers, patch from Renรฉ Kyllingstad [email protected]
  • fix timeout and RET handling wrt to not changing window selection

0.6 - 2010-08-12 - Minibuf-1

  • add support for selecting the minibuffer when it's active
  • some try at a better horizontal centering
  • assorted cleanup

0.5 - 2010-08-08 - Polishing

  • dim:switch-window-increase is now a maximum value

Converted from switch-window.el by el2org .

More Repositories

1

pgloader

Migrate to PostgreSQL in a single command!
Common Lisp
5,092
star
2

el-get

Manage the external elisp bits and pieces upon which you depend!
Emacs Lisp
1,641
star
3

pgcopydb

Copy a Postgres database to a target Postgres server (pg_dump | pg_restore on steroids)
C
1,039
star
4

pgcharts

Turn your PostgreSQL queries into Charts
Common Lisp
387
star
5

regresql

Regression Testing your SQL queries
Go
254
star
6

emacs-kicker

A minimal kick start init file for emacs
Emacs Lisp
145
star
7

prefix

Prefix Range module for PostgreSQL
C
96
star
8

pgextwlist

PostgreSQL Extension Whitelisting
C
92
star
9

sudoku

Solving Every Sudoku Puzzle
Python
58
star
10

preprepare

PostgreSQL prepare statements made pooling friendly
C
45
star
11

tpch-citus

Drivers to run TPC-H with Citus and PostgreSQL
C
31
star
12

nba

Aggregating NBA data
Common Lisp
30
star
13

pg_staging

Setup and maintain your staging environments from your production backups!
Python
28
star
14

cssh

ClusterSSH meets Emacs
Emacs Lisp
27
star
15

cl-abnf

ABNF Parser Generator, per RFC2234
Common Lisp
27
star
16

pgdevenv-el

PostgreSQL Development Tool for Emacs
Emacs Lisp
23
star
17

ql-to-deb

Update cl-* debian packages from Quicklisp releases.
Common Lisp
23
star
18

mbsync-el

Wrap calling mbsync in Emacs Lisp, with a gnus hook
Emacs Lisp
23
star
19

libphp-pgq

PHP level API for PGQ PostgreSQL Queing solution
PHP
17
star
20

pg_basebackup

Make your PostgreSQL base backup from a plain connection to the server (as superuser)
Python
17
star
21

kids

Helping kids discover computing
Common Lisp
16
star
22

base36

PostgreSQL base36 data type input/output support, internally a bigint.
C
14
star
23

getddl

Get the DDL from a live database and split them in files and directories
Python
14
star
24

tapoueh.org

Sources of the tapoueh.org web site, using Hugo
HTML
13
star
25

taop.xyz

The Art of PostgreSQL
HTML
13
star
26

apt.postgresql.org

debian packaging scripts for PostgreSQL.org
Shell
12
star
27

pginstall

The PostgreSQL Extension Installer
Common Lisp
11
star
28

emacs.d

My Emacs Setup
Emacs Lisp
9
star
29

pgsql-linum-format

a linum-mode hook to display PostgreSQL functions line numbers
Emacs Lisp
8
star
30

pgconfs

dim's PostgreSQL Conferences Slides, the sources.
PostScript
8
star
31

cl-db3

A Common Lisp lib to read dbf files version 3.
Common Lisp
7
star
32

pubnames

The Most Popular Pub Names
Common Lisp
7
star
33

subcommands.c

Another single-file header C lib: command line, file paths manipulation API, run subprograms.
C
7
star
34

AdventOfCode

Implementation of Advent Of Code puzzles in Common Lisp, just for fun.
Common Lisp
7
star
35

masteringpostgresql.com

My new book, still in the making.
CSS
7
star
36

plconvert

Convert code in between non standard database Procedural Languages.
Common Lisp
6
star
37

mailq-el

Emacs major mode for `mailq' interaction
Emacs Lisp
5
star
38

toy-parser

How to build a parser and have a compiler for free, in Common Lisp.
Common Lisp
5
star
39

mysqltopgsql.com

How to migrate from MySQL to PostgreSQL
HTML
5
star
40

pgsrc-el

PostgreSQL source editing facilities for Emacs
Emacs Lisp
3
star
41

rcirc-groups

an emacs buffer in rcirc-groups major mode
Emacs Lisp
3
star
42

cl-ixf

Parse IBM IXF file format.
Common Lisp
2
star
43

go-hello-world

Concurrent Hello World, in Common Lisp
Common Lisp
2
star
44

artisan-mysql

Common Lisp Native Driver for MySQL
Common Lisp
2
star
45

preventddl

set preventddl.enable to true;
PLpgSQL
1
star
46

pgaf_debian

debian packaging for apt.pg.o for pg_auto_failover
1
star
47

cl-pgdumpfile

Common Lisp library that knows how to read a PostgreSQL dump file in custom format.
Common Lisp
1
star
48

Citus-tutorial

Automate the Citus tutorial steps into a single command.
Makefile
1
star
49

pgloader.io

Public Website for the pgloader project.
SCSS
1
star