Skip to content

Commit

Permalink
fix word motion mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
linrongbin16 committed Nov 22, 2022
1 parent d3e5cdb commit 42820ab
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 7 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,9 @@ Support by [vim-easymotion](https://github.com/easymotion/vim-easymotion) (switc
So introduce better word motions:

- `<Leader>w`/`<Leader>W` **🇳** - word/WORD forward(right), exclusive.
- `[count]<Leader>w`/`[count]<Leader>W` **🇳** - _[count]_ words/WORDS forward, exclusive.
- `<Leader>bb`/`<Leader>B` **🇳** - word/WORD backward(left), exclusive.
- `<Leader>e`/`<Leader>E` **🇳** - Forward to the end of word/WORD, inclusive.
- `[count]<Leader>e`/`[count]<Leader>E` **🇳** - Forward to the end of _[count]_ words/WORDS, inclusive.
- `<Leader>b`/`<Leader>B` **🇳** - word/WORD backward(left), exclusive.
- `[count]<Leader>b`/`[count]<Leader>B` **🇳** - _[count]_ words/WORDS backward.
- `<Leader>ge`/`<Leader>gE` **🇳** - Backward to the end of word/WORD, inclusive.
- `[count]<Leader>ge`/`[count]<Leader>gE` **🇳** - Backward to the end of _[count]_ words/WORDS, inclusive.

Support by [vim-wordmotion](https://github.com/chaoren/vim-wordmotion).

Expand Down
46 changes: 44 additions & 2 deletions repository/chaoren/vim-wordmotion.vim
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
" Add prefix <leader> for word motion.
let g:wordmotion_prefix='<leader>'
" Disable default key mappings
g:wordmotion_nomap=1

" <Leader>w
nmap <Leader>w <Plug>WordMotion_w
xmap <Leader>w <Plug>WordMotion_w
omap <Leader>w <Plug>WordMotion_w
" <Leader>W
nmap <Leader>W <Plug>WordMotion_W
xmap <Leader>W <Plug>WordMotion_W
omap <Leader>W <Plug>WordMotion_W
" Since <leader>bn <leader>bp <leader>bd are used by tabline plugins.
" <leader>b will be delayed (try to wait for bn/bp/bd), so here we map <leader>b to <leader>bb to avoid this.
" <Leader>bb
nmap <Leader>bb <Plug>WordMotion_b
xmap <Leader>bb <Plug>WordMotion_b
omap <Leader>bb <Plug>WordMotion_b
" <Leader>B
nmap <Leader>B <Plug>WordMotion_B
xmap <Leader>B <Plug>WordMotion_B
omap <Leader>B <Plug>WordMotion_B
" <Leader>e
nmap <Leader>e <Plug>WordMotion_e
xmap <Leader>e <Plug>WordMotion_e
omap <Leader>e <Plug>WordMotion_e
" <Leader>E
nmap <Leader>E <Plug>WordMotion_E
xmap <Leader>E <Plug>WordMotion_E
omap <Leader>E <Plug>WordMotion_E
" <Leader>ge
nmap <Leader>ge <Plug>WordMotion_ge
xmap <Leader>ge <Plug>WordMotion_ge
omap <Leader>ge <Plug>WordMotion_ge
" <Leader>gE
nmap <Leader>gE <Plug>WordMotion_gE
xmap <Leader>gE <Plug>WordMotion_gE
omap <Leader>gE <Plug>WordMotion_gE

0 comments on commit 42820ab

Please sign in to comment.