在用户状态下
[mwq@localhost ~]$ vimtutor 查看教程
[mwq@localhost ~]$ vim .vimrc 进入编辑样式
.表示隐藏文件,进入此文件可以在所有文件中设置样式
例如,显示行号,就在.vimrc文件中键入set nu
可以自己进行配置
我的配置:
set cul
set autowrite
set completeopt=longest,menu
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
colorscheme torte
set background=dark
set ai
set mouse=n
set smartindent
set nu
编写代码
[mwq@localhost ~]$ vim hello.C
运行
[mwq@localhost ~]$ g++ hello.C -o hello
[mwq@localhost ~]$ ./hello
hello world