Skip to content

Commit

Permalink
Remove generation of keybindings.conf
Browse files Browse the repository at this point in the history
The file will always be sourced. The keybindings can manually be added
to that one place only.
  • Loading branch information
whame committed Jan 1, 2023
1 parent bc5720a commit 45737ad
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 291 deletions.
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,11 @@ CONF_FILE := keybindings.conf
SCRIPT := tmux-modal.tmux

.PHONY: all
all: $(CONF_FILE)

$(CONF_FILE): $(SCRIPT)
@lineNr=$$(wc -l $< | cut -d ' ' -f 1); \
grep "^# START KEYBINDINGS" -A $${lineNr} $< | tail -n +2 | \
grep "^# END KEYBINDINGS" -B $${lineNr} | head -n -1 > $@
@echo "Created ${CONF_FILE}"
all:

.PHONY: test
test: all
./$(SCRIPT)

.PHONY: clean
clean:
$(RM) $(CONF_FILE)
283 changes: 0 additions & 283 deletions tmux-modal.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -61,289 +61,6 @@ parse_yn_opt() {
fi
}

# The "START/END KEYBINDINGS" comment lines are parsed by the Makefile to
# auto-generate the default user configuration file.

# START KEYBINDINGS
# These are the default keybindings for tmux-modal. This file will be used by
# the main script `tmux-modal.tmux` when tmux loads. Users can however load
# their own custom keybindings file by copying this file, make any changes and
# then tell tmux-modal to load the custom file instead with tmux option
# `modal-keybindings-conf`. For example, put this is in your `.tmux.conf`:
#
# set -g @modal-keybindings-conf /path/to/my-tmux-modal-keybindings.conf
#
# The syntax is the same as for tmux keybindings:
#
# KBD_CMD_EXIT=Escape
# KBD_WIN_RESIZE_UP=S-Up
# KBD_GOTO_WIN_NEXT=C-n
# KBD_GOTO_SESS_PREV=M-p
#
# This binds `Esc`, `Shift-Up`, `Ctrl-n` and `Alt-p`, to `KBD_CMD_EXIT` (exit
# modal command mode), `KBD_WIN_RESIZE_UP` (window resize up),
# `KBD_GOTO_WIN_NEXT` (go to next window) and `KBD_GOTO_SESS_PREV` (go to
# previous session), respectively.
#
# Each keybinding variable below has an accompanying comment line. Comment lines
# that starts with a single '#' are "root" commands. Two '#'s means that this is
# a "sub-command" to the previous root command. Three '#'s means that it is a
# sub-command to the previous sub-command, and so on. If a 'q' is followed by a
# '#' in the comment line, it indicates that this command is "sticky", i.e. it
# needs to be exited explicitly (with `KBD_QUIT`).
#
# For example, `KBD_WIN_GOTO_1` is a sub-command to `KBD_WIN` and is used with
# `w 1`. `KBD_PASTE` can be used directly after entering the modal mode, i.e.
# `M-m y`. While `KBD_WIN_RESIZE_RIGHT` is used with `w r l` and is a sticky
# command (since `KBD_WIN_RESIZE`'s comment line is `##q`) and must be exited
# with 'q' (see the `README` for more details).

# Enter modal command mode.
KBD_CMD=M-m

# Exit modal command mode.
KBD_CMD_EXIT=M-m

# Quit command. This is used to exit command modes that don't require prefix
# (e.g. "w r" used for resizing panes).
KBD_QUIT=q

# Enter copy mode.
KBD_COPY_MODE=c

# Paste buffer (e.g. from copy mode).
KBD_PASTE=y

# Open the tmux command prompt.
KBD_CMD_PROMPT=:

# Window command prefix.
KBD_WIN=w

## Select window 0 (window command alias for KBD_GOTO_WIN_0).
KBD_WIN_GOTO_0=0

## Select window 1 (window command alias for KBD_GOTO_WIN_1).
KBD_WIN_GOTO_1=1

## Select window 2 (window command alias for KBD_GOTO_WIN_2).
KBD_WIN_GOTO_2=2

## Select window 3 (window command alias for KBD_GOTO_WIN_3).
KBD_WIN_GOTO_3=3

## Select window 4 (window command alias for KBD_GOTO_WIN_4).
KBD_WIN_GOTO_4=4

## Select window 5 (window command alias for KBD_GOTO_WIN_5).
KBD_WIN_GOTO_5=5

## Select window 6 (window command alias for KBD_GOTO_WIN_6).
KBD_WIN_GOTO_6=6

## Select window 7 (window command alias for KBD_GOTO_WIN_7).
KBD_WIN_GOTO_7=7

## Select window 8 (window command alias for KBD_GOTO_WIN_8).
KBD_WIN_GOTO_8=8

## Select window 9 (window command alias for KBD_GOTO_WIN_9).
KBD_WIN_GOTO_9=9

## Select window with tree view (window command alias for KBD_GOTO_WIN_TREE).
KBD_WIN_GOTO_TREE=t

## Select window with index (window command alias for KBD_GOTO_WIN_INDEX).
KBD_WIN_GOTO_INDEX=i

## Select left pane.
KBD_WIN_PANE_LEFT=h

## Select right pane.
KBD_WIN_PANE_RIGHT=l

## Select above pane.
KBD_WIN_PANE_UP=k

## Select below pane.
KBD_WIN_PANE_DOWN=j

## Delete window pane.
KBD_WIN_PANE_DEL=d

## Select previous window (window command alias for KBD_GOTO_WIN_PREV).
KBD_WIN_PREV=H

## Select next window (window command alias for KBD_GOTO_WIN_NEXT).
KBD_WIN_NEXT=L

## Delete window.
KBD_WIN_DEL=D

## Create new window.
KBD_WIN_CREATE=c

## Select last window (window command alias for KBD_GOTO_WIN_LAST).
KBD_WIN_LAST=o

## Zoom pane.
KBD_WIN_ZOOM=z

## Break pane.
KBD_WIN_BREAK=b

## Display pane numbers.
KBD_WIN_NR=n

## Rename window.
KBD_WIN_RENAME=,

##q Pane command prefix (same bindings as KBD_WIN but without the prefix).
KBD_WIN_PANE=w

## Split command prefix.
KBD_WIN_SPLIT=s

### Split window pane right.
KBD_WIN_SPLIT_RIGHT=l

### Split window pane down.
KBD_WIN_SPLIT_DOWN=j

## Move command prefix.
KBD_WIN_MOVE=m

### Move window pane up.
KBD_WIN_MOVE_UP=k

### Move window pane down.
KBD_WIN_MOVE_DOWN=j

## Arrange command prefix.
KBD_WIN_ARRANGE=a

### Arrange window layout 1 ("even-horizontal").
KBD_WIN_ARRANGE_1=1

### Arrange window layout 2 ("even-vertical").
KBD_WIN_ARRANGE_2=2

### Arrange window layout 3 ("main-horizontal").
KBD_WIN_ARRANGE_3=3

### Arrange window layout 4 ("main-vertical").
KBD_WIN_ARRANGE_4=4

##q Resize command prefix.
KBD_WIN_RESIZE=r

### Resize pane left one step.
KBD_WIN_RESIZE_LEFT=h

### Resize pane right one step.
KBD_WIN_RESIZE_RIGHT=l

### Resize pane down one step.
KBD_WIN_RESIZE_DOWN=j

### Resize pane up one step.
KBD_WIN_RESIZE_UP=k

### Resize pane left multiple steps.
KBD_WIN_RESIZE_MULTI_LEFT=H

### Resize pane right multiple steps.
KBD_WIN_RESIZE_MULTI_RIGHT=L

### Resize pane down multiple steps.
KBD_WIN_RESIZE_MULTI_DOWN=J

### Resize pane up multiple steps.
KBD_WIN_RESIZE_MULTI_UP=K

# Session command prefix.
KBD_SESS=s

## Detach session.
KBD_SESS_DETACH=d

## Select previous session (session command alias for KBD_GOTO_SESS_PREV).
KBD_SESS_PREV=h

## Select next session (session command alias for KBD_GOTO_SESS_NEXT).
KBD_SESS_NEXT=l

## Select session with a tree view (session command alias for
## KBD_GOTO_SESS_TREE).
KBD_SESS_TREE=t

## Delete session.
KBD_SESS_DEL=D

# "Go to" command prefix.
KBD_GOTO=g

## Go to window command prefix.
KBD_GOTO_WIN=w

### Go to window 0.
KBD_GOTO_WIN_0=0

### Go to window 1.
KBD_GOTO_WIN_1=1

### Go to window 2.
KBD_GOTO_WIN_2=2

### Go to window 3.
KBD_GOTO_WIN_3=3

### Go to window 4.
KBD_GOTO_WIN_4=4

### Go to window 5.
KBD_GOTO_WIN_5=5

### Go to window 6.
KBD_GOTO_WIN_6=6

### Go to window 7.
KBD_GOTO_WIN_7=7

### Go to window 8.
KBD_GOTO_WIN_8=8

### Go to window 9.
KBD_GOTO_WIN_9=9

### Go to window with tree view.
KBD_GOTO_WIN_TREE=t

### Go to window with index.
KBD_GOTO_WIN_INDEX=i

### Go to previous window.
KBD_GOTO_WIN_PREV=h

### Go to next window.
KBD_GOTO_WIN_NEXT=l

### Go to last window.
KBD_GOTO_WIN_LAST=o

## Go to session command prefix.
KBD_GOTO_SESS=s

### Go to previous session.
KBD_GOTO_SESS_PREV=h

### Go to next session.
KBD_GOTO_SESS_NEXT=l

### Go to session with tree view.
KBD_GOTO_SESS_TREE=t
# END KEYBINDINGS

KT_PREFIX="ktm"
KT_CMD=$KT_PREFIX-cmd

Expand Down

0 comments on commit 45737ad

Please sign in to comment.