这篇文章上次修改于 1249 天前,可能其部分内容已经发生变化,如有疑问可询问作者。

title: "vim.MD"
author: "andy"
description: "description information"
date: "2016-09-28"

lastmod: "2023-11-28"

vim ~/.vimrc

syntax enable
syntax on
filetype on
filetype plugin on
filetype indent on
filetype plugin indent on

set number
set ignorecase
set autoread
set showcmd
set showmode
set incsearch
set cursorline
"set cursorcolumn
set ruler
set history=1024
set nobackup
set noswapfile

set autoindent
set cindent
set smartindent
set tabstop=4
set shiftwidth=4

set guifont=Monaco
set background=light
"colorscheme evening
set t_Co=256
set encoding=utf-8
set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
set helplang=cn
set termencoding=utf-8
set ffs=unix,dos,mac

set statusline=%<%f\ %h%m%r%=%k[%{(&fenc==\"\")?&enc:&fenc}%{(&bomb?\",BOM\":\"\")}]\ %-14.(%l,%c%V%)\ %P
set laststatus=2
:set pastetoggle=<F12>
if has("autocmd")
  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

func! CompileCodeRunResult()
    exec "w"
        if &filetype == "c"
            exec "!gcc  -std=c99 -I. -L. -lpthread ./% -o %<"
        elseif &filetype == "cpp"
            exec "!g++ -std=c++11 -I. -L. -lpthread ./% -o %<"
        elseif &filetype == "python"
            exec "!python ./%"
        elseif &filetype == "java"
            exec "!java %<"
        endif
    exec "! ./%<"
endfunc

map <F5> :call CompileCodeRunResult()<CR>
map  <F9> :call CompileCodeRunResult()<CR>
imap <F9> <ESC>:call CompileCodeRunResult()<CR>
vmap <F9> <ESC>:call CompileCodeRunResult()<CR>