FollieHiyuki-dotfiles/home/.config/nvim/lua/plugins.lua
2021-10-17 21:48:12 +07:00

405 lines
12 KiB
Lua

local packer = require('modules.pack')
-- This is recommended when using `luafile <afile>` a lot
-- packer.reset()
return packer.startup(function(use)
use {'wbthomason/packer.nvim', opt = true}
---------------------------------
-- Plugins used by many others --
---------------------------------
use {'kyazdani42/nvim-web-devicons', module = 'nvim-web-devicons'}
use {'nvim-lua/plenary.nvim', module = 'plenary'}
use {'nvim-lua/popup.nvim', module = 'popup'}
--------
-- UI --
--------
local ui = require('modules.ui')
use {
'goolord/alpha-nvim',
event = 'VimEnter',
config = ui.dashboard_conf
}
use {
'famiu/feline.nvim',
wants = 'nvim-web-devicons',
config = ui.statusline_conf
}
use {
'akinsho/bufferline.nvim',
event = {'BufRead', 'BufNewFile'},
config = ui.bufferline_conf
}
use {
'kyazdani42/nvim-tree.lua',
cmd = 'NvimTreeToggle',
setup = ui.nvimtree_conf,
-- FIX: when all the options are migrated to setup()
config = function()
require('nvim-tree').setup {
open_on_setup = false,
auto_close = true,
hijack_cursor = true,
update_cwd = true,
lsp_diagnostics = true,
view = {
auto_resize = false
}
}
end
}
use {
'folke/which-key.nvim',
event = 'VimEnter',
config = ui.whichkey_conf
}
use {
'lewis6991/gitsigns.nvim',
event = {'BufRead', 'BufNewFile'},
wants = 'plenary.nvim',
config = ui.gitsigns_conf
}
------------
-- Editor --
------------
local editor = require('modules.editor')
use {
'norcalli/nvim-colorizer.lua',
cmd = 'ColorizerToggle',
config = editor.colorizer_conf
}
use {
'RRethy/vim-illuminate',
event = {'BufReadPre', 'BufNewFile'}
}
use {
'lukas-reineke/indent-blankline.nvim',
after = 'nvim-treesitter',
config = editor.blankline_conf
}
use { -- TODO: config (lua -> fennel) + learn clojure, fennel, guile scheme
'Olical/conjure',
ft = {'clojure', 'fennel', 'scheme'},
requires = {{'Olical/aniseed', config = editor.aniseed_conf}}
}
use {
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
event = 'BufRead',
config = editor.treesitter_conf
}
use {
'p00f/nvim-ts-rainbow',
after = 'nvim-treesitter',
-- Putting config into `treesitter_conf` doesn't work for some reason
config = editor.rainbow_conf
}
use {
'romgrk/nvim-treesitter-context',
after = 'nvim-treesitter'
}
use {
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter'
}
use {
'mizlan/iswap.nvim',
cmd = {'ISwapWith', 'ISwap'},
wants = 'nvim-treesitter',
config = editor.iswap_conf
}
use {
'andymass/vim-matchup',
after = 'nvim-treesitter',
config = editor.matchup_conf
}
use {
'machakann/vim-sandwich',
keys = 's'
}
use {
'phaazon/hop.nvim',
cmd = {'HopChar1', 'HopChar2', 'HopWord', 'HopPattern', 'HopLine'},
config = editor.hop_conf
}
use {
'hrsh7th/vim-eft',
event = {'BufRead', 'BufNewFile'},
setup = editor.eft_conf
}
use {
'junegunn/vim-easy-align',
cmd = 'EasyAlign'
}
use {
'terrortylor/nvim-comment',
keys = 'gc',
config = editor.comment_conf
}
use {
'editorconfig/editorconfig-vim',
ft = {'go', 'rust', 'python', 'c', 'cpp', 'javascript', 'typescript', 'vim', 'zig'}
}
use { -- TODO: move to nvim-parinfer (lua)
'eraserhd/parinfer-rust',
run = 'cargo build --release',
ft = {'clojure', 'lisp', 'scheme', 'fennel'}
}
use {
'ahmedkhalf/project.nvim',
event = 'BufEnter',
config = editor.project_conf
}
---------
-- LSP --
---------
local lsp = require('modules.lsp')
use { -- TODO: scripts to install/update lsp servers
'neovim/nvim-lspconfig',
event = 'BufReadPre',
wants = 'lsp_signature.nvim',
requires = {{'ray-x/lsp_signature.nvim', opt = true}},
config = lsp.lsp_conf
}
use {
'nanotee/sqls.nvim',
ft = {'sql', 'mysql', 'plsql'},
wants = 'nvim-lspconfig',
config = lsp.sqls_conf
}
use {
'folke/trouble.nvim',
cmd = {'Trouble', 'TroubleToggle', 'TroubleRefresh'},
config = lsp.trouble_conf
}
-- use { -- FIX: conflict highlights with hop.nvim
-- 'folke/todo-comments.nvim',
-- wants = 'plenary.nvim',
-- event = 'BufRead',
-- config = lsp.comments_conf
-- }
use {
'simrat39/symbols-outline.nvim',
cmd = {'SymbolsOutline', 'SymbolsOutlineOpen'},
setup = lsp.outline_conf
}
use { -- TODO: scripts to install/update linters
'mfussenegger/nvim-lint',
event = 'BufRead',
config = lsp.lint_conf
}
use { -- TODO: config, scripts to install/update dap servers
'rcarriga/nvim-dap-ui',
event = 'BufReadPre',
wants = 'nvim-dap',
requires = {{'mfussenegger/nvim-dap', config = lsp.dap_conf, opt = true}},
config = lsp.dapui_conf
}
----------------
-- Completion --
----------------
local completion = require('modules.completion')
use {
'hrsh7th/nvim-cmp',
event = 'InsertEnter',
wants = 'LuaSnip',
requires = {{
'L3MON4D3/LuaSnip',
wants = 'friendly-snippets',
requires = {{'rafamadriz/friendly-snippets', opt = true}},
config = completion.snippets_conf,
opt = true
}},
config = completion.cmp_conf
}
use {'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp'}
use {'hrsh7th/cmp-path', after = 'nvim-cmp'}
use {'hrsh7th/cmp-buffer', after = 'nvim-cmp'}
-- use {'hrsh7th/cmp-calc', after = 'nvim-cmp'}
-- use {'f3fora/cmp-nuspell', after = 'nvim-cmp', rocks={'lua-nuspell'}}
use {'f3fora/cmp-spell', after = 'nvim-cmp'}
use {'hrsh7th/cmp-emoji', after = 'nvim-cmp'}
-- use {'ray-x/cmp-treesitter', after = {'nvim-cmp', 'nvim-treesitter'}}
use {'hrsh7th/cmp-nvim-lsp', after = {'nvim-cmp', 'nvim-lspconfig'}}
-- use {
-- 'tzachar/cmp-tabnine',
-- after = 'nvim-cmp',
-- run = './install.sh',
-- config = completion.tabnine_conf
-- }
use {'kdheepak/cmp-latex-symbols', after = {'nvim-cmp', 'vimtex'}}
-- use {'andersevenrud/compe-tmux', after = 'nvim-cmp', branch = 'cmp'}
use {'PaterJason/cmp-conjure', after = {'conjure', 'nvim-cmp'}}
use {
'windwp/nvim-autopairs',
after = 'nvim-cmp',
config = completion.autopairs_conf
}
-- use {
-- 'ms-jpq/coq_nvim',
-- branch = 'coq',
-- event = 'InsertEnter',
-- run = ':COQdeps',
-- wants = 'coq.artifacts',
-- requires = {{'ms-jpq/coq.artifacts', branch = 'artifacts', opt = true}},
-- setup = completion.coq_conf
-- }
use {
'windwp/nvim-ts-autotag',
ft = {
'html', 'javascript', 'javascriptreact', 'typescript',
'typescriptreact', 'vue', 'svelte'
},
wants = 'nvim-treesitter',
config = completion.autotag_conf
}
-----------
-- Tools --
-----------
local tools = require('modules.tools')
use { -- TODO: watch out for fzf-lua
'nvim-telescope/telescope.nvim',
cmd = 'Telescope',
wants = {
'popup.nvim',
'plenary.nvim',
'telescope-symbols.nvim',
'telescope-project.nvim',
'telescope-fzf-native.nvim'
},
requires = {
{'nvim-telescope/telescope-symbols.nvim', opt = true},
{'nvim-telescope/telescope-project.nvim', opt = true},
{'nvim-telescope/telescope-fzf-native.nvim', run = 'make', opt = true}
},
config = tools.telescope_conf
}
use { -- TODO: colors + config
'pwntester/octo.nvim',
cmd = 'Octo',
wants = 'telescope.nvim',
config = tools.octo_conf
}
use {
'TimUntersberger/neogit',
cmd = 'Neogit',
wants = {'diffview.nvim', 'plenary.nvim'},
requires = {{
'sindrets/diffview.nvim',
config = tools.diffview_conf,
opt = true
}},
config = tools.neogit_conf
}
use { -- TODO: replace with code_runner.nvim
'skywind3000/asynctasks.vim',
cmd = {
'AsyncTask',
'AsyncTaskEdit',
'AsyncTaskList',
'AsyncTaskMacro'
},
wants = 'asyncrun.vim',
requires = {{
'skywind3000/asyncrun.vim',
setup = tools.asynctasks_conf,
opt = true
}}
}
use {
'iamcco/markdown-preview.nvim',
run = 'cd app && yarn install',
ft = {'markdown', 'rmd'},
config = tools.markdown_preview_conf
}
use {
'turbio/bracey.vim',
run = 'npm install --prefix server',
cmd = 'Bracey'
}
use {
'folke/zen-mode.nvim',
cmd = 'ZenMode',
wants = 'twilight.nvim',
requires = {{'folke/twilight.nvim', opt = true}},
config = tools.zenmode_conf
}
use { -- shouldn't be lazy-loaded (global bindings don't work)
'kristijanhusak/orgmode.nvim',
ft = 'org',
config = tools.orgmode_conf
}
use { -- TODO: config
'lervag/vimtex',
ft = 'tex',
setup = tools.vimtext_conf
}
use {
'windwp/nvim-spectre',
event = {'BufRead', 'BufNewFile'},
wants = 'plenary.nvim',
config = tools.spectre_conf
}
use {
'echuraev/translate-shell.vim',
cmd = {'Trans', 'TransSelectDirection'},
config = tools.translate_conf
}
use {
'mbbill/undotree',
cmd = 'UndotreeToggle',
setup = tools.undotree_conf
}
use {
'akinsho/toggleterm.nvim',
cmd = 'ToggleTerm',
config = tools.toggleterm_conf
}
-- use {
-- 'gelguy/wilder.nvim',
-- run = ':UpdateRemotePlugins',
-- event = 'CmdlineEnter',
-- config = tools.wilder_conf
-- }
use {
'karb94/neoscroll.nvim',
event = 'WinScrolled',
config = tools.neoscroll_conf
}
use {
'michaelb/sniprun',
run = 'bash ./install.sh 1',
cmd = 'SnipRun',
config = tools.sniprun_conf
}
use {
'NTBBloodbath/rest.nvim',
keys = {'<Plug>RestNvim', '<Plug>RestNvimPreview', '<Plug>RestNvimLast'},
wants = {'plenary.nvim', 'nvim-treesitter'},
run = ':TSInstall http',
config = tools.rest_conf
}
use { -- TODO: move to formater.nvim
'sbdchd/neoformat',
cmd = 'Neoformat'
}
use {
'folke/persistence.nvim',
event = 'BufEnter',
config = tools.session_conf
}
use {'dstein64/vim-startuptime', cmd = 'StartupTime'} -- Just for benchmarking
-- TODO: dial.nvim, rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*,
-- nvim-bqf, nvim-comment-frame, nvim-revJ.lua
-- Install plugins if missing
packer.install()
end)