加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
_vimrc 7.10 KB
一键复制 编辑 原始数据 按行查看 历史
Partidramon 提交于 2023-06-23 15:47 . taks.ini
" Vim with all enhancements
source $VIMRUNTIME/vimrc_example.vim
" Use the internal diff if available.
" Otherwise use the special 'diffexpr' for Windows.
if &diffopt !~# 'internal'
set diffexpr=MyDiff()
endif
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 arg1 = substitute(arg1, '!', '\!', 'g')
let arg2 = v:fname_new
if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
let arg2 = substitute(arg2, '!', '\!', 'g')
let arg3 = v:fname_out
if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
let arg3 = substitute(arg3, '!', '\!', 'g')
if $VIMRUNTIME =~ ' '
if &sh =~ '\<cmd'
if empty(&shellxquote)
let l:shxq_sav = ''
set shellxquote&
endif
let cmd = '"' . $VIMRUNTIME . '\diff"'
else
let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
endif
else
let cmd = $VIMRUNTIME . '\diff'
endif
let cmd = substitute(cmd, '!', '\!', 'g')
silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3
if exists('l:shxq_sav')
let &shellxquote=l:shxq_sav
endif
endfunction
" HotKey
" ¼üÅÌÉèÖÃ
"====================
"±£´æ
noremap <C-s> :w<CR>
noremap! <C-s> <ESC>:w<CR>
"±£´æ²¢Í˳ö
noremap <C-q> :q<CR>
noremap! <C-q> <ESC>:q<CR>
"È«Ñ¡
noremap <C-A> ggVG
noremap! <C-A> <Esc>ggVG
"Õ³Ìù
noremap <C-v> p
"¹Ø±Õbuff
noremap bd :bdelete<CR>
"Õ³Ìù¿ª¹Ø
set pastetoggle=<F8>
"leader°´¼ü
let mapleader='\'
" Commons Setting
" ¹«¹²ÅäÖÃ
"====================
" Encode
" ±àÂë
" ÎļþÖÐÎÄÂÒÂë
set encoding=utf-8
set fileencodings=utf-8,gbk,gb19030,gbk2112
language message zh_CN.utf-8
" ²Ëµ¥ÂÒÂë
source $VIMRUNTIME\delmenu.vim
source $VIMRUNTIME\menu.vim
" UI
" ½çÃæÉèÖÃ
set ruler
set cursorline
set cursorcolumn
set number
syntax on
set showmode
set guioptions-=r
set guioptions-=L
set guioptions-=b
" File open
cd F:\Project\
" Search and Replace
" ËÑË÷ºÍÌæ»»
set ignorecase "ËÑË÷ºöÂÔ´óСд
set hlsearch "ËÑË÷Öð×Ö·û¸ßÁÁ
set incsearch "×Ô¶¯¸ú½ø
set gdefault "ÐÐÄÚÌæ»»
" Backup, swap and undo
" ±¸·Ý¡¢ÁÙʱºÍÀúÊ·Îļþ
set history=10000
set undofile
set undodir=~/.vim/undo/
set noswapfile
set backupdir=~/.vim/backup/
set backup
set autoread
" Indent and Tab
" Ëõ½øºÍ»»ÐÐ
set autoindent " ×Ô¶¯Ëõ½ø
set cindent
set tabstop=4 " Tab¼üµÄ¿í¶È
set softtabstop=4 " ͳһËõ½øΪ4
set shiftwidth=4
set noexpandtab " ²»ÒªÓÿոñ´úÌæÖƱí·û
set smarttab " ÔÚÐкͶοªÊ¼´¦Ê¹ÓÃÖƱí
set linespace=0 " Ðмä¾àµÄÏñËØ
" Optirations
" ²Ù×÷·½Ê½
set confirm " δ±£´æ¡¢Ö»¶ÁÈ·ÈÏ
set nocompatible " vim¼üÅÌģʽ
" ʹ»Ø¸ñ¼ü£¨backspace£©Õý³£´¦Àíindent, eol, startµÈ
set backspace=2
" ÔÊÐíbackspaceºÍ¹â±ê¼ü¿çÔ½Ðб߽ç
set whichwrap+=<,>,h,l
" ¿ÉÒÔÔÚbufferµÄÈκεط½Ê¹ÓÃÊó±ê£¨ÀàËÆofficeÖÐÔÚ¹¤×÷ÇøË«»÷Êó±ê¶¨Î»£©
set mouse=a
" ²å¼þ¹ÜÀí
"====================
filetype on
filetype plugin on
filetype indent on
call plug#begin('~/.vim/plugged/')
" ÖÐÎÄÎĵµ
Plug 'https://gitee.com/partidramon/vimcdoc.git'
" Ŀ¼Ê÷
Plug 'https://gitee.com/partidramon/nerdtree.git'
" ±êÇ©Áбí
Plug 'https://gitee.com/partidramon/tagbar.git'
" buffÀ¸ºÍ״̬À¸
Plug 'https://gitee.com/partidramon/vim-airline.git'
Plug 'https://gitee.com/partidramon/vim-airline-themes.git'
" ¶àÐÐ×¢ÊÍ
Plug 'https://gitee.com/partidramon/nerdcommenter.git'
" Ëõ½øÏß
Plug 'https://gitee.com/partidramon/indentLine.git'
" ×Ô¶¯Åä¶Ô
Plug 'https://gitee.com/partidramon/auto-pairs.git'
" ²ÊºçÀ¨ºÅ
Plug 'https://gitee.com/partidramon/rainbow.git'
" ×Ô¶¯²¹È«
Plug 'https://gitee.com/ovoll/coc.nvim.git'
" ÈÎÎñ¹ÜÀí
Plug 'https://gitee.com/partidramon/asynctasks.vim.git'
Plug 'https://gitee.com/partidramon/asyncrun.vim.git'
call plug#end()
" Ŀ¼Ê÷
"====================
map <F2> :NERDTreeToggle<CR>
map! <F2> <ESC>:NERDTreeToggle<CR>
let NERDTreeWidth = 20 " ÉèÖÃĿ¼Ê÷´°¿Ú¿í¶È
let NERDTreeHighlightCursorline = 1 " ¸ßÁÁµ±Ç°ÐÐ
let NERDTreeShowLineNumbers = 1 " ÏÔʾÐкÅ
let NERDTreeShowHidden = 1 " ÏÔʾÒþ²ØÎļþ
" ±êÇ©Áбí
"====================
set tags=tags;
set autochdir " ×Ô¶¯Çл»¹¤×÷Ŀ¼
map <F3> :TagbarToggle<CR>
map! <F3> <ESC>:TagbarToggle<CR>
let g:tagbar_ctags_bin = 'ctags' " ±êÇ©ÒÀÀµctags
let g:tagbar_width = 20 " ¿í¶ÈΪ30ÁУ¬Ä¬ÈÏ30
" buffÀ¸ºÍ״̬À¸
"====================
" ÉèÖÃ״̬À¸
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_alt_sep = '|'
let g:airline#extensions#tabline#formatter = 'default'
let g:airline_theme = 'desertink' " Ö÷Ìâ
let g:airline#extensions#keymap#enabled = 1
" tablineÖÐbufferÏÔʾ±àºÅ
let g:airline#extensions#tabline#buffer_nr_show = 0
let g:airline#extensions#tabline#buffer_idx_mode = 1
let g:airline#extensions#tabline#buffer_idx_format = {
\'0': '0 ',
\'1': '1 ',
\'2': '2 ',
\'3': '3 ',
\'4': '4 ',
\'5': '5 ',
\'6': '6 ',
\'7': '7 ',
\'8': '8 ',
\'9': '9 '
\}
" ÉèÖÃÇл»tabµÄ¿ì½Ý¼ü <> + Çл»µ½µÚi¸ö tab
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
" ÉèÖÃÇл»tabµÄ¿ì½Ý¼ü <> + Çл»µ½Ç°Ò»¸ö tab
nmap <tab> <Plug>AirlineSelectPrevTab
" ÉèÖÃÇл»tabµÄ¿ì½Ý¼ü <> + Çл»µ½ºóÒ»¸ö tab
nmap <S+tab> <Plug>AirlineSelectNextTab
" ÐÞ¸ÄÁËһЩ¸öÈ˲»Ï²»¶µÄ×Ö·û
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols_ascii = 1
" Ëõ½øÏß
"====================
let g:indent_guides_guide_size = 1 " Ö¸¶¨¶ÔÆëÏߵijߴç
let g:indent_guides_start_level = 2 " ´ÓµÚ¶þ²ã¿ªÊ¼¿ÉÊÓ»¯ÏÔʾËõ½ø""
" ×Ô¶¯²¹È«
"====================
" ×Ô¶¯Òì²½Éú³Éctags
hi Pmenu ctermfg=white ctermbg=black guibg=black guifg=white
hi PmenuSel ctermfg=white ctermbg=grey guifg=white guibg=grey
" Use <Tab> and <S-Tab> to navigate the completion list
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
"ÈÎÎñ¹ÜÀí
"====================
let g:asyncrun_open = 10
noremap <silent><f5> :AsyncRun -mode=term -pos=external
let g:asyncrun_rootmarks = ['.git', '.svn', '.root', '.project', '.hg']
noremap <silent><f7> :AsyncTask project-run<cr>
noremap <silent><f6> :AsyncTask project-build<cr>
noremap <silent><F4> :AsyncTask file-build<cr>
noremap <silent><F5> :AsyncTask file-run<cr>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化