From 8eeaaffa63a2e659abd44564c9b6512c80b09afe Mon Sep 17 00:00:00 2001 From: Rahsheen Porter Date: Sun, 26 Sep 2021 20:30:29 -0400 Subject: [PATCH] Initial commit --- .config/nvim/coc-settings.json | 3 ++ .config/nvim/init.vim | 91 ++++++++++++++++++++++++++++++++++ .config/nvim/plugin/coc.vim | 88 ++++++++++++++++++++++++++++++++ .config/nvim/plugin/sets.vim | 58 ++++++++++++++++++++++ .zshrc | 16 ++++++ 5 files changed, 256 insertions(+) create mode 100644 .config/nvim/coc-settings.json create mode 100644 .config/nvim/init.vim create mode 100644 .config/nvim/plugin/coc.vim create mode 100644 .config/nvim/plugin/sets.vim create mode 100644 .zshrc diff --git a/.config/nvim/coc-settings.json b/.config/nvim/coc-settings.json new file mode 100644 index 00000000..a4ffa130 --- /dev/null +++ b/.config/nvim/coc-settings.json @@ -0,0 +1,3 @@ +{ + "coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "javascript", "typescript", "typescriptreact", "go"] +} diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 00000000..76cb97cd --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,91 @@ + +let mapleader = " " + +vnoremap J :m '>+1gv=gv +vnoremap K :m '<-2gv=gv + +nnoremap / /\v +vnoremap / /\v +nnoremap ` :noh +nnoremap % +vnoremap % + +" No Cheating +nnoremap +nnoremap +nnoremap +nnoremap +inoremap +inoremap +inoremap +inoremap + +" No weird line jumps +nnoremap j gj +nnoremap k gk + +" FZF Bindings +nnoremap :Files +noremap :GFiles +nnoremap C :Colors +nnoremap :Buffers +nnoremap fl :Lines +nnoremap m :History + +inoremap +nnoremap +vnoremap + +inoremap hh + +" - Avoid using standard Vim directory names like 'plugin' +call plug#begin() + +Plug 'gruvbox-community/gruvbox' +Plug 'tpope/vim-repeat' +Plug 'tpope/vim-surround' +Plug 'tpope/vim-fugitive' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' +Plug 'leafgarland/typescript-vim' +Plug 'airblade/vim-gitgutter' +Plug 'neoclide/coc.nvim', {'branch': 'release'} + +" Initialize plugin system +call plug#end() + +syntax on +let g:gruvbox_contrast_dark = 'hard' +let g:gruvbox_italic=1 +let g:gruvbox_invert_selection='0' +set termguicolors +set background=dark + +augroup RAH_CODES + autocmd! + autocmd vimenter * ++nested colorscheme gruvbox +augroup END + +"let g:netrw_banner = 0 +"let g:netrw_liststyle = 3 +"let g:netrw_browse_split = 4 +"let g:netrw_altv = 1 +"let g:netrw_winsize = 25 +"augroup ProjectDrawer +" autocmd! +" autocmd VimEnter * :Vexplore +"augroup END + +let g:airline_powerline_fonts = 1 +let g:airline#extensions#tabline#enabled = 1 + +" Completion +set completeopt=menuone,noinsert,noselect +let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy'] + +" Git Fugitive +nmap gs :G +nmap gh :diffget //3 +nmap gu :diffget //2 diff --git a/.config/nvim/plugin/coc.vim b/.config/nvim/plugin/coc.vim new file mode 100644 index 00000000..3181e7f8 --- /dev/null +++ b/.config/nvim/plugin/coc.vim @@ -0,0 +1,88 @@ +" Use tab for trigger completion with characters ahead and navigate. +" NOTE: Use command ':verbose imap ' to make sure tab is not mapped by +" other plugin before putting this into your config. +inoremap + \ pumvisible() ? "\" : + \ check_back_space() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +" Use to trigger completion. +if has('nvim') + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Make auto-select the first completion item and notify coc.nvim to +" format on enter, could be remapped by other vim plugin +inoremap pumvisible() ? coc#_select_confirm() + \: "\u\\=coc#on_enter()\" + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" 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() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + elseif (coc#rpc#ready()) + call CocActionAsync('doHover') + else + execute '!' . &keywordprg . " " . expand('') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming. +nmap rn (coc-rename) + +" Formatting selected code. +xmap f (coc-format-selected) +nmap f (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: `aap` for current paragraph +xmap a (coc-codeaction-selected) +nmap a (coc-codeaction-selected) + +" 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) + +command! -nargs=0 Prettier :CocCommand prettier.formatFile + +" Add `:Format` command to format current buffer. +command! -nargs=0 Format :call CocAction('format') + +" Add `:Fold` command to fold current buffer. +command! -nargs=? Fold :call CocAction('fold', ) + +" Add `:OR` command for organize imports of the current buffer. +command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') diff --git a/.config/nvim/plugin/sets.vim b/.config/nvim/plugin/sets.vim new file mode 100644 index 00000000..4275395a --- /dev/null +++ b/.config/nvim/plugin/sets.vim @@ -0,0 +1,58 @@ + +set rtp+=/usr/local/opt/fzf +set background=dark +set nowrap +set textwidth=79 +set formatoptions=qrn1 + +set ignorecase +set smartcase +set gdefault + +set incsearch +set showmatch +set hlsearch +set nocompatible +set exrc + +set modelines=0 +set tabstop=4 +set shiftwidth=4 +set softtabstop=4 +set expandtab + +set encoding=utf-8 +set scrolloff=8 +set autoindent +set smartindent +set showmode +set showcmd +set cmdheight=2 +set hidden +set wildmenu +set wildmode=list:longest +set visualbell +set cursorline +set ttyfast +set ruler +set backspace=indent,eol,start +set laststatus=2 +set relativenumber +set nu +set noswapfile +set nobackup +set nowritebackup +set undodir=~/.config/nvim/undodir +set undofile +set signcolumn=yes +set colorcolumn=80 + +" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable +" delays and poor user experience. +set updatetime=300 + +" Don't pass messages to |ins-completion-menu|. +set shortmess+=c + +set grepprg=rg\ --vimgrep\ --smart-case\ --follow + diff --git a/.zshrc b/.zshrc new file mode 100644 index 00000000..1d8bf4cf --- /dev/null +++ b/.zshrc @@ -0,0 +1,16 @@ +source "$HOME/.antigen/antigen.zsh" + +antigen use oh-my-zsh +antigen bundle arialdomartini/oh-my-git +antigen theme arialdomartini/oh-my-git-themes oppa-lana-style + +antigen apply + +export NVM_DIR="$HOME/.nvm" + [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm + [ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion + + +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh +export PATH=$PATH:$(go env GOPATH)/bin +alias config='/usr/bin/git --git-dir=/Users/rporter/.cfg/ --work-tree=/Users/rporter'