Vim 官方文档教程 All In One
Vim 官方文档教程 All In One
Vim 官方教程 / Vim 图解教程
zh-hans
Vim 8.x
Vi IMproved 8.2
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
包含补丁: 1-2434
Extra patches: 8.2.3402, 8.2.3403, 8.2.3409, 8.2.3428
修改者 team+vim@tracker.debian.org
编译者 team+vim@tracker.debian.org
巨型版本 无图形界面。 可使用(+)与不可使用(-)的功能:
+acl -farsi +mouse_sgr +tag_binary
+arabic +file_in_path -mouse_sysmouse -tag_old_static
+autocmd +find_in_path +mouse_urxvt -tag_any_white
+autochdir +float +mouse_xterm -tcl
-autoservername +folding +multi_byte +termguicolors
-balloon_eval -footer +multi_lang +terminal
+balloon_eval_term +fork() -mzscheme +terminfo
-browse +gettext +netbeans_intg +termresponse
++builtin_terms -hangul_input +num64 +textobjects
+byte_offset +iconv +packages +textprop
+channel +insert_expand +path_extra +timers
+cindent +ipv6 -perl +title
-clientserver +job +persistent_undo -toolbar
-clipboard +jumplist +popupwin +user_commands
+cmdline_compl +keymap +postscript +vartabs
+cmdline_hist +lambda +printer +vertsplit
+cmdline_info +langmap +profile +virtualedit
+comments +libcall -python +visual
+conceal +linebreak -python3 +visualextra
+cryptv +lispindent +quickfix +viminfo
+cscope +listcmds +reltime +vreplace
+cursorbind +localmap +rightleft +wildignore
+cursorshape -lua -ruby +wildmenu
+dialog_con +menu +scrollbind +windows
+diff +mksession +signs +writebackup
+digraphs +modify_fname +smartindent -X11
-dnd +mouse -sound -xfontset
-ebcdic -mouseshape +spell -xim
+emacs_tags +mouse_dec +startuptime -xpm
+eval +mouse_gpm +statusline -xsmp
+ex_extra -mouse_jsbterm -sun_workshop -xterm_clipboard
+extra_search +mouse_netterm +syntax -xterm_save
系统 vimrc 文件: "$VIM/vimrc"
用户 vimrc 文件: "$HOME/.vimrc"
第二用户 vimrc 文件: "~/.vim/vimrc"
用户 exrc 文件: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
$VIM 预设值: "/usr/share/vim"
编译方式: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-I0JMpS/vim-8.2.2434=. -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
链接方式: gcc -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lacl -lattr -lgpm -ldl
Vim 模式
normal mode 正常模式
visual mode 可视化模式
command mode 命令模式
insert mode 插入模式 i
/ eidt mode 编辑模式
select mode 选择模式
ex mode 扩展模式
Vim modes
https://vimdoc.sourceforge.net/htmldoc/intro.html#vim-modes-intro
5. Modes, introduction *vim-modes-intro* *vim-modes*
Vim has six BASIC modes:
*Normal* *Normal-mode* *command-mode*
Normal mode In Normal mode you can enter all the normal editor
commands. If you start the editor you are in this
mode (unless you have set the 'insertmode' option,
see below). This is also known as command mode.
Visual mode This is like Normal mode, but the movement commands
extend a highlighted area. When a non-movement
command is used, it is executed for the highlighted
area. See |Visual-mode|.
If the 'showmode' option is on "-- VISUAL --" is shown
at the bottom of the window.
Select mode This looks most like the MS-Windows selection mode.
Typing a printable character deletes the selection
and starts Insert mode. See |Select-mode|.
If the 'showmode' option is on "-- SELECT --" is shown
at the bottom of the window.
Insert mode In Insert mode the text you type is inserted into the
buffer. See |Insert-mode|.
If the 'showmode' option is on "-- INSERT --" is shown
at the bottom of the window.
Command-line mode In Command-line mode (also called Cmdline mode) you
Cmdline mode can enter one line of text at the bottom of the
window. This is for the Ex commands, ":", the pattern
search commands, "?" and "/", and the filter command,
"!". |Cmdline-mode|
Ex mode Like Command-line mode, but after entering a command
you remain in Ex mode. Very limited editing of the
command line. |Ex-mode|
There are six ADDITIONAL modes. These are variants of the BASIC modes:
*Operator-pending* *Operator-pending-mode*
Operator-pending mode This is like Normal mode, but after an operator
command has started, and Vim is waiting for a {motion}
to specify the text that the operator will work on.
Replace mode Replace mode is a special case of Insert mode. You
can do the same things as in Insert mode, but for
each character you enter, one character of the existing
text is deleted. See |Replace-mode|.
If the 'showmode' option is on "-- REPLACE --" is
shown at the bottom of the window.
Virtual Replace mode Virtual Replace mode is similar to Replace mode, but
instead of file characters you are replacing screen
real estate. See |Virtual-Replace-mode|.
If the 'showmode' option is on "-- VREPLACE --" is
shown at the bottom of the window.
Insert Normal mode Entered when CTRL-O given in Insert mode. This is
like Normal mode, but after executing one command Vim
returns to Insert mode.
If the 'showmode' option is on "-- (insert) --" is
shown at the bottom of the window.
Insert Visual mode Entered when starting a Visual selection from Insert
mode, e.g., by using CTRL-O and then "v", "V" or
CTRL-V. When the Visual selection ends, Vim returns
to Insert mode.
If the 'showmode' option is on "-- (insert) VISUAL --"
is shown at the bottom of the window.
Insert Select mode Entered when starting Select mode from Insert mode.
E.g., by dragging the mouse or <S-Right>.
When the Select mode ends, Vim returns to Insert mode.
If the 'showmode' option is on "-- (insert) SELECT --"
is shown at the bottom of the window.
mode-switching / 模式转换
https://vimdoc.sourceforge.net/htmldoc/intro.html#mode-switching
Vim 6 种
基本模式
Normal
mode
https://vimdoc.sourceforge.net/htmldoc/intro.html#Normal
Visual
mode
https://vimdoc.sourceforge.net/htmldoc/visual.html#Visual
Select
mode
https://vimdoc.sourceforge.net/htmldoc/visual.html#Select
Insert
mode
https://vimdoc.sourceforge.net/htmldoc/insert.html#Insert
Command-line
mode / Cmdline
mode
https://vimdoc.sourceforge.net/htmldoc/cmdline.html#Command-line
https://vimdoc.sourceforge.net/htmldoc/cmdline.html#Cmdline
Ex
mode
https://vimdoc.sourceforge.net/htmldoc/intro.html#Ex
Vim 6 种
附加模式
There are six ADDITIONAL
modes. These are variants of the BASIC
modes:
有六种附加
模式。 这些是 BASIC 模式的变体:
Operator-pending
mode
https://vimdoc.sourceforge.net/htmldoc/intro.html#Operator-pending
Replace
mode
Virtual Replace
mode
https://vimdoc.sourceforge.net/htmldoc/insert.html#Replace
Insert Normal
mode
https://vimdoc.sourceforge.net/htmldoc/insert.html#Insert
https://vimdoc.sourceforge.net/htmldoc/intro.html#Normal
Insert Visual
mode
https://vimdoc.sourceforge.net/htmldoc/insert.html#Insert
https://vimdoc.sourceforge.net/htmldoc/visual.html#Visual
Insert Select
mode
https://vimdoc.sourceforge.net/htmldoc/insert.html#Insert
https://vimdoc.sourceforge.net/htmldoc/visual.html#Select
Vim 使用文档
https://vimdoc.sourceforge.net/htmldoc/usr_toc.html
$ vim --help
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Oct 01 2021 01:51:08)
用法: vim [参数] [文件 ..] 编辑指定的文件
或: vim [参数] - 从标准输入(stdin)读取文本
或: vim [参数] -t tag 编辑 tag 定义处的文件
或: vim [参数] -q [errorfile] 编辑第一个出错处的文件
参数:
-- 在这以后只有文件名
-v Vi 模式 (同 "vi")
-e Ex 模式 (同 "ex")
-E Improved Ex mode
-s 安静(批处理)模式 (只能与 "ex" 一起使用)
-d Diff 模式 (同 "vimdiff")
-y 容易模式 (同 "evim",无模式)
-R 只读模式 (同 "view")
-Z 限制模式 (同 "rvim")
-m 不可修改(写入文件)
-M 文本不可修改
-b 二进制模式
-l Lisp 模式
-C 兼容传统的 Vi: 'compatible'
-N 不完全兼容传统的 Vi: 'nocompatible'
-V[N][fname] Be verbose [level N] [log messages to fname]
-D 调试模式
-n 不使用交换文件,只使用内存
-r 列出交换文件并退出
-r (跟文件名) 恢复崩溃的会话
-L 同 -r
-A 以 Arabic 模式启动
-H 以 Hebrew 模式启动
-T <terminal> 设定终端类型为 <terminal>
--not-a-term Skip warning for input/output not being a terminal
--ttyfail Exit if input or output is not a terminal
-u <vimrc> 使用 <vimrc> 替代任何 .vimrc
--noplugin 不加载 plugin 脚本
-p[N] 打开 N 个标签页 (默认值: 每个文件一个)
-o[N] 打开 N 个窗口 (默认值: 每个文件一个)
-O[N] 同 -o 但垂直分割
+ 启动后跳到文件末尾
+<lnum> 启动后跳到第 <lnum> 行
--cmd <command> 加载任何 vimrc 文件前执行 <command>
-c <command> 加载第一个文件后执行 <command>
-S <session> 加载第一个文件后执行文件 <session>
-s <scriptin> 从文件 <scriptin> 读入正常模式的命令
-w <scriptout> 将所有输入的命令追加到文件 <scriptout>
-W <scriptout> 将所有输入的命令写入到文件 <scriptout>
-x 编辑加密的文件
--startuptime <file> Write startup timing messages to <file>
-i <viminfo> 使用 <viminfo> 取代 .viminfo
--clean 'nocompatible', Vim defaults, no plugins, no viminfo
-h 或 --help 打印帮助(本信息)并退出
--version 打印版本信息并退出
Vim official documents
官方文档
Vim docs
http://vimcdoc.sourceforge.net/
http://vimdoc.sourceforge.net/htmldoc/usr_toc.html
http://vimdoc.sourceforge.net/htmldoc/help.html
Vim translations
https://www.vim.org/translations.php
Chinese ZH-Hans
https://sourceforge.net/projects/vimcdoc/files/pdf-manual/user_manual-2.3.0.pdf/download
https://github.com/yianwillis/vimcdoc
Vim books
https://iccf-holland.org/vim_books.html
https://iccf-holland.org/vim_books.html#oualline
Vim Cookbook
http://www.oualline.com/vim-cook.html
???
https://vim.fandom.com/wiki/Vim_Tips_Wiki
Vim bugs
mistake: "command mode" should be "Normal mode".
https://www.moolenaar.net/vim_errata.html
Vim pdf
https://www.truth.sk/vim/vimbook-OPL.pdf
Vim REPL
online
Vim 中的六种
基本模式
https://www.shiyanlou.com/courses/2/learning/
Vim 在线手册
https://vimdoc.sourceforge.net/htmldoc/usr_toc.html
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13405977.html
未经授权禁止转载,违者必究!