vimプロファイルvimrcスクリプト(Linux、Mac OSどちらでも使用可能)
10244 ワード
========================================== ” Filename : .vimrc"Author:ゲーム心逐夢yixzm"Email:[email protected]"Create:2013-04-09ネット資料を参考にして、勉強を始めます"Repair:2013-07-04満足できるシナリオを最適化します"Repair:2016-08-01数年後、再び最適化を探究します"Repair:2017-08-31既存の使用習慣に基づいて、総括"Repair:2017-09-19 Markdownエディタを再整理します
行番号の表示
自動インデント(auto)、スマートインデント(smart)、Cフォーマットインデント
横、縦のカーソルを表示
ハイライトをオフにすると、カラーブロックが頻繁に表示されます.
行番号の表示
set nu
相対行番号の表示(ndd,nyyなどのコマンドが便利)set relativenumber
注意:相対行番号の設定vim 7.2バージョンのデフォルトは使用できません.自動インデント(auto)、スマートインデント(smart)、Cフォーマットインデント
set ai
set si
set ci
tableキーインデント長、改行インデント長set ts=4
set sw=4
行ごとに表示される文字数set textwidth=79
エンドカラーをオンにする(これは何の役にも立たない)set shortmess=atI
if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif
構文ハイライトをオンにします(プログラミング言語キーワードのカラー表示)syntax enable
syntax on
重要だ!!!Macコンピュータでは、syntax on
が欠けていると、キーワードの色が表示されません.横、縦のカーソルを表示
set cursorline
set cursorcolumn
ステータスバーset cmdheight=2
set laststatus=2
カーソルが下の行から離れているので、体験がいいです.set scrolloff=5
マウスを使用できます.リモートtelnetやsshのシーンでも有効です.set mouse=a
set selection=exclusive
set selectmode=mouse,key
検索時に大文字と小文字を区別しないset incsearch
生成しません.swpファイルset nobackup
set nowb
set report=0
” Autoaddset nocp
カラースタイルの設定colorscheme default
色のスタイルは大Vのお勧めのデザインに変えることができます:slate、evening、desert、koehlerなどハイライトをオフにすると、カラーブロックが頻繁に表示されます.
set nohls
プラグインfiletype plugin on
filetype plugin indent on
set tags+=tags
set autochdir
set history=50
" inoremap ' ''<Esc>i
" inoremap " ""<Esc>i
" inoremap < <><Esc>i
" inoremap ( ()<Esc>i
" inoremap [ []<Esc>i
" inoremap { {<CR>}<Esc>O
これらの行は自動的に一致する括弧を追加して、今あまりC++コードを書かないので、私自身も開けません.==================================================================================================================================================="-- omnicppcomplete setting --
set completeopt=menu,preview
set completeopt-=preview
set completeopt=longest,menu
let OmniCpp_MayCompleteDot = 1 " autocomplete with .
let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
let OmniCpp_ShowPrototypeInAbbr = 1
" show function prototype in popup window
let OmniCpp_GlobalScopeSearch=1
let OmniCpp_DisplayMode=1
let OmniCpp_DefaultNamespaces=["std"]
function Myadd()
inoremap ' ''i
inoremap " ""i
inoremap < <>i
inoremap ( ()i
inoremap [ []i
inoremap { {}O
inoremap > =ClosePair('>')
inoremap ) =ClosePair(')')
inoremap ] =ClosePair(']')
"" inoremap } =CloseBracket('}')
inoremap " =QuoteDelim(' "')
inoremap ' =QuoteDelim(" '")
endfunction
function Mydel()
inoremap ' '
inoremap " "
inoremap < <
inoremap ( (
inoremap [ [
inoremap { {
endfunction
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\"
else
return a:char
endif
endf
function CloseBracket()
if match(getline(line('.') + 1), '\s*}') < 0
return "\}"
else
return "\j0f}a"
endif
endf
function QuoteDelim(char)
let line = getline('.')
let col = col('.')
if line[col - 2] == "\\"
"Inserting a quoted quotation mark into
the string
return a:char
elseif line[col - 1] == a:char
"Escaping out of the string
return "\"
else
"Starting a string
return a:char.a:char."\i"
endif
endfunction
" Colorconfig
" Templetes
""autocmd BufRead,BufNewFile *.h set filetype=c
""let g: C_SourceCodeExtensions = 'h c cp ...'
" :help c-support-comm-frame
let g:SuperTabDefaultCompletionType="context"
" Inoremap
inoremap :call Myadd()a
inoremap :call Mydel()a
inoremap :TlistOpena
inoremap :TlistClosea
" Default
call Myadd()
“========================================================= “`