总是学不会的Vim

自定义bash配置

修改/etc/vim/vimrc文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

" 开启语法高亮
syntax enable
syntax on

" 自动缩进设置
set tabstop=4
" 设置自动对齐空格数
set shiftwidth=4
set expandtab
set autoindent
"智能缩进
set smartindent

" 显示行号
set number

" 检测文件类型
filetype on

" 文件修改之后自动读入
set autoread

" 显示当前行号和列号
set ruler

" " 在状态栏显示正在输入的命令
set showcmd

" " 左下角显示当前Vim模式
set showmode

"搜索结果高亮显示
set hlsearch
set incsearch " 输入搜索内容时就显示搜索结果

autocmd InsertLeave * se nocul " 用浅色高亮当前行
autocmd InsertEnter * se cul " 用浅色高亮当前行

set cursorline " 突出显示当前行

频繁操作

  1. o:光标所在行下面插入一行
  2. 在vim外ctrl+C复制的内容不能用p粘贴
  3. dd:删除一行,dw:删除一个单词,df×:删除光标到×中间的东西(包括×)
  4. :>:<是对当前缩进,gg=G是全局代码格式化
  5. 类似于 sed 的替换指令。

插件安装

  • vundle
  • vim-scripts/indentpython.vim
  • vim-syntastic/syntastic

VIM - 自动补全插件 jedi-vim

本站总访问量