source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" VIM userinterface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set smarttab
set cursorline
"顯示行號
set nu
"設置最大列數,超出后自動換行
set textwidth=120
"設置tab=4
set shiftwidth=4
set sts=4
set tabstop=4
"tab->空格
set expandtab
"以breakat的值的位置回繞長行,而不是以屏幕上可以顯示的最后一個字符回繞。breakat=" ^I!@*-+;:,./?"
set lbr
"不備份
set nobackup
set nowritebackup
set noswapfile
"不要工具條
"set guioptions-=T
"顏色主題
colorscheme murphy
"默認字體為Lucida Console,字體大小為11,粗體
"set guifont=Lucida_Console:h10
"搜索時全小寫相當于不區分大小寫,只要有一個大寫字母出現,則區分大小寫 simple idea, great achievement!
set ignorecase smartcase
set incsearch
"啟動gVIM時最大化
au GUIEnter * simalt ~x
" 進入插入模式時改變狀態欄顏色(僅限于Vim 7)
set laststatus=2 "總是顯示狀態欄
if version >= 700
au InsertEnter * hi StatusLine guibg=#818D29 guifg=#FCFCFC gui=none
au InsertLeave * hi StatusLine guibg=#EEEEEE guifg=#363636 gui=none
endif
" r 確保 Vim 在回車后自動追加注釋符號
" mM 確保Vim 能在中文字符之間折行而不要求空格的存在
set formatoptions+=rmM
"設置狀態欄
set showcmd
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set statusline=%F%m%r%h%w\ [POS=%04l,%04v]\ [%p%%]\ [LEN=%L]\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]
"Tab complete now ignores these file types
set wildignore=*.o,*.obj,*.bak,*.exe,*~
"Get out of VI's compatible mode..
set nocompatible
"Sets how many lines of history VIM har to remember
set history=100
"Enable filetype plugin
filetype plugin on
filetype indent on
"Set to auto read when a file is changed from the outside
set autoread
"Have the mouse enabled all the time:
set mouse=a
"光標上下兩側最少保留的屏幕行數 scrolloff
set so=5
"Turn on WiLd menu
set wildmenu
"Always show current position
set ruler
"The commandbar is 2 high
set cmdheight=1
"Do not redraw, when running macros.. lazyredraw
"set lz
"Change buffer - without saving
"set hid
"Set backspace
set backspace=eol,start,indent
"Bbackspace and cursor keys wrap to
set whichwrap+=<,>,h,l
"Set magic on
set magic
"No sound on errors.
set noerrorbells
set novisualbell
set t_vb=
"show matching bracets
set showmatch
"How many tenths of a second to blink
set mat=2
"Highlight search things
set hlsearch
"設置折疊
"set foldcolumn=2
"相同縮進構成折疊
"set foldmethod=indent
"手動設置折疊
set foldmethod=manual
"set foldlevel=10
"Set mapleader
let mapleader = ","
let g:mapleader = ","
"Fast reloading of the .vimrc
map <silent> <leader>ss :source $vim/_vimrc<CR>
"Fast editing of .vimrc
map <silent> <leader>ee :e $vim/_vimrc<CR>
"When .vimrc is edited, reload it
autocmd! bufwritepost _vimrc source $vim/_vimrc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Colors and Fonts
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Enable syntax hl
syntax enable
autocmd BufEnter * :syntax sync fromstart
"Highlight current
if has("gui_running")
set cursorline
hi cursorline guibg=#333333
hi CursorColumn guibg=#333333
endif
"Omni menu colors
hi Pmenu guibg=#333333
hi PmenuSel guibg=#555555 guifg=#ffffff
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Fileformats
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Favorite filetypes
set ffs=dos,unix,mac
nmap <leader>fd :se ff=dos<cr>
nmap <leader>fu :se ff=unix<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"map
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"myself
nmap <leader>w :w!<cr>
map ; :
"nmap <leader>f :find<cr>
nmap <F4> <C-O>
nmap <F5> g]
imap <F4> <ESC>g]i
"imap <S-F7> <ESC>:%!xxd -r<CR>i
"set Highlight
nmap <C-F5> :set hls<CR>gd
imap <C-F5> <ESC>:set hls<CR>gd<CR>i
"goto file
nmap <C-F6> gf
imap <C-F6> <ESC>gf<CR>i
nmap <C-F10> :set mouse=<CR>
imap <C-F10> <ESC>:set mouse=<CR>i
nmap <C-F11> :set mouse=a<CR>
imap <C-F11> <ESC>:set mouse=a<CR>i
"生成一個tags文件
nmap <F9> <Esc>:!ctags -R *<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""EnhanceCommentify設置
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"注釋
nmap <silent> <F3> ,x
vmap <silent> <F3> ,x
imap <silent> <F3> ,x
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Autocommands
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Switch to current dir
map <leader>cd :cd %:p:h<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General Abbrevs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"My information
iab xdate <c-r>=strftime("%d/%m/%y %H:%M:%S")<cr>
iab xname ChenYong(chenyong@vorx.com.cn)
let g:HDL_Author = "ChenYong"
let g:HDL_Company = "Vorx Ltd.com"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Indent
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Auto indent
set autoindent
"Smart indet
set smartindent
"C-style indeting
set cindent
"Wrap lines
set wrap
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" markbrowser setting
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nmap <silent> <leader>mk :MarksBrowser<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 獲取當前路徑,將$home_vim轉化為~
" 這里要在環境變量里設置:home_vim=D:\Program Files\Vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! CurDir()
let curdir = substitute(getcwd(), $home_vim, "~", "g")
return curdir
endfunction
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"設置Taglist
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 這項必須設定,否則出錯,配置taglist的ctags路徑
let Tlist_Ctags_Cmd = 'D:\ctags58\ctags.exe'
" 使用F8打開Taglist 有winmanager所以不設置此項
"nnoremap <silent> <F8> :TlistToggle<CR>
" 不同時顯示多個文件的 tag ,只顯示當前文件的
let Tlist_Show_One_File=1
" 如果 taglist 窗口是最后一個窗口,則退出 vim
let Tlist_Exit_OnlyWindow=1
"讓當前不被編輯的文件的方法列表自動折疊起來
let Tlist_File_Fold_Auto_Close=1
"把taglist窗口放在屏幕的右側,缺省在左側
let Tlist_Use_Right_Window=1
"顯示taglist菜單
let Tlist_Show_Menu=1
"let Tlist_Max_Submenu_Items=
"let Tlist_Max_Tag_Length=
"缺省情況下,雙擊一個 tag,跳到該 tag 定義的位置,如果你想單擊 tag 就跳轉
"let Tlist_Use_SingleClick=1
"啟動vim自動打開taglist
"let Tlist_Auto_Open=1
"選擇了tag后自動關閉taglist窗口
"let Tlist_Close_On_Select=1
"打開taglist焦點設置在taglist窗口中
"let Tlist_GainFocus_On_ToggleOpen=1
"taglist始終解析文件中的tag,不管taglist窗口有沒有打開
"let Tlist_Process_File_Always=1
"taglist窗口寬度
"let Tlist_WinWidth=25
"taglist窗口高度
"let Tlist_WinHeight=25
"窗口橫向顯示
"let Tlist_Use_Horiz_Window=1
"設置tags文件路徑 總報錯 不知道是什么錯
"set tags=D:\Program Files\Vim\vim72\tags
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"default
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set diffexpr=MyDiff()
function! MyDiff()
let opt = '-a --binary '
if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
let arg1 = v:fname_in
if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let eq = ''
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
let cmd = '""' . $VIMRUNTIME . '\diff"'
let eq = '"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction
""""""""""""""""""""""""""""""
" netrw setting瀏覽器
""""""""""""""""""""""""""""""
"let g:netrw_winsize = 30
"nmap <silent> <leader>fe :Sexplore!<cr>
nmap <silent> <leader>fe :Explore!<cr>
"""""""""""""""""""""""""""""""
"" winManager setting
"""""""""""""""""""""""""""""""
"設置界面分割
"let g:winManagerWindowLayout = "BufExplorer,FileExplorer|TagList"
"let g:winManagerWindowLayout = "TagList|FileExplorer,BufExplorer"
let g:winManagerWindowLayout='NERDTree|TagList,BufExplorer'
"let g:winManagerWindowLayout='Mark|TagList'
"在進入vim時自動打開winmanager
let g:AutoOpenWinManager = 1
"設置winmanager的寬度,默認為25
let g:winManagerWidth = 30
"定義打開關閉winmanager按鍵
"nmap <silent> <F8> :WMToggle<cr><C-W>h
nmap <silent> <F8> :WMToggle<cr>
""""""""""""""""""""""""""""""""""""""""""""""
"hdl_plugin
""""""""""""""""""""""""""""""""""""""""""""""
nmap <silent>va :ProBuild<CR>
nmap <silent>vin :AddInfo<CR>
nmap <silent>vc :Acontent<CR>
nmap <silent>ve :VhdlEntity<CR>
nmap <silent>vf :AddFsdb<CR>
"Component窗口=1設置右側,=0垂直左側,不設置則默認為水平分割
"let g:RightB_Commponent = 0
""""""""""""""""""""""""""""""""""""""""""""""
""omni completion
""""""""""""""""""""""""""""""""""""""""""""""
set ofu=syntaxcomplete#Complete
imap <silent><M-`> <C-X><C-O>
""""""""""""""""""""""""""""""""""""""""""""""
" 匹配
""""""""""""""""""""""""""""""""""""""""""""""
let g:loaded_matchit = 1
""""""""""""""""""""""""""""""""""""""""""""""
"calendar setting
""""""""""""""""""""""""""""""""""""""""""""""
let g:calendar_diary = "F:/diary"
""""""""""""""""""""""""""""""""""""""""""""""
" v模式下選擇查找
""""""""""""""""""""""""""""""""""""""""""""""
" From an idea by Michael Naumann
function! VisualSearch(direction) range
let l:saved_reg = @"
execute "normal! vgvy"
let l:pattern = escape(@", '\\/.*$^~[]')
let l:pattern = substitute(l:pattern, "\n$", "", "")
if a:direction == 'b'
execute "normal ?" . l:pattern . "^M"
else
execute "normal /" . l:pattern . "^M"
endif
let @/ = l:pattern
let @" = l:saved_reg
endfunction
"Basically you press * or # to search for the current selection !! Really useful
vnoremap <silent> * :call VisualSearch('f')<CR>
vnoremap <silent> # :call VisualSearch('b')<CR>
au BufEnter *.txt setlocal ft=txt
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

