Update plugin setup
This commit is contained in:
parent
eab4fe2fbf
commit
58d7223925
@ -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
|
||||
-- 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>
|
||||
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
|
||||
vim.api.nvim_buf_set_keymap('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('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('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('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('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('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('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<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(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<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(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<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(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_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(bufnr, '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>D', '<cmd>lua vim.lsp.buf.type_definition()<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(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<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(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
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
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
|
@ -27,15 +27,12 @@ lua <<EOF
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
-- For `vsnip` user.
|
||||
vim.fn["vsnip#anonymous"](args.body)
|
||||
|
||||
-- For `luasnip` user.
|
||||
-- require('luasnip').lsp_expand(args.body)
|
||||
|
||||
-- For `ultisnips` user.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body)
|
||||
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,
|
||||
},
|
||||
mapping = {
|
||||
@ -43,29 +40,53 @@ lua <<EOF
|
||||
['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
['<Down>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
['<Up>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.close(),
|
||||
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||
['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
|
||||
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
||||
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
['<C-e>'] = cmp.mapping({
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
}),
|
||||
['<CR>'] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
select = true, -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
})
|
||||
},
|
||||
sources = {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
|
||||
-- For vsnip user.
|
||||
{ name = 'vsnip' },
|
||||
|
||||
-- For luasnip user.
|
||||
-- { name = 'luasnip' },
|
||||
|
||||
-- For ultisnips user.
|
||||
-- { name = 'ultisnips' },
|
||||
|
||||
{ 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('/', {
|
||||
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
|
||||
|
@ -8,7 +8,7 @@ Plug 'lukas-reineke/indent-blankline.nvim'
|
||||
Plug 'mfussenegger/nvim-dap'
|
||||
Plug 'nvim-lua/plenary.nvim'
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
Plug 'petertriho/nvim-scrollbar'
|
||||
"Plug 'petertriho/nvim-scrollbar'
|
||||
Plug 'posva/vim-vue', { 'for': 'vue' }
|
||||
Plug 'ron-rs/ron.vim', { 'for': 'ron' }
|
||||
Plug 'simrat39/rust-tools.nvim'
|
||||
@ -23,13 +23,15 @@ Plug 'wakatime/vim-wakatime'
|
||||
Plug 'windwp/nvim-autopairs'
|
||||
|
||||
" LSP and autocomplete
|
||||
Plug 'neovim/nvim-lspconfig' |
|
||||
\ Plug 'hrsh7th/cmp-nvim-lsp' |
|
||||
\ Plug 'hrsh7th/cmp-buffer' |
|
||||
\ Plug 'hrsh7th/nvim-cmp' |
|
||||
\ Plug 'hrsh7th/cmp-vsnip' |
|
||||
\ Plug 'hrsh7th/vim-vsnip' |
|
||||
\ Plug 'rafamadriz/friendly-snippets'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
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'
|
||||
Plug 'rafamadriz/friendly-snippets'
|
||||
|
||||
" Gitsigns
|
||||
Plug 'lewis6991/gitsigns.nvim'
|
||||
@ -38,24 +40,24 @@ Plug 'lewis6991/gitsigns.nvim'
|
||||
Plug 'nvim-telescope/telescope.nvim'
|
||||
|
||||
" Lightline
|
||||
Plug 'itchyny/lightline.vim' |
|
||||
\ Plug 'albertomontesg/lightline-asyncrun' |
|
||||
\ Plug 'itchyny/vim-gitbranch' |
|
||||
\ Plug 'macthecadillac/lightline-gitdiff' |
|
||||
\ Plug 'ryanoasis/vim-devicons' |
|
||||
\ Plug 'anstadnik/tmuxline.vim'
|
||||
Plug 'itchyny/lightline.vim'
|
||||
Plug 'albertomontesg/lightline-asyncrun'
|
||||
Plug 'itchyny/vim-gitbranch'
|
||||
Plug 'macthecadillac/lightline-gitdiff'
|
||||
Plug 'ryanoasis/vim-devicons'
|
||||
Plug 'anstadnik/tmuxline.vim'
|
||||
" Using the above fork for lightline truecolor support
|
||||
" \ Plug 'edkolev/tmuxline.vim'
|
||||
|
||||
" NvimTree
|
||||
Plug 'kyazdani42/nvim-tree.lua' |
|
||||
\ Plug 'kyazdani42/nvim-web-devicons'
|
||||
Plug 'kyazdani42/nvim-tree.lua'
|
||||
Plug 'kyazdani42/nvim-web-devicons'
|
||||
|
||||
" Vim-Markdown
|
||||
Plug 'godlygeek/tabular' |
|
||||
\ Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
|
||||
Plug 'godlygeek/tabular'
|
||||
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
|
||||
|
||||
" sonokai colorscheme + supporting plugins
|
||||
Plug 'sainnhe/sonokai' |
|
||||
\ Plug 'rmolin88/pomodoro.vim' |
|
||||
\ Plug 'sainnhe/artify.vim'
|
||||
Plug 'sainnhe/sonokai'
|
||||
Plug 'rmolin88/pomodoro.vim'
|
||||
Plug 'sainnhe/artify.vim'
|
||||
|
115
vimrc
115
vimrc
@ -61,100 +61,111 @@ if executable('rg')
|
||||
set grepprg=rg\ --color\ never
|
||||
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
|
||||
call plug#begin('~/.vim/plugged')
|
||||
if filereadable(expand("~/.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
|
||||
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
|
||||
if filereadable(expand("~/.config/nvim/keybindings.vimrc"))
|
||||
source ~/.config/nvim/keybindings.vimrc
|
||||
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
|
||||
if filereadable(expand("~/.config/nvim/git.vimrc"))
|
||||
source ~/.config/nvim/git.vimrc
|
||||
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
|
||||
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
|
||||
endif
|
||||
|
||||
" 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
|
||||
endif
|
||||
|
||||
" 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
|
||||
endif
|
||||
|
||||
" 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
|
||||
endif
|
||||
|
||||
" 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
|
||||
endif
|
||||
|
||||
" 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
|
||||
endif
|
||||
|
||||
" 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
|
||||
endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user