From 292aa54bce09a67dd9116813e3f0645090827b33 Mon Sep 17 00:00:00 2001 From: Marco Thomas Date: Tue, 15 Aug 2023 18:32:21 +0200 Subject: [PATCH] vim: re-arrange lsp, add polyglot --- files/nvim/.config/nvim/lua/mappings.lua | 2 +- files/vim/.vimrc | 64 +++++++++++++++--------- 2 files changed, 41 insertions(+), 25 deletions(-) diff --git a/files/nvim/.config/nvim/lua/mappings.lua b/files/nvim/.config/nvim/lua/mappings.lua index 9c74108..2576690 100644 --- a/files/nvim/.config/nvim/lua/mappings.lua +++ b/files/nvim/.config/nvim/lua/mappings.lua @@ -98,7 +98,7 @@ require('Comment').setup({ local cmp = require 'cmp' cmp.setup({ mapping = { - [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_prev_item(), [""] = cmp.mapping.select_next_item(), [""] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, diff --git a/files/vim/.vimrc b/files/vim/.vimrc index c951d03..88aff14 100644 --- a/files/vim/.vimrc +++ b/files/vim/.vimrc @@ -1,5 +1,7 @@ " ~/.vimrc " +" caveats in config start with XXX +" " ~ M. Thomas let mapleader = "\" @@ -13,26 +15,32 @@ endif call plug#begin() -Plug 'tpope/vim-sleuth' " heuristic file indendation +" essentials Plug 'jiangmiao/auto-pairs' " pair completion -Plug 'tpope/vim-fugitive' " git wrapper -Plug 'mhinz/vim-signify' " show lines changed +Plug 'tpope/vim-fugitive' " git(1) command wrapper +Plug 'mhinz/vim-signify' " show lines changed in git(1) Plug 'tpope/vim-commentary' " DWIM comments +Plug 'sheerun/vim-polyglot' " language packs (highlighting, indent) + +" nice to have +Plug 'metakirby5/codi.vim' " interactive python (:Codi and :Codi!) Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' -Plug 'sainnhe/everforest' " color scheme -Plug 'vim-airline/vim-airline' " nicer status line -Plug 'vim-airline/vim-airline-themes' " auto settings theme for airline - -if has('linux') +if executable('cargo') + " XXX requires locally installed lsp's (see LSP section) Plug 'autozimu/LanguageClient-neovim', { \ 'branch': 'next', \ 'do': 'bash install.sh', \ } endif +" colors +Plug 'sainnhe/everforest' " color scheme +Plug 'vim-airline/vim-airline' " nicer status line +Plug 'vim-airline/vim-airline-themes' " auto settings theme for airline + call plug#end() " ============================== Colors @@ -67,6 +75,8 @@ set backspace=indent,eol,start " always delete with backspace set wildmenu " autocomplete :e set scrolloff=5 " minimum lines above or below the cursor +autocmd FileType c setlocal tabstop=4 shiftwidth=4 noexpandtab + let g:ctrlp_show_hidden = 1 " show hidden files in ctrlp menus let g:fzf_preview_window = ['down,50%', 'ctrl-/'] @@ -122,6 +132,7 @@ let g:netrw_banner = 0 " Remove useless banner at the top of netrw " im a lazy brick cabbrev g Git +cabbrev mktex latexmk -xelatex -shell-escape " search git tracked files via git-ls-files(1) map :GFiles @@ -150,20 +161,25 @@ map :Commentary " clear search highlighting faster map :noh -" ============================== LSP -if has('linux') - set hidden - let g:LanguageClient_serverCommands = { - \ 'rust': ['rust-analyzer'], - \ 'python': ['pylsp'], - \ 'c': ['clangd'], - \ 'cpp': ['clangd'], - \ 'yaml': ['yaml-lsp'], - \ } +" Codi +cabbrev py CodiNew python +map :Codi!! - nnoremap :call LanguageClient_contextMenu() - map :call LanguageClient#textDocument_rename() - map :call LanguageClient#textDocument_definition() - inoremap - imap -endif +" ============================== LSP +set hidden +let g:LanguageClient_serverCommands = { + \ 'rust': ['rust-analyzer'], + \ 'python': ['pylsp'], + \ 'c': ['clangd'], + \ 'cpp': ['clangd'], + \ 'yaml': ['yaml-lsp'], + \ } + +nnoremap :call LanguageClient_contextMenu() +map :call LanguageClient#textDocument_rename() +map :call LanguageClient#textDocument_definition() +map :call LanguageClient#textDocument_hover() + +" completion suggestions mapped to +inoremap +imap