• gvim使用总结


    我的gvim配置

    set nocompatible " 关闭vi兼容 
    " 显示相关
    set go=
    set number 
    set cursorline  
    set nowrap 
    set nofixendofline
    set hlsearch
    set wildmenu
    " 主题相关
    syn on
    colorscheme desert
    " 编码相关
    set fencs=utf-8,gbk,gb2312
    set encoding=utf-8
    set fileencoding=utf-8 
    " 关闭临时文件
    set nobackup
    set noundofile
    set noswapfile 
    " 缩进相关
    set autoindent 
    set tabstop=4
    set softtabstop=4
    set shiftwidth=4
    set expandtab
    set smarttab 
    " 字体相关
    set guifont=Consolas:h16
    set guifontwide=楷体:h16
    " 状态栏相关
    set laststatus=2
    set statusline=Filetype:%Y  Hex:0x%B  Position:(%l,%c) Progress:(%o,%p%%)  Total:%L lines 
    filetype plugin indent on " 打开文件类型探测
    " 按键相关
    set keymodel=startsel,stopsel
    set backspace=indent,eol,start
    nmap j gj
    nmap k gk
    func Run()
        exec 'w'
        if &filetype == 'cpp' || &filetype == 'c'
            exec '! clang % -Wall -o %<.exe'
            exec 'silent ! start cmd /C "%<.exe & pause"'
        endif
        if &filetype == 'python'
            exec 'silent ! start cmd /C "python % & pause"'
        endif
        if &filetype == 'haskell'
            exec 'silent ! start cmd /C "ghci % & pause"'
        endif
    endfunc
    map <C-F5> :call Run() <CR>
    

    一些总结

    • ={motion} [number]== 缩进

    • :sm :sno magic和nomagic模式下的替换

    • 替换标识:

      • c 逐个确认
      • i 忽略大小写
      • n 只包括有多少个匹配,不实际替换
    • :[range]ret 规范制表符

    • :[range]ce [width] :[range]ri [width] :[range]le [indent] 居中,右对齐和左对齐,width为列宽,indent为缩进空格数

    • [range]sor[!] [f][i][n][/{pattern}] 对range里的内容排序:

      • ! 表示降序
      • f 按行中第一个浮点数大小排
      • n 按行中第一个整数大小排
      • i 忽略大小写
      • /{pattern} 按匹配的元素排
    • zf{motion} [number]zF 创建折行

    • zd zD 删除光标下的折行,后者为递归

    • zo zO 打开光标下的折行,后者为递归

    • zc zC 收起光标下的折行,后者为递归

    • gd gD 跳到定义,前者为函数内,后者为全文件

    • gJ 下一行合并到当前行,不插入空格

    • :noh 关闭搜索出来的高亮

    • Ctrl-O Ctrl-I 到达上一次/下一次跳转的地方

    • g; g, 到达上一次/下一次修改的地方

    • :set cc(colorcolumn)=number 让第number列高亮

    • set lsp(linespace)=number 调节行距

    • set noar/ar(noautoread/autoread) 设置当前文件被外部改动时是否加载

    • set sh(shell)=shellpath 设置使用的命令行程序

    • :opt(options) 展示所有的set设置

    • z{number}<Cr> 将当前编辑区的高度设置为number

    • Ctrl-w{number}| 将当前编辑区的宽度设置为number

    • Ctrl-w</>/-/+ 缩小/放大当前编辑区的宽度/缩小/放大当前编辑器的高度

    • :[vertical] res [+|-][number] 将当前编辑区的宽度/高度缩小/放大/设为number

  • 相关阅读:
    Consul 简介及集群安装
    poj 1300 Door Man 欧拉回路
    Codeforces Round #284 (Div. 2)
    bnuoj 34985 Elegant String DP+矩阵快速幂
    cf 496B Secret Combination
    hdu 5120 Intersection
    poj 2002 Squares
    Codeforces Round #281 (Div. 2)
    转载:百度原CTO李一男经典语录
    hdu 4005 The war
  • 原文地址:https://www.cnblogs.com/YuanZiming/p/9547894.html
Copyright © 2020-2023  润新知