" ------ Basic Setting ------
set ts=4 set shiftwidth=4 set softtabstop=4 set number set expandtab set autoindent set noeb set scrolloff=5 set t_Co=256 set wildmenu set smartcase set cursorline set encoding=utf-8
" ------ Theme Setting ------ set background=dark
hi cursorLine cterm=underline ctermbg=darkred ctermfg=white set relativenumber
" locate the point at last time; And set 'sudo chmod 777 ~/.viminfo' au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
" airline setting " let g:airline#extensions#tabline#formatter = 'default' " let g:airline#extensions#tabline#enabled = 1 " let g:airline_theme=''
" powerline symbols let g:airline_left_sep = '' let g:airline_left_alt_sep = '' let g:airline_right_sep = '' let g:airline_right_alt_sep = ''
" colorscheme monokai " runtime plugged/material.vim/colors/material.vim runtime plugged/gruvbox/colors/gruvbox.vim " runtime colors/monokai.vim/colors/monokai.vim " runtime plugged/vim-snazzy/colors/snazzy.vim
" material theme
" if (has('termguicolors')) " set termguicolors " endif let g:material_theme_style = 'default'
set laststatus=2 set noshowmode " let g:lightline = { " \ 'colorscheme': 'material_vim', " \ 'active': { " \ 'left': [ [ 'mode', 'paste' ], " \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] " \ }, " \ 'component_function': { " \ 'gitbranch': 'FugitiveHead' " \ }, " \ } " ------------------------------------------------------------------------
" ------ Plug Index ------ :call plug#begin('~/.vim/plugged')
" airline Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' "Plug 'itchyny/lightline.vim'
Plug 'skywind3000/vim-terminal-help'
" vim-themes
Plug 'junegunn/seoul256.vim' Plug 'kaicataldo/material.vim', { 'branch': 'main' } Plug 'hzchirs/vim-material' Plug 'arcticicestudio/nord-vim' Plug 'rakr/vim-one' Plug 'morhetz/gruvbox'
Plug 'preservim/nerdcommenter' Plug 'connorholyday/vim-snazzy' Plug 'jiangmiao/auto-pairs' Plug 'rhysd/vim-clang-format' Plug 'artur-shaik/vim-javacomplete2' " File navigation Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'Xuyuanp/nerdtree-git-plugin'
" Find Plug 'Yggdroot/LeaderF', { 'do': './install.sh' }
"Taglist Plug 'majutsushi/tagbar', { 'on': 'TagbarOpenAutoClose' }
" Undo Tree Plug 'mbbill/undotree/'
" Markdown Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install_sync() }, 'for' :['markdown', 'vim-plug'] } Plug 'dhruvasagar/vim-table-mode', { 'on': 'TableModeToggle' } Plug 'iamcco/mathjax-support-for-mkdp' Plug 'vimwiki/vimwiki'
" Bookmarks Plug 'kshenoy/vim-signature'
" c++ hightlight Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
"Coc Plug 'neoclide/coc.nvim', {'branch': 'release'}
"cmake Plug 'cdelledonne/vim-cmake'
call plug#end()
" ------ Coc-setting ------
let g:coc_global_extensions = ['coc-clangd', 'coc-vimlsp' ]
" ------ 让tab可以补全 ------ inoremap <silent><expr> <TAB> \ pumvisible() ? "\<C-n>" : \ "\<TAB>" inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" ------ Replace Esc ------ inoremap jj <ESC> vnoremap jj <ESC>
" ------ 方向键 ------ noremap i k noremap I 5k noremap K 5j noremap k j noremap j h noremap h i noremap J 5h noremap L 5l noremap <C-K> 15j noremap <C-I> 15k noremap <C-J> 15h noremap <C-L> 15l
noremap @si 30k noremap @sk 30j noremap @sj 30h noremap @sl 30l
noremap H I
" ------ 括号自动对应 ------ inoremap ( ()<ESC>i inoremap ) <c-r>=ClosePair(')')<CR> inoremap { {<CR>}<ESC>O inoremap } <c-r>=ClosePair('}')<CR> inoremap [ []<ESC>i inoremap ] <c-r>=ClosePair(']')<CR> inoremap ' ''<ESC>i
" ------ 删除括号时自动删除对应的另一半 ------ function! ClosePair(char) if getline('.')[col('.') - 1] == a:char return "\<Right>" else return a:char endif endfunction
" ------ Other setting ------ " j+i jump out brace imap ji jjla " leader key let mapleader="\<space>" " setting backspace to reindent set backspace=indent,eol,start
" ------ Exit, Write, Save, Resource ------ map Q :q!<CR> map W :w<CR> map S :wq<CR> map R :source ~/.vim/vimrc<CR>
" ------ 分屏与标签页 ------
map sl :set splitright<CR>:vsplit<CR> map sj :set nosplitright<CR>:vsplit<CR> map si :set nosplitbelow<CR>:split<CR> map sk :set splitbelow<CR>:split<CR>
"分屏切换 " 表示alt键 但不可直接键入 需在insert模式下,按ctrl+v 再按要映射的快捷键 map l <C-w>l map i <C-w>k map j <C-w>h map k <C-w>j
map sv <C-w>t<C-w>H map sh <C-w>t<C-w>K
"分屏大小 map I :res +5<CR> map K :res -5<CR> map L :vertical resize-5<CR> map J :vertical resize+5<CR>
"标签页 map tn :tabe<CR> map tj :-tabnext<CR> map tl :+tabnext<CR>
" ------ terminal ------ nnoremap <leader>t :terminal<CR>
" ------ NERDTree configuration ------ nnoremap n :NERDTreeFocus<CR> nnoremap <C-n> :NERDTree<CR> nnoremap <C-t> :NERDTreeToggle<CR> nnoremap <C-f> :NERDTreeFind<CR>
let NERDTreeMapOpenSplit='h' let NERDTreeMapJumpFirstChild='F' let NERDTreeMapToggleHidden="H"
" ------ clang-format ------ nnoremap cf :ClangFormat<CR> nnoremap <C-d> :CocCommand clangd.switchSourceHeader<CR>
" ------ markdown preview ------ nmap <C-s> <Plug>MarkdownPreview nmap <M-s> <Plug>MarkdownPreviewStop nmap <C-p> <Plug>MarkdownPreviewToggle
|