Skip to content

Updates #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Portable neovim configuration configured for MacOS.
## Setup

```bash
git clone http://github.com/willfish/vimrc.git ~/<path/to/repos>
git clone http://github.com/parkwherever/vimrc.git ~/<path/to/repos>
cd ~/path/to/repos/vimrc
./setup.sh
```
Expand Down
25 changes: 25 additions & 0 deletions alacritty/alacritty.yml
Original file line number Diff line number Diff line change
@@ -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


25 changes: 25 additions & 0 deletions alacritty/gruvbox.yml
Original file line number Diff line number Diff line change
@@ -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"
32 changes: 32 additions & 0 deletions alacritty/nord.yml
Original file line number Diff line number Diff line change
@@ -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"
18 changes: 17 additions & 1 deletion coc-settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"suggest.noselect": false,
"suggest.noselect": true,
"suggest.removeDuplicateItems": true,
"coc.preferences.hoverTarget": "echo",
"coc.preferences.formatOnSaveFiletypes": [
"css",
Expand Down Expand Up @@ -36,6 +37,21 @@
"markdownlint.onChange": false,
"markdownlint.onSave": true,
"languageserver": {
"golang": {
"command": "gopls",
"rootPatterns": [
"go.mod",
".vim/",
".git/",
".hg/"
],
"filetypes": [
"go"
],
"initializationOptions": {
"usePlaceholders": true
}
},
"terraform": {
"command": "terraform-ls",
"args": [
Expand Down
39 changes: 39 additions & 0 deletions scripts/set_color_scheme.zsh
Original file line number Diff line number Diff line change
@@ -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
86 changes: 74 additions & 12 deletions vimrcs/advanced.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@
" => 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 <C-f> :FzfFiles<CR>
nnoremap <C-g> :FzfAg<CR>
nnoremap <C-p> :FzfFiles<CR>
" Map <C-r> back to redo
nnoremap <C-r> :redo<CR>
nnoremap <C-f> :FzfAg<CR>
nnoremap <C-b> :FzfBuffers<CR>

"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => ag
" => ack
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
nnoremap <leader>g :Ag<space>
nnoremap <leader>g :Ack<space>
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => anyfold
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

augroup anyfold
autocmd Filetype * AnyFoldActivate
Expand All @@ -28,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 <silent> <Leader>x :TestNearest<CR>
nnoremap <silent> <Leader>t :TestFile<CR>
nnoremap <silent> <Leader>r :TestSuite<CR>
nnoremap <silent> <Leader>e :TestLast<CR>
nnoremap <silent> <Leader>l :TestVisit<CR>
"Testing
" these "Ctrl mappings" work well when Caps Lock is mapped to Ctrl
nmap <silent> t<C-n> :w<CR> :TestNearest<CR>
nmap <silent> t<C-f> :w<CR> :TestFile<CR>
nmap <silent> t<C-s> :w<CR> :TestSuite<CR>
nmap <silent> t<C-l> :w<CR> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR>

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => vim-fugitive
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

vnoremap <silent> <leader>git :Gbrowse<CR>
nnoremap <silent> <leader>git :Gbrowse<CR>
nnoremap <silent> <Leader>i :Git<space>
nnoremap <silent> <Leader>b :Gblame<CR>
nnoremap <silent> <Leader>o :Gbrowse<CR>
nnoremap <silent> <Leader>s :Gstatus<CR>
nnoremap <silent> <Leader>] :Gpush<CR>
nnoremap <silent> <Leader>[ :Gpull<CR>
Expand All @@ -68,6 +79,7 @@ let g:coc_global_extensions = [
\ 'coc-elixir',
\ 'coc-explorer',
\ 'coc-fish',
\ 'coc-sh',
\ 'coc-go',
\ 'coc-html',
\ 'coc-json',
Expand Down Expand Up @@ -102,6 +114,55 @@ endfunction

nnoremap <silent><leader>n :CocCommand explorer<CR>

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
nmap <silent> <C-m> <Plug>(coc-diagnostic-prev)
nmap <silent> <C-n> <Plug>(coc-diagnostic-next)

" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gh<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 <SID>show_documentation()<CR>

function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
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 <leader>rn <Plug>(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
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Expand All @@ -115,3 +176,4 @@ augroup END | " EasyAlign: Hit enter in Markdown to automatically align table
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

colorscheme gruvbox-material
" colorscheme nord
17 changes: 16 additions & 1 deletion vimrcs/basic.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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 <silent> <Space> za
nnoremap <silent> <leader>w :w!<cr>
nnoremap <silent> <leader>q :wq!<cr>
Expand All @@ -42,6 +49,12 @@ nnoremap <silent> <M-Right> :wincmd l<CR>
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 <silent> s* :let @/='\<'.expand('<cword>').'\>'<CR>cgn
Expand All @@ -60,12 +73,14 @@ augroup helpfiles
autocmd FileType help nnoremap q :q<CR>
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'
Expand Down
9 changes: 5 additions & 4 deletions vimrcs/plugs.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ 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
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
Expand All @@ -22,11 +23,13 @@ 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
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
Expand All @@ -35,6 +38,4 @@ Plug 'tpope/vim-surround' | " Change, a

call plug#end()

set shell=fish

filetype plugin indent on