• Vim学习笔记


    主要内容来自 vimtutor.

    ## vimtutor
    x d - del
    	- dd - del whole line
    i a - add
    A = $a
    w - to next word
    	- space 分割
    	- 连续标点看做一个单词, 包括汉字标点
    	- 汉字看做一个单词
    	- exclusive
    e - to end of word
    	- inclusive
    u c-r - undo/redo
    p - paste
    	- insert after cursor
    	- = a c-v/A c-v(whole line)
    y - copy
    r - replace one char
    R - replace mode
    c = d&i
    	- ce = dei/a (a when reach end of line)
    	- caw = dwi/a (not to use cw)
    G - jump to line
    	- G - end of file
    	- gg - first line of file
    / ? - search forward/backward
    	- n/N - next/prev
    c-o c-i - back/reback ---- 
    % - go to {}()[] matched
    	- or go to next ]})
    :s - replace
    	- #,# / % range
    	- g - all
    	- c - ask
    :! - outside command
    v - visual
    	- inclusive
    o = A<cr>
    O = kA<cr>
    :set ic (ignore case) hls (hlsearch) is (incsearch)
    :r file - o && append file 
    :r file - o && append file 
    :help
    <c-d> tab - 补全
    <c-w> jump among windows
    
    ## Insert
    i I a A o O
    ## Copy/Paste
    y yy
    p s-p
    v V <c-v>
    ## Delete
    x 
    d dd
    ## File
    :o file
    ## Multiple Windows
    :[n]sp file = vim -o files
    :[n]vs file = vim -O files
     ^ lines
    <c-w> h/j/k/l - move
    <c-w> + - = < >
    <c-w> q
    ## Multiple Tabs
    :tabe tabc tabo
    <c-pu/pd>
    
    ## cmd
    set xx/noxx/invxx
    
    set list "show invisible characters
    
    "hex
    :%!xxd "show hex
    :%!xxd -r  "convert back
    u "alternative
    
    :redir (([>] / >>) filename) / (@xx ([>] / >>)) "redirect to file/register
    :redir END "end
    
    :| "execute multiple commands; not pipe
    
    :expand(expr) "expand wildcards and keywords to string
    :let @"=expand("% [:p] ") "copy file name/path
    
    ## register
    1. The unnamed register ""
    	- `"` = ``; which means `p` = `""p` 
    2. 10 numbered registers "0 to "9
    	- `y` -> `0`
    	- `d`/`c`/`s`/`x` -> '1' ~ '9'
    		- only when deling whole line
    		- otherwise, -> `-`
    3. The small delete register "-
    4. 26 named registers "a to "z or "A to "Z
    	- when `p`: 'a' = 'A'
    	- when `y` and so on: 'a': overwrite, 'A': append
    5. three read-only registers ":, "., "%
    	- `.`: str in the insert mode
    	- `%`: file name
    6. alternate buffer register "#
    7. the expression register "=
    8. The selection and drop registers "*, "+ and "~ 
    9. The black hole register "_
    10. Last search pattern register "/
    
    @xx : string in the register
    
    c-r + register: paste
    
    ## 宏录制
    q + register 
    q
    [n + ]@ + register
    
    ## Code folding
    set fdm=manual
    zc zo
    zC zO
    zf + sw. - fold
    zd zD - del
    
    ## variables
    display:
    	echo $xxx - environment variable
    	echo &xxx - option value
    	echo @xxx - register
    	echo xxx  - other variables
    set + [no]option
    let var = value
    
    ## encoding
    set encoding=xxx
    set fileencoding=xxx "change the encoding of file
    set fileencodings=xxx,xxx
    
    :e ++enc=xxx "reload
    "about encoding : http://www.fmddlmyy.cn/text6.html
    
    ## linebreak
    unix: 
     
    dos: 
     
    mac: 
    
    :e ++ff=xx "dos/unix/mac
    :set ff=xx "convert
    

    参考

  • 相关阅读:
    Linux安全加固
    mosquitto
    Docker设置2375端口
    linux shell 常见的时间戳操作
    tar打包并且排除log目录
    spring boot2整合shiro安全框架实现前后端分离的JWT token登录验证
    http post
    scp命令 Linux和Windows文件互传
    git did not exit cleanly (exit code 1) 的解决办法
    windows安装TortoiseGit详细使用教程【基础篇】
  • 原文地址:https://www.cnblogs.com/ubospica/p/10647896.html
Copyright © 2020-2023  润新知