intro.txt 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  1. *intro.txt* Nvim
  2. NVIM REFERENCE MANUAL
  3. Nvim *ref* *reference*
  4. Type |gO| to see the table of contents.
  5. ==============================================================================
  6. Introduction *intro*
  7. Vim is a text editor which includes most commands from the Unix program "Vi"
  8. and many new ones.
  9. An overview of this manual can be found in the file "help.txt", |help.txt|.
  10. It can be accessed from within Vim with the <Help> or <F1> key and with the
  11. |:help| command (just type ":help", without the bars or quotes).
  12. The 'helpfile' option can be set to the name of the help file, in case it
  13. is not located in the default place. You can jump to subjects like with tags:
  14. Use CTRL-] to jump to a subject under the cursor, use CTRL-T to jump back.
  15. *pronounce*
  16. Vim is pronounced as one word, like Jim. So Nvim is N-Jim, which sounds like
  17. "Ninja". Starting Nvim is like performing a roundhouse kick.
  18. This manual is a reference for all Nvim editor and API features. It is not an
  19. introduction; instead for beginners, there is a hands-on |tutor| and a user
  20. manual |usr_toc.txt|.
  21. *book*
  22. There are many books on Vi and Vim. We recommend:
  23. "Practical Vim" by Drew Neil
  24. "Modern Vim" by Drew Neil
  25. https://vimcasts.org/publications/
  26. "Practical Vim" is acclaimed for its focus on quickly learning common editing
  27. tasks with Vim. "Modern Vim" explores new features in Nvim and Vim 8.
  28. "Vim - Vi Improved" by Steve Oualline
  29. This was the first book dedicated to Vim. Parts of it were included in the
  30. user manual. |frombook| ISBN: 0735710015
  31. For more information try one of these:
  32. https://iccf-holland.org/click5.html
  33. https://www.vim.org/iccf/click5.html
  34. ==============================================================================
  35. Nvim on the interwebs *internet*
  36. *www* *faq* *distribution* *download*
  37. Nvim home page: https://neovim.io/
  38. Nvim FAQ: https://github.com/neovim/neovim/wiki/FAQ
  39. Downloads: https://github.com/neovim/neovim/releases
  40. Vim FAQ: https://vimhelp.org/vim_faq.txt.html
  41. *bugs* *bug-report*
  42. Report bugs and request features here:
  43. https://github.com/neovim/neovim/issues
  44. Be brief, yet complete. Always give a reproducible example and try to find
  45. out which settings or other things trigger the bug.
  46. If Nvim crashes, try to get a backtrace. See |debug.txt|.
  47. ==============================================================================
  48. Sponsor Vim/Nvim development *sponsor* *register*
  49. Fixing bugs and adding new features takes a lot of time and effort. To show
  50. your appreciation for the work and motivate Bram and others to continue
  51. working on Vim please send a donation.
  52. Since Bram is back to a paid job the money will now be used to help children
  53. in Uganda. See |uganda|. But at the same time donations increase Bram's
  54. motivation to keep working on Vim!
  55. For the most recent information about sponsoring look on the Vim web site:
  56. https://www.vim.org/sponsor/
  57. Neovim development is funded separately from Vim:
  58. https://neovim.io/#sponsor
  59. ==============================================================================
  60. Credits *credits*
  61. Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
  62. Parts of the documentation come from several Vi manuals, written by:
  63. W.N. Joy
  64. Alan P.W. Hewett
  65. Mark Horton
  66. The Vim editor is based on Stevie and includes (ideas from) other software,
  67. worked on by the people mentioned here. Other people helped by sending me
  68. patches, suggestions and giving feedback about what is good and bad in Vim.
  69. Vim would never have become what it is now, without the help of these people!
  70. Ron Aaron Win32 GUI changes
  71. Mohsin Ahmed encryption
  72. Zoltan Arpadffy work on VMS port
  73. Tony Andrews Stevie
  74. Gert van Antwerpen changes for DJGPP on MS-DOS
  75. Berkeley DB(3) ideas for swap file implementation
  76. Keith Bostic Nvi
  77. Walter Briscoe Makefile updates, various patches
  78. Ralf Brown SPAWNO library for MS-DOS
  79. Robert Colon many useful remarks
  80. Marcin Dalecki GTK+ GUI port, toolbar icons, gettext()
  81. Kayhan Demirel sent me news in Uganda
  82. Chris & John Downey xvi (ideas for multi-windows version)
  83. Henk Elbers first VMS port
  84. Daniel Elstner GTK+ 2 port
  85. Eric Fischer Mac port, 'cindent', and other improvements
  86. Benji Fisher Answering lots of user questions
  87. Bill Foster Athena GUI port (later removed)
  88. Google Lets me work on Vim one day a week
  89. Loic Grenie xvim (ideas for multi windows version)
  90. Sven Guckes Vim promoter and previous WWW page maintainer
  91. Darren Hiebert Exuberant ctags
  92. Jason Hildebrand GTK+ 2 port
  93. Bruce Hunsaker improvements for VMS port
  94. Andy Kahn Cscope support, GTK+ GUI port
  95. Oezguer Kesim Maintainer of Vim Mailing Lists
  96. Axel Kielhorn work on the Macintosh port
  97. Steve Kirkendall Elvis
  98. Roger Knobbe original port to Windows NT
  99. Sergey Laskavy Vim's help from Moscow
  100. Felix von Leitner Previous maintainer of Vim Mailing Lists
  101. David Leonard Port of Python extensions to Unix
  102. Avner Lottem Edit in right-to-left windows
  103. Flemming Madsen X11 client-server, various features and patches
  104. Tony Mechelynck answers many user questions
  105. Paul Moore Python interface extensions, many patches
  106. Katsuhito Nagano Work on multibyte versions
  107. Sung-Hyun Nam Work on multibyte versions
  108. Vince Negri Win32 GUI and generic console enhancements
  109. Steve Oualline Author of the first Vim book |frombook|
  110. Dominique Pelle Valgrind reports and many fixes
  111. A.Politz Many bug reports and some fixes
  112. George V. Reilly Win32 port, Win32 GUI start-off
  113. Stephen Riehm bug collector
  114. Stefan Roemer various patches and help to users
  115. Ralf Schandl IBM OS/390 port
  116. Olaf Seibert DICE and BeBox version, regexp improvements
  117. Mortaza Shiran Farsi patches
  118. Peter da Silva termlib
  119. Paul Slootman OS/2 port
  120. Henry Spencer regular expressions
  121. Dany St-Amant Macintosh port
  122. Tim Thompson Stevie
  123. G. R. (Fred) Walter Stevie
  124. Sven Verdoolaege Perl interface
  125. Robert Webb Command-line completion, GUI versions, and
  126. lots of patches
  127. Ingo Wilken Tcl interface
  128. Mike Williams PostScript printing
  129. Juergen Weigert Lattice version, AUX improvements, Unix and
  130. MS-DOS ports, autoconf
  131. Stefan 'Sec' Zehl Maintainer of vim.org
  132. Yasuhiro Matsumoto many MS-Windows improvements
  133. Ken Takata fixes and features
  134. Kazunobu Kuriyama GTK 3
  135. Christian Brabandt many fixes, features, user support, etc.
  136. Yegappan Lakshmanan many quickfix features
  137. I wish to thank all the people that sent me bug reports and suggestions. The
  138. list is too long to mention them all here. Vim would not be the same without
  139. the ideas from all these people: They keep Vim alive!
  140. *love* *peace* *friendship* *gross-national-happiness*
  141. Documentation may refer to other versions of Vi:
  142. *Vi* *vi*
  143. Vi "the original". Without further remarks this is the version
  144. of Vi that appeared in Sun OS 4.x. ":version" returns
  145. "Version 3.7, 6/7/85". Source code only available with a license.
  146. *Nvi*
  147. Nvi The "New" Vi. The version of Vi that comes with BSD 4.4 and FreeBSD.
  148. Very good compatibility with the original Vi, with a few extensions.
  149. The version used is 1.79. ":version" returns "Version 1.79
  150. (10/23/96)". Source code is freely available.
  151. *Elvis*
  152. Elvis Another Vi clone, made by Steve Kirkendall. Very compact but isn't
  153. as flexible as Vim. Source code is freely available.
  154. Vim Nvim is based on Vim. https://www.vim.org/
  155. ==============================================================================
  156. Notation *notation*
  157. When syntax highlighting is used to read this, text that is not typed
  158. literally is often highlighted with the Special group. These are items in [],
  159. {} and <>, and CTRL-X.
  160. Note that Vim uses all possible characters in commands. Sometimes the [], {}
  161. and <> are part of what you type, the context should make this clear.
  162. [] Characters in square brackets are optional.
  163. *count* *[count]*
  164. [count] An optional number that may precede the command to multiply
  165. or iterate the command. If no number is given, a count of one
  166. is used, unless otherwise noted. Note that in this manual the
  167. [count] is not mentioned in the description of the command,
  168. but only in the explanation. This was done to make the
  169. commands easier to look up. If the 'showcmd' option is on,
  170. the (partially) entered count is shown at the bottom of the
  171. window. You can use <Del> to erase the last digit (|N<Del>|).
  172. *[quotex]*
  173. ["x] An optional register designation where text can be stored.
  174. See |registers|. The x is a single character between 'a' and
  175. 'z' or 'A' and 'Z' or '"', and in some cases (with the put
  176. command) between '0' and '9', '%', '#', or others. The
  177. uppercase and lowercase letter designate the same register,
  178. but the lowercase letter is used to overwrite the previous
  179. register contents, while the uppercase letter is used to
  180. append to the previous register contents. Without the ""x" or
  181. with """" the stored text is put into the unnamed register.
  182. *{}*
  183. {} Curly braces denote parts of the command which must appear,
  184. but which can take a number of different values. The
  185. differences between Vim and Vi are also given in curly braces
  186. (this will be clear from the context).
  187. *{char1-char2}*
  188. {char1-char2} A single character from the range char1 to char2. For
  189. example: {a-z} is a lowercase letter. Multiple ranges may be
  190. concatenated. For example, {a-zA-Z0-9} is any alphanumeric
  191. character.
  192. *{motion}* *movement*
  193. {motion} A command that moves the cursor. These are explained in
  194. |motion.txt|. Examples:
  195. w to start of next word
  196. b to begin of current word
  197. 4j four lines down
  198. /The<CR> to next occurrence of "The"
  199. This is used after an |operator| command to move over the text
  200. that is to be operated upon.
  201. - If the motion includes a count and the operator also has a
  202. count, the two counts are multiplied. For example: "2d3w"
  203. deletes six words.
  204. - The motion can be backwards, e.g. "db" to delete to the
  205. start of the word.
  206. - The motion can also be a mouse click. The mouse is not
  207. supported in every terminal though.
  208. - The ":omap" command can be used to map characters while an
  209. operator is pending.
  210. - Ex commands can be used to move the cursor. This can be
  211. used to call a function that does some complicated motion.
  212. The motion is always charwise exclusive, no matter
  213. what ":" command is used. This means it's impossible to
  214. include the last character of a line without the line break
  215. (unless 'virtualedit' is set).
  216. If the Ex command changes the text before where the operator
  217. starts or jumps to another buffer the result is
  218. unpredictable. It is possible to change the text further
  219. down. Jumping to another buffer is possible if the current
  220. buffer is not unloaded.
  221. *{Visual}*
  222. {Visual} A selected text area. It is started with the "v", "V", or
  223. CTRL-V command, then any cursor movement command can be used
  224. to change the end of the selected text.
  225. This is used before an |operator| command to highlight the
  226. text that is to be operated upon.
  227. See |Visual-mode|.
  228. *<character>*
  229. <character> A special character from the table below, optionally with
  230. modifiers, or a single ASCII character with modifiers.
  231. *'character'*
  232. 'c' A single ASCII character.
  233. *CTRL-{char}*
  234. CTRL-{char} {char} typed as a control character; that is, typing {char}
  235. while holding the CTRL key down. The case of {char} is
  236. ignored; thus CTRL-A and CTRL-a are equivalent. But in
  237. some terminals and environments, using the SHIFT key will
  238. produce a distinct code (e.g. CTRL-SHIFT-a); in these
  239. environments using the SHIFT key will not trigger commands
  240. such as CTRL-A.
  241. *'option'*
  242. 'option' An option, or parameter, that can be set to a value, is
  243. enclosed in single quotes. See |options|.
  244. *quotecommandquote*
  245. "command" A reference to a command that you can type is enclosed in
  246. double quotes.
  247. `command` New style command, this distinguishes it from other quoted
  248. text and strings.
  249. *key-notation* *key-codes* *keycodes*
  250. These names for keys are used in the documentation. They can also be used
  251. with the ":map" command.
  252. notation meaning equivalent decimal value(s) ~
  253. ----------------------------------------------------------------------- ~
  254. <Nul> zero CTRL-@ 0 (stored as 10) *<Nul>*
  255. <BS> backspace CTRL-H 8 *backspace*
  256. <Tab> tab CTRL-I 9 *tab* *Tab*
  257. *linefeed*
  258. <NL> linefeed CTRL-J 10 (used for <Nul>)
  259. <CR> carriage return CTRL-M 13 *carriage-return*
  260. <Return> same as <CR> *<Return>*
  261. <Enter> same as <CR> *<Enter>*
  262. <Esc> escape CTRL-[ 27 *escape* *<Esc>*
  263. <Space> space 32 *space*
  264. <lt> less-than < 60 *<lt>*
  265. <Bslash> backslash \ 92 *backslash* *<Bslash>*
  266. <Bar> vertical bar | 124 *<Bar>*
  267. <Del> delete 127
  268. <CSI> command sequence intro ALT-Esc 155 *<CSI>*
  269. <EOL> end-of-line (can be <CR>, <NL> or <CR><NL>,
  270. depends on system and 'fileformat') *<EOL>*
  271. <Ignore> cancel wait-for-character *<Ignore>*
  272. <NOP> no-op: do nothing (useful in mappings) *<Nop>*
  273. <Up> cursor-up *cursor-up* *cursor_up*
  274. <Down> cursor-down *cursor-down* *cursor_down*
  275. <Left> cursor-left *cursor-left* *cursor_left*
  276. <Right> cursor-right *cursor-right* *cursor_right*
  277. <S-Up> shift-cursor-up
  278. <S-Down> shift-cursor-down
  279. <S-Left> shift-cursor-left
  280. <S-Right> shift-cursor-right
  281. <C-Left> control-cursor-left
  282. <C-Right> control-cursor-right
  283. <F1> - <F12> function keys 1 to 12 *function_key* *function-key*
  284. <S-F1> - <S-F12> shift-function keys 1 to 12 *<S-F1>*
  285. <Help> help key
  286. <Undo> undo key
  287. <Insert> insert key
  288. <Home> home *home*
  289. <End> end *end*
  290. <PageUp> page-up *page_up* *page-up*
  291. <PageDown> page-down *page_down* *page-down*
  292. <kUp> keypad cursor-up *keypad-cursor-up*
  293. <kDown> keypad cursor-down *keypad-cursor-down*
  294. <kLeft> keypad cursor-left *keypad-cursor-left*
  295. <kRight> keypad cursor-right *keypad-cursor-right*
  296. <kHome> keypad home (upper left) *keypad-home*
  297. <kEnd> keypad end (lower left) *keypad-end*
  298. <kOrigin> keypad origin (middle) *keypad-origin*
  299. <kPageUp> keypad page-up (upper right) *keypad-page-up*
  300. <kPageDown> keypad page-down (lower right) *keypad-page-down*
  301. <kDel> keypad delete *keypad-delete*
  302. <kPlus> keypad + *keypad-plus*
  303. <kMinus> keypad - *keypad-minus*
  304. <kMultiply> keypad * *keypad-multiply*
  305. <kDivide> keypad / *keypad-divide*
  306. <kPoint> keypad . *keypad-point*
  307. <kComma> keypad , *keypad-comma*
  308. <kEqual> keypad = *keypad-equal*
  309. <kEnter> keypad Enter *keypad-enter*
  310. <k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
  311. <S-…> shift-key *shift* *<S-*
  312. <C-…> control-key *control* *ctrl* *<C-*
  313. <M-…> alt-key or meta-key *META* *ALT* *<M-*
  314. <A-…> same as <M-…> *<A-*
  315. <D-…> command-key or "super" key *<D-*
  316. ----------------------------------------------------------------------- ~
  317. Note:
  318. - Availability of some keys (<Help>, <S-Right>, …) depends on the UI or host
  319. terminal.
  320. - If numlock is on the |TUI| receives plain ASCII values, so mapping <k0>,
  321. <k1>, ..., <k9> and <kPoint> will not work.
  322. - Nvim supports mapping multibyte chars with modifiers such as `<M-ä>`. Which
  323. combinations actually work depends on the the UI or host terminal.
  324. - When a key is pressed using a meta or alt modifier and no mapping exists for
  325. that keypress, Nvim may behave as though <Esc> was pressed before the key.
  326. - It is possible to notate combined modifiers (e.g. <C-A-T> for CTRL-ALT-T),
  327. but your terminal must encode the input for that to work. |tui-input|
  328. *<>*
  329. Examples are often given in the <> notation. Sometimes this is just to make
  330. clear what you need to type, but often it can be typed literally, e.g., with
  331. the ":map" command. The rules are:
  332. 1. Printable characters are typed directly, except backslash and "<"
  333. 2. Backslash is represented with "\\", double backslash, or "<Bslash>".
  334. 3. Literal "<" is represented with "\<" or "<lt>". When there is no
  335. confusion possible, "<" can be used directly.
  336. 4. "<key>" means the special key typed (see the table above). Examples:
  337. <Esc> Escape key
  338. <C-G> CTRL-G
  339. <Up> cursor up key
  340. <C-LeftMouse> Control- left mouse click
  341. <S-F11> Shifted function key 11
  342. <M-a> Meta- a ('a' with bit 8 set)
  343. <M-A> Meta- A ('A' with bit 8 set)
  344. The <> notation uses <lt> to escape the special meaning of key names. Using a
  345. backslash also works, but only when 'cpoptions' does not include the 'B' flag.
  346. Examples for mapping CTRL-H to the six characters "<Home>": >
  347. :imap <C-H> \<Home>
  348. :imap <C-H> <lt>Home>
  349. The first one only works when the 'B' flag is not in 'cpoptions'. The second
  350. one always works.
  351. To get a literal "<lt>" in a mapping: >
  352. :map <C-L> <lt>lt>
  353. The notation can be used in a double quoted strings, using "\<" at the start,
  354. e.g. "\<C-Space>". This results in a special key code. To convert this back
  355. to readable text use `keytrans()`.
  356. ==============================================================================
  357. Modes, introduction *vim-modes-intro* *vim-modes*
  358. Vim has seven BASIC modes:
  359. *Normal* *Normal-mode* *command-mode*
  360. Normal mode In Normal mode you can enter all the normal editor
  361. commands. If you start the editor you are in this
  362. mode. This is also known as command mode.
  363. Visual mode This is like Normal mode, but the movement commands
  364. extend a highlighted area. When a non-movement
  365. command is used, it is executed for the highlighted
  366. area. See |Visual-mode|.
  367. If the 'showmode' option is on "-- VISUAL --" is shown
  368. at the bottom of the window.
  369. Select mode This looks most like the MS-Windows selection mode.
  370. Typing a printable character deletes the selection
  371. and starts Insert mode. See |Select-mode|.
  372. If the 'showmode' option is on "-- SELECT --" is shown
  373. at the bottom of the window.
  374. Insert mode In Insert mode the text you type is inserted into the
  375. buffer. See |Insert-mode|.
  376. If the 'showmode' option is on "-- INSERT --" is shown
  377. at the bottom of the window.
  378. Command-line mode In Command-line mode (also called Cmdline mode) you
  379. Cmdline mode can enter one line of text at the bottom of the
  380. window. This is for the Ex commands, ":", the pattern
  381. search commands, "?" and "/", and the filter command,
  382. "!". |Cmdline-mode|
  383. Ex mode Like Command-line mode, but after entering a command
  384. you remain in Ex mode. Very limited editing of the
  385. command line. |Ex-mode|
  386. *Terminal-mode*
  387. Terminal mode In Terminal mode all input (except CTRL-\) is sent to
  388. the process running in the current |terminal| buffer.
  389. If CTRL-\ is pressed, the next key is sent unless it
  390. is CTRL-N (|CTRL-\_CTRL-N|) or CTRL-O (|t_CTRL-\_CTRL-O|).
  391. If the 'showmode' option is on "-- TERMINAL --" is shown
  392. at the bottom of the window.
  393. There are six ADDITIONAL modes. These are variants of the BASIC modes:
  394. *Operator-pending* *Operator-pending-mode*
  395. Operator-pending mode This is like Normal mode, but after an operator
  396. command has started, and Vim is waiting for a {motion}
  397. to specify the text that the operator will work on.
  398. Replace mode Replace mode is a special case of Insert mode. You
  399. can do the same things as in Insert mode, but for
  400. each character you enter, one character of the existing
  401. text is deleted. See |Replace-mode|.
  402. If the 'showmode' option is on "-- REPLACE --" is
  403. shown at the bottom of the window.
  404. Virtual Replace mode Virtual Replace mode is similar to Replace mode, but
  405. instead of file characters you are replacing screen
  406. real estate. See |Virtual-Replace-mode|.
  407. If the 'showmode' option is on "-- VREPLACE --" is
  408. shown at the bottom of the window.
  409. Insert Normal mode Entered when CTRL-O is typed in Insert mode (see
  410. |i_CTRL-O|). This is like Normal mode, but after
  411. executing one command Vim returns to Insert mode.
  412. If the 'showmode' option is on "-- (insert) --" is
  413. shown at the bottom of the window.
  414. Insert Visual mode Entered when starting a Visual selection from Insert
  415. mode, e.g., by using CTRL-O and then "v", "V" or
  416. CTRL-V. When the Visual selection ends, Vim returns
  417. to Insert mode.
  418. If the 'showmode' option is on "-- (insert) VISUAL --"
  419. is shown at the bottom of the window.
  420. Insert Select mode Entered when starting Select mode from Insert mode.
  421. E.g., by dragging the mouse or <S-Right>.
  422. When the Select mode ends, Vim returns to Insert mode.
  423. If the 'showmode' option is on "-- (insert) SELECT --"
  424. is shown at the bottom of the window.
  425. ==============================================================================
  426. Switching from mode to mode *mode-switching*
  427. If for any reason you do not know which mode you are in, you can always get
  428. back to Normal mode by typing <Esc> twice. This doesn't work for Ex mode
  429. though, use ":visual".
  430. You will know you are back in Normal mode when you see the screen flash or
  431. hear the bell after you type <Esc>. However, when pressing <Esc> after using
  432. CTRL-O in Insert mode you get a beep but you are still in Insert mode, type
  433. <Esc> again.
  434. *i_esc*
  435. TO mode ~
  436. Normal Visual Select Insert Replace Cmd-line Ex ~
  437. FROM mode ~
  438. Normal v V ^V *4 *1 R gR : / ? ! Q
  439. Visual *2 ^G c C -- : --
  440. Select *5 ^O ^G *6 -- -- --
  441. Insert <Esc> -- -- <Insert> -- --
  442. Replace <Esc> -- -- <Insert> -- --
  443. Command-line *3 -- -- :start -- --
  444. Ex :vi -- -- -- -- --
  445. -- not possible
  446. * 1 Go from Normal mode to Insert mode by giving the command "i", "I", "a",
  447. "A", "o", "O", "c", "C", "s" or S".
  448. * 2 Go from Visual mode to Normal mode by giving a non-movement command, which
  449. causes the command to be executed, or by hitting <Esc> "v", "V" or "CTRL-V"
  450. (see |v_v|), which just stops Visual mode without side effects.
  451. * 3 Go from Command-line mode to Normal mode by:
  452. - Hitting <CR> or <NL>, which causes the entered command to be executed.
  453. - Deleting the complete line (e.g., with CTRL-U) and giving a final <BS>.
  454. - Hitting CTRL-C or <Esc>, which quits the command-line without executing
  455. the command.
  456. In the last case <Esc> may be the character defined with the 'wildchar'
  457. option, in which case it will start command-line completion. You can
  458. ignore that and type <Esc> again.
  459. * 4 Go from Normal to Select mode by:
  460. - use the mouse to select text while 'selectmode' contains "mouse"
  461. - use a non-printable command to move the cursor while keeping the Shift
  462. key pressed, and the 'selectmode' option contains "key"
  463. - use "v", "V" or "CTRL-V" while 'selectmode' contains "cmd"
  464. - use "gh", "gH" or "g CTRL-H" |g_CTRL-H|
  465. * 5 Go from Select mode to Normal mode by using a non-printable command to move
  466. the cursor, without keeping the Shift key pressed.
  467. * 6 Go from Select mode to Insert mode by typing a printable character. The
  468. selection is deleted and the character is inserted.
  469. *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N*
  470. *v_CTRL-\_CTRL-N* *t_CTRL-\_CTRL-N*
  471. Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to
  472. Normal mode from any other mode. This can be used to make sure Vim is in
  473. Normal mode, without causing a beep like <Esc> would. However, this does not
  474. work in Ex mode. When used after a command that takes an argument, such as
  475. |f| or |m|, the timeout set with 'ttimeoutlen' applies.
  476. *CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G*
  477. CTRL-\ CTRL-G works the same as |CTRL-\_CTRL-N| for backward compatibility.
  478. *gQ* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
  479. gQ Switch to Ex mode. This is like typing ":" commands
  480. one after another, except:
  481. - You don't have to keep pressing ":".
  482. - The screen doesn't get updated after each command.
  483. Use the `:vi` command (|:visual|) to exit this mode.
  484. ==============================================================================
  485. Window contents *window-contents*
  486. In Normal mode and Insert/Replace mode the screen window will show the current
  487. contents of the buffer: What You See Is What You Get. There are two
  488. exceptions:
  489. - When the 'cpoptions' option contains '$', and the change is within one line,
  490. the text is not directly deleted, but a '$' is put at the last deleted
  491. character.
  492. - When inserting text in one window, other windows on the same text are not
  493. updated until the insert is finished.
  494. Lines longer than the window width will wrap, unless the 'wrap' option is off
  495. (see below). The 'linebreak' option can be set to wrap at a blank character.
  496. If the window has room after the last line of the buffer, Vim will show '~' in
  497. the first column of the last lines in the window, like this:
  498. +-----------------------+
  499. |some line |
  500. |last line |
  501. |~ |
  502. |~ |
  503. +-----------------------+
  504. Thus the '~' lines indicate that the end of the buffer was reached.
  505. If the last line in a window doesn't fit, Vim will indicate this with a '@' in
  506. the first column of the last lines in the window, like this:
  507. +-----------------------+
  508. |first line |
  509. |second line |
  510. |@ |
  511. |@ |
  512. +-----------------------+
  513. Thus the '@' lines indicate that there is a line that doesn't fit in the
  514. window.
  515. When the "lastline" flag is present in the 'display' option, you will not see
  516. '@' characters at the left side of window. If the last line doesn't fit
  517. completely, only the part that fits is shown, and the last three characters of
  518. the last line are replaced with "@@@", like this:
  519. +-----------------------+
  520. |first line |
  521. |second line |
  522. |a very long line that d|
  523. |oesn't fit in the wi@@@|
  524. +-----------------------+
  525. If there is a single line that is too long to fit in the window, this is a
  526. special situation. Vim will show only part of the line, around where the
  527. cursor is. There are no special characters shown, so that you can edit all
  528. parts of this line.
  529. The |hl-NonText| highlight group can be used to set special highlighting
  530. for the '@' and '~' characters. This makes it possible to distinguish them
  531. from real characters in the buffer.
  532. The 'showbreak' option contains the string to put in front of wrapped lines.
  533. *wrap-off*
  534. If the 'wrap' option is off, long lines will not wrap. Only the part that
  535. fits on the screen is shown. If the cursor is moved to a part of the line
  536. that is not shown, the screen is scrolled horizontally. The advantage of
  537. this method is that columns are shown as they are and lines that cannot fit
  538. on the screen can be edited. The disadvantage is that you cannot see all the
  539. characters of a line at once. The 'sidescroll' option can be set to the
  540. minimal number of columns to scroll.
  541. All normal ASCII characters are displayed directly on the screen. The <Tab>
  542. is replaced with the number of spaces that it represents. Other non-printing
  543. characters are replaced with "^{char}", where {char} is the non-printing
  544. character with 64 added. Thus character 7 (bell) will be shown as "^G".
  545. Characters between 127 and 160 are replaced with "~{char}", where {char} is
  546. the character with 64 subtracted. These characters occupy more than one
  547. position on the screen. The cursor can only be positioned on the first one.
  548. If you set the 'number' option, all lines will be preceded with their
  549. number. Tip: If you don't like wrapping lines to mix with the line numbers,
  550. set the 'showbreak' option to eight spaces:
  551. ":set showbreak=\ \ \ \ \ \ \ \ "
  552. If you set the 'list' option, <Tab> characters will not be shown as several
  553. spaces, but as "^I". A '$' will be placed at the end of the line, so you can
  554. find trailing blanks.
  555. In Command-line mode only the command-line itself is shown correctly. The
  556. display of the buffer contents is updated as soon as you go back to Command
  557. mode.
  558. The last line of the window is used for status and other messages. The
  559. status messages will only be used if an option is on:
  560. status message option default Unix default ~
  561. current mode 'showmode' on on
  562. command characters 'showcmd' on off
  563. cursor position 'ruler' off off
  564. The current mode is "-- INSERT --" or "-- REPLACE --", see |'showmode'|. The
  565. command characters are those that you typed but were not used yet.
  566. If you have a slow terminal you can switch off the status messages to speed
  567. up editing:
  568. :set nosc noru nosm
  569. If there is an error, an error message will be shown for at least one second
  570. (in reverse video).
  571. Some commands show how many lines were affected. Above which threshold this
  572. happens can be controlled with the 'report' option (default 2).
  573. The name Vim and the full name of the current file name will be shown in the
  574. title bar. When the window is resized, Vim will automatically redraw the
  575. window. You may make the window as small as you like, but if it gets too
  576. small not a single line will fit in it. Make it at least 40 characters wide
  577. to be able to read most messages on the last line.
  578. ==============================================================================
  579. Definitions *definitions* *jargon*
  580. buffer Contains lines of text, usually from a file.
  581. screen The whole area that Nvim uses to display things.
  582. window A view on a buffer. There can be multiple windows for
  583. one buffer.
  584. frame Windows are kept in a tree of frames. Each frame
  585. contains a column, row, or window ("leaf" frame).
  586. A screen contains one or more windows, separated by status lines and with the
  587. command line at the bottom.
  588. +-------------------------------+
  589. screen | window 1 | window 2 |
  590. | | |
  591. | | |
  592. |= status line =|= status line =|
  593. | window 3 |
  594. | |
  595. | |
  596. |==== status line ==============|
  597. |command line |
  598. +-------------------------------+
  599. The command line is also used for messages. It scrolls up the screen when
  600. there is not enough room in the command line.
  601. A difference is made between four types of lines:
  602. buffer lines The lines in the buffer. This is the same as the
  603. lines as they are read from/written to a file. They
  604. can be thousands of characters long.
  605. logical lines The buffer lines with folding applied. Buffer lines
  606. in a closed fold are changed to a single logical line:
  607. "+-- 99 lines folded". They can be thousands of
  608. characters long.
  609. window lines The lines displayed in a window: A range of logical
  610. lines with wrapping, line breaks, etc. applied. They
  611. can only be as long as the width of the window allows,
  612. longer lines are wrapped or truncated.
  613. screen lines The lines of the screen that Nvim uses. Consists of
  614. the window lines of all windows, with status lines
  615. and the command line added. They can only be as long
  616. as the width of the screen allows. When the command
  617. line gets longer it wraps and lines are scrolled to
  618. make room.
  619. buffer lines logical lines window lines screen lines ~
  620. 1. one 1. one 1. +-- folded 1. +-- folded
  621. 2. two 2. +-- folded 2. five 2. five
  622. 3. three 3. five 3. six 3. six
  623. 4. four 4. six 4. seven 4. seven
  624. 5. five 5. seven 5. === status line ===
  625. 6. six 6. aaa
  626. 7. seven 7. bbb
  627. 8. ccc ccc c
  628. 1. aaa 1. aaa 1. aaa 9. cc
  629. 2. bbb 2. bbb 2. bbb 10. ddd
  630. 3. ccc ccc ccc 3. ccc ccc ccc 3. ccc ccc c 11. ~
  631. 4. ddd 4. ddd 4. cc 12. === status line ===
  632. 5. ddd 13. (command line)
  633. 6. ~
  634. API client ~
  635. All external UIs and remote plugins (as opposed to regular Vim plugins) are
  636. "clients" in general; but we call something an "API client" if its purpose is
  637. to abstract or wrap the RPC API for the convenience of other applications
  638. (just like a REST client or SDK such as boto3 for AWS: you can speak AWS REST
  639. using an HTTP client like curl, but boto3 wraps that in a convenient python
  640. interface). For example, the Nvim lua-client is an API client:
  641. https://github.com/neovim/lua-client
  642. Host ~
  643. A plugin "host" is both a client (of the Nvim API) and a server (of an
  644. external platform, e.g. python). It is a remote plugin that hosts other
  645. plugins.
  646. Remote plugin ~
  647. Arbitrary code registered via |:UpdateRemotePlugins|, that runs in a separate
  648. process and communicates with Nvim via the |api|.
  649. ==============================================================================
  650. vim:tw=78:ts=8:noet:ft=help:norl: