@@ -6,14 +6,14 @@ one-hand usage. Forget about `<C-f>`, `<C-d>`, and `G`. You don't need to keep
6
6
holding modifier keys anymore — everything can be done with single-key
7
7
mappings!
8
8
9
- New key mappings available in the scroll mode:
9
+ New key mappings available in the Scroll mode:
10
10
11
11
- ` j ` / ` k ` — scroll 5 lines down / up
12
12
- ` l ` / ` h ` — scroll page down / up
13
13
- ` b ` — scroll to the ending of the buffer (bottom)
14
14
- ` u ` — scroll to the beginning of the buffer (up)
15
- - ` ; ` — quit the scroll mode
16
- - ` - ` — quit the scroll mode and delete the buffer
15
+ - ` ; ` — quit the Scroll mode
16
+ - ` - ` — quit the Scroll mode and delete the buffer
17
17
18
18
With these mappings, you can quickly look around, walk through several screens
19
19
of text, and when you are in the right place return back to normal mode for
@@ -22,7 +22,7 @@ more accurate text manipulations.
22
22
![ Demo] ( https://github.com/GeneZharov/vim-scrollmode/blob/master/demo.gif?raw=true )
23
23
24
24
For example, compare this scenario of a scrolling session in normal mode and in
25
- scroll mode.
25
+ Scroll mode.
26
26
27
27
| | Normal Mode | Scroll Mode |
28
28
| --- | ------------------------------- | ------------------------ |
@@ -32,28 +32,34 @@ scroll mode.
32
32
| 4. | ` k ` ` k ` ` k ` ` k ` ` k ` ` k ` ` k ` ` k ` | ` j ` ` j ` |
33
33
| | 13 keys (including 3 modifiers) | 5 keys, all for one hand |
34
34
35
- Since scroll mode is in fact just a wrapper around normal mode, all keys, that
36
- are not remapped by scroll mode continue to be available: searching (` / ` , ` ? ` ,
35
+ Since Scroll mode is in fact just a wrapper around normal mode, all keys, that
36
+ are not remapped by Scroll mode continue to be available: searching (` / ` , ` ? ` ,
37
37
` n ` , ` N ` ), window managing (` <C-w> ` ), etc.
38
38
39
+ If you enter another mode (Command mode, Insert mode, etc.) while Scroll mode
40
+ is active, then it will be implicitly automatically finished, all Normal mode
41
+ mappings will be restored, and you will be able to proceed in the mode of your
42
+ choice.
43
+
39
44
## Installation
40
45
41
46
| Plugin Manager | Command |
42
47
| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
43
48
| [ vim-plug] ( https://github.com/junegunn/vim-plug ) | ` Plug 'GeneZharov/vim-scrollmode' ` |
44
49
| [ Vundle] ( https://github.com/VundleVim/Vundle.vim ) | ` Plugin 'GeneZharov/vim-scrollmode' ` |
45
- | [ pathogen.vim] ( https://github.com/tpope/vim-pathogen/ ) | ` git clone 'git@github.com:GeneZharov/vim-scrollmode.git ~/.vim/bundle/vim-scrollmode' ` |
50
+ | [ pathogen.vim] ( https://github.com/tpope/vim-pathogen/ ) | ` git clone 'git@github.com:GeneZharov/vim-scrollmode.git' ~/.vim/bundle/vim-scrollmode ` |
46
51
| native pack | ` git clone 'git@github.com:GeneZharov/vim-scrollmode.git' ~/.vim/pack/dist/start/vim-scrollmode ` |
47
52
48
- Set a preferred shortcut to enter the scroll mode:
53
+ Set a preferred shortcut to enter the Scroll mode:
49
54
50
55
``` vim
51
56
nmap <Leader>; <Plug>ScrollMode
52
57
```
53
58
54
- I prefer to use ` <Space> ` as a ` <Leader> ` key:
59
+ I prefer to use Scroll mode with a ` <Space> ` as my ` <Leader> ` key:
55
60
56
61
``` vim
62
+ " Place it before all the <Leader> mappings
57
63
map <SPACE> <Nop>
58
64
let mapleader = "\<Space>"
59
65
```
@@ -64,7 +70,7 @@ let mapleader = "\<Space>"
64
70
65
71
- ** ` g:scrollmode_actions ` **
66
72
67
- This option allows to configure default scroll mode key mappings. These
73
+ This option allows to configure default Scroll mode key mappings. These
68
74
key mappings are internally set with the following dictionary.
69
75
70
76
``` vim
@@ -83,36 +89,36 @@ let mapleader = "\<Space>"
83
89
You can specify any subset of this dictionary as a value for this option in
84
90
order to override default mappings.
85
91
86
- For example, to add ` <Esc> ` key to the keys that exit the scroll mode:
92
+ For example, to add ` <Esc> ` key to the keys that exit the Scroll mode:
87
93
88
94
``` vim
89
95
let g:scrollmode_actions = {
90
96
\ "exit": [";", "<Esc>"],
91
97
\ }
92
98
```
93
99
94
- _ I didn't make ` <Esc> ` to quit the scroll mode as default behavior, because
100
+ _ I didn't make ` <Esc> ` to quit the Scroll mode as default behavior, because
95
101
in the terminal Vim (but not Neovim) it can break some complex keys like
96
- ` <Up> ` and ` <Down> ` while the scroll mode is active. If you are not going
97
- to use these keys in the scroll mode or if you use a different Vim version
102
+ ` <Up> ` and ` <Down> ` while the Scroll mode is active. If you are not going
103
+ to use these keys in the Scroll mode or if you use a different Vim version
98
104
(GVim, Neovim), then you are welcome to use the config from the example
99
105
above._
100
106
101
107
- ** ` g:scrollmode_mappings ` **
102
108
103
- With this option, you can specify new mappings available in the scroll
109
+ With this option, you can specify new mappings available in the Scroll
104
110
mode. This option has precedence over ` g:scrollmode_actions ` , so you can
105
111
rebind a default action with any custom command.
106
112
107
113
For example, let's add a custom command for buffer deletion:
108
114
109
115
``` vim
110
- let g:scroll_mode_mappings = {
116
+ let g:scrollmode_mappings = {
111
117
\ ":Bdelete<CR>": ["-", "c"]
112
118
\ }
113
119
```
114
120
115
- When the scroll mode is activated, this code will internally result to:
121
+ When the Scroll mode is activated, this code will internally result to:
116
122
117
123
``` vim
118
124
nnoremap <silent> <buffer> - :Bdelete<CR>
@@ -130,7 +136,7 @@ let mapleader = "\<Space>"
130
136
131
137
- ** ` g:scrollmode_cmdline_indicator ` **
132
138
133
- Enables or disables the scroll mode indicator in the command line. The
139
+ Enables or disables the Scroll mode indicator in the command line. The
134
140
indicator looks similar to other indicators for built-in modes and looks
135
141
like this:
136
142
@@ -142,14 +148,14 @@ let mapleader = "\<Space>"
142
148
143
149
- ** ` g:scrollmode_statusline_highlight ` **
144
150
145
- Enables or disables StatusLine highlighting, when the scroll mode is
151
+ Enables or disables StatusLine highlighting, when the Scroll mode is
146
152
activated. Has no effect with plugins that replace the status line
147
153
([ Airline] ( https://github.com/vim-airline/vim-airline ) ,
148
154
[ Powerline] ( https://github.com/powerline/powerline ) ,
149
155
[ Lightline] ( https://github.com/itchyny/lightline.vim ) ).
150
156
151
157
_ I am not fully satisfied with how this feature works, so it is disabled by
152
- default. But if you need scroll mode to be more noticeable and colorful,
158
+ default. But if you need Scroll mode to be more noticeable and colorful,
153
159
then you can enable this option. See the options below for color
154
160
customization._
155
161
@@ -162,14 +168,14 @@ Options for status line color customization. Only have effect if
162
168
163
169
- ** ` g:scrollmode_statusline_group ` **
164
170
165
- Highlight group that is used for ` StatusLine ` when the scroll mode
171
+ Highlight group that is used for ` StatusLine ` when the Scroll mode
166
172
is active.
167
173
168
174
_ Default:_ ` "DiffAdd" `
169
175
170
176
- ** ` g:scrollmode_statusline_group_edge ` **
171
177
172
- Highlight group that is used for ` StatusLine ` when the scroll mode is
178
+ Highlight group that is used for ` StatusLine ` when the Scroll mode is
173
179
active and the top/bottom edge of the buffer is reached. The color helps to
174
180
notice that you can't scroll in that direction anymore. Specify ` v:null ` if
175
181
you don't need this behavior.
@@ -180,7 +186,7 @@ Options for status line color customization. Only have effect if
180
186
181
187
- ** ` g:ScrollmodeOnQuit ` **
182
188
183
- Funcref that is called after you exit the scroll mode.
189
+ Funcref that is called after you exit the Scroll mode.
184
190
185
191
``` vim
186
192
function! s:fn() abort
0 commit comments