Skip to content

Instantly share code, notes, and snippets.

@abrasumente233
Created February 6, 2021 14:12
Show Gist options
  • Save abrasumente233/4c8467bd9990e8c7f37098980a39600b to your computer and use it in GitHub Desktop.
Save abrasumente233/4c8467bd9990e8c7f37098980a39600b to your computer and use it in GitHub Desktop.
.vimrc
set guifont=Fira\ Code:h11:cANSI
set guifontwide=Microsoft\ Yahei\ Mono:h12
set pythonthreedll=python38.dll
set encoding=utf-8
set fileencodings=utf-8,chinese,latin-1,gbk,gb18030,gk2312
set fileencoding=utf-8
" set foldmethod=indent
source $VIMRUNTIME/delmenu.vim
source $VIMRUNTIME/menu.vim
" set shell=powershell.exe
" set shellxquote=
" let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command '
" let &shellquote = ''
" let &shellpipe = '| Out-File -Encoding UTF8 %s'
" let &shellredir = '| Out-File -Encoding UTF8 %s'
language messages zh_CN.utf-8
"" basic settings
" For everything else, use a tab width of 4 space chars.
" noremap <Up> <NOP>
" noremap <Down> <NOP>
" noremap <Left> <NOP>
" noremap <Right> <NOP>
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that Vim will interpret it
" to be having a width of 4.
set shiftwidth=4 " Indents will have a width of 4. set softtabstop=4 "
"Sets the number of columns for a TAB.
set expandtab
set incsearch
set hlsearch
set laststatus=2
set ignorecase
set smartcase
set nocompatible
set number
set guioptions+=a
let mapleader = "\<Space>"
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'kana/vim-textobj-user'
Plug 'sgur/vim-textobj-parameter'
Plug 'jdsimcoe/abstract.vim'
Plug 'AlessandroYorba/Despacio'
Plug 'owickstrom/vim-colors-paramount'
Plug 'andreypopp/vim-colors-plain'
Plug 'agudulin/vim-colors-alabaster'
Plug 'davidosomething/vim-colors-meh'
Plug 'jonathanfilip/vim-lucius'
Plug 'rakr/vim-one'
Plug 'rakr/vim-two-firewatch'
Plug 'junegunn/vim-easy-align'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
" Plug 'dense-analysis/ale'
Plug 'mattn/emmet-vim'
Plug 'skywind3000/asyncrun.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'justinmk/vim-dirvish'
Plug 'tommcdo/vim-exchange'
Plug 'ycm-core/YouCompleteMe'
call plug#end()
" colorscheme
colorscheme meh
set background=dark
" build hotkeys, asyncrun
let g:asyncrun_open = 6
let g:asyncrun_encs = 'gbk'
nmap <F10> :call asyncrun#quickfix_toggle(6)<CR>
nmap <silent> <F6> :AsyncRun g++ -Wall -O2 "$(VIM_FILEPATH)" -o "$(VIM_FILEDIR)/$(VIM_FILENOEXT)" <CR>
nmap <silent> <F5> :AsyncRun $(VIM_FILEDIR)/$(VIM_FILENOEXT) <CR>
nmap <silent> <A-m> :AsyncRun -mode=term -pos=external <cwd>/compile.bat<CR>
" easy align mapping
xmap ga <Plug>(EasyAlign)
nmap ga <Plug>(EasyAlign)
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Use filetype detection and file-based automatic indenting.
filetype plugin indent on
" Use actual tab chars in Makefiles.
autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab
endif
" emmet
let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
imap <C-Q> <C-Y>,
" fzf
map <silent> <C-P> :Files<CR>
map <silent> <C-N> :History<CR>
map <silent> <A-P> :Buffers<CR>
" vim hotkeys
" reload config, capital for plug install too
map <Leader>r :source ~/.vimrc<CR>
map <Leader>R <Leader>r:PlugInstall<CR><Leader>r
" black hole register
nmap <Leader>b "_
" window nav
map <C-H> <C-W>h
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-L> <C-W>l
nmap <C-Tab> <C-W>w
" open explore to the path of current file
nmap <F11> :silent !start explorer /select,%:p<CR>
" open file tree
nmap <A--> <C-W>v<C-W>l-
nmap <C-_> <C-W>s<C-W>j-
nmap <Leader>- :vsp .<CR>
" debug c++ program using devcpp
autocmd FileType cpp nmap <F7> :silent !devcpp %:p<CR>
" clang-format
map <silent> <C-K> :py3f C:\Program Files\LLVM\share\clang\clang-format-py3.py<cr>
imap <silent> <C-K> <c-o>:py3f C:\Program Files\LLVM\share\clang\clang-format-py3.py<cr>
" work around vim's py3 deprecated warnings
silent! py3 pass
" nmap <C-v> "+gp
vmap <C-c> "+y
" auto-closing
" inoremap {; {<CR>}<C-c>O
" inoremap ( ()<C-c>i
" inoremap [ []<C-c>i
" inoremap ' ''<C-c>i
" inoremap " ""<C-c>i
" YCM "
" let g:ycm_global_ycm_extra_conf = "~/.vim/ycm_extra_conf.py"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment