vim: re-arrange lsp, add polyglot

This commit is contained in:
Marco Thomas
2023-08-15 18:32:21 +02:00
parent 8824d51b24
commit 292aa54bce
2 changed files with 41 additions and 25 deletions

View File

@@ -98,7 +98,7 @@ require('Comment').setup({
local cmp = require 'cmp' local cmp = require 'cmp'
cmp.setup({ cmp.setup({
mapping = { mapping = {
["<C-n>"] = cmp.mapping.select_prev_item(), ["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(), ["<C-n>"] = cmp.mapping.select_next_item(),
["<Tab>"] = cmp.mapping.confirm({ ["<Tab>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert, behavior = cmp.ConfirmBehavior.Insert,

View File

@@ -1,5 +1,7 @@
" ~/.vimrc " ~/.vimrc
" "
" caveats in config start with XXX
"
" ~ M. Thomas " ~ M. Thomas
let mapleader = "\<Space>" let mapleader = "\<Space>"
@@ -13,26 +15,32 @@ endif
call plug#begin() call plug#begin()
Plug 'tpope/vim-sleuth' " heuristic file indendation " essentials
Plug 'jiangmiao/auto-pairs' " pair completion Plug 'jiangmiao/auto-pairs' " pair completion
Plug 'tpope/vim-fugitive' " git wrapper Plug 'tpope/vim-fugitive' " git(1) command wrapper
Plug 'mhinz/vim-signify' " show lines changed Plug 'mhinz/vim-signify' " show lines changed in git(1)
Plug 'tpope/vim-commentary' " DWIM comments 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', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'sainnhe/everforest' " color scheme if executable('cargo')
Plug 'vim-airline/vim-airline' " nicer status line " XXX requires locally installed lsp's (see LSP section)
Plug 'vim-airline/vim-airline-themes' " auto settings theme for airline
if has('linux')
Plug 'autozimu/LanguageClient-neovim', { Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next', \ 'branch': 'next',
\ 'do': 'bash install.sh', \ 'do': 'bash install.sh',
\ } \ }
endif 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() call plug#end()
" ============================== Colors " ============================== Colors
@@ -67,6 +75,8 @@ set backspace=indent,eol,start " always delete with backspace
set wildmenu " autocomplete :e set wildmenu " autocomplete :e
set scrolloff=5 " minimum lines above or below the cursor 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:ctrlp_show_hidden = 1 " show hidden files in ctrlp menus
let g:fzf_preview_window = ['down,50%', 'ctrl-/'] 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 " im a lazy brick
cabbrev g Git cabbrev g Git
cabbrev mktex latexmk -xelatex -shell-escape
" search git tracked files via git-ls-files(1) " search git tracked files via git-ls-files(1)
map <C-p> :GFiles<CR> map <C-p> :GFiles<CR>
@@ -150,20 +161,25 @@ map <C-_> :Commentary<CR>
" clear search highlighting faster " clear search highlighting faster
map <esc> :noh <CR> map <esc> :noh <CR>
" ============================== LSP " Codi
if has('linux') cabbrev py CodiNew python
set hidden map <C-i> :Codi!!<CR>
let g:LanguageClient_serverCommands = {
\ 'rust': ['rust-analyzer'],
\ 'python': ['pylsp'],
\ 'c': ['clangd'],
\ 'cpp': ['clangd'],
\ 'yaml': ['yaml-lsp'],
\ }
nnoremap <C-l> :call LanguageClient_contextMenu()<CR> " ============================== LSP
map <F2> :call LanguageClient#textDocument_rename()<CR> set hidden
map <F12> :call LanguageClient#textDocument_definition()<CR> let g:LanguageClient_serverCommands = {
inoremap <C-space> <C-x><C-o> \ 'rust': ['rust-analyzer'],
imap <C-@> <C-space> \ 'python': ['pylsp'],
endif \ 'c': ['clangd'],
\ 'cpp': ['clangd'],
\ 'yaml': ['yaml-lsp'],
\ }
nnoremap <C-l> :call LanguageClient_contextMenu()<CR>
map <F2> :call LanguageClient#textDocument_rename()<CR>
map <F12> :call LanguageClient#textDocument_definition()<CR>
map <C-h> :call LanguageClient#textDocument_hover()<CR>
" completion suggestions mapped to <C-Space>
inoremap <C-space> <C-x><C-o>
imap <C-@> <C-space>