zoukankan      html  css  js  c++  java
  • Ubuntu

    vim基本命令

    $vimtutor
    可以查看基本的vim操作

    1

    h (left) j(down) k(up) l(right)
    q! wq
    i: insert before the cursor (insert) 插队嘛,肯定在光标前面
    A: append after the line (appending)

    2

    dw: 删除一个单词,保留光标前面部分
    d$:删除光标之后的同行所有部分
    dd:删除一行


    2w: 当前光标之后第2个单词词首
    3e:当前光标之后第3个单词词首
    0:行首
    $: 行尾
    e: 跳到一个单词结尾,可以联系点击

    u: to undo previoud actions
    U: to undo all the changes on a line
    ctrl+r: to undo the undo's

    3

    p(paste)
    r(replace)
    rx:replace with x

    c(change)
    ce: change until the end of a word
    c$: change until the end of a line
    c + number + motion

    4

    ctrl+g:显示文件名和当前光标所在的行数
    G:去最后一行
    number+G:去指定number行
    gg:去第一行

    /word enter n:向下 N:向上
    ?word enter 默认向上查找
    ctrl+o:repeat to go back further
    crrl+i:go forward

    %:matching parenthese search,匹配(, [, or { } ] )

    :s/old/new/g to substitute 'new' for 'old'.
    type :#,#s/old/new/g where #,# are the line numbers of the range
    of lines where the substitution is to be done.
    Type :%s/old/new/g to change every occurrence in the whole file.
    Type :%s/old/new/gc to find every occurrence in the whole file,
    with a prompt whether to substitute or not.

    5

    :! shell command # 使用:!可以执行外部shell命令
    :w TEST # 将当前文件保存为TEST文件,而当前的文件名仍然不变
    :!rm TEST or del TEST # 删除TEST文件
    :v 通过jk选择内容之后,在使用:w TEST将选中的内容保存到文件中,然后通过:!dir或:!ls或:!cat TEST查看
    同时,通过v选中的内容,然后按d,可以删除对应的选中内容
    同时,通过v选中的内容,然后按d,可以删除对应的选中内容,通过p来复制刚刚删除的内容
    :r TEST 在光标所在的下一行并入文件TEST的内容
    :r !ls 在光标所在的下一行并入ls的内容,而!表示执行外部shell命令

    6


    o:Open command, 在光标下面打开文件
    O:在光标上面打开文件
    a:在光标所在处追加,i是在前面插队,A是行尾追加

    连续替换
    R:光标下连续替换,而r只是替换一个字符

    复制和粘贴
    y:复制(yank),然后p(put pastes)进行粘贴,前提是在v的情况下,进行yank,然后找到合适的位置进行p
    j$:复制到行尾

    设置选项:set option
    设置高亮搜索设置:set hls is # hlsearch incsearch
    取消高亮设置:set nohlsearch
    在进行搜索之后,可以通过设置忽略大小写,高亮设置,方便搜索
    /word
    set ic # ignore case
    set noic
    set hls is # heightligt search / increase search
    结束的时候:可以使用set nohlsearch

    7help

    vim的资源文件:~/.vimrc
    vimy有很多特征默认是关闭的,需要在vimrc中开启
    :e ~/.vimrc # 可以编辑
    :w ~/.vimrc

    命令补全:
    要想使用vim的补全模式,需要关闭兼容(vi)的模式:set nocp
    当敲入:e,然后Ctrl+D时,会显示所有e开头的命令,然输入d<TAB>,会快速补全剩下的命令符

    Ctrl+W Ctrl+W 调到另外一个窗口

  • 相关阅读:
    2013百度轻应用巡讲沙龙上海站
    xcode自动打ipa包脚本 资料
    Xcode 自动对齐 插件
    Lable中添加链接文字。。。各种操作 都能满足。简单易用【NIAttributedLabel】
    XMPP 安装ejabberd 搭建服务器环境
    git 终端命令行工具(忽略大小写,很好用)
    IOS团队开发之——CocoaPods 第三方库管理工具
    XCode 调试方法 (很全 很有用)
    模块化设计-iOS团队协作开发 v1.0
    淘宝技术部(ios 优化方案)
  • 原文地址:https://www.cnblogs.com/gwzz/p/13345555.html
Copyright © 2011-2022 走看看