`
iwebcode
  • 浏览: 2007748 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

vim中三类文本对象 句,段落,节的区别

 
阅读更多
*sentence*
A sentence is defined as ending at a '.', '!' or '?' followed by either theend of a line, or by a space or tab. Any number of closing ')', ']', '"'and ''' characters may appear after the '.', '!' or '?' before the spaces,tabs or end of line. A paragraph and section boundary is also a sentenceboundary.
If the 'J' flag is present in 'cpoptions', at least two spaces have tofollow the punctuation mark; <Tab>s are not recognized as white space.The definition of a sentence cannot be changed.

*sentence*

一个句子以 '.'、'!' 或者 '?' 结尾并紧随着一个换行符、空格或者制表符。标点和空白字符之间可以出现任何数量的闭括号和引号: ')'、']'、'"' (双引号)和 '''(单引号)。另,段落和小节的边界也视为句子的边界。
如果 'cpoptions' 包含 'J' 标志位,那么标点之后的空格至少要出现两个,而且制表符不被视为空白字符。


*paragraph*
A paragraph begins after each empty line, and also at each of a set ofparagraph macros, specified by the pairs of characters in the 'paragraphs'option. The default is "IPLPPPQPP TPHPLIPpLpItpplpipbp", which corresponds tothe macros ".IP", ".LP", etc. (These are nroff macros, so the dot must be inthe first column). A section boundary is also a paragraph boundary.Note that a blank line (only containing white space) is NOT a paragraphboundary.
Also note that this does not include a '{' or '}' in the first column. Whenthe '{' flag is in 'cpoptions' then '{' in the first column is used as aparagraph boundary |posix|.

*paragraph*

一个段落从空行或某一个段落宏命令开始,段落宏由 'paragraphs' 选项里成对出现的字符所定义。它的缺省值为 "IPLPPPQPP TPHPLIPpLpItpplpipbp",也就是宏 ".IP"、".LP"等 (这些是 nroff 宏,所以句号一定要出现在第一列)。小节边界也被视为段落边界。注意 空白行 (只包含空白) _不是_ 段落边界。

也要 注意: 这不包括首列出现的 '{' 或 '}'。如果 'cpoptions' 里包含 '{' 标志位,那么首列的 '{' 用作段落边界 |posix|。



*section*
A section begins after a form-feed (<C-L>) in the first column and at each ofa set of section macros, specified by the pairs of characters in the'sections' option. The default is "SHNHH HUnhsh", which defines a section tostart at the nroff macros ".SH", ".NH", ".H", ".HU", ".nh" and ".sh".

The "]" and "[" commands stop at the '{' or '}' in the first column. This isuseful to find the start or end of a function in a C program. Note that thefirst character of the command determines the search direction and thesecond character the type of brace found.

If your '{' or '}' are not in the first column, and you would like to use "[["and "]]" anyway, try these mappings: >
:map [[ ?{<CR>w99[{
:map ][ /}<CR>b99]}
:map ]] j0[[%/{<CR>
:map [] k$][%?}<CR>

[type these literally, see |<>|]

*section*

一个小节从首列出现的换页符 (<C-L>) 或某一个小节宏命令开始。小节宏由 'sections'选项里成对出现的字符所定义。它的缺省值是 "SHNHH HUnhsh",也就是说小节可以从如下的 nroff 宏开始: ".SH"、".NH"、".H"、".HU"、".nh" 和 ".sh"。

"]" 和 "[" 命令也停在首列出现的 '{' 或 '}' 上。这有助于在 C 程序里找到函数的开始和结束位置。 注意: 命令的第一个字符决定搜索的方向,第二个字符决定要找到的括号。

如果你的 '{' 或 '}' 不在第一列但是你还是希望用 "[[" 和 "]]" 来找它们,试试这些映射: >
:map [[ ?{<CR>w99[{
:map ][ /}<CR>b99]}
:map ]] j0[[%/{<CR>
:map [] k$][%?}<CR>
[照文本直接输入,参见 |<>|]

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics