-
-
Save yongjulejule/43d32ce0d5ba235e4784fb528e8da8e3 to your computer and use it in GitHub Desktop.
init.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin('~/.vim/plugged') | |
Plug 'tpope/vim-fugitive' "use git things in vim | |
Plug 'tpope/vim-sensible' "required | |
Plug 'preservim/nerdtree' "filetree | |
Plug 'dense-analysis/ale' "syntax check | |
Plug 'preservim/nerdcommenter' "comment | |
Plug 'nathanaelkane/vim-indent-guides' "highlight indent lines | |
Plug 'vim-airline/vim-airline' "fancy status bar | |
Plug 'vim-airline/vim-airline-themes' "add airline theme | |
Plug 'airblade/vim-gitgutter' "see code changes | |
"Plug 'junegunn/fzf.vim' "file manager | |
Plug 'ctrlpvim/ctrlp.vim' "file manager | |
Plug 'mg979/vim-visual-multi', {'branch': 'master'} "multiple selection-updated | |
Plug 'Raimondi/delimitMate' "auto bracket | |
Plug 'terryma/vim-smooth-scroll' "smooth scroll | |
Plug 'tpope/vim-surround' "smart quotes | |
Plug 'pbondoer/vim-42header' "42header | |
Plug 'easymotion/vim-easymotion' "easy to deal with words | |
Plug 'edkolev/promptline.vim' "shell inside VIM | |
Plug 'vim-scripts/WhiteWash' "highlights white spaces | |
Plug 'crusoexia/vim-monokai' | |
Plug 'mattn/emmet-vim' | |
Plug 'octol/vim-cpp-enhanced-highlight' "유저 함수 하이라이팅 | |
Plug 'ryanoasis/vim-devicons' "nerdtree icons | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
"Plug 'wfxr/minimap.vim' "minimap | |
"Plug 'luochen1990/rainbow' "🌈 괄호 | |
Plug 'junegunn/rainbow_parentheses.vim' | |
call plug#end() | |
set nocompatible | |
set hlsearch | |
set number | |
set cindent | |
set autoindent | |
set smartindent | |
set tabstop=2 | |
set shiftwidth=2 | |
set mouse=a | |
set cursorline | |
set syntax=1 | |
set encoding=utf8 | |
set termguicolors | |
set scrolloff=999 | |
"cursor error fix | |
set guicursor=n-v-c-i:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,sm:block-blinkwait175-blinkoff150-blinkon175 | |
let g:coc_disable_transparent_cursor = 1 | |
"autocmd FileType vim,c,cpp,h,hpp | RainbowParentheses | |
" 자동 ctags | |
au BufWritePost *.c,*.cpp,*.h silent! !ctags -R & | |
"Easymotion mappings | |
let g:EasyMotion_do_mapping = 0 " Disable default mappings | |
" Jump to anywhere you want with minimal keystrokes, with just one key binding. | |
" `s{char}{label}` | |
nmap f <Plug>(easymotion-overwin-f) | |
" or | |
" `s{char}{char}{label}` | |
" Need one more keystroke, but on average, it may be more comfortable. | |
nmap F <Plug>(easymotion-overwin-f2) | |
" Turn on case-insensitive feature | |
let g:EasyMotion_smartcase = 1 | |
" JK motions: Line motions | |
map <Leader>j <Plug>(easymotion-j) | |
map <Leader>k <Plug>(easymotion-k) | |
" Move to line | |
map <Leader>L <Plug>(easymotion-bd-jk) | |
nmap <Leader>L <Plug>(easymotion-overwin-line) | |
" Move to word | |
map <Leader>w <Plug>(easymotion-bd-w) | |
nmap <Leader>w <Plug>(easymotion-overwin-w) | |
"airline setting | |
let g:airline_theme='bubblegum' | |
" Smarter tab line 활성화: 모든 파일 버퍼 출력 | |
let g:airline#extensions#tabline#enabled = 1 | |
" Tab line 구분자 '|' 로 설정 | |
let g:airline#extensions#tabline#left_sep = ' ' | |
let g:airline#extensions#tabline#left_alt_sep = '|' | |
" Tab line 에 파일명만 출력되도록 설정 | |
let g:airline#extensions#tabline#formatter = 'unique_tail' | |
" Powerline-font 활성화 let g:airline_powerline_fonts = 1 | |
nnoremap <C-h> :bp<Enter> "이전 버퍼로 이동 | |
nnoremap <C-l> :bn<Enter> "다음 버퍼로 이동 | |
nnoremap <C-q> :bd<Enter> "다음 버퍼로 이동 | |
nnoremap <Leader>1 :z% | |
"nnoremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar> :let @/=_s<Bar><CR> | |
"for nerd-tree | |
"autocmd vimenter * NERDTree "automatically start | |
map <C-b> :NERDTreeToggle<CR> "open NERDTree with ctrl+b | |
nmap <Leader>r :NERDTreeFocus<cr>R<c-w><c-p> | |
"for nerd-commenter | |
let g:NERDSpaceDelims = 1 " Add spaces after comment delimiters by default | |
let g:NERDCompactSexyComs = 1 " Use compact syntax for prettified multi-line comments | |
let g:NERDCommentEmptyLines = 1 " Allow commenting and inverting empty lines (useful when commenting a region) | |
let g:NERDTrimTrailingWhitespace = 1 " Enable trimming of trailing whitespace when uncommenting | |
"for syntastic tool | |
let g:ale_sign_column_always = 1 | |
"for vim-indent-guide | |
let g:indent_guides_enable_on_vim_startup = 1 | |
let g:indent_guides_auto_colors = 0 | |
"for ctrlp | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip | |
let g:ctrlp_custom_ignore = { | |
\ 'dir': '\.git$\|public$\|log$\|tmp$\|vendor$', | |
\ 'file': '\v\.(exe|so|dll)$' | |
\ } | |
"for simplefold | |
"============== 주석 매크로 ============== | |
" func! CmtOn() "주석 on | |
" exe "'<,'>norm i//" | |
" endfunc | |
" | |
" func! CmtOff() "주석 off | |
" exe "'<,'>norm 2x" | |
" endfunc | |
"vmap <C-_> <esc>:call CmtOn() <cr> | |
"vmap <C-x> <esc>:call CmtOff() <cr> | |
"nmap <C-_> <esc>v:call CmtOn() <cr> | |
"nmap <C-x> <esc>v:call CmtOff() <cr> | |
nmap <space> zf% | |
nmap <space><CR> zd | |
tnoremap <Esc> <C-\><C-n> | |
" COC SETTING | |
" if hidden is not set, TextEdit might fail. | |
set hidden | |
" Better display for messages | |
set cmdheight=2 | |
" README.md Setting | |
" Some servers have issues with backup files, see #649 | |
set nobackup | |
set nowritebackup | |
" You will have bad experience for diagnostic messages when it's default 4000. | |
set updatetime=300 | |
" don't give |ins-completion-menu| messages. | |
set shortmess+=c | |
" always show signcolumns | |
set signcolumn=yes | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ coc#pum#visible() ? coc#pum#next(1): | |
\ CheckBackspace() ? "\<Tab>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>" | |
" Make <CR> to accept selected completion item or notify coc.nvim to format | |
" <C-g>u breaks current undo, please make your own choice. | |
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
function! CheckBackspace() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Use <c-space> to trigger completion. | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Use `[g` and `]g` to navigate diagnostics | |
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" Remap keys for gotos | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Use K to show documentation in preview window. | |
nnoremap <silent> K :call ShowDocumentation()<CR> | |
function! ShowDocumentation() | |
if CocAction('hasProvider', 'hover') | |
call CocActionAsync('doHover') | |
else | |
call feedkeys('K', 'in') | |
endif | |
endfunction | |
" Highlight symbol under cursor on CursorHold | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Remap for rename current word | |
nmap <leader>rn <Plug>(coc-rename) | |
" Remap for format selected region | |
xmap <leader>M <Plug>(coc-format-selected) | |
nmap <leader>M <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
" Applying codeAction to the selected region. | |
" Example: `<leader>aap` for current paragraph | |
xmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap keys for applying codeAction to the current buffer. | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Apply AutoFix to problem on the current line. | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Run the Code Lens action on the current line. | |
nmap <leader>cl <Plug>(coc-codelens-action) | |
" Map function and class text objects | |
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. | |
xmap if <Plug>(coc-funcobj-i) | |
omap if <Plug>(coc-funcobj-i) | |
xmap af <Plug>(coc-funcobj-a) | |
omap af <Plug>(coc-funcobj-a) | |
xmap ic <Plug>(coc-classobj-i) | |
omap ic <Plug>(coc-classobj-i) | |
xmap ac <Plug>(coc-classobj-a) | |
omap ac <Plug>(coc-classobj-a) | |
" Remap <C-f> and <C-b> for scroll float windows/popups. | |
"if has('nvim-0.4.0') || has('patch-8.2.0750') | |
" nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | |
" nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | |
" inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>" | |
" inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>" | |
" vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" | |
" vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" | |
"endif | |
" Use CTRL-S for selections ranges. | |
" Requires 'textDocument/selectionRange' support of language server. | |
nmap <silent> <C-s> <Plug>(coc-range-select) | |
xmap <silent> <C-s> <Plug>(coc-range-select) | |
" Use `:Format` to format current buffer | |
command! -nargs=0 Format :call CocAction('format') | |
" Use `:Fold` to fold current buffer | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
" use `:OR` for organize import of current buffer | |
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') | |
" Add (Neo)Vim's native statusline support. | |
" NOTE: Please see `:h coc-status` for integrations with external plugins that | |
" provide custom statusline: lightline.vim, vim-airline. | |
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} | |
" Using CocList | |
" Show all diagnostics | |
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr> | |
" Manage extensions | |
nnoremap <silent> <space>e :<C-u>CocList extensions<cr> | |
" Show commands | |
nnoremap <silent> <space>c :<C-u>CocList commands<cr> | |
" Find symbol of current document | |
nnoremap <silent> <space>o :<C-u>CocList outline<cr> | |
" Search workspace symbols | |
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr> | |
" Do default action for next item. | |
nnoremap <silent> <space>j :<C-u>CocNext<CR> | |
" Do default action for previous item. | |
nnoremap <silent> <space>k :<C-u>CocPrev<CR> | |
" Resume latest coc list | |
nnoremap <silent> <space>p :<C-u>CocListResume<CR> | |
filetype plugin indent on | |
" clang format | |
function! Formatonsave() | |
let l:formatdiff = 1 | |
py3f /opt/homebrew/opt/clang-format/share/clang/clang-format.py | |
endfunction | |
autocmd BufWritePre *.h,*.cc,*.cpp call Formatonsave() | |
"Custom Color set | |
" | |
:match TODO /NOTE/ | |
colorscheme monokai | |
highlight Comment term=bold ctermfg=103 guifg=#c6abff | |
highlight VM_Mono guibg=gray | |
highlight Normal guibg=black | |
highlight Linenr guibg=black term=italic | |
highlight IndentGuidesOdd ctermbg=235 guibg=#242424 | |
highlight IndentGuidesEven ctermbg=233 guibg=#404040 | |
highlight NERDTreeFile ctermfg=140 | |
highlight NERDTreeExecFile ctermfg=146 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requirement
nvim
vim-plug
clangd
node.js
ctags