Update plugin setup

This commit is contained in:
Daniel Lynn 2022-03-11 15:49:48 -06:00
parent eab4fe2fbf
commit 58d7223925
Signed by: daniel
GPG Key ID: 28496A140E180A9D
4 changed files with 168 additions and 133 deletions

View File

@ -9,33 +9,34 @@ vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.setloclist
-- Use an on_attach function to only map the following keys -- Use an on_attach function to only map the following keys
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) local on_attach = function(_, bufnr)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
vim.api.nvim_buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
end end
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- map buffer local keybindings when the language server attaches
local servers = { 'solargraph', 'rust_analyzer', 'gopls', 'tsserver', 'stylelint_lsp' } local servers = { 'solargraph', 'rust_analyzer', 'gopls', 'tsserver', 'stylelint_lsp' }
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
for _, lsp in pairs(servers) do for _, lsp in pairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities,
flags = { flags = {
debounce_text_changes = 150, debounce_text_changes = 150,
} }

View File

@ -22,50 +22,71 @@ nmap S <Plug>(vsnip-cut-text)
xmap S <Plug>(vsnip-cut-text) xmap S <Plug>(vsnip-cut-text)
lua <<EOF lua <<EOF
-- Setup nvim-cmp. -- Setup nvim-cmp.
local cmp = require'cmp' local cmp = require'cmp'
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) -- REQUIRED - you must specify a snippet engine
-- For `vsnip` user. expand = function(args)
vim.fn["vsnip#anonymous"](args.body) vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
-- For `luasnip` user. -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
-- require('luasnip').lsp_expand(args.body) -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
end,
-- For `ultisnips` user. },
-- vim.fn["UltiSnips#Anon"](args.body) mapping = {
end, ['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
}, ['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
mapping = { ['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }), ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }), ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
['<C-Space>'] = cmp.mapping.complete(), ['<C-e>'] = cmp.mapping({
['<C-e>'] = cmp.mapping.close(), i = cmp.mapping.abort(),
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }), c = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({ }),
behavior = cmp.ConfirmBehavior.Replace, ['<CR>'] = cmp.mapping.confirm({
select = true, behavior = cmp.ConfirmBehavior.Replace,
}) select = true, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}, })
sources = { },
{ name = 'nvim_lsp' }, sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- For vsnip user. { name = 'vsnip' }, -- For vsnip users.
{ name = 'vsnip' }, -- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- For luasnip user. -- { name = 'snippy' }, -- For snippy users.
-- { name = 'luasnip' }, }, {
{ name = 'buffer' },
-- For ultisnips user.
-- { name = 'ultisnips' },
{ 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('/', {
sources = {
{ name = 'buffer' }
}
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
})
EOF EOF

View File

@ -8,7 +8,7 @@ Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'mfussenegger/nvim-dap' Plug 'mfussenegger/nvim-dap'
Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'petertriho/nvim-scrollbar' "Plug 'petertriho/nvim-scrollbar'
Plug 'posva/vim-vue', { 'for': 'vue' } Plug 'posva/vim-vue', { 'for': 'vue' }
Plug 'ron-rs/ron.vim', { 'for': 'ron' } Plug 'ron-rs/ron.vim', { 'for': 'ron' }
Plug 'simrat39/rust-tools.nvim' Plug 'simrat39/rust-tools.nvim'
@ -23,13 +23,15 @@ Plug 'wakatime/vim-wakatime'
Plug 'windwp/nvim-autopairs' Plug 'windwp/nvim-autopairs'
" LSP and autocomplete " LSP and autocomplete
Plug 'neovim/nvim-lspconfig' | Plug 'neovim/nvim-lspconfig'
\ Plug 'hrsh7th/cmp-nvim-lsp' | Plug 'hrsh7th/cmp-nvim-lsp'
\ Plug 'hrsh7th/cmp-buffer' | Plug 'hrsh7th/cmp-buffer'
\ Plug 'hrsh7th/nvim-cmp' | Plug 'hrsh7th/cmp-path'
\ Plug 'hrsh7th/cmp-vsnip' | Plug 'hrsh7th/cmp-cmdline'
\ Plug 'hrsh7th/vim-vsnip' | Plug 'hrsh7th/nvim-cmp'
\ Plug 'rafamadriz/friendly-snippets' Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'rafamadriz/friendly-snippets'
" Gitsigns " Gitsigns
Plug 'lewis6991/gitsigns.nvim' Plug 'lewis6991/gitsigns.nvim'
@ -38,24 +40,24 @@ Plug 'lewis6991/gitsigns.nvim'
Plug 'nvim-telescope/telescope.nvim' Plug 'nvim-telescope/telescope.nvim'
" Lightline " Lightline
Plug 'itchyny/lightline.vim' | Plug 'itchyny/lightline.vim'
\ Plug 'albertomontesg/lightline-asyncrun' | Plug 'albertomontesg/lightline-asyncrun'
\ Plug 'itchyny/vim-gitbranch' | Plug 'itchyny/vim-gitbranch'
\ Plug 'macthecadillac/lightline-gitdiff' | Plug 'macthecadillac/lightline-gitdiff'
\ Plug 'ryanoasis/vim-devicons' | Plug 'ryanoasis/vim-devicons'
\ Plug 'anstadnik/tmuxline.vim' Plug 'anstadnik/tmuxline.vim'
" Using the above fork for lightline truecolor support " Using the above fork for lightline truecolor support
" \ Plug 'edkolev/tmuxline.vim' " \ Plug 'edkolev/tmuxline.vim'
" NvimTree " NvimTree
Plug 'kyazdani42/nvim-tree.lua' | Plug 'kyazdani42/nvim-tree.lua'
\ Plug 'kyazdani42/nvim-web-devicons' Plug 'kyazdani42/nvim-web-devicons'
" Vim-Markdown " Vim-Markdown
Plug 'godlygeek/tabular' | Plug 'godlygeek/tabular'
\ Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
" sonokai colorscheme + supporting plugins " sonokai colorscheme + supporting plugins
Plug 'sainnhe/sonokai' | Plug 'sainnhe/sonokai'
\ Plug 'rmolin88/pomodoro.vim' | Plug 'rmolin88/pomodoro.vim'
\ Plug 'sainnhe/artify.vim' Plug 'sainnhe/artify.vim'

115
vimrc
View File

@ -61,100 +61,111 @@ if executable('rg')
set grepprg=rg\ --color\ never set grepprg=rg\ --color\ never
endif endif
" Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif
" Plugins " Plugins
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
if filereadable(expand("~/.config/nvim/plugins.vimrc")) if filereadable(expand("~/.config/nvim/plugins.vimrc"))
source ~/.config/nvim/plugins.vimrc source ~/.config/nvim/plugins.vimrc
" Run PlugInstall if there are missing plugins
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source ~/.config/nvim/plugins.vimrc
\| endif
endif endif
call plug#end() call plug#end()
" Autocomplete
if filereadable(expand("~/.config/nvim/nvim-cmp.vimrc"))
source ~/.config/nvim/nvim-cmp.vimrc
endif
" Autopairs
if filereadable(expand("~/.config/nvim/autopairs.vimrc"))
source ~/.config/nvim/autopairs.vimrc
endif
" LSP
if filereadable(expand("~/.config/nvim/lspconfig.vimrc"))
source ~/.config/nvim/lspconfig.vimrc
endif
" Keybindings " Keybindings
if filereadable(expand("~/.config/nvim/keybindings.vimrc")) if filereadable(expand("~/.config/nvim/keybindings.vimrc"))
source ~/.config/nvim/keybindings.vimrc source ~/.config/nvim/keybindings.vimrc
endif endif
" Gitsigns setup
if filereadable(expand("~/.config/nvim/gitsigns.vimrc"))
source ~/.config/nvim/gitsigns.vimrc
endif
" Telescope setup
if filereadable(expand("~/.config/nvim/telescope.vimrc"))
source ~/.config/nvim/telescope.vimrc
endif
" Search
if filereadable(expand("~/.config/nvim/hlslens.vimrc"))
source ~/.config/nvim/hlslens.vimrc
endif
" Lightline setup
if filereadable(expand("~/.config/nvim/lightline.vimrc"))
source ~/.config/nvim/lightline.vimrc
endif
" Tmuxline setup
if filereadable(expand("~/.config/nvim/tmuxline.vimrc"))
source ~/.config/nvim/tmuxline.vimrc
endif
" Indent setup
if filereadable(expand("~/.config/nvim/lua/indent.lua"))
lua require('indent')
endif
" Git setup " Git setup
if filereadable(expand("~/.config/nvim/git.vimrc")) if filereadable(expand("~/.config/nvim/git.vimrc"))
source ~/.config/nvim/git.vimrc source ~/.config/nvim/git.vimrc
endif endif
" Autocomplete
if has_key(g:plugs, "nvim-cmp") && filereadable(expand("~/.config/nvim/nvim-cmp.vimrc"))
source ~/.config/nvim/nvim-cmp.vimrc
endif
" Autopairs
if has_key(g:plugs, "nvim-autopairs") && has_key(g:plugs, "treesitter.nvim") && filereadable(expand("~/.config/nvim/autopairs.vimrc"))
source ~/.config/nvim/autopairs.vimrc
endif
" LSP
if has_key(g:plugs, "nvim-lspconfig") && has_key(g:plugs, "cmp-nvim-lsp") && filereadable(expand("~/.config/nvim/lspconfig.vimrc"))
source ~/.config/nvim/lspconfig.vimrc
endif
" Gitsigns setup
if has_key(g:plugs, "gitsigns.nvim") && filereadable(expand("~/.config/nvim/gitsigns.vimrc"))
source ~/.config/nvim/gitsigns.vimrc
endif
" Telescope setup
if has_key(g:plugs, "telescope.nvim") && filereadable(expand("~/.config/nvim/telescope.vimrc"))
source ~/.config/nvim/telescope.vimrc
endif
" Search
if has_key(g:plugs, "nvim-hlslens") && filereadable(expand("~/.config/nvim/hlslens.vimrc"))
source ~/.config/nvim/hlslens.vimrc
endif
" Lightline setup
if has_key(g:plugs, "lightline.vim") && filereadable(expand("~/.config/nvim/lightline.vimrc"))
source ~/.config/nvim/lightline.vimrc
endif
" Tmuxline setup
if has_key(g:plugs, "tmuxline.vim") && filereadable(expand("~/.config/nvim/tmuxline.vimrc"))
source ~/.config/nvim/tmuxline.vimrc
endif
" Indent setup
if has_key(g:plugs, "indent-blankline.nvim") && filereadable(expand("~/.config/nvim/lua/indent.lua"))
lua require('indent')
endif
" Scrollbar " Scrollbar
if filereadable(expand("~/.config/nvim/scrollbar.vimrc")) if has_key(g:plugs, "nvim-scrollbar") && filereadable(expand("~/.config/nvim/scrollbar.vimrc"))
source ~/.config/nvim/scrollbar.vimrc source ~/.config/nvim/scrollbar.vimrc
endif endif
" Tree setup " Tree setup
if filereadable(expand("~/.config/nvim/nvimtree.vimrc")) if has_key(g:plugs, "nvim-tree.lua") && filereadable(expand("~/.config/nvim/nvimtree.vimrc"))
source ~/.config/nvim/nvimtree.vimrc source ~/.config/nvim/nvimtree.vimrc
endif endif
" Projections " Projections
if filereadable(expand("~/.config/nvim/projections.vimrc")) if has_key(g:plugs, "vim-projectionist") && filereadable(expand("~/.config/nvim/projections.vimrc"))
source ~/.config/nvim/projections.vimrc source ~/.config/nvim/projections.vimrc
endif endif
" Test setup " Test setup
if filereadable(expand("~/.config/nvim/test.vimrc")) if has_key(g:plugs, "vim-test") && filereadable(expand("~/.config/nvim/test.vimrc"))
source ~/.config/nvim/test.vimrc source ~/.config/nvim/test.vimrc
endif endif
" Markdown setup " Markdown setup
if filereadable(expand("~/.config/nvim/markdown.vimrc")) if has_key(g:plugs, "vim-markdown") && filereadable(expand("~/.config/nvim/markdown.vimrc"))
source ~/.config/nvim/markdown.vimrc source ~/.config/nvim/markdown.vimrc
endif endif
" Rust tools " Rust tools
if filereadable(expand("~/.config/nvim/rust-tools.vimrc")) if has_key(g:plugs, "rust-tools.nvim") && has_key(g:plugs, "nvim-lspconfig") && filereadable(expand("~/.config/nvim/rust-tools.vimrc"))
source ~/.config/nvim/rust-tools.vimrc source ~/.config/nvim/rust-tools.vimrc
endif endif
" Color setup " Color setup
if filereadable(expand("~/.config/nvim/colors.vimrc")) if has_key(g:plugs, "sonokai") && filereadable(expand("~/.config/nvim/colors.vimrc"))
source ~/.config/nvim/colors.vimrc source ~/.config/nvim/colors.vimrc
endif endif