diff --git a/install.sh b/install.sh index 8aba3c9..64e19cf 100755 --- a/install.sh +++ b/install.sh @@ -24,10 +24,13 @@ then bat \ difftastic \ vim \ + neovim \ zsh \ tmux \ starship \ - nodejs + nodejs \ + ripgrep \ + fd fi echo "== zplug" @@ -42,7 +45,7 @@ fi echo "== Copying configuration files..." # GIT workspace_backup .gitconfig -workspace_link git/gitconfig .gitconfig +workspace_link git/gitconfig .gitconfig # SSH workspace_backup .ssh/authorized_keys @@ -81,3 +84,9 @@ workspace_backup .vimrc workspace_link vim/vimrc .vimrc workspace_backup .vim/coc-settings.json workspace_link vim/coc-settings.json .vim/coc-settings.json + +# NEOVIM +sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' +workspace_backup .config/nvim/init.vim +workspace_link nvim/init.vim .config/nvim/init.vim diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100644 index 0000000..38da17c --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,255 @@ +" Run PlugInstall if there are missing plugins +autocmd VimEnter * + \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + \| PlugInstall --sync | q + \| endif + +""""" +"--- Plugins +call plug#begin('~/.vim/plugged') + +" General +Plug 'ojroques/vim-oscyank' +Plug 'tpope/vim-obsession' +Plug 'tmux-plugins/vim-tmux-focus-events' +" Look +Plug 'vim-airline/vim-airline' +Plug 'sonph/onehalf', { 'rtp': 'vim' } +Plug 'Yggdroot/indentLine' +" Git +Plug 'tpope/vim-fugitive' +Plug 'airblade/vim-gitgutter' +" Search/Files +Plug 'nvim-lua/plenary.nvim' +Plug 'nvim-telescope/telescope.nvim' +Plug 'ANGkeith/telescope-terraform-doc.nvim' +Plug 'fannheyward/telescope-coc.nvim' +" Ignore/Edit files +Plug 'vim-scripts/gitignore' +" Coding helpers +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +Plug 'neoclide/coc.nvim', {'branch': 'release'} + +call plug#end() + +""""" +"--- CodeServer Configurations +let g:coc_global_extensions = [ + \ 'coc-tsserver', + \ 'coc-prettier', + \ 'coc-yaml', + \ 'coc-json', + \ 'coc-git', + \ 'coc-pyright', + \ 'coc-pairs', + \ 'coc-prisma', + \ 'coc-sh', + \ ] +if isdirectory('./node_modules') && isdirectory('./node_modules/prettier') + let g:coc_global_extensions += ['coc-prettier'] +endif +if isdirectory('./node_modules') && isdirectory('./node_modules/eslint') + let g:coc_global_extensions += ['coc-eslint'] +endif + +" Diagnostic list +nnoremap d :CocList diagnostics +" Symbols list +nnoremap s :CocList -I symbols +" Code actions +nmap do (coc-codeaction) +" Rename current world +nmap rn (coc-rename) +" Use K to show documentation in preview window. +nnoremap K :call ShowDocumentation() +function! ShowDocumentation() + if CocAction('hasProvider', 'hover') + call CocActionAsync('doHover') + else + call feedkeys('K', 'in') + endif +endfunction +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') +" Remap keys for applying codeAction to the current buffer. +nmap ac (coc-codeaction) +" Apply AutoFix to problem on the current line. +nmap qf (coc-fix-current) +" GoTo code navigation. +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) + +""""" +"--- TMUX/Clipboard fixes +set t_Co=256 +set t_ut= +" Set Vim-specific sequences for RGB colors +" Fixes 'termguicolors' usage in vim+tmux +" :h xterm-true-color +let &t_8f = "\[38;2;%lu;%lu;%lum" +let &t_8b = "\[48;2;%lu;%lu;%lum" +" Enables 24-bit RGB color in the terminal +if has('termguicolors') + if empty($COLORTERM) || $COLORTERM =~# 'truecolor\|24bit' + set termguicolors + endif +endif +" Use system clipboard to get buffers synced between TMUX and VIM +if has('clipboard') && has('vim_starting') + " set clipboard& clipboard+=unnamedplus + set clipboard& clipboard^=unnamed,unnamedplus +endif +if exists('##TextYankPost') + augroup BlinkClipboardIntegration + autocmd! + autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '' | execute 'OSCYankReg "' | endif + augroup END +endif + +"""" +"--- Treesitter configuration +lua <