"TODO: add documentation in the vim folder for this vim config if empty(glob('~/.vim/autoload/plug.vim')) silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim endif call plug#begin('~/.vim/plugged') Plug 'itchyny/lightline.vim' Plug 'rafi/awesome-vim-colorschemes' Plug 'mattn/emmet-vim' Plug 'liuchengxu/vim-which-key' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'kamil-stachowski/flatwhite-vim' Plug 'ap/vim-buftabline' Plug 'sheerun/vim-polyglot' Plug 'tpope/vim-commentary' Plug 'yegappan/lsp' Plug 'mattn/vim-lsp-settings' Plug 'normen/vim-lsp-settings-adapter' Plug 'kalbasit/vim-colemak' call plug#end() let mapleader = "\" syntax on "filetype filetype on filetype indent on filetype plugin on "set set nocompatible set fileformat=unix set encoding=UTF-8 set number set nowrap set rnu set expandtab set tabstop=4 set shiftwidth=4 set smarttab set smartindent set noswapfile set incsearch set ignorecase set smartcase set autochdir set hidden set virtualedit=onemore set timeoutlen=500 set ttimeoutlen=1 set termguicolors set laststatus=2 set noshowmode set undofile set undodir=~/.vim/undodir set signcolumn=yes set shortmess+=c " etc colorscheme flatwhite nnoremap nnoremap :WhichKey '' inoremap l nnoremap y w nnoremap c "+y vnoremap c "+y autocmd FileType html,css EmmetInstall "let let g:VM_maps = {} let g:buftabline_show = 2 let g:buftabline_numbers = 1 let g:user_emmet_leader_key='' let g:user_emmet_mode='n' let g:user_emmet_install_global = 0 let g:lightline = { \ 'colorscheme': 'one', \ 'background': 'light', \ } let g:which_key_map = {} let g:which_key_map.f = ['Files', 'file buffer'] let g:which_key_map.b = { \ 'name' : '+buffer', \ 'n' : ['bn', 'next buffer'], \ 'p' : ['bp', 'previous buffer'], \ 'b' : ['Buffers', 'fuzzy find buffers'], \ } call which_key#register('', 'g:which_key_map') " lsp autocmd User LspSetup call LspOptionsSet(#{ \ autoComplete: v:true, \ autoHighlightDiags: v:true, \ }) " one list instead of N copy-pasted if-executable/augroup blocks autocmd User LspSetup call LspAddServer([ \ #{name: 'pylsp', filetype: 'python', path: 'pylsp'}, \ #{name: 'clangd', filetype: ['c', 'cpp', 'objc', 'objcpp'], \ path: 'clangd', args: ['--background-index']}, \ #{name: 'html', filetype: 'html', \ path: 'vscode-html-language-server', args: ['--stdio']}, \ #{name: 'css', filetype: ['css', 'scss', 'less'], \ path: 'vscode-css-language-server', args: ['--stdio']}, \ #{name: 'ts', filetype: ['javascript', 'javascript.jsx', 'javascriptreact'], \ path: 'typescript-language-server', args: ['--stdio']}, \ ]) " keymaps: explicit :Lsp* commands mapped by hand, buffer-local, same idea as " your old on_lsp_buffer_enabled() but no separate function/augroup needed — " this fires once per attached buffer via the plugin's own event autocmd User LspAttached call s:lsp_keymaps() function! s:lsp_keymaps() abort nmap gs :LspDocumentSymbol nmap gr :LspShowReferences nmap gi :LspGotoImpl nmap gt :LspGotoTypeDef nmap rn :LspRename nmap [g :LspDiagPrev nmap ]g :LspDiagNext nmap K :LspHover if index(['python', 'c', 'cpp', 'objc', 'objcpp', \ 'javascript', 'javascript.jsx', 'javascriptreact'], &filetype) >= 0 autocmd BufWritePre LspFormat endif endfunction function! s:prettier_format() abort if !executable('prettier') return endif let l:view = winsaveview() silent %!prettier --stdin-filepath % --html-whitespace-sensitivity=scrict if v:shell_error silent undo echohl ErrorMsg | echom 'formatting failed' endif call winrestview(l:view) endfunction augroup prettierformat au! autocmd BufWritePre *.html,*.css call s:prettier_format() augroup END