vim 配置

修改系统用户Vim的配置

vim /etc/vim/vimrc

修改当前用户Vim配置

vim ~/.vimrc

" 设置字符编码
set fileencoding=utf-8
set fileencodings=utf-8,gb2312,gb18030,latin1
set encoding=utf-8

" Sets how many lines of history VIM has to remember
set history=500

" Set to auto read when a file is changed from the outside
set autoread

" Enable filetype plugins
filetype plugin on
filetype indent on

" Set 7 lines to the cursor - when moving vertically using j/k
set so=7

" Turn on the Wild menu
set wildmenu

" 显示行号
set number
" 语法高亮
syntax on
" Show matching brackets when text indicator is over them
set showmatch

" Use spaces instead of tabs
set expandtab
" Be smart when using tabs
set smarttab

" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set softtabstop=4

" 保持上下缩进一致
set autoindent

" Always show current position
set ruler
" Always show the status line
set laststatus=2
" 高亮显示当前行
set cursorline

" 同一 vim 窗口编辑多个文件时,自动切换到正在编辑的文件
set autochdir

" 自动完成大括号
imap { {<CR>}<Esc>kA<CR>

" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l

配置F5编译运行

map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
    exec"w"
    if &filetype =='c'
        exec"!g++ % -o %<"
        exec"!time ./%<"
endfunc

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值