Add extra packages

Add completion packages, re-add vim-slime
Add command to README to install/clean plugins
This commit is contained in:
Edward Litherland-Smith 2022-08-09 15:16:37 +01:00
parent ef1a91b5e5
commit 808d53cdd6
3 changed files with 81 additions and 5 deletions

View file

@ -18,6 +18,7 @@ ln -s $HOME/.vim/init.vim $HOME/.config/nvim/init.vim
### Installing `vim-plug` plugin manager ### Installing `vim-plug` plugin manager
```bash ```bash
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
vim -c PlugInstall -c PlugClean -c qa! # To install plugins for nvim defined in init.vim
``` ```
Plugin definitions are in `init.vim`, inside `vim` run `:PlugInstall` to install plugins Plugin definitions are in `init.vim`, inside `vim` run `:PlugInstall` to install plugins

View file

@ -28,8 +28,15 @@ Plug 'tpope/vim-commentary'
Plug 'airblade/vim-gitgutter' Plug 'airblade/vim-gitgutter'
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'
" Plug 'itchyny/lightline.vim'
Plug 'christoomey/vim-tmux-navigator' Plug 'christoomey/vim-tmux-navigator'
Plug 'jpalardy/vim-slime'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
" Initialize plugin system " Initialize plugin system
call plug#end() call plug#end()
@ -102,14 +109,14 @@ set splitright
let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
let g:slime_target = "tmux"
let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": "{last}"}
" function! GitStatus() " function! GitStatus()
" let [a,m,r] = GitGutterGetHunkSummary() " let [a,m,r] = GitGutterGetHunkSummary()
" return printf('%s +%d ~%d -%d', FugitiveHead(), a, m, r) " return printf('%s +%d ~%d -%d', FugitiveHead(), a, m, r)
" endfunction " endfunction
" "
" let g:slime_target = "tmux"
" let g:slime_default_config = {"socket_name": get(split($TMUX, ","), 0), "target_pane": "{last}"}
"
" let g:lightline = { 'colorscheme': 'onehalfdark' } " let g:lightline = { 'colorscheme': 'onehalfdark' }
" let g:lightline.component_expand = { " let g:lightline.component_expand = {
" \ 'linter_checking': 'lightline#ale#checking', " \ 'linter_checking': 'lightline#ale#checking',

View file

@ -36,6 +36,72 @@ local lsp_flags = {
-- This is the default in Nvim 0.7+ -- This is the default in Nvim 0.7+
debounce_text_changes = 150, debounce_text_changes = 150,
} }
-- Setup nvim-cmp.
local cmp = require'cmp'
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
},
window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
})
})
-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
sources = cmp.config.sources({
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
}, {
{ name = 'buffer' },
})
})
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
-- Setup lspconfig.
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig')['pylsp'].setup{ require('lspconfig')['pylsp'].setup{
cmd = {os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/pylsp"}, cmd = {os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/pylsp"},
on_attach = on_attach, on_attach = on_attach,
@ -47,12 +113,14 @@ require('lspconfig')['pylsp'].setup{
flake8 = {maxLineLength = 88} flake8 = {maxLineLength = 88}
} }
} }
} },
capabilities = capabilities
} }
require('lspconfig')['fortls'].setup{ require('lspconfig')['fortls'].setup{
cmd = {os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/fortls"}, cmd = {os.getenv( "HOME" ).."/.pyenv/versions/neovim3/bin/fortls"},
on_attach = on_attach, on_attach = on_attach,
flags = lsp_flags, flags = lsp_flags,
capabilities = capabilities
} }
require'nvim-treesitter.configs'.setup { require'nvim-treesitter.configs'.setup {