" General settings set belloff=all set nocompatible set hidden set backspace=eol,start,indent set nu set ignorecase set laststatus=2 filetype off filetype plugin indent on "Space as leader nnoremap let mapleader="\" let g:mapleader="\" "Buffer navigation nnoremap [b :bprev nnoremap ]b :bnext nnoremap c :bprev\|bdelete # nnoremap C :bdelete! nnoremap f :echo expand('%:p') " Window navigation nnoremap h nnoremap j nnoremap k nnoremap l " Tab settings set expandtab set smarttab set shiftwidth=4 set tabstop=4 set background=dark "File specific tab settings autocmd FileType yaml setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab autocmd FileType typescript setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab autocmd FileType typescriptreact setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab autocmd FileType python setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab " Trim whitespace before write fun! TrimWhitespace() let l:save = winsaveview() keeppatterns %s/\s\+$//e call winrestview(l:save) endfun autocmd BufWritePre * call TrimWhitespace() set cmdheight=2 set updatetime=300 set shortmess+=c set signcolumn=yes "Auto install vim-plug let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' if empty(glob(data_dir . '/autoload/plug.vim')) silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif "Plugins call plug#begin() Plug 'preservim/nerdtree' Plug 'tmhedberg/SimpylFold' Plug 'tpope/vim-fugitive' Plug 'sainnhe/gruvbox-material' Plug 'kien/ctrlp.vim' Plug 'itchyny/lightline.vim' Plug 'junegunn/fzf' Plug 'junegunn/fzf.vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'neoclide/coc-snippets' Plug 'pangloss/vim-javascript' Plug 'neoclide/vim-jsx-improve' Plug 'leafgarland/typescript-vim' Plug 'peitalin/vim-jsx-typescript' Plug 'ojroques/vim-oscyank', {'branch': 'main'} Plug 'ap/vim-buftabline' Plug 'adamlamers/terminal-drawer.vim' call plug#end() "Colorscheme colorscheme gruvbox-material "Coc Config " Use to trigger completion if has('nvim') inoremap coc#refresh() else inoremap coc#refresh() endif function! ShowDocumentation() if CocAction('hasProvider', 'hover') call CocActionAsync('doHover') else call feedkeys('K', 'in') endif endfunction function! CheckBackspace() abort let col = col('.') - 1 return !col || getline('.')[col - 1] =~# '\s' endfunction nmap [g (coc-diagnostic-prev) nmap ]g (coc-diagnostic-next) nmap d (coc-definition) nmap rn (coc-rename) nmap D :CocDiagnostics nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) nmap gr (coc-references) " Suggestion navigation inoremap coc#refresh() inoremap coc#pum#visible() ? coc#_select_confirm() : "\" inoremap coc#pum#visible() ? coc#_select_confirm() : "\" nnoremap K :call ShowDocumentation() nnoremap coc#float#has_scroll() ? coc#float#scroll(1, 1) : "" nnoremap coc#float#has_scroll() ? coc#float#scroll(0, 1) : "" " Symbol renaming nmap rn (coc-rename) " Formatting selected code xmap = (coc-format-selected) nmap = (coc-format-selected) let g:coc_disable_transparent_cursor=1 "SimpylFold Config let g:SimpylFold_docstring_preview=1 "NERDTree keybinds nmap g :NERDTreeFind nmap e :NERDTreeToggle let NERDTreeIgnore = ['__pycache__', '\.pyc$', '\.egg-info$', 'node_modules'] " prevent changing buffer in NERDtree window autocmd BufWinLeave * if &filetype == 'nerdtree' | call interrupt() | endif "CtrlP config nmap :CtrlPBuffer nmap :CtrlP let g:ctrlp_working_path_mode= 0 let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\|\.egg-info|\.pyc' "fzf keybinds let $FZF_DEFAULT_COMMAND = 'rg --files -g "!node_modules/"' nmap :FZF nmap :Rg "Wildignore set wildignore+=*/node_modules/*,*/__pycache__/*,*.pyc,*.egg-info "OSCYank settings autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is 'a' | execute 'OSCYankReg a' | endif nnoremap yf :call OSCYank(expand('%:p')) "Lightline settings let g:lightline = { \ 'colorscheme': 'wombat', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] \ }, \ 'component_function': { \ 'gitbranch': 'FugitiveHead' \ }, \ } " Terminal drawer options let g:terminal_drawer_start_nobuflisted = 1