From 3f0d25f0a0ff2c8892d2a8f420f000118f82a263 Mon Sep 17 00:00:00 2001 From: Jordan Orelli Date: Wed, 14 Sep 2022 17:07:58 -0500 Subject: [PATCH] rust autocomplete stuff seems to be working now --- .vim/ftplugin/rust.vim | 1 + .vimrc | 88 ++++++++++++++++++++++++++---------------- 2 files changed, 55 insertions(+), 34 deletions(-) create mode 100644 .vim/ftplugin/rust.vim diff --git a/.vim/ftplugin/rust.vim b/.vim/ftplugin/rust.vim new file mode 100644 index 0000000..0f403a9 --- /dev/null +++ b/.vim/ftplugin/rust.vim @@ -0,0 +1 @@ +nnoremap :ALEGoToDefinition diff --git a/.vimrc b/.vimrc index b4a0b11..85a1681 100644 --- a/.vimrc +++ b/.vimrc @@ -8,30 +8,29 @@ call vundle#begin() " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' - " Plugin 'ycm-core/YouCompleteMe' - Plugin 'tpope/vim-fugitive' - Plugin 'tpope/vim-surround' - Plugin 'tpope/vim-rails' - Plugin 'tpope/vim-repeat' - Plugin 'slim-template/vim-slim' - Plugin 'kchmck/vim-coffee-script' - Plugin 'fatih/vim-go' - Plugin 'fatih/vim-hclfmt' - Plugin 'nanotech/jellybeans.vim' - Plugin 'ervandew/supertab' - Plugin 'scrooloose/nerdcommenter' - Plugin 'scrooloose/nerdtree' - Plugin 'Align' - Plugin 'tomtom/tlib_vim' " dependency of flashdevelop - Plugin 'endel/flashdevelop.vim' - Plugin 'ctrlpvim/ctrlp.vim' - Plugin 'itchyny/lightline.vim' - Plugin 'heavenshell/vim-jsdoc' - Plugin 'hashivim/vim-terraform' - Plugin 'b4b4r07/vim-hcl' - Plugin 'Glench/Vim-Jinja2-Syntax' - Plugin 'prabirshrestha/vim-lsp' - Plugin 'mattn/vim-lsp-settings' + Plugin 'dense-analysis/ale' " asynchronous linting engine + Plugin 'tpope/vim-fugitive' " git integration that I never use + Plugin 'tpope/vim-surround' " edits surrounding quotes and parens and the like + Plugin 'tpope/vim-rails' " rails project management stuff + Plugin 'tpope/vim-repeat' " fixes the . key for ...something + Plugin 'slim-template/vim-slim' " what in the 2008 is this + Plugin 'kchmck/vim-coffee-script' " lol coffee script + Plugin 'fatih/vim-go' " all-in-one Go tools + Plugin 'fatih/vim-hclfmt' " nicely formats hcl files + Plugin 'nanotech/jellybeans.vim' " the best colorscheme + Plugin 'ervandew/supertab' " makes tab better apparently + Plugin 'scrooloose/nerdcommenter' " no idea if I'm even using this + Plugin 'scrooloose/nerdtree' " better file navigation + Plugin 'Align' " aligns things on demand + Plugin 'tomtom/tlib_vim' " dependency of flashdevelop + Plugin 'endel/flashdevelop.vim' " this is probably old now + Plugin 'ctrlpvim/ctrlp.vim' " don't actually know how to use this honestly + Plugin 'itchyny/lightline.vim' " fancy status line + Plugin 'heavenshell/vim-jsdoc' " js docs? + Plugin 'hashivim/vim-terraform' " hclfmt but for terraform + Plugin 'b4b4r07/vim-hcl' " hcl syntax stuff? + Plugin 'Glench/Vim-Jinja2-Syntax' " jinja2 syntax stuff + Plugin 'rust-lang/rust.vim' " bare minimum rust syntax stuff " Past plugins " @@ -47,6 +46,11 @@ call vundle#begin() " " this repo is gone " Plugin 'calviken/vim-gdscript3' + " + " I'm trying ALE instead + " Plugin 'ycm-core/YouCompleteMe' + " Plugin 'prabirshrestha/vim-lsp' + " Plugin 'mattn/vim-lsp-settings' call vundle#end() " required " enable the filetype plugin @@ -214,6 +218,7 @@ if has("autocmd") autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType css set omnifunc=csscomplete#CompleteCSS + autocmd FileType rust set omnifunc=ale#completion#OmniFunc " causes VIM to enter the directory of the file being edited to simplify " finding related files. @@ -353,21 +358,36 @@ onoremap il( :normal! F)vi( " use omnicomplete by default " let g:SuperTabDefaultCompletionType = "" +let g:SuperTabDefaultCompletionType = "" +let g:SuperTabClosePreviewOnPopupClose = 1 + " close doc window after finishing an autocomplete " let g:SuperTabClosePreviewOnPopupClose = 1 " ---------------------------------------------------------------------------}}} " YouCompleteMe -------------------------------------------------------------{{{ -let g:ycm_keep_logfiles = 1 -let g:ycm_log_level = 'debug' -let g:ycm_language_server = - \ [ - \ { - \ 'name': 'zig', - \ 'cmdline': [ 'zls', '--debug-log' ], - \ 'filetypes': [ 'zig' ], - \ } - \ ] +" +" I've stopped using this because the install process was too crazy +" +" let g:ycm_keep_logfiles = 1 +" let g:ycm_log_level = 'debug' +" let g:ycm_language_server = +" \ [ +" \ { +" \ 'name': 'zig', +" \ 'cmdline': [ 'zls', '--debug-log' ], +" \ 'filetypes': [ 'zig' ], +" \ } +" \ ] +" ---------------------------------------------------------------------------}}} + +" ALE -----------------------------------------------------------------------{{{ +let g:ale_linters = {'rust': ['analyzer']} +let g:ale_fixers = {'rust': ['rustfmt', 'trim_whitespace', 'remove_trailing_lines']} +let g:rustfmt_autosave = 1 +let g:ale_rust_cargo_use_clippy = executable('cargo-clippy') +let g:ale_completion_enabled = 1 +set completeopt=menu,menuone,preview,noselect,noinsert " ---------------------------------------------------------------------------}}} " CtrlP ---------------------------------------------------------------------{{{