Skip to content

Instantly share code, notes, and snippets.

@dusty-phillips
Created February 1, 2021 19:19
Show Gist options
  • Save dusty-phillips/572ec4dca1c7697d975041c905f6350a to your computer and use it in GitHub Desktop.
Save dusty-phillips/572ec4dca1c7697d975041c905f6350a to your computer and use it in GitHub Desktop.
set termguicolors
set background=dark
let g:bubbly_palette = #{
\ background: "#34343c",
\ foreground: "#c5cdd9",
\ black: "#3e4249",
\ red: "#ec7279",
\ green: "#a0c980",
\ yellow: "#deb974",
\ blue: "#6cb6eb",
\ purple: "#d38aea",
\ cyan: "#5dbbc1",
\ white: "#c5cdd9",
\ lightgrey: "#57595e",
\ darkgrey: "#404247",
\ }
let g:bubbly_tags = #{
\ mode: #{
\ command: "C",
\ normal: "N",
\ insert: "I",
\ visual: "V",
\ visualblock: "VB",
\ },
\}
let g:coc_node_path = "/usr/local/opt/nvm/versions/node/v12.20.0/bin/node"
let mapleader=" "
set mouse=a
" Needed to make the cursor look sane in the different modes
" set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr:hor20,o:hor50,a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor,sm:block-blinkwait175-blinkoff150-blinkon175
set cursorline
set nohlsearch
set inccommand=split " highlight :%s calls
set updatetime=50 " Make git gutter and coc show up faster (use Kitty to keep up)
set undofile " persistent undo
" Settings Keybindings ('V to open)
nnoremap <leader>vr :so $MYVIMRC<CR>
nnoremap <leader>vp :so $MYVIMRC <bar> PlugClean <bar> PlugInstall <CR>
" Filesystem Keybindings
nnoremap <C-s> :w<CR>
inoremap <C-s> <C-o>:w<CR>
nnoremap <D-s> :w<CR>
inoremap <D-s> <C-o>:w<CR>
nnoremap <C-P> :Files<CR>
nnoremap <leader><C-p> :GFiles<CR>
nnoremap <leader>` :FZF ~<CR>
nnoremap <CR><CR> <cmd>CHADopen<CR>
" Git keybindings and config
nnoremap <leader>gs :vert Git<CR>
nnoremap <leader>gl :vert rightb Flogsplit -all<CR>
nnoremap <leader>gb :Git blame<CR>
nnoremap <leader>gpp :Git push<CR>
nnoremap <leader>gpf :Git push --force
nnoremap <leader>gpu :Git push --set-upstream origin HEAD<CR>
nnoremap <leader>gpl :Git pull<CR>
nnoremap <leader>gf :Git fetch --prune<CR>
nnoremap <leader>gt :Merginal<CR>
let g:flog_default_arguments = { 'all': 1, 'date': 'short'}
let g:conflict_marker_begin = '^<<<<<<.*$'
let g:conflict_marker_end = '^>>>>>.*$'
let g:merginal_windowSize = 60
highlight ConflictMarkerBegin guibg=#2f7366
highlight ConflictMarkerOurs guibg=#2e5049
highlight ConflictMarkerTheirs guibg=#344f69
highlight ConflictMarkerEnd guibg=#2f628e
highlight ConflictMarkerCommonAncestorsHunk guibg=#754a81
augroup flog
autocmd FileType floggraph nno <buffer> mo :<C-U>call flog#run_tmp_command('Git reset --hard %h')
augroup END
" Misc keybindings
nnoremap <leader>u :UndotreeToggle<CR>
cnoremap <expr> <up> wildmenumode() ? "\<left>" : "\<up>"
cnoremap <expr> <down> wildmenumode() ? "\<right>" : "\<down>"
cnoremap <expr> <left> wildmenumode() ? "\<up>" : "\<left>"
cnoremap <expr> <right> wildmenumode() ? " \<bs>\<C-Z>" : "\<right>"
nmap sw saiw
" clipboard
nnoremap <leader>y "*y
vnoremap <leader>y "*y
nnoremap <leader>p "*p
vnoremap <leader>p "*p
nnoremap <leader>P "*P
vnoremap <leader>P "*P
" Window keymapping
nnoremap <leader><CR> :term<CR>i
tnoremap \<Esc> <C-\><C-n>
tnoremap \ <C-\><C-w>
nnoremap \ <C-w>
nnoremap \c :Sayonara!<CR>
nnoremap \q :Sayonara<CR>
nnoremap \t :tabnew<CR>
" \n is already :new
nnoremap \N :vnew<CR>
nnoremap \1 <C-w>1w
nnoremap \2 <C-w>2w
nnoremap \3 <C-w>3w
nnoremap \4 <C-w>4w
nnoremap \5 <C-w>5w
nnoremap \6 <C-w>6w
nnoremap \7 <C-w>7w
nnoremap \8 <C-w>8w
" Search
let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwxyz1234567890;,.'
let g:EasyMotion_smartcase = 1
nmap h <Plug>(easymotion-s)
omap h <Plug>(easymotion-s)
vmap h <Plug>(easymotion-s)
nmap \\ <Plug>(easymotion-overwin-line)
nmap / <Plug>(incsearch-forward)
nmap ? <Plug>(incsearch-backward)
nmap g/ <Plug>(incsearch-stay)
let g:camelcasemotion_key = '\'
" IDE
set nobackup
set nowritebackup
set shortmess=ac
set cmdheight=2
set noshowcmd
set noshowmode
set signcolumn=yes
" show completion menu
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Highlight the symbol and its references when holding the cursor.
autocmd CursorHold * silent call CocActionAsync('highlight')
" Navigate and fix diagnostics
nmap [d <Plug>(coc-diagnostic-prev)
nmap ]d <Plug>(coc-diagnostic-next)
nmap <leader>. <Plug>(coc-fix-current)
nmap <leader>rn <Plug>(coc-rename)
" GoTo code navigation.
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gr <Plug>(coc-references)
nnoremap <silent> K :call <SID>show_documentation()<CR>
" Function and class text objects
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
nnoremap <leader>cd :<C-u>CocList diagnostics<CR>
nnoremap <leader>co :<C-u>CocList outline<CR>
nnoremap <leader>cs :<C-u>CocList -I symbols<CR>
" Coc supporting functions
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
" Install plugins
call plug#begin('~/.config/nvim/plugged')
" color schemes
Plug 'jacoborus/tender.vim'
" Editing
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-abolish'
Plug 'wellle/targets.vim'
Plug 'machakann/vim-sandwich'
Plug 'bkad/CamelCaseMotion'
Plug 'kana/vim-textobj-user'
Plug 'kana/vim-textobj-entire'
Plug 'ethomas2/vim-indent-object'
" Search
Plug 'easymotion/vim-easymotion'
Plug 'haya14busa/incsearch.vim'
Plug 'tpope/vim-repeat'
" Git
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
Plug 'rbong/vim-flog'
Plug 'rhysd/conflict-marker.vim'
Plug 'idanarye/vim-merginal'
" Visual
Plug 'ryanoasis/vim-devicons'
Plug 'glepnir/indent-guides.nvim'
Plug 'datwaft/bubbly.nvim'
Plug 'machakann/vim-highlightedyank'
Plug 'mhinz/vim-sayonara', {'on': 'Sayonara'}
" IDE
Plug 'mbbill/undotree'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': ':UpdateRemotePlugins'}
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Language support
Plug 'rescript-lang/vim-rescript' " Rescript syntax
Plug 'sheerun/vim-polyglot'
call plug#end()
autocmd FileType markdown let b:coc_suggest_disable = 1
autocmd FileType rescript set omnifunc=xmlcomplete#CompleteTags
autocmd FileType rescript iabbrev <// </<C-X><C-O>
colorscheme tender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment