-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathlearn-vi-36-Mouse.html
62 lines (54 loc) · 5.33 KB
/
learn-vi-36-Mouse.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh" xml:lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="learn-vi.css" />
<title>VIM学习笔记 鼠标(Mouse)</title>
</head>
<body>
<p style="font-weight:bold; border-bottom:1px solid lightgray; border-left:6px solid lightgray; padding:0 0 3px 5px">启用/禁用鼠标</p>
<p>使用以下命令可以启用鼠标(默认选项):</p>
<p style="text-indent:2em"><code class="inset">:set mouse=a</code></p>
<p>使用以下命令可以禁用鼠标:</p>
<p style="text-indent:2em"><code class="inset">:set mouse=""</code></p>
<p style="font-weight:bold; border-bottom:1px solid lightgray; border-left:6px solid lightgray; padding:0 0 3px 5px">鼠标选项</p>
<p>在Windows和X Window这两种系统中,使用鼠标的方式是不同的。我们可以定制Vim编辑器,以启用不同的鼠标行为。命令<code class="inset">:behave xterm</code>设置使用X Window风格的鼠标行为。而命令<code class="inset">:behave mswin</code>则启用Windows风格的鼠标行为。</p>
<table summary="Options of :behave" border="1" rules="all" cellspacing="0" cellpadding="2">
<tr><th></th><th>xterm的鼠标行为</th><th>Windows的鼠标行为</th></tr>
<tr><td><strong>左键</strong></td><td>移动光标</td><td>移动光标</td></tr>
<tr><td><strong>拉动左键</strong></td><td>在可视化模式下选择文本</td><td>在选择模式下选中文本</td></tr>
<tr><td><strong>右键</strong></td><td>选中光标到右键点击处的文本</td><td>显示弹出菜单</td></tr>
<tr><td><strong>中键</strong></td><td>在光标处粘贴选中的文本</td><td>将系统剪切板中的文本粘贴到文件</td></tr>
</table>
<p>使用以下命令,可以定义双击之间的最大时间间隔:</p>
<p style="text-indent:2em"><code class="inset">:set mousetime=time</code></p>
<p>其中的时间以毫秒为单位,默认情况下为半秒(500ms)。</p>
<p>使用以下命令,可以设置鼠标的模式为extend,popup,popup_setpos其中之一:</p>
<p style="text-indent:2em"><code class="inset">:set mousemodel=mode</code></p>
<p>在所有模式之下,鼠标左键可以移动光标,拉动左键可以选择文本。在<em>extend</em>模式中,可以使用左键点中起始位置,然后按住<kbd>Alt</kbd>键的同时右击结束位置,将选中两点定义的可视化块(visual block)。在<em>popup</em>模式中,右键可以显示弹出菜单。而<em>popup_setpos</em>模式与popup模式相类似,所不同的只是当按下鼠标右键时,光标会移动到鼠标点击处,然后显示弹出菜单。</p>
<p>通过clipboard选项,可以控制Vim如何处理由鼠标选择的文本。使用以下设置,可以将所有鼠标选择的文本放在未命名寄存器中和剪切板寄存器中,这也意味着我们可以将文本粘贴到其他程序中。</p>
<p style="text-indent:2em"><code class="inset">:set clipboard=unnamed</code></p>
<p>如果设置如下选项,那么可视模式下选择的文本就会被放到系统剪切板中:</p>
<p style="text-indent:2em"><code class="inset">:set clipboard=autoselect</code></p>
<p style="font-weight:bold; border-bottom:1px solid lightgray; border-left:6px solid lightgray; padding:0 0 3px 5px">隐藏鼠标</p>
<p>在图形界面下编辑时,如果认为鼠标光标的存在会打扰你的工作,可以设置隐藏鼠标光标。</p>
<p style="text-indent:2em"><code class="inset">:set mousehide</code></p>
<p>设置之后,当键盘输入时鼠标光标就会隐藏,而移动光标时鼠标光标就会再度出现。</p>
<p style="font-weight:bold; border-bottom:1px solid lightgray; border-left:6px solid lightgray; padding:0 0 3px 5px">帮助信息</p>
<p>可以使用以下命令,查看关于鼠标使用的更多帮助信息:</p>
<p style="text-indent:2em"><code class="inset">:help mouse</code></p>
<p style="text-indent:2em"><code class="inset">:help mouse-using</code></p>
<p style="text-indent:2em"><code class="inset">:help scroll-mousewheel</code></p>
<table summary="Commands" border="2" frame="hsides" rules="all" cellspacing="0" cellpadding="3">
<caption>命令小结</caption>
<tr><td><code class="inset">:set mouse=a</code></td><td>启用鼠标</td></tr>
<tr><td><code class="inset">:set mouse=""</code></td><td>禁用鼠标</td></tr>
<tr><td><code class="inset">:behave</code></td><td>控制鼠标的行为</td></tr>
<tr><td><code class="inset">:set mousetime</code></td><td>设置双击时间间隔</td></tr>
<tr><td><code class="inset">:set mousemodel</code></td><td>设置鼠标模式</td></tr>
<tr><td><code class="inset">:set mousehide</code></td><td>隐藏鼠标</td></tr>
</table>
<p style="border-top:1px solid lightgray"><span style="float:right">Ver: 2.0 | <a href="mailto:yyq123@gmail.com">YYQ</a></span><span><<a title="光标(Cursor)" href="http://yyq123.github.io/learn-vim/learn-vi-35-Cursor.html">上一篇</a> |<a title="笔记列表" href="http://yyq123.github.com/learn-vim/learn-vi-00-List.html"> 目录 </a>| <a title="字体(Font)" href="http://yyq123.github.io/learn-vim/learn-vi-37-Font.html">下一篇</a>></span></p>
</body>
</html>