223 lines
6.6 KiB
Lua
223 lines
6.6 KiB
Lua
local fn = vim.fn
|
|
|
|
-- boostrap packer
|
|
local install_path = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim'
|
|
local packer_bootstrap
|
|
if fn.empty(fn.glob(install_path)) > 0 then
|
|
packer_bootstrap = fn.system({
|
|
'git', 'clone', 'https://github.com/wbthomason/packer.nvim',
|
|
install_path
|
|
})
|
|
end
|
|
|
|
-- run PackerSync everytime plugins.lua is updated
|
|
vim.cmd([[
|
|
augroup packer_user_config
|
|
autocmd!
|
|
autocmd BufWritePost plugins.lua source <afile> | PackerSync
|
|
augroup end
|
|
]])
|
|
|
|
vim.cmd([[packadd packer.nvim]])
|
|
|
|
-- initialize plugins
|
|
return require('packer').startup(function(use)
|
|
-- let packer manage itself
|
|
use({'wbthomason/packer.nvim', opt = true})
|
|
|
|
-- theme
|
|
use("ishan9299/nvim-solarized-lua")
|
|
|
|
-- commenting
|
|
use {
|
|
'numToStr/Comment.nvim',
|
|
config = function() require('Comment').setup() end
|
|
}
|
|
|
|
-- session handling
|
|
use('tpope/vim-obsession')
|
|
use('dhruvasagar/vim-prosession')
|
|
|
|
-- tabline
|
|
use {
|
|
'kdheepak/tabline.nvim',
|
|
config = function()
|
|
require'tabline'.setup {
|
|
enable = true,
|
|
options = {show_bufnr = true, show_filename_only = true}
|
|
}
|
|
end,
|
|
requires = {
|
|
{'hoob3rt/lualine.nvim'},
|
|
{'kyazdani42/nvim-web-devicons', opt = true}
|
|
}
|
|
}
|
|
|
|
-- status line
|
|
use {
|
|
'nvim-lualine/lualine.nvim',
|
|
requires = {'kyazdani42/nvim-web-devicons', opt = true},
|
|
config = function()
|
|
require('lualine').setup({
|
|
options = {globalstatus = true},
|
|
extensions = {"toggleterm"}
|
|
})
|
|
end
|
|
}
|
|
|
|
-- blankline
|
|
use({
|
|
"lukas-reineke/indent-blankline.nvim",
|
|
config = function()
|
|
require("indent_blankline").setup {
|
|
char = "┊",
|
|
buftype_exclude = {"terminal", "help", "nofile"},
|
|
filetype_exclude = {'help', 'packer'},
|
|
show_trailing_blankline_indent = false
|
|
}
|
|
end
|
|
})
|
|
|
|
-- git
|
|
use('tpope/vim-fugitive')
|
|
use({
|
|
'lewis6991/gitsigns.nvim',
|
|
requires = {'nvim-lua/plenary.nvim'},
|
|
config = function() require('gitsigns').setup() end
|
|
})
|
|
use("junegunn/gv.vim")
|
|
|
|
-- autocompletion
|
|
use({
|
|
"L3MON4D3/LuaSnip",
|
|
requires = {"rafamadriz/friendly-snippets"},
|
|
config = function()
|
|
require("luasnip.loaders.from_vscode").lazy_load()
|
|
end
|
|
})
|
|
use({
|
|
"hrsh7th/nvim-cmp",
|
|
requires = {
|
|
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path",
|
|
"hrsh7th/cmp-cmdline", "hrsh7th/cmp-git", "hrsh7th/cmp-nvim-lua",
|
|
"saadparwaiz1/cmp_luasnip", "hrsh7th/cmp-nvim-lsp-signature-help",
|
|
"davidsierradz/cmp-conventionalcommits", "hrsh7th/cmp-nvim-lua",
|
|
"hrsh7th/cmp-calc"
|
|
},
|
|
config = function()
|
|
local has_words_before = function()
|
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
return col ~= 0 and
|
|
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
|
|
col, col):match("%s") == nil
|
|
end
|
|
|
|
local cmp = require('cmp')
|
|
local luasnip = require("luasnip")
|
|
|
|
cmp.setup({
|
|
snippet = {
|
|
expand = function(args)
|
|
require("luasnip").lsp_expand(args.body)
|
|
end
|
|
},
|
|
sources = require("cmp").config.sources({
|
|
{name = "nvim_lsp"}, {name = "luasnip"}, {name = "path"},
|
|
{name = "buffer"}, {name = "git"},
|
|
{name = 'nvim_lsp_signature_help'},
|
|
{name = "conventionalcommits"}, {name = "nvim-lua"},
|
|
{name = "calc"}
|
|
}),
|
|
mapping = {
|
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(),
|
|
{'i', 'c'}),
|
|
['<CR>'] = cmp.mapping.confirm({select = true}),
|
|
["<Tab>"] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_next_item()
|
|
elseif luasnip.expand_or_jumpable() then
|
|
luasnip.expand_or_jump()
|
|
elseif has_words_before() then
|
|
cmp.complete()
|
|
else
|
|
fallback()
|
|
end
|
|
end, {"i", "s"}),
|
|
|
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
if cmp.visible() then
|
|
cmp.select_prev_item()
|
|
elseif luasnip.jumpable(-1) then
|
|
luasnip.jump(-1)
|
|
else
|
|
fallback()
|
|
end
|
|
end, {"i", "s"})
|
|
},
|
|
experimental = {ghost_text = true}
|
|
})
|
|
|
|
-- `/` cmdline setup.
|
|
cmp.setup.cmdline('/', {sources = {{name = 'buffer'}}})
|
|
|
|
-- `:` cmdline setup.
|
|
cmp.setup.cmdline(':', {
|
|
sources = cmp.config
|
|
.sources({{name = 'path'}}, {{name = 'cmdline'}})
|
|
})
|
|
|
|
end
|
|
})
|
|
|
|
-- highlight current symbol
|
|
use({"RRethy/vim-illuminate"})
|
|
|
|
-- language server
|
|
use({
|
|
"neovim/nvim-lspconfig",
|
|
config = function() require("plugins.lspconfig") end
|
|
})
|
|
|
|
use('williamboman/nvim-lsp-installer')
|
|
|
|
-- treesitter
|
|
use({
|
|
'nvim-treesitter/nvim-treesitter',
|
|
config = function() require('plugins.treesitter') end,
|
|
run = ':TSUpdate'
|
|
})
|
|
|
|
-- Telescope
|
|
use({
|
|
'nvim-telescope/telescope.nvim',
|
|
requires = {{'nvim-lua/plenary.nvim'}},
|
|
config = function() require('plugins.telescope') end
|
|
})
|
|
use({'nvim-telescope/telescope-fzf-native.nvim', run = 'make'})
|
|
|
|
-- automatic pairs
|
|
use({"Raimondi/delimitMate"})
|
|
|
|
-- rust tools
|
|
use({"simrat39/rust-tools.nvim", requires = {{"neovim/nvim-lspconfig"}}})
|
|
|
|
-- markdown preview
|
|
use({'iamcco/markdown-preview.nvim'})
|
|
|
|
-- terminal
|
|
use({
|
|
"akinsho/nvim-toggleterm.lua",
|
|
config = function()
|
|
require("toggleterm").setup({size = 32, open_mapping = [[<F4>]]})
|
|
end
|
|
})
|
|
|
|
-- buffer closing
|
|
use({"sar/bbye.nvim"})
|
|
|
|
-- ansible filetype
|
|
use({"pearofducks/ansible-vim"})
|
|
|
|
if packer_bootstrap then require('packer').sync() end
|
|
end)
|