add vim config

This commit is contained in:
Adam Jeniski 2022-06-23 08:59:27 -04:00
parent dc3987ec3e
commit e0ab0fba55
5 changed files with 3171 additions and 0 deletions

3
.vim/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
plugged
colors

2812
.vim/autoload/plug.vim Normal file

File diff suppressed because it is too large Load Diff

162
.vim/keymaps.vim Normal file
View File

@ -0,0 +1,162 @@
"""" Key Bindings
:nmap <F1> :echo<CR>
:imap <F1> <C-o>:echo<CR>
" move vertically by visual line (don't skip wrapped lines)
nmap j gj
nmap k gk
let mapleader = ' '
let maplocalleader = ' '
" save file bind
noremap <c-s> :w<cr>
" exit terminal mode
:tnoremap <Esc> <C-\><C-n>
" toggle relative number
function! ToggleLineNumber()
if &rnu == 1
set nornu
else
set rnu
endif
endfunction
nnoremap <leader>tr :call ToggleLineNumber()<CR>
" toggle Zen Mode
nnoremap <leader>tz :Goyo<CR>
" tree sitter text object key bindings
lua <<EOF
require'nvim-treesitter.configs'.setup {
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
},
},
},
}
EOF
" remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <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 CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Symbol renaming.
nmap <leader>rn <Plug>(coc-rename)
" Formatting selected code.
xmap <leader>f <Plug>(coc-format-selected)
" jump to next error
nnoremap <leader>EN <Plug>(coc-diagnostic-next)
nnoremap <leader>EB <Plug>(coc-diagnostic-prev)
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: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap keys for applying codeAction to the current buffer.
nmap <leader>ac <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>qf <Plug>(coc-fix-current)
" ignore for ctrlp
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|target\|dist\|build'
" ignore for telescope
if has('nvim')
lua <<EOF
require('telescope').setup{ defaults = { file_ignore_patterns = {".git", "node_modules", "dist", "build", "DS_Store"} } }
EOF
endif
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ CheckBackspace() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
" Make <CR> auto-select the first completion item and notify coc.nvim to
" " format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
" transparent vim toggle bind
nnoremap <leader>tt :TransparentToggle<cr>
" prettier format bind
nnoremap <leader>P :PrettierAsync<cr>
" binds for swapping buffers
nnoremap gT :bp<cr>
nnoremap gt :bn<cr>
nnoremap <leader>h :wincmd h<cr>
nnoremap <leader>j :wincmd j<cr>
nnoremap <leader>k :wincmd k<cr>
nnoremap <leader>l :wincmd l<cr>
" format clojure
nnoremap <leader>F :AsyncRun! lein cljfmt fix<cr><cr>

97
.vim/plugins.vim Normal file
View File

@ -0,0 +1,97 @@
call plug#begin('~/.vim/plugged')
" File Viewer
Plug 'scrooloose/nerdtree'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
"Plug 'ryanoasis/vim-devicons' " disable for git-bash (no emoji support)
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
" git wrapper
Plug 'tpope/vim-fugitive'
Plug 'airblade/vim-gitgutter'
" status bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" theme
Plug 'ghifarit53/tokyonight-vim'
Plug 'EdenEast/nightfox.nvim'
Plug 'tribela/vim-transparent'
Plug 'junegunn/goyo.vim'
Plug 'arcticicestudio/nord-vim'
Plug 'dylanaraps/wal'
" editing extensions
Plug 'skywind3000/asyncrun.vim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-treesitter/nvim-treesitter-textobjects'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
Plug 'preservim/nerdcommenter'
Plug 'prettier/vim-prettier', { 'do': 'yarn install --frozen-lockfile --production' }
Plug 'guns/vim-sexp'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'tpope/vim-dispatch'
Plug 'radenling/vim-dispatch-neovim'
Plug 'clojure-vim/vim-jack-in'
Plug 'luochen1990/rainbow'
Plug 'jiangmiao/auto-pairs'
" language support
Plug 'sheerun/vim-polyglot'
Plug 'jparise/vim-graphql'
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
Plug 'evanleck/vim-svelte'
Plug 'pangloss/vim-javascript'
Plug 'HerringtonDarkholme/yats.vim'
Plug 'pantharshit00/vim-prisma'
Plug 'Olical/conjure'
Plug 'tpope/vim-fireplace'
" fuzzy file finder
Plug 'kien/ctrlp.vim'
call plug#end()
" airline settings
let g:airline_powerline_fonts = 1
let g:airline_theme='night_owl'
let g:airline_section_y = '%{strftime("%H:%M")}'
let g:airline#extensions#tabline#enabled = 1 " Enable the list of buffers
let g:airline#extensions#whitespace#enabled = 0
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
" Enable rainbow parens
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
" powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = ''
let g:airline_symbols.linenr = '☰'
let g:airline_symbols.maxlinenr = ''
let g:airline_symbols.dirty='⚡'
" ctrlp settings
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|build\|dist\|target'
" telescope settings
lua << EOF
require('telescope').setup{ defaults = { file_ignore_patterns = {
"node_modules",
".git",
"build",
"dist",
"target"
} } }
EOF

97
.vim/vimrc Normal file
View File

@ -0,0 +1,97 @@
source ~/.vim/plugins.vim
source ~/.vim/keymaps.vim
"""" Basic Behavior
set number
set relativenumber
set wrap " wrap lines
set encoding=UTF-8 " set encoding to UTF-8 (default was "latin1")
set mouse=a " enable mouse support (might not work well on Mac OS X)
set wildmenu " visual autocomplete for command menu
set lazyredraw " redraw screen only when we need to
set showmatch " highlight matching parentheses / brackets [{()}]
set laststatus=2 " always show statusline (even with only single window)
set ruler " show line and column number of the cursor on right side of statusline
set visualbell " blink cursor on error, instead of beeping
set invlist " show tabs
""" Vim Appearance
syntax on
set t_Co=256
set cursorline
set termguicolors
let g:tokyonight_style = 'night' " available: night, storm
let g:tokyonight_enable_italic = 1
colorscheme nord
" colorscheme wal
" colorscheme nordfox
" colorscheme tokyonight
" colorscheme duskfox
" colorscheme nightfox
hi Normal guibg=NONE ctermbg=NONE
" turn on mouse mode
" use filetype-based syntax highlighting, ftplugins, and indentati
syntax enable
filetype plugin indent on
set foldmethod=indent
set foldlevel=10
" fix clipboard
" set clipboard=unnamed.unnamedplus
"""" Tab settings
set tabstop=4 " width that a <TAB> character displays as
set shiftwidth=4 " number of spaces to use for each step of (auto)indent
set softtabstop=4 " backspace after pressing <TAB> will remove up to this many spaces
set autoindent " copy indent from current line when starting a new line
set smartindent " even better autoindent (e.g. add indent after '{')
"""" Search settings
set incsearch " search as characters are entered
set hlsearch " highlight matches
" turn off search highlighting with <CR> (carriage-return)
nnoremap <CR> :nohlsearch<CR><CR>
"""" NerdTree Settings
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
let g:NerdTreeQuitOnOpen = 1
nnoremap <leader>n :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
nnoremap <C-f> :NERDTreeFind<CR>
" Start NERDTree when Vim starts with a directory argument.
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists('s:std_in') |
\ execute 'NERDTree' argv()[0] | wincmd p | enew | execute 'cd '.argv()[0] | endif
" Exit Vim if NERDTree is the only window remaining in the only tab.
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
"""" Miscellaneous settings that might be worth enabling
set cursorline " highlight current line
set background=dark " configure Vim to use brighter colors
set autoread " autoreload the file in Vim if it has been changed outside of Vim