1. vim配置:
    vim ~/.vimrc

    set nocompatible
    set number
    set ruler
    set wrap
    set showcmd
    set history=1000
    set nobackup
    set noswapfile
    "set cursorline
    "set cursorcolumn
    set showmatch
    set autoindent
    set cindent
    syntax enable
    syntax on
    set t_Co=256
    set ignorecase
    "set mouse=a
    set tabstop=4
    set shiftwidth=4
    set softtabstop=4
    set smarttab
    set expandtab
    set encoding=utf-8
    set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
    set ff=unix
    filetype on
    filetype indent on
    filetype plugin on
    filetype plugin indent on
  2. 解决粘贴代码混乱的问题:

    1. 设置为粘贴模式:
      :set paste
    2. 退出粘贴模式:
      :set nopaste
  3. 可视模式:

     1. 可视:v
     2. 可视行:V
     3. 可视块:Ctrl + v
  4. 大小写忽略设置:

    1. 忽略:
      :set ic
    2. 不忽略:
      :set noic
  5. 查找/替换/删除命令:

    1. 查找:
      # 命令
      /{内容}
      # n 向下查找
      # N 向上查找
    2. 替换:
      # 命令
      :%s/{search}/{replace}/g
    3. 删除行:
      # 删除所有包含指定内容的行,忽略大小写
      :g/{内容}/d
  6. 修改默认编辑器:
    vim /etc/profile
    export EDITOR=/usr/bin/vim

文档更新时间: 2024-04-20 10:57   作者:lee