1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Creator documentation.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/
/*!
\previouspage creator-editor-options-text.html
\page creator-editor-fakevim.html
\nextpage creator-language-servers.html
\title Using FakeVim Mode
In the \uicontrol FakeVim mode, you can run the main editor in a manner
similar to the Vim editor. To run the editor in the \uicontrol FakeVim
mode, select \uicontrol Edit > \uicontrol Advanced >
\uicontrol {Use Vim-style Editing} or press \key {Alt+V,Alt+V}.
\section1 Supported Modes and Commands
In the \uicontrol FakeVim mode, most keystrokes in the main editor will be
intercepted and interpreted in a way that resembles Vim. Most of the
supported commands can be followed by a motion command or executed in visual
mode, or they work with registers or can be prefixed with a number of
repetitions.
The following sections describe the commands emulated in the supported modes
and how they diverge from Vim in functionality:
\list
\li Normal
\li Visual
\li Command line (:)
\li Insert and replace
\endlist
For more information on using Vim, see \l{http://www.vim.org/docs.php}
{Documentation} on the Vim web site.
\section2 Normal and Visual Modes
\list
\li Basic movement, such as \c h/j/k/l, \c <C-U>, \c <C-D>, \c <C-F>,
\c <C-B>, \c gg, \c G, \c 0, \c ^, \c $
\li Word movement, such as \c w, \c e, \c b
\li \e Inner/a movement, such as \c ciw, \c 3daw, ya{
\li \c f and \c t movement
\li \c [ and \c ] movement
\li { and } paragraph movement
\li Delete/change/yank/paste with register
\li Undo and redo
\li \c <C-A> and \c <C-X> increase or decrease a number in decimal,
octal, or hexadecimal format (for example \c 128<C-A> on or before
\c "0x0ff" changes it to \c "0x17f")
\li \c . repeats the last change
\li \c /search, \c ?search, \c *, \c #, \c n, \c N - most of regular
expression syntax is used in Vim except that \c \< and \c \> are
the same as \c {\b} in QRegExp
\li \c @ and \c q (macro recording and execution) special keys are saved
as \c <S-Left>
\li Marks
\li \c gv goes to last visual selection; can differ if text is edited
around it
\li Indentation using \c =, \c <<, \c >>, with movement, count, and in
visual mode
\li \e {to upper/lower}, such as \c ~, \c gU, \c gu
\li \c i, \c a, \c o, \c I, \c A, and \c O enter insert mode
\li Scroll window, such as \c zt, \c zb, \c zz
\li Wrap line movement, such as \c gj, \c gk, \c g0, \c g^, \c g$
\endlist
\section2 Command Line Mode
\list
\li \c :map, \c :unmap, \c :inoremap, and so on
\li \c :source provides very basic line-by-line sourcing of vimrc files
\li \c :substitute substitutes an expression in a range
\li \c :'<,'>!cmd filters through an external command (for example,
sorts the lines in a file with \c :%!sort)
\li \c :<range>sor[t][!]
\li \c :.!cmd inserts the standard output of an external command
\li \c :read
\li \c :yank, \c :delete, \c :change
\li \c :move, \c :join
\li \c :20 goes to an address
\li \c :history
\li \c :registers, \c :display
\li \c :nohlsearch
\li \c :undo, \c :redo
\li \c :normal
\li \c :<, \c :>
\endlist
\section2 Insert Mode
\list
\li \c <C-O> executes a single command and returns to insert mode
\li \c <C-V> inserts a raw character
\li \c <insert> toggles replace mode
\endlist
\section2 Options
Use \c {:set ...} to set the options listed in the following table:
\table
\header
\li Long Name
\li Short Name
\li Arguments
\row
\li \c autoindent
\li \c ai
\li
\row
\li \c backspace
\li \c bs
\li \c indent, \c eol, \c start
\row
\li \c blinkingcursor
\li \c bc
\li
\row
\li \c clipboard
\li \c cb
\li
\row
\li \c expandtab
\li \c et
\li
\row
\li \c hlsearch
\li \c hls
\li
\row
\li \c ignorecase
\li \c ic
\li
\row
\li \c incsearch
\li \c is
\li
\row
\li \c iskeyword
\li \c isk
\li A combination of the following characters: \c @, \c 48-57, \c _,
\c 192-255, \c a-z, \c A-Z
\row
\li \c relativenumber
\li \c rnu
\li
\row
\li \c scrolloff
\li \c so
\li
\row
\li \c shiftwidth
\li \c sw
\li
\row
\li \c showcmd
\li \c sc
\li
\row
\li \c smartcase
\li \c scs
\li
\row
\li \c smartindent
\li \c si
\li
\row
\li \c smarttab
\li \c sta
\li
\row
\li \c startofline
\li \c sol
\li
\row
\li \c tabstop
\li \c ts
\li
\row
\li \c tildeop
\li \c top
\li
\row
\li \c usecoresearch
\li \c ucs
\li
\row
\li \c wrapscan
\li \c ws
\li
\endtable
\section2 Vimrc Example
\code
" highlight matched
set hlsearch
" case insensitive search
set ignorecase
set smartcase
" search while typing
set incsearch
" wrap-around when searching
set wrapscan
" show pressed keys in lower right corner
set showcmd
" tab -> spaces
set expandtab
set tabstop=4
set shiftwidth=4
" keep a 5 line buffer for the cursor from top/bottom of window
set scrolloff=5
" X11 clipboard
set clipboard=unnamed
" use ~ with movement
set tildeop
" mappings
nnoremap ; :
inoremap jj <Esc>
" clear highlighted search term on space
noremap <silent> <Space> :nohls<CR>
" reselect visual block after indent
vnoremap < <gv
vnoremap > >gv
" MOVE LINE/BLOCK
nnoremap <C-S-J> :m+<CR>==
nnoremap <C-S-K> :m-2<CR>==
inoremap <C-S-J> <Esc>:m+<CR>==gi
inoremap <C-S-K> <Esc>:m-2<CR>==gi
vnoremap <C-S-J> :m'>+<CR>gv=gv
vnoremap <C-S-K> :m-2<CR>gv=gv
\endcode
\section1 Mapping FakeVim Commands
To map commands entered on the \uicontrol FakeVim command line to actions
of the \QC core, select \uicontrol Tools > \uicontrol Options >
\uicontrol FakeVim > \uicontrol {Ex Command Mapping}.
To map \e {user commands} to keyboard shortcuts, select \uicontrol Tools >
\uicontrol Options > \uicontrol FakeVim >
\uicontrol {User Command Mapping}. The user command mapped to the shortcut
is executed by FakeVim as if you were typing it (as when replaying a macro).
\section1 Specifying FakeVim Options
To make changes to the Vim-style settings, select \uicontrol Tools >
\uicontrol Options > \uicontrol FakeVim > \uicontrol General.
\image qtcreator-fakevim-options.png "FakeVim options"
To preselect the indentation settings specified for the text editor, select
\uicontrol {Copy Text Editor Settings}. To preselect the Qt coding style,
select \uicontrol {Set Qt Style}. To preselect a simple indentation style,
select \uicontrol {Set Plain Style}. You can then change any of the
preselected settings.
To use a Vim-style color scheme, select \uicontrol Tools >
\uicontrol Options > \uicontrol {Text Editor} > \uicontrol {Fonts & Color}.
In the \uicontrol {Color Scheme} list, select \uicontrol {Vim (dark)}.
\section1 Quitting FakeVim Mode
To quit the FakeVim mode, unselect \uicontrol Tools > \uicontrol Options >
\uicontrol FakeVim > \uicontrol {Use FakeVim} or press \key {Alt+V,Alt+V}.
You can temporarily escape FakeVim mode to access the normal \QC keyboard
shortcuts like \key {Ctrl-R} for \uicontrol Run by pressing \key {,} first.
*/
|