VIM设置记录

简介:

linux下开发总是坑爹的,特别是纯命令行的服务器机子。连个gui的编译器都没,无奈之下只能用vim凑合了。vim也不那么让人省心,有些东西还是需要设置才行。

配置文件:

这个是目前用的vim配置文件,我是直接修改的/etc/vimrc,这是全局配置文件。如果只想针对某个用户可以在用户文件夹下~/.vimrc文件配置。

01 " If using a dark background within the editing area and syntax highlighting
02 " turn on this option as well
03 "set background=dark
04  
05 " Uncomment the following to have Vim jump to the last position when
06 " reopening a file
07 "if has("autocmd")
08 "  au BufReadPost * if line("'"") > 1 && line("'"") <= line("$") | exe "normal! g'"" | endif
09 "endif
10  
11 " Uncomment the following to have Vim load indentation rules and plugins
12 " according to the detected filetype.
13 "if has("autocmd")
14 "  filetype plugin indent on
15 "endif
16  
17 " The following are commented out as they cause vim to behave a lot
18 " differently from regular Vi. They are highly recommended though.
19 set nocompatible  "支持方向键
20 set backspace=2   "支持backsapce前删键
21 autocmd FileType python setlocal et sta sw=4 sts=4  "缩进四个空格,用四个空格替换tab        
22  
23 set ai
24 set nu
25 set showmatch
26 set autoindent
27 set cindent
28 set noignorecase
29 set ruler
30 set scrolloff=5
31 set tabstop=3
32 set shiftwidth=3
33 set wrap
34 set showcmd        " Show (partial) command in status line.
35 set showmatch        " Show matching brackets.
36 set ignorecase        " Do case insensitive matching
37 set smartcase        " Do smart case matching
38 "set incsearch        " Incremental search
39 "set autowrite        " Automatically save before commands like :next and :make
40 "set hidden             " Hide buffers when they are abandoned
41 "set mouse=a        " Enable mouse usage (all modes),注释掉使得可以在putty上右键粘贴。
42 set smartindent
43 " Source a global configuration file if available
44 if filereadable("/etc/vim/vimrc.local")
45   source /etc/vim/vimrc.local
46 endif
47  
48 syntax enable
49 syntax on

参数解释:

 

01 "设置方向键移动光标以及退格键。
02 set nocompatible  "支持方向键
03 set backspace=2   "支持backsapce前删键
04  
05 "这行如果不注释,右键是用于选中。
06 "注释后,右键可以粘贴内容(在putty中)
07 "set mouse=a
08  
09 autocmd FileType python setlocal et sta sw=4 sts=4    "因为是用于python编写,所以缩进四个空格,并用四个空格替换tab
10 "参数详解
11 "et    expandtab,将tab键展开成空格
12 "sta    smartab,在行首按TAB将加入sw个空格
13 "sw    shiftwidth,自动缩进插入的空格数
14 "sts    softabstop,使用<Tab>或<BS>自动插入或删除相应的空格数

 

 

转载请注明:旅途@KryptosX » VIM设置记录

目录
相关文章
|
4月前
|
数据可视化 Linux 开发工具
【Linux】开发工具——vim多模式编辑器的入土&&设置sudoers白名单
通过前面几篇文章的学习我们已经对Linux操作系统算是比较了解了,可以熟练的使用一些指令,我们就要进入Linux下的系统编程。在Windows系统下可以安装各种集成开发环境像Dev-C++、VC6.0、VS等等,在这些软件中我们不仅可以写代码,软件也可以完成编译、链接,甚至是调试等一系列功能。而在我们Linux系统中编写代码、编译代码、调试代码可以说都是分开的,使用各种工具完成。例如:编写代码使用vim多功能编辑器、编译代码使用gcc/g++编译器、调试代码使用gdp调试器。今天给大家带来的是vim多功能编辑器的使用。
|
8月前
|
Linux 开发工具
CentOS设置vim样式
CentOS设置vim样式
|
8月前
|
Linux 开发工具
CentOS中设置vim为默认vi编辑器
CentOS中设置vim为默认vi编辑器
|
程序员 Linux Go
vim设置go语法高亮
快速设置vim的go语法高亮
219 0
vim设置go语法高亮
|
开发工具
SAP Vim和ABAP Editor的个人设置
SAP Vim和ABAP Editor的个人设置
197 0
SAP Vim和ABAP Editor的个人设置
|
Linux 开发工具
Fedora CentOS Red Hat中让vim支持语法高亮设置
Fedora CentOS Red Hat中让vim支持语法高亮设置
95 0
|
开发工具 Perl
vim设置特殊快捷键
vim设置特殊快捷键
|
Linux 开发工具
Fedora CentOS Red Hat中让vim支持语法高亮设置
Fedora / CentOS / Red Hat这三个系统里默认的vi是没有语法高亮显示的,白色的字体看起来很不舒服。 首先用命令行cat /etc/os-release查看当前linux系统的类型,发现为Red Hat: 使用命令行yum install vim-enhanced下载vi的增强版本: vim --version,确认这个版本确实有syntax支持。
1256 0