*'tabstop'* *'ts'*
'tabstop''ts' number (default 8) local to buffer
Number of spaces that a <Tab> in the file counts for. Also see
the |:retab| command, and the 'softtabstop' option.
Note: Setting 'tabstop' to any other value than 8 can make your file
appear wrong in many places, e.g., when printing it.
The value must be more than 0 and less than 10000.
There are four main ways to use tabs in Vim:
1. Always keep 'tabstop' at 8,set'softtabstop' and 'shiftwidth' to 4(or 3 or whatever you prefer) and use 'noexpandtab'. Then Vim
will use a mix of tabs and spaces, but typing <Tab> and <BS> will
behave like a tab appears every 4(or 3) characters.
This is the recommended way, the file will look the same with other
tools and when listing it in a terminal.
2. Set 'softtabstop' and 'shiftwidth' to whatever you prefer and use
'expandtab'. This way you will always insert spaces. The
formatting will never be messed up when 'tabstop' is changed (leave
it at 8 just in case). The file will be a bit larger.
You do need to check if no Tabs exist in the file. You can get rid
of them by first setting 'expandtab' and using `%retab!`, making
sure the value of 'tabstop' is set correctly.
3. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use
'expandtab'. This way you will always insert spaces. The
formatting will never be messed up when 'tabstop' is changed.
You do need to check if no Tabs exist in the file, just like in the
item just above.
4. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a
|modeline| to set these values when editing the file again. Only
works when using Vim to edit the file, other tools assume a tabstop
大意:
文件中的所有 Tab (\t) 「看起來」要代表多少 space
不要設定超過 8 不然會容易跑版
shiftwidth (sw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
shiftwidth([{col}]) *shiftwidth()*
Returns the effective value of 'shiftwidth'. This is the
'shiftwidth' value unless it is zero, in which case it is the
'tabstop' value. This function was introduced with patch
7.3.694 in 2012, everybody should have it by now (however it
did not allow for the optional {col} argument until 8.1.542).
When there is one argument {col} this is used as column number
for which to return the 'shiftwidth' value. This matters for the
'vartabstop' feature. If the 'vartabstop' setting is enabled and
no {col} argument is given, column 1 will be assumed.
Can also be used as a |method|:
GetColumn()->shiftwidth()
'softtabstop''sts' number (default 0) local to buffer
Number of spaces that a <Tab> counts for while performing editing
operations, like inserting a <Tab> or using <BS>. It "feels" like
<Tab>s are being inserted, while in fact a mix of spaces and <Tab>s is
used. This is useful to keep the 'ts' setting at its standard value
of 8, while being able to edit like it is set to 'sts'. However, commands like "x" still work on the actual characters.
When 'sts' is zero, this feature is off.
When 'sts' is negative, the value of 'shiftwidth' is used.
'softtabstop' is set to 0 when the 'paste' option is set and restored
when 'paste' is reset.
See also |ins-expandtab|. When 'expandtab' is not set, the number of
spaces is minimized by using <Tab>s.
The 'L' flag in 'cpoptions' changes how tabs are used when 'list' is
set.
NOTE: This option is set to 0 when 'compatible' is set.
If Vim is compiled with the |+vartabs| feature then the value of
'softtabstop' will be ignored if|'varsofttabstop'| is set to
anything other than an empty string.
*'expandtab'* *'et'* *'noexpandtab'* *'noet'*
'expandtab''et' boolean (default off) local to buffer
In Insert mode: Use the appropriate number of spaces to insert a
<Tab>. Spaces are used in indents with the '>' and '<' commands and
when 'autoindent' is on. To insert a real tab when 'expandtab' is
on, use CTRL-V<Tab>. See also |:retab| and |ins-expandtab|.
This option is reset when the 'paste' option is set and restored when
the 'paste' option is reset.
NOTE: This option is reset when 'compatible' is set.
*'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'*
'hlsearch''hls' boolean (default off) global
{not available when compiled without the
|+extra_search| feature}
When there is a previous search pattern,highlight all its matches.
The type of highlighting used can be set with the 'l' occasion in the
'highlight' option. This uses the "Search"highlight group by
default. Note that only the matching text is highlighted, any offsets
are not applied.
See also: 'incsearch' and |:match|.
When you get bored looking at the highlighted matches, you can turn it
off with |:nohlsearch|. This does not change the option value, as
soon as you use a search command, the highlighting comes back.
'redrawtime' specifies the maximum time spent on finding matches.
When the search pattern can match an end-of-line, Vim will try to
highlight all of the matched text. However, this depends on where the
search starts. This will be the first line in the window or the first
line below a closed fold. A match in a previous line which is not
drawn may not continue in a newly drawn line.
You can specify whether the highlight status is restored on startup
with the 'h' flag in 'viminfo'|viminfo-h|.
NOTE: This option is reset when 'compatible' is set.
把搜尋結果 hightlight 出來
nnoremap
要拆開看,這其實代表 n-no-remap
1
2
3
4
5
6
7
'remap' boolean (default on) global
Allows for mappings to work recursively. If you do not want this for
a single entry, use the :noremap[!] command.
NOTE: To avoid portability problems with Vim scripts, always keep
this option at the default "on". Only switch it off when working with
old Vi scripts.
remap 代表會按鍵對應 (key mapping) 會遞迴套用 (recursively)
noremap 則代表不要遞迴套用 (no-recursively-map)
第一個 n 則代表 mode:vim 有很多 mode,例如 insert mode、visual mode;這裡的 n 表示 normal mode。