From 14bb831a8db04ca61973e0ecc35d4f2ee084ac5a Mon Sep 17 00:00:00 2001 From: parker Date: Tue, 7 Jul 2020 07:55:35 -0700 Subject: [PATCH 1/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 724a880..f6e3d83 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Portable neovim configuration configured for MacOS. ## Setup ```bash -git clone http://github.com/willfish/vimrc.git ~/ +git clone http://github.com/parkwherever/vimrc.git ~/ cd ~/path/to/repos/vimrc ./setup.sh ``` From 1a471fb603166cc544f20686462feb567ca1662a Mon Sep 17 00:00:00 2001 From: Parker Spielman Date: Tue, 7 Jul 2020 10:20:00 -0700 Subject: [PATCH 2/3] setup-base --- coc-settings.json | 10 ++++++++++ vimrcs/advanced.vim | 15 ++++++++++----- vimrcs/basic.vim | 2 ++ vimrcs/plugs.vim | 4 ++-- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/coc-settings.json b/coc-settings.json index 94fca20..7d0f676 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -36,6 +36,16 @@ "markdownlint.onChange": false, "markdownlint.onSave": true, "languageserver": { + "go": { + "command": "gopls", + "rootPatterns": [ + "go.mod" + ], + "trace.server": "verbose", + "filetypes": [ + "go" + ] + }, "terraform": { "command": "terraform-ls", "args": [ diff --git a/vimrcs/advanced.vim b/vimrcs/advanced.vim index 61281a8..b2b1c2e 100644 --- a/vimrcs/advanced.vim +++ b/vimrcs/advanced.vim @@ -2,19 +2,24 @@ " => fzf """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let g:fzf_command_prefix = 'Fzf' | " FZF: Set the prefix for exposed fzf commands +let g:fzf_buffers_jump = 1 let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git --ignore .terragrunt-cache --ignore temp_dirs -l -g ""' | " FZF: Speed up agging files -nnoremap :FzfFiles -nnoremap :FzfAg +nnoremap :FzfFiles +" Map back to redo +nnoremap :redo +nnoremap :FzfAg +nnoremap :FzfBuffers + " """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" => ag +" => ack """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -nnoremap g :Ag +nnoremap g :Ack """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => anyfold -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" augroup anyfold autocmd Filetype * AnyFoldActivate diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 23783dd..0921f17 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -60,12 +60,14 @@ augroup helpfiles autocmd FileType help nnoremap q :q augroup END +" Updates text in command line function! CmdLine(str) exe 'menu Foo.Bar :' . a:str emenu Foo.Bar unmenu Foo endfunction +" Highlights copied selection function! VisualSelection(direction, extra_filter) range let l:saved_reg = @" execute 'normal! vgvy' diff --git a/vimrcs/plugs.vim b/vimrcs/plugs.vim index 07012cb..5d55b36 100644 --- a/vimrcs/plugs.vim +++ b/vimrcs/plugs.vim @@ -8,7 +8,7 @@ Plug 'sainnhe/gruvbox-material' | " Theme Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | " Open files and ag buffers Plug 'junegunn/fzf.vim' | " Open files and ag buffers Plug 'junegunn/vim-easy-align' | " Align stuff -Plug 'rking/ag.vim' | " Grep into quickfix +Plug 'mileszs/ack.vim' | " Grep into quickfix Plug 'stefandtw/quickfix-reflector.vim' | " Make quickfix writeable - useful for find and replace Plug 'sheerun/vim-polyglot' | " Language syntax highlighting Plug 'tpope/vim-bundler' | " Gemfile syntax highlighting @@ -22,7 +22,7 @@ Plug 'bps/vim-textobj-python' | " Python fu Plug 'mattn/vim-textobj-url' | " URI textobj Plug 'christoomey/vim-sort-motion' | " Sort motion Plug 'tpope/vim-commentary' | " Comment motion -Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'} | " Intellisense +Plug 'neoclide/coc.nvim', {'branch': 'release'} | " Intellisense Plug 'vim-test/vim-test' | " Run tests Plug 'pseewald/vim-anyfold' | " Language aware folds Plug 'tpope/vim-dispatch' | " Asynchronous arbitrary shell execution From ee00607f1b716f6aca866c65fdc0d77e87b291a4 Mon Sep 17 00:00:00 2001 From: Parker Spielman Date: Fri, 25 Feb 2022 13:50:53 -0800 Subject: [PATCH 3/3] updates --- alacritty/alacritty.yml | 25 +++++++++++++ alacritty/gruvbox.yml | 25 +++++++++++++ alacritty/nord.yml | 32 ++++++++++++++++ coc-settings.json | 16 +++++--- scripts/set_color_scheme.zsh | 39 ++++++++++++++++++++ vimrcs/advanced.vim | 71 ++++++++++++++++++++++++++++++++---- vimrcs/basic.vim | 15 +++++++- vimrcs/plugs.vim | 5 ++- 8 files changed, 213 insertions(+), 15 deletions(-) create mode 100644 alacritty/alacritty.yml create mode 100644 alacritty/gruvbox.yml create mode 100644 alacritty/nord.yml create mode 100644 scripts/set_color_scheme.zsh diff --git a/alacritty/alacritty.yml b/alacritty/alacritty.yml new file mode 100644 index 0000000..9d39b52 --- /dev/null +++ b/alacritty/alacritty.yml @@ -0,0 +1,25 @@ +env: + TERM: xterm-256color + +dpi: + x: 96.0 + y: 96.0 + +font: + # https://github.com/alacritty/alacritty/issues/1635 + use_thin_strokes: true + normal: + family: Menlo + # style: Regular + bold: + family: Menlo + # style: Bold + italic: + family: Menlo + # style: Italic + size: 12 + offset: + x: 0 + y: 0 + + diff --git a/alacritty/gruvbox.yml b/alacritty/gruvbox.yml new file mode 100644 index 0000000..a61486f --- /dev/null +++ b/alacritty/gruvbox.yml @@ -0,0 +1,25 @@ +# Colors (Gruvbox Material Dark Medium) +colors: + primary: + background: "0x282828" + foreground: "0xdfbf8e" + + normal: + black: "0x665c54" + red: "0xea6962" + green: "0xa9b665" + yellow: "0xe78a4e" + blue: "0x7daea3" + magenta: "0xd3869b" + cyan: "0x89b482" + white: "0xdfbf8e" + + bright: + black: "0x928374" + red: "0xea6962" + green: "0xa9b665" + yellow: "0xe3a84e" + blue: "0x7daea3" + magenta: "0xd3869b" + cyan: "0x89b482" + white: "0xdfbf8e" diff --git a/alacritty/nord.yml b/alacritty/nord.yml new file mode 100644 index 0000000..a9f2089 --- /dev/null +++ b/alacritty/nord.yml @@ -0,0 +1,32 @@ +# Project: Nord Alacritty +# Version: 0.1.0 +# Repository: https://github.com/arcticicestudio/nord-alacritty +# License: MIT +# References: +# https://github.com/jwilm/alacritty + +colors: + primary: + background: "0x2E3440" + foreground: "0xD8DEE9" + cursor: + text: "0x2E3440" + cursor: "0xD8DEE9" + normal: + black: "0x3B4252" + red: "0xBF616A" + green: "0xA3BE8C" + yellow: "0xEBCB8B" + blue: "0x81A1C1" + magenta: "0xB48EAD" + cyan: "0x88C0D0" + white: "0xE5E9F0" + bright: + black: "0x4C566A" + red: "0xBF616A" + green: "0xA3BE8C" + yellow: "0xEBCB8B" + blue: "0x81A1C1" + magenta: "0xB48EAD" + cyan: "0x8FBCBB" + white: "0xECEFF4" diff --git a/coc-settings.json b/coc-settings.json index 7d0f676..c6dbec1 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -1,5 +1,6 @@ { - "suggest.noselect": false, + "suggest.noselect": true, + "suggest.removeDuplicateItems": true, "coc.preferences.hoverTarget": "echo", "coc.preferences.formatOnSaveFiletypes": [ "css", @@ -36,15 +37,20 @@ "markdownlint.onChange": false, "markdownlint.onSave": true, "languageserver": { - "go": { + "golang": { "command": "gopls", "rootPatterns": [ - "go.mod" + "go.mod", + ".vim/", + ".git/", + ".hg/" ], - "trace.server": "verbose", "filetypes": [ "go" - ] + ], + "initializationOptions": { + "usePlaceholders": true + } }, "terraform": { "command": "terraform-ls", diff --git a/scripts/set_color_scheme.zsh b/scripts/set_color_scheme.zsh new file mode 100644 index 0000000..1f2edcf --- /dev/null +++ b/scripts/set_color_scheme.zsh @@ -0,0 +1,39 @@ +#!/bin/sh +# +# Enable dynamic color changing +# https://shuheikagawa.com/blog/2020/02/14/switching-colorschemes-of-vim-and-alacritty/ + +color=$1 +dotfiles= dirname `pwd` +alacritty=${dotfiles}/alacritty + +configure_alacritty() { + cat ${alacritty}/base.yml ${alacritty}/${color}.yml > ${dotfiles}/.alacritty.yml +} + +configure_vim() { + echo $1 > ${dotfiles}/.vim/color.vim +} + +case $color in + dracula) + configure_alacritty + configure_vim 'colorscheme dracula' + ;; + nord) + configure_alacritty + configure_vim 'colorscheme nord' + ;; + pink-moon) + configure_alacritty + configure_vim 'colorscheme pink-moon' + ;; + ayu-light) + configure_alacritty + configure_vim 'let ayucolor="light"\ncolorscheme ayu' + ;; + *) + echo "Supported colorschemes: dracula, nord, pink-moon, ayu-light" + exit 1 + ;; +esac diff --git a/vimrcs/advanced.vim b/vimrcs/advanced.vim index b2b1c2e..7b01d6c 100644 --- a/vimrcs/advanced.vim +++ b/vimrcs/advanced.vim @@ -16,6 +16,9 @@ nnoremap :FzfBuffers " => ack """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" nnoremap g :Ack +if executable('ag') + let g:ackprg = 'ag --vimgrep' +endif """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => anyfold @@ -33,26 +36,29 @@ set foldlevel=99 | " Anyfold: Open folds to 99 folds deep """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" let test#strategy = { - \ 'nearest': 'basic', + \ 'nearest': 'neovim', \ 'file': 'dispatch', \ 'suite': 'dispatch_background', \} let test#ruby#rspec#executable = 'bundle exec rspec' -nnoremap x :TestNearest -nnoremap t :TestFile -nnoremap r :TestSuite -nnoremap e :TestLast -nnoremap l :TestVisit +"Testing +" these "Ctrl mappings" work well when Caps Lock is mapped to Ctrl +nmap t :w :TestNearest +nmap t :w :TestFile +nmap t :w :TestSuite +nmap t :w :TestLast +nmap t :TestVisit """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => vim-fugitive """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +vnoremap git :Gbrowse +nnoremap git :Gbrowse nnoremap i :Git nnoremap b :Gblame -nnoremap o :Gbrowse nnoremap s :Gstatus nnoremap ] :Gpush nnoremap [ :Gpull @@ -73,6 +79,7 @@ let g:coc_global_extensions = [ \ 'coc-elixir', \ 'coc-explorer', \ 'coc-fish', + \ 'coc-sh', \ 'coc-go', \ 'coc-html', \ 'coc-json', @@ -107,6 +114,55 @@ endfunction nnoremap n :CocCommand explorer +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. +nmap (coc-diagnostic-prev) +nmap (coc-diagnostic-next) + +" GoTo code navigation. +nmap gd (coc-definition) +nmap gh(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('') + else + call CocAction('doHover') + endif +endfunction + +" Highlight the symbol and its references when holding the cursor. +autocmd CursorHold * silent call CocActionAsync('highlight') + +" Symbol renaming. +nmap rn (coc-rename) + +" ALE setup to fix on save +" let g:ale_fixers = { +" \ '*': ['remove_trailing_lines', 'trim_whitespace'], +" \ 'go': ['goimports', 'gofmt'], +" \ 'rust': ['rustfmt'], +" \} + +" let g:ale_go_gofmt_options = '-s' +" let g:ale_go_bingo_executable = 'gopls' +" autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport') +" let g:airline#extensions#ale#enabled = 1 +" let g:ale_go_golangci_lint_options = '--fast -c ~/.golangci.yml ' +" let g:ale_go_golangci_lint_package = 1 +" let g:ale_fix_on_save = 1 +" let g:ale_set_balloons = 1 +" let g:airline#extensions#ale#enabled = 1 +" let g:ale_set_highlights = 0 +" let g:ale_sign_column_always = 1 +" let g:ale_completion_enabled = 1 + + """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " => vim-easy-align """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -120,3 +176,4 @@ augroup END | " EasyAlign: Hit enter in Markdown to automatically align table """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" colorscheme gruvbox-material +" colorscheme nord diff --git a/vimrcs/basic.vim b/vimrcs/basic.vim index 0921f17..bc3c4d1 100644 --- a/vimrcs/basic.vim +++ b/vimrcs/basic.vim @@ -2,6 +2,7 @@ set clipboard+=unnamedplus | " Use os clipboard for copy and paste set expandtab | " Use spaces instead of tabs +set ignorecase | " Ignore case on search set hidden | " A buffer becomes hidden when it is abandoned set history=200 | " Limit history for commands, etc - default is 100000 set lazyredraw | " Don't redraw while executing macros (good performance config) @@ -17,7 +18,7 @@ set smartindent set splitright | " Split right set tabstop=2 | " 1 tab == 4 spaces set termguicolors | " Enables 24-bit RGB color in the TUI -set textwidth=500 | " Linebreak on 500 characters +set textwidth=80 | " Linebreak on 500 characters set undodir=~/.vim_runtime/temp_dirs/undodir set undofile set wrap | " Wrap lines @@ -30,6 +31,12 @@ set dir=/tmp set wildignore=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store,_build,*.o,*~,*.pyc | " Ignore version control and os files set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:» | " Show special characters +" Spelling. +set spell +highlight SpellBad cterm=undercurl ctermbg=18 gui=undercurl guisp=#F07178 +highlight Comment ctermfg=gray +highlight clear SpellCap + nnoremap za nnoremap w :w! nnoremap q :wq! @@ -42,6 +49,12 @@ nnoremap :wincmd l nnoremap 0 ^ nnoremap ^ 0 +" Quick capitalization +nnoremap ,C g~w + +" Paste replace +nnoremap R Pdw + " Multiple replace with s* " hit . to repeatedly replace a change to the word under the cursor nnoremap s* :let @/='\<'.expand('').'\>'cgn diff --git a/vimrcs/plugs.vim b/vimrcs/plugs.vim index 5d55b36..ebe88ff 100644 --- a/vimrcs/plugs.vim +++ b/vimrcs/plugs.vim @@ -5,6 +5,7 @@ set shell=bash call plug#begin('~/.vim_runtime/plugged/') Plug 'sainnhe/gruvbox-material' | " Theme +Plug 'arcticicestudio/nord-vim' | " Theme Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | " Open files and ag buffers Plug 'junegunn/fzf.vim' | " Open files and ag buffers Plug 'junegunn/vim-easy-align' | " Align stuff @@ -27,6 +28,8 @@ Plug 'vim-test/vim-test' | " Run tests Plug 'pseewald/vim-anyfold' | " Language aware folds Plug 'tpope/vim-dispatch' | " Asynchronous arbitrary shell execution Plug 'tpope/vim-endwise' | " Automatically terminate ( ), do end, { } etc + +" Plug 'dense-analysis/ale' | "Golang formatting Plug 'tpope/vim-fugitive' | " Git integrations Plug 'tpope/vim-repeat' | " Support for repeating vim-surround motions Plug 'tpope/vim-rhubarb' | " Open browser with git object under cursor - context aware @@ -35,6 +38,4 @@ Plug 'tpope/vim-surround' | " Change, a call plug#end() -set shell=fish - filetype plugin indent on