Created
February 16, 2021 14:04
-
-
Save dusty-phillips/877077b3c956b0903a0042126e29c653 to your computer and use it in GitHub Desktop.
2021 Neovim Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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> | |
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 | |
" 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 | |
inoremap ;p <C-o>"*p | |
" select last changed or put text | |
nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]' | |
" move last register to system clipboard | |
nnoremap Y :let @*=@"<CR> | |
" 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) | |
imap ;h <C-o><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 'glepnir/zephyr-nvim' | |
" Editing | |
Plug 'tpope/vim-sensible' | |
Plug 'tpope/vim-commentary' | |
Plug 'tpope/vim-abolish' | |
Plug 'tpope/vim-sleuth' | |
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 'rhysd/conflict-marker.vim' | |
" Visual | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'glepnir/indent-guides.nvim' | |
Plug 'datwaft/bubbly.nvim' | |
Plug 'machakann/vim-highlightedyank' | |
Plug 'norcalli/nvim-colorizer.lua' | |
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 'nvim-treesitter/nvim-treesitter' | |
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 zephyr | |
hi Normal guibg=NONE ctermbg=NONE | |
lua require 'colorizer'.setup() | |
lua <<EOF | |
require'nvim-treesitter.configs'.setup { | |
highlight = { | |
enable = true, | |
}, | |
} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment