vim 用户手册第三章 moving around

usr_03 Moving around

03.1 Word movement
This is a line with example text  
  --->-->->----------------->
   w  w  w    3w  

This is a line with example text  
<----<--<-<---------<---
   b   b b    2b      b   

This is a line with example text  
   <-   <--- ----->   ---->
   ge    ge     e       e   

:set iskeyword&
ge b w e
<- <- —> —>
This is-a line, with special/separated/words (and some more).
<----- <----- --------------------> ----->
gE B W E

03.2 Moving to the start or end of a line
          ^   
     <------------
.....This is a line with example text 
<-----------------   --------------->
       0                    $   
03.3 Moving to a character
To err is human.  To really foul up you need a computer. 
---------->--------------->
    fh       fy  
To err is human.  To really foul up you need a computer. ~
      --------------------->
           3fl 
To err is human.  To really foul up you need a computer. ~
      <---------------------
            Fh  
To err is human.  To really foul up you need a computer. ~
       <------------  ------------->
        Th      tn  
03.4 Matching a parenthesis
            %   
         <----->
    if (a == (b * c) / d) ~
       <---------------->
            %   
03.5 Moving to a specific line
    |   first line of a file   ^   
    |   text text text text    |   
    |   text text text text    |  gg
7G  |   text text text text    |
    |   text text text text
    |   text text text text
    V   text text text text    |
    text text text text    |  G
    text text text text    |
    last line of a file    V

        +---------------------------+
    H -->   | text sample text      |
        | sample text           |
        | text sample text      |
        | sample text           |
    M -->   | text sample text      |
        | sample text           |
        | text sample text      |
        | sample text           |
    L -->   | text sample text      |
        +---------------------------+
03.6 Telling where you are
  1. Use the CTRL-G command.
  2. Set the ‘number’ option.
  3. Set the ‘ruler’ option.
03.7 Scrolling around

The CTRL-U command scrolls down half a screen of text.
The CTRL-D command scrolls the text up half a screen.
To scroll one line at a time use CTRL-E (scroll up) and CTRL-Y (scroll down).
Fortunately CTRL-F is Forward and CTRL-B is Backward.
±-----------------+ ±-----------------+
| some text | | some text |
| some text | | some text |
| some text | | some text |
| some text | zz --> | line with cursor |
| some text | | some text |
| some text | | some text |
| line with cursor | | some text |
±-----------------+ ±-----------------+

03.8 Simple searches
/include
?word

n N search direction
IGNORING CASE
:set ignorecase
:set noignorecase
HISTORY
SEARCHING FOR A WORD IN THE TEXT

* # command

SEARCHING FOR WHOLE WORDS
/<the>
HIGHLIGHTING MATCHES
:set hlsearch
:set nohlsearch
:nohlsearch
TUNING SEARCHES
:set incsearch
:set nowrapscan
INTERMEZZO
:scriptnames
:edit ~/.vimrc

03.9 Simple search patterns

BEGINNING AND END OF A LINE
/^the$
MATCHING ANY SINGLE CHARACTER
c.m
MATCHING SPECIAL CHARACTERS
ter.

03.10 Using marks

``
CTRL-O
CTRL-I
The “:jumps” command gives a list of positions you jumped to.
NAMED MARKS
ma
ms
`a
:marks

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值