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 'mattn/emmet-vim' Plug 'liuchengxu/vim-which-key' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' Plug 'kamil-stachowski/flatwhite-vim' Plug 'prabirshrestha/vim-lsp' Plug 'mattn/vim-lsp-settings' Plug 'prabirshrestha/asyncomplete.vim' Plug 'prabirshrestha/asyncomplete-lsp.vim' Plug 'tpope/vim-vinegar' Plug 'ap/vim-buftabline' Plug 'sheerun/vim-polyglot' Plug 'kalbasit/vim-colemak' call plug#end() filetype on filetype indent on filetype plugin on set nocompatible set fileformat=unix set encoding=UTF-8 set number set rnu set expandtab set tabstop=4 set shiftwidth=4 set smartindent syntax on 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 colorscheme flatwhite let mapleader = "\" nnoremap nnoremap :WhichKey '' inoremap l 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 autocmd FileType html,css EmmetInstall let g:lightline = { \ 'colorscheme': 'one', \ 'background': 'light', \ } let g:loaded_newtrw = 1 let g:loaded_newtrwPlugin = 1 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 if executable('pylsp') " pip install python-lsp-server au User lsp_setup call lsp#register_server({ \ 'name': 'pylsp', \ 'cmd': {server_info->['pylsp']}, \ 'allowlist': ['python'], \ }) endif function! s:on_lsp_buffer_enabled() abort setlocal omnifunc=lsp#complete setlocal signcolumn=yes if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap gd (lsp-definition) nmap gs (lsp-document-symbol-search) nmap gS (lsp-workspace-symbol-search) nmap gr (lsp-references) nmap gi (lsp-implementation) nmap gt (lsp-type-definition) nmap rn (lsp-rename) nmap [g (lsp-previous-diagnostic) nmap ]g (lsp-next-diagnostic) nmap K (lsp-hover) nnoremap lsp#scroll(+4) nnoremap lsp#scroll(-4) let g:lsp_format_sync_timeout = 1000 autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync') " refer to doc to add more commands endfunction augroup lsp_install au! " call s:on_lsp_buffer_enabled only for languages that has the server registered. autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() augroup END