Skip to content

Commit

Permalink
Update home/end bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
xPMo committed May 15, 2020
1 parent 80eb304 commit 1fcba3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Add more Vi Motions

| New\* | Map | Keybinding | Motion |
| --- | --- | --- | --- |
| No | `vicmd` `viins` | `\e[H` `\e[F` (Home/End) | beginning/end of line |
| No | `vicmd` `viopp` | `a'` `a"` ```a` ``` | select a quoted string or backticks |
| No | `vicmd` `viopp` | `i'` `i"` ```i` ``` | select in a quoted string or backticks |
| No | `vicmd` `viopp` | `a(` `a[` `a{` `a<` `ab` `a)` `a]` `a}` `a>` `aB` | select a bracketed segment |
Expand Down
10 changes: 6 additions & 4 deletions motions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ autoload -Uz select-quoted select-bracketed split-shell-arguments surround \
local m seq

# Bind Home/End
bindkey -M vicmd '^[[H' vi-beginning-of-line
bindkey -M viins '^[[H' beginning-of-line
bindkey -M vicmd '^[[F' vi-end-of-line
bindkey -M viins '^[[F' end-of-line
for m in vicmd viins viopp; do
# Map variants of Home to '^[[H', and varients of End to '^[[F'
bindkey -M $m -s '^[[1~' '^[[H' '^[[7~' '^[[H' '^[OH' '^[[H' \
'^[[2~' '^[[F' '^[[8~' '^[[F' '^[OF' '^[[F' \
bindkey -M $m '^[[H' vi-beginning-of-line '^[[F' vi-end-of-line
done

# Forced motion
zle -N vi-forced-motion
Expand Down

0 comments on commit 1fcba3b

Please sign in to comment.