From f11ad3166334b275b1a491c439080c8f6b0be637 Mon Sep 17 00:00:00 2001 From: Jisu Kim Date: Sat, 24 Jul 2021 02:40:01 +0900 Subject: [PATCH] =?UTF-8?q?neovim=EC=9C=BC=EB=A1=9C=20=EB=8B=A4=EC=8B=9C?= =?UTF-8?q?=20=EB=8F=8C=EC=95=84=EA=B0=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- darwin/alacritty/alacritty.yml | 15 ++- darwin/bin/ufetch | 6 +- nvim/coc-settings.json | 3 + nvim/init.vim | 166 ++++++++++++++++++--------------- omz/vbalien.zsh-theme | 2 +- tmux.conf | 7 +- vimrc | 75 ++++++++++++--- zshrc | 1 + 8 files changed, 176 insertions(+), 99 deletions(-) create mode 100644 nvim/coc-settings.json diff --git a/darwin/alacritty/alacritty.yml b/darwin/alacritty/alacritty.yml index d57e933..2ed7444 100644 --- a/darwin/alacritty/alacritty.yml +++ b/darwin/alacritty/alacritty.yml @@ -1,10 +1,10 @@ import: - - ~/.config/alacritty/base16-tomorrow.yml + - ~/.config/alacritty/dracula.yml window: dimensions: columns: 80 - lines: 25 + lines: 24 padding: x: 6 @@ -15,5 +15,12 @@ font: family: TerminessTTF Nerd Font size: 16.0 -colors: -background_opacity: 1 + +background_opacity: 0.96 + +key_bindings: + - { key: Period, mods: Command, chars: "\\f" } + - { key: P, mods: Command, chars: "\\p" } + +env: + TERM: screen-256color diff --git a/darwin/bin/ufetch b/darwin/bin/ufetch index 438d5f0..c8e7f77 100755 --- a/darwin/bin/ufetch +++ b/darwin/bin/ufetch @@ -57,10 +57,10 @@ if [ -x "$(command -v tput)" ]; then fi # you can change these -lc="${reset}${bold}${blue}" # labels -nc="${reset}${bold}${blue}" # user and hostname +lc="${reset}${bold}${magenta}" # labels +nc="${reset}${bold}${magenta}" # user and hostname ic="${reset}" # info -c0="${reset}${blue}" # first color +c0="${reset}${magenta}" # first color ## OUTPUT diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json new file mode 100644 index 0000000..036dbe9 --- /dev/null +++ b/nvim/coc-settings.json @@ -0,0 +1,3 @@ +{ + "coc.preferences.formatOnSaveFiletypes": ["*"] +} diff --git a/nvim/init.vim b/nvim/init.vim index b9c8921..7863394 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,17 +1,15 @@ -call plug#begin('~/.local/share/nvim/plugged') - -" Prettier -Plug 'prettier/vim-prettier', { - \ 'do': 'yarn install', - \ 'for': ['javascript', 'typescript', 'css', 'less', 'scss', 'json', 'graphql', 'markdown', 'vue', 'yaml', 'html'] } +call plug#begin(stdpath('data') . '/plugged') " 아이콘 폰트 사용 Plug 'ryanoasis/vim-devicons' + +" Start page +Plug 'mhinz/vim-startify' + " NERDTree -" NERDTree git -Plug 'preservim/nerdtree' -" NERDTree icon color -Plug 'tiagofumo/vim-nerdtree-syntax-highlight' +Plug 'preservim/nerdtree' | + \ Plug 'Xuyuanp/nerdtree-git-plugin' | + \ Plug 'tiagofumo/vim-nerdtree-syntax-highlight' " Restore Session Plug 'tpope/vim-obsession' @@ -24,14 +22,16 @@ Plug 'junegunn/fzf.vim' Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' -" 컬러 테마 -Plug 'tomasiser/vim-code-dark' -Plug 'NLKNguyen/papercolor-theme' -Plug 'scheakur/vim-scheakur' -Plug 'junegunn/seoul256.vim' +" color scheme theme +Plug 'dracula/vim', { 'as': 'dracula' } + +" automatic closing of quotes, parenthesis, brackets, etc. +Plug 'Raimondi/delimitMate' " Language Pack Plug 'sheerun/vim-polyglot' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'styled-components/vim-styled-components', { 'branch': 'main' } " indent 표시 Plug 'Yggdroot/indentLine' @@ -42,28 +42,12 @@ Plug 'wakatime/vim-wakatime' " git status Plug 'airblade/vim-gitgutter' -" Auto Complete -Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } -Plug 'Shougo/echodoc.vim' - -" LSP -Plug 'autozimu/LanguageClient-neovim', { - \ 'branch': 'next', - \ 'do': 'bash install.sh', - \ } - -Plug 'vim-scripts/SyntaxComplete' - -" TypeScript -Plug 'HerringtonDarkholme/yats.vim' -Plug 'mhartington/nvim-typescript', {'do': './install.sh'} -Plug 'Shougo/denite.nvim' - call plug#end() set smartindent -set backspace=2 +set autoindent set cindent +set backspace=2 set tabstop=2 set shiftwidth=2 set expandtab @@ -72,47 +56,59 @@ set ruler set title set hlsearch set cursorline -syntax on +syntax enable +set t_Co=256 +if (has("termguicolors")) + set termguicolors +endif -set clipboard+=unnamedplus +if has('nvim') + set clipboard+=unnamedplus +else + set clipboard=unnamed +end set laststatus=2 set shell=/bin/bash set fillchars+=vert:┃ set mouse=a + +if !has('nvim') + if has("mouse_sgr") + set ttymouse=sgr + else + set ttymouse=xterm2 + end +end + +lang ko_KR.UTF-8 set encoding=UTF-8 +" theme config +let g:dracula_italic = 0 +colorscheme dracula +hi Normal guibg=NONE ctermbg=NONE " 단축키 설정 nmap :FZF +nmap p :FZF nmap :NERDTreeToggle inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" - -" theme config -let g:PaperColor_Theme_Options = { - \ 'theme': { - \ 'default': { - \ 'transparent_background': 1 - \ } - \ } - \ } - -set background=light -colorscheme seoul256-light - -hi Normal guibg=NONE ctermbg=NONE -hi EndOfBuffer guibg=NONE ctermbg=NONE +" detect extension +autocmd BufNewFile,BufRead *.tsx set filetype=typescriptreact +autocmd BufNewFile,BufRead *.jsx set filetype=javascriptreact +autocmd BufNewFile,BufRead .eslintrc,.prettierrc,.parcelrc set filetype=json " devicons let g:WebDevIconsUnicodeDecorateFolderNodes = 1 let g:DevIconsEnableFoldersOpenClose = 1 " airline -let g:airline_theme = 'base16' +let g:airline_theme='dracula' let g:airline_powerline_fonts=0 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#tab_nr_type = 1 " tab number @@ -129,28 +125,52 @@ let g:cpp_class_decl_highlight = 1 let g:cpp_concepts_highlight = 1 let g:cpp_experimental_template_highlight = 1 -" LSP -let g:LanguageClient_serverCommands = { - \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'], - \ 'c': ['clangd'], - \ 'cpp': ['clangd'], - \ } -execute 'autocmd FileType ' - \ . join(keys(g:LanguageClient_serverCommands), ',') - \ . ' autocmd BufWritePre call LanguageClient#textDocument_formatting_sync()' - -" deoplete -let g:deoplete#enable_at_startup = 1 -inoremap pumvisible() ? "\" : "\" -inoremap pumvisible() ? "\" : "\" -set shortmess+=c -set completeopt-=preview - -" echodoc -let g:echodoc#enable_at_startup = 1 -let g:echodoc#type = 'floating' -highlight link EchoDocFloat Pmenu - " prettier let g:prettier#autoformat = 1 let g:prettier#autoformat_require_pragma = 0 + +" nerdtree +let g:NERDTreeWinPos = 'right' +let g:NERDTreeShowHidden=1 +let g:NERDTreeAutoDeleteBuffer=1 +let g:NERDTreeMinimalUI=1 + +" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. +autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | + \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif + +" Open the existing NERDTree on each new tab. +autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif + +let g:indentLine_char='│' +let g:indentLine_color_gui='gray' + + +""" +" Coc +""" +" Use K to show documentation in preview window. +nmap f (coc-codeaction) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() +function! s:show_documentation() + call CocActionAsync('doHover') +endfunction + +" Cursor symbol highlight +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Coc Prettier +command! -nargs=0 Prettier :CocCommand prettier.formatFile + + +""" delimitMate +let delimitMate_expand_cr=1 + diff --git a/omz/vbalien.zsh-theme b/omz/vbalien.zsh-theme index 179a2e1..69c97cb 100644 --- a/omz/vbalien.zsh-theme +++ b/omz/vbalien.zsh-theme @@ -204,7 +204,7 @@ prompt_hg() { # Dir: current working directory prompt_dir() { - prompt_segment blue $CURRENT_FG '%~' + prompt_segment magenta $CURRENT_FG '%~' } # Virtualenv: current working virtualenv diff --git a/tmux.conf b/tmux.conf index 36041fa..65b58c2 100644 --- a/tmux.conf +++ b/tmux.conf @@ -3,7 +3,7 @@ set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-pain-control' set -g @plugin 'tmux-plugins/tmux-yank' -set -g @plugin 'mattdavis90/base16-tmux' +set -g @plugin 'dracula/tmux' # Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) run -b '~/.tmux/plugins/tpm/tpm' @@ -12,12 +12,11 @@ set-option -g @pane_resize "1" set -g @yank_selection_mouse 'clipboard' set -g mouse on -set -g default-terminal screen-256color +set -g default-terminal "screen-256color" +set-option -ga terminal-overrides ",xterm-256color:Tc" bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard' -set -g @colors-base16 'tomorrow' - # bind -n End send-key C-e # bind -n Home send-key C-a diff --git a/vimrc b/vimrc index 31c6168..120c90a 100644 --- a/vimrc +++ b/vimrc @@ -8,6 +8,9 @@ Plug 'prettier/vim-prettier', { " 아이콘 폰트 사용 Plug 'ryanoasis/vim-devicons' +" Start page +Plug 'mhinz/vim-startify' + " NERDTree " NERDTree git Plug 'preservim/nerdtree' @@ -26,15 +29,15 @@ Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline-themes' " 컬러 테마 -Plug 'chriskempson/base16-vim' +Plug 'dracula/vim', { 'as': 'dracula' } " automatic closing of quotes, parenthesis, brackets, etc. Plug 'Raimondi/delimitMate' " Language Pack Plug 'sheerun/vim-polyglot' - Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'styled-components/vim-styled-components', { 'branch': 'main' } " indent 표시 Plug 'Yggdroot/indentLine' @@ -58,7 +61,11 @@ set ruler set title set hlsearch set cursorline -syntax on +syntax enable +set t_Co=256 +if (has("termguicolors")) + set termguicolors +endif set clipboard=unnamed " set clipboard+=unnamedplus @@ -68,32 +75,38 @@ set shell=/bin/bash set fillchars+=vert:┃ set mouse=a +if has("mouse_sgr") + set ttymouse=sgr +else + set ttymouse=xterm2 +end + set encoding=UTF-8 +" theme config +let g:dracula_italic = 0 +colorscheme dracula +hi Normal guibg=NONE ctermbg=NONE " 단축키 설정 nmap :FZF +nmap p :FZF nmap :NERDTreeToggle -nmap f (coc-fix-current) inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" -" extension -autocmd BufNewFile,BufRead *.tsx,*.jsx set filetype=typescriptreact - -" theme config -colorscheme base16-tomorrow - -hi Normal guibg=NONE ctermbg=NONE -hi EndOfBuffer guibg=NONE ctermbg=NONE +" detect extension +autocmd BufNewFile,BufRead *.tsx set filetype=typescriptreact +autocmd BufNewFile,BufRead *.jsx set filetype=javascriptreact +autocmd BufNewFile,BufRead .eslintrc set filetype=json " devicons let g:WebDevIconsUnicodeDecorateFolderNodes = 1 let g:DevIconsEnableFoldersOpenClose = 1 " airline -let g:airline_theme = 'base16' +let g:airline_theme='dracula' let g:airline_powerline_fonts=0 let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#tab_nr_type = 1 " tab number @@ -115,4 +128,38 @@ let g:prettier#autoformat = 1 let g:prettier#autoformat_require_pragma = 0 " nerdtree -let NERDTreeShowHidden=1 +let g:NERDTreeWinPos = 'right' +let g:NERDTreeShowHidden=1 +let g:NERDTreeAutoDeleteBuffer=1 +let NERDTreeMinimalUI=1 + +" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree. +autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 | + \ let buf=bufnr() | buffer# | execute "normal! \w" | execute 'buffer'.buf | endif + +" Open the existing NERDTree on each new tab. +autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif + +let g:indentLine_char='│' +let g:indentLine_color_gui='gray' + + +""" +" Coc +""" +" Use K to show documentation in preview window. +nmap f (coc-codeaction) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +" Use K to show documentation in preview window. +nnoremap K :call show_documentation() +autocmd CursorHold * silent call CocActionAsync('highlight') + +function! s:show_documentation() + call CocActionAsync('doHover') +endfunction diff --git a/zshrc b/zshrc index d34c68a..9378104 100644 --- a/zshrc +++ b/zshrc @@ -104,6 +104,7 @@ source $ZSH/oh-my-zsh.sh # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" +alias vim=nvim alias vi=vim TERM=xterm-256color export GPG_TTY=$(tty)