VIM单文件配置

"开启行号
set nu
"禁止生成备份文件
set nobackup
set noundofile
set noswapfile
syntax on " 语法高亮
"更换字体
set guifont=Consolas:h11
"更换主题
colorscheme evening
if has("gui_running")
"au GUIEnter * simalt ~x " 窗口启动时自动最大化
"set guioptions-=m " 隐藏菜单栏
"set guioptions-=T " 隐藏工具栏
set guioptions-=L " 隐藏左侧滚动条
set guioptions-=r " 隐藏右侧滚动条
set guioptions-=b " 隐藏底部滚动条
set showtabline=0 " 隐藏Tab栏
endif
"乱码处理
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1
let &termencoding=&encoding
set fileencodings=utf-8,gb18030,utf-16,big5
"解决菜单乱码
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
"解决consle输出乱码
language messages zh_CN.utf-8
let &termencoding=&encoding
set fileencodings=utf-8,gb18030,utf-16,big5
"C,C++ 按F5编译运行
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
        exec "!g++ % -o %< & %<"
    elseif &filetype == 'cpp'
        exec "!g++ % -o %< & %<"
    elseif &filetype == 'java' 
        exec "!javac -encoding UTF-8 % & java %<" 
    elseif &filetype == 'php'
        exec "!chrome localhost/%:t"
    elseif &filetype == 'html'
        "exec "!start chrome localhost/%:t"
        exec "!start chrome %"
    endif
endfunc
"设置窗口大小
set lines=35 columns=95 "设置初始界面大小
"设置tab键等于4个空格
set ts=4
set sw=4 
set expandtab
set autoindent
"亮光标所在行和所在列
set cursorline
set backspace=2
posted @ 2023-03-07 13:58  皮豪  阅读(19)  评论(0编辑  收藏  举报