nvim: declare all plugins in one file
Having it in many files is logically nicer, but breaks on fresh installs.
This commit is contained in:
parent
d3e7e17d40
commit
4615f1f9c5
@ -13,8 +13,17 @@ require('my/tools')
|
||||
require('my/coding')
|
||||
require('my/net')
|
||||
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
elseif not io.open(vim.fn.stdpath('config') .. '/plugin') then
|
||||
require('packer').install()
|
||||
end
|
||||
-- reload config file after writing
|
||||
vim.api.nvim_create_augroup('config_init', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufWritePost' },
|
||||
{
|
||||
group = 'config_init',
|
||||
pattern = { '*/nvim/lua/my/*.lua', '*/nvim/init.lua' },
|
||||
callback = function()
|
||||
-- exclude plugins.lua, because it is sourced in another autocmd
|
||||
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
|
||||
vim.cmd([[source <afile>]])
|
||||
end
|
||||
end
|
||||
})
|
||||
|
@ -2,25 +2,10 @@ require('my/plugins')
|
||||
require('my/keymaps')
|
||||
require('my/tools')
|
||||
|
||||
packer.use { -- toggle comments
|
||||
'https://github.com/tomtom/tcomment_vim',
|
||||
-- tag = '*' -- reactivate when tagged after 2022-08-15
|
||||
}
|
||||
|
||||
vim.g.tcomment_opleader1 = '<Leader>c'
|
||||
vim.g.tcomment_mapleader1 = ''
|
||||
vim.g.tcomment_mapleader2 = ''
|
||||
|
||||
|
||||
packer.use {
|
||||
'https://github.com/TimUntersberger/neogit',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/folke/which-key.nvim',
|
||||
'https://github.com/sindrets/diffview.nvim'
|
||||
},
|
||||
}
|
||||
|
||||
local neogit = require('neogit')
|
||||
neogit.setup {
|
||||
disable_commit_confirmation = true,
|
||||
@ -50,16 +35,6 @@ vim.api.nvim_create_autocmd(
|
||||
command = [[set nolist]]
|
||||
})
|
||||
|
||||
packer.use 'https://github.com/gentoo/gentoo-syntax'
|
||||
|
||||
packer.use { -- NOTE: looks abandoned
|
||||
'https://github.com/jiangmiao/auto-pairs',
|
||||
config = function()
|
||||
vim.g.AutoPairsFlyMode = 0
|
||||
end
|
||||
}
|
||||
|
||||
packer.use 'https://github.com/L3MON4D3/LuaSnip'
|
||||
|
||||
require("luasnip.loaders.from_lua").load({
|
||||
paths = vim.fn.stdpath('config') .. '/snippets'
|
||||
|
@ -1,22 +1,5 @@
|
||||
require('my/plugins')
|
||||
|
||||
packer.use {
|
||||
'https://github.com/hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'https://github.com/hrsh7th/cmp-nvim-lsp',
|
||||
'https://github.com/hrsh7th/cmp-buffer',
|
||||
'https://github.com/hrsh7th/cmp-path',
|
||||
'https://github.com/hrsh7th/cmp-cmdline',
|
||||
{
|
||||
'https://github.com/saadparwaiz1/cmp_luasnip',
|
||||
requires = 'https://github.com/L3MON4D3/LuaSnip'
|
||||
},
|
||||
'https://github.com/hrsh7th/cmp-nvim-lua',
|
||||
'https://github.com/hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'https://github.com/uga-rosa/cmp-dictionary',
|
||||
}
|
||||
}
|
||||
|
||||
local cmp = require('cmp')
|
||||
local luasnip = require('luasnip')
|
||||
|
||||
|
@ -1,12 +1,5 @@
|
||||
require('my/plugins')
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
run = function()
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
end
|
||||
}
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
@ -18,12 +11,6 @@ require'nvim-treesitter.configs'.setup {
|
||||
},
|
||||
}
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-orgmode/orgmode',
|
||||
tag = '*',
|
||||
requires = 'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
}
|
||||
|
||||
require('orgmode').setup{}
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
|
@ -2,12 +2,6 @@ require('my/plugins')
|
||||
require('my/keymaps')
|
||||
require('my/completion')
|
||||
|
||||
packer.use {
|
||||
'https://github.com/neovim/nvim-lspconfig',
|
||||
tag = '*',
|
||||
requires = 'https://github.com/hrsh7th/cmp-nvim-lsp'
|
||||
}
|
||||
|
||||
-- only do this after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function map(mode, shortcut, command) -- overwrite function in keymaps
|
||||
|
@ -1,14 +1,5 @@
|
||||
require('my/plugins')
|
||||
|
||||
-- embed nvim in browsers
|
||||
packer.use {
|
||||
'https://github.com/glacambre/firenvim',
|
||||
tag = '*',
|
||||
run = function()
|
||||
vim.fn['firenvim#install'](0)
|
||||
end
|
||||
}
|
||||
|
||||
if vim.g.started_by_firenvim then
|
||||
vim.g.firenvim_config = {
|
||||
localSettings = {
|
||||
|
@ -1,4 +1,5 @@
|
||||
local install_path = vim.fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
local packer_bootstrap
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = vim.fn.system({
|
||||
'git',
|
||||
@ -10,33 +11,125 @@ if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
end
|
||||
|
||||
packer = require('packer')
|
||||
packer.init()
|
||||
require('packer').startup(function(use)
|
||||
use { 'https://github.com/wbthomason/packer.nvim' }
|
||||
|
||||
packer.use 'https://github.com/wbthomason/packer.nvim'
|
||||
-- settings
|
||||
use { 'https://github.com/owozsh/amora' }
|
||||
use { 'https://github.com/editorconfig/editorconfig-vim' }
|
||||
|
||||
-- source file, install and compile plugins when config file is written
|
||||
vim.api.nvim_create_augroup('packer_user_config', { clear = true })
|
||||
-- filetypes
|
||||
use {
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
run = function()
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
end
|
||||
}
|
||||
use {
|
||||
'https://github.com/nvim-orgmode/orgmode',
|
||||
tag = '*',
|
||||
requires = 'https://github.com/nvim-treesitter/nvim-treesitter'
|
||||
}
|
||||
|
||||
-- completion
|
||||
use {
|
||||
'https://github.com/hrsh7th/nvim-cmp',
|
||||
requires = {
|
||||
'https://github.com/hrsh7th/cmp-nvim-lsp',
|
||||
'https://github.com/hrsh7th/cmp-buffer',
|
||||
'https://github.com/hrsh7th/cmp-path',
|
||||
'https://github.com/hrsh7th/cmp-cmdline',
|
||||
{
|
||||
'https://github.com/saadparwaiz1/cmp_luasnip',
|
||||
requires = 'https://github.com/L3MON4D3/LuaSnip'
|
||||
},
|
||||
'https://github.com/hrsh7th/cmp-nvim-lua',
|
||||
'https://github.com/hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'https://github.com/uga-rosa/cmp-dictionary',
|
||||
}
|
||||
}
|
||||
|
||||
-- lsp
|
||||
use {
|
||||
'https://github.com/neovim/nvim-lspconfig',
|
||||
tag = '*',
|
||||
requires = 'https://github.com/hrsh7th/cmp-nvim-lsp'
|
||||
}
|
||||
|
||||
-- tools
|
||||
use {
|
||||
'https://github.com/folke/which-key.nvim'
|
||||
}
|
||||
use {
|
||||
'https://github.com/nvim-telescope/telescope.nvim',
|
||||
tag = '*',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
use {
|
||||
'https://github.com/nvim-telescope/telescope-media-files.nvim',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/popup.nvim',
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/nvim-telescope/telescope.nvim'
|
||||
}
|
||||
}
|
||||
|
||||
-- coding
|
||||
use {
|
||||
'https://github.com/tomtom/tcomment_vim',
|
||||
tag = '*' -- NOTE: reactivate when tagged after 2022-08-15
|
||||
}
|
||||
use {
|
||||
'https://github.com/TimUntersberger/neogit',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/folke/which-key.nvim',
|
||||
'https://github.com/sindrets/diffview.nvim'
|
||||
},
|
||||
}
|
||||
use { 'https://github.com/gentoo/gentoo-syntax' }
|
||||
use { -- NOTE: looks abandoned
|
||||
'https://github.com/jiangmiao/auto-pairs',
|
||||
config = function()
|
||||
vim.g.AutoPairsFlyMode = 0
|
||||
end
|
||||
}
|
||||
use { 'https://github.com/L3MON4D3/LuaSnip' }
|
||||
|
||||
-- net
|
||||
use { -- embed nvim in browsers
|
||||
'https://github.com/glacambre/firenvim',
|
||||
tag = '*',
|
||||
run = function()
|
||||
vim.fn['firenvim#install'](0)
|
||||
end
|
||||
}
|
||||
|
||||
-- ensure plugins are installed and compiled
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
elseif not io.open(vim.fn.stdpath('config') .. '/plugin') then
|
||||
require('packer').install()
|
||||
end
|
||||
end)
|
||||
|
||||
-- source file, install and compile plugins when this file is written
|
||||
vim.api.nvim_create_augroup('config_plugins', { clear = true })
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'BufWritePost' },
|
||||
{
|
||||
group = 'packer_user_config',
|
||||
pattern = { '*/nvim/lua/*.lua', '*/nvim/init.lua' },
|
||||
callback = function()
|
||||
-- exclude plugins.lua, because that would re-init packer
|
||||
if not vim.api.nvim_buf_get_name(0):match('plugins.lua$') then
|
||||
vim.cmd([[
|
||||
source <afile>
|
||||
PackerInstall
|
||||
]])
|
||||
end
|
||||
end
|
||||
group = 'config_plugins',
|
||||
pattern = { '*/nvim/lua/my/plugins.lua' },
|
||||
command =[[source <afile> | PackerInstall]]
|
||||
}
|
||||
)
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'User' },
|
||||
{
|
||||
group = 'packer_user_config',
|
||||
group = 'config_plugins',
|
||||
pattern = 'PackerComplete',
|
||||
command = [[PackerCompile]]
|
||||
}
|
||||
@ -44,7 +137,7 @@ vim.api.nvim_create_autocmd(
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ 'User' },
|
||||
{
|
||||
group = 'packer_user_config',
|
||||
group = 'config_plugins',
|
||||
pattern = 'PackerCompileDone',
|
||||
command = [[echo 'plugins compiled']]
|
||||
}
|
||||
|
@ -26,14 +26,10 @@ vim.cmd([[command! -narg=1 -complete=help Ht tab help <args>]])
|
||||
|
||||
-- theme
|
||||
vim.o.termguicolors = true -- 24 bit colours
|
||||
packer.use {
|
||||
'https://github.com/owozsh/amora'
|
||||
}
|
||||
vim.cmd('colorscheme amora')
|
||||
-- make comments a bit lighter
|
||||
---- make comments a bit lighter
|
||||
vim.cmd([[
|
||||
highlight AmoraComment ctermfg=61 guifg=#7C4180
|
||||
highlight AmoraCommentBold cterm=bold ctermfg=61 gui=bold guifg=#7C4180
|
||||
]])
|
||||
|
||||
packer.use 'https://github.com/editorconfig/editorconfig-vim'
|
||||
|
@ -2,21 +2,8 @@ require('my/plugins')
|
||||
require('my/keymaps')
|
||||
require('my/filetypes')
|
||||
|
||||
packer.use {
|
||||
'https://github.com/folke/which-key.nvim'
|
||||
}
|
||||
|
||||
require('which-key').setup{}
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-telescope/telescope.nvim',
|
||||
tag = '*',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/nvim-treesitter/nvim-treesitter',
|
||||
},
|
||||
}
|
||||
|
||||
local telescope = require('telescope')
|
||||
local actions = require('telescope.actions')
|
||||
telescope.load_extension('media_files') -- FIXME: does not work
|
||||
@ -49,12 +36,3 @@ map('n', '<Leader>tg', function()
|
||||
end)
|
||||
map('n', '<Leader>tm', builtin.man_pages)
|
||||
map('n', '<Leader>tr', builtin.registers)
|
||||
|
||||
packer.use {
|
||||
'https://github.com/nvim-telescope/telescope-media-files.nvim',
|
||||
requires = {
|
||||
'https://github.com/nvim-lua/popup.nvim',
|
||||
'https://github.com/nvim-lua/plenary.nvim',
|
||||
'https://github.com/nvim-telescope/telescope.nvim'
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user