57 lines
1.5 KiB
VimL
57 lines
1.5 KiB
VimL
" 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
|
|
|
|
" setup plugins
|
|
call plug#begin()
|
|
Plug 'preservim/nerdtree'
|
|
Plug 'ryanoasis/vim-devicons'
|
|
Plug 'vim-airline/vim-airline'
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
Plug 'prabirshrestha/vim-lsp'
|
|
Plug 'mattn/vim-lsp-settings'
|
|
Plug 'prabirshrestha/asyncomplete.vim'
|
|
Plug 'prabirshrestha/asyncomplete-lsp.vim'
|
|
call plug#end()
|
|
|
|
" general settings
|
|
syntax on
|
|
set tabstop=4
|
|
set shiftwidth=4
|
|
set expandtab
|
|
set number relativenumber
|
|
|
|
" required for vim-devicons to work properly
|
|
set encoding=UTF-8
|
|
|
|
" vim-airline settings
|
|
let g:airline_theme='papercolor'
|
|
|
|
" NERDTree settings
|
|
let g:NERDTreeShowHidden=1
|
|
nnoremap <C-t> :NERDTreeToggle<CR>
|
|
|
|
" set up vim-lsp
|
|
let g:lsp_diagnostics_echo_cursor = 1
|
|
|
|
" set up vim-lsp-settings
|
|
let g:lsp_settings= {
|
|
\ 'clangd': {
|
|
\ 'cmd': ['/opt/homebrew/Cellar/llvm/19.1.6/bin/clangd'],
|
|
\ }
|
|
\}
|
|
|
|
" set up autocomplete tabing
|
|
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
|
|
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
|
|
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
|
|
|
|
" set up automatic braces
|
|
inoremap { {<CR>}<Esc>ko
|
|
inoremap ( ()<Esc>i
|
|
inoremap [ []<Esc>i
|
|
inoremap " ""<Esc>i
|