refactor config structure
This commit is contained in:
parent
fc922961fe
commit
29ab09bed9
22
after/plugin/telescope-theme.lua
Normal file
22
after/plugin/telescope-theme.lua
Normal file
@ -0,0 +1,22 @@
|
||||
if vim.g.colors_name == "srcery" then
|
||||
local bright_white = vim.api.nvim_get_hl_by_name("SrceryBrightWhite", true).foreground
|
||||
local hard_black = vim.api.nvim_get_hl_by_name("SrceryHardBlack", true).foreground
|
||||
local red = vim.api.nvim_get_hl_by_name("SrceryRed", true).foreground
|
||||
local yellow = vim.api.nvim_get_hl_by_name("SrceryYellow", true).foreground
|
||||
local gray1 = vim.api.nvim_get_hl_by_name("SrceryXgray1", true).foreground
|
||||
|
||||
local TelescopePrompt = {
|
||||
TelescopeBorder = {bg = hard_black, fg = hard_black},
|
||||
TelescopePromptBorder = {bg = gray1, fg = gray1},
|
||||
TelescopePromptNormal = {bg = gray1},
|
||||
TelescopePromptTitle = {fg = hard_black, bg = red },
|
||||
TelescopePreviewTitle = {fg = hard_black, bg = yellow },
|
||||
TelescopeNormal = {bg = hard_black, fg = bright_white},
|
||||
TelescopeResultsNormal = {bg = hard_black, fg = bright_white},
|
||||
TelescopePreviewNormal = {bg = hard_black, fg = bright_white},
|
||||
TelescopeSelection = {bg = hard_black, fg = bright_white, underline = true},
|
||||
}
|
||||
for hl, col in pairs(TelescopePrompt) do
|
||||
vim.api.nvim_set_hl(0, hl, col)
|
||||
end
|
||||
end
|
40
init.lua
40
init.lua
@ -1,45 +1,21 @@
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Allow loading */init.lua files
|
||||
package.path = "./?/init.lua;"..package.path
|
||||
|
||||
-- Leader/local leader
|
||||
g.mapleader = [[ ]]
|
||||
g.maplocalleader = [[,]]
|
||||
vim.g.mapleader = [[ ]]
|
||||
vim.g.maplocalleader = [[,]]
|
||||
|
||||
-- Disable some built-in plugins we don't want
|
||||
local disabled_built_ins = {
|
||||
'matchit',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
}
|
||||
|
||||
for _, name in ipairs(disabled_built_ins) do
|
||||
g['loaded_' .. name] = 1
|
||||
end
|
||||
|
||||
require("plugins")
|
||||
require("disable-builtin")
|
||||
require("highlight-yank")
|
||||
require("plugin-manager")
|
||||
require("options")
|
||||
require("bindings")
|
||||
require("pludin-dev")
|
||||
|
||||
require("add-guard")
|
||||
require("cmacro-align")
|
||||
|
||||
-- Misc features
|
||||
require("highlight-yank")
|
||||
|
||||
-- Background transparency
|
||||
-- cmd [[autocmd ColorScheme * highlight Normal ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight Folded ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight SignColumn ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight VertSplit ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight StatusLineNC ctermbg=none guibg=none]]
|
||||
-- cmd [[autocmd ColorScheme * highlight CursorLineNr ctermbg=none guibg=none]]
|
||||
require("personal.add-guard")
|
||||
require("personal.cmacro-align")
|
||||
|
||||
-- THEME_BEGIN
|
||||
cmd("colorscheme srcery")
|
||||
vim.cmd("colorscheme srcery")
|
||||
-- THEME_END
|
||||
|
@ -6,7 +6,7 @@ local silent = {silent = true}
|
||||
map('n', 'Q', '<nop>')
|
||||
|
||||
-- Save file
|
||||
map('n', '<C-s>', ':w<cr>')
|
||||
map('n', '<C-s>', ':w<cr>', silent)
|
||||
|
||||
-- Paste from register and not replace it
|
||||
-- map('x', '<leader>p', '"_dP')
|
||||
|
@ -1,3 +1,7 @@
|
||||
local user = os.getenv("USER")
|
||||
vim.g.autosource_hashdir = '/home/'..user..'/.cache/vim-autosource/hashes'
|
||||
|
||||
return {
|
||||
'jenterkin/vim-autosource',
|
||||
config = function()
|
||||
local user = os.getenv("USER")
|
||||
vim.g.autosource_hashdir = '/home/'..user..'/.cache/vim-autosource/hashes'
|
||||
end
|
||||
}
|
||||
|
@ -1,4 +1,10 @@
|
||||
local baleia = require("baleia").setup()
|
||||
vim.api.nvim_create_user_command("BaleiaColorize", function()
|
||||
baleia.once(vim.api.nvim_get_current_buf())
|
||||
end, { })
|
||||
return {
|
||||
'm00qek/baleia.nvim',
|
||||
tag = 'v1.2.0',
|
||||
config = function()
|
||||
local baleia = require("baleia").setup()
|
||||
vim.api.nvim_create_user_command("BaleiaColorize", function()
|
||||
baleia.once(vim.api.nvim_get_current_buf())
|
||||
end, { })
|
||||
end
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
local based = require("based")
|
||||
based.setup{}
|
||||
return {
|
||||
'trmckay/based.nvim',
|
||||
config = function ()
|
||||
local based = require("based")
|
||||
based.setup{}
|
||||
|
||||
vim.keymap.set({"n", "v"}, "<C-b>", based.convert)
|
||||
vim.keymap.set({"n", "v"}, "<C-b>", based.convert)
|
||||
end
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
local automaton = require("cellular-automaton")
|
||||
|
||||
local timeout = 120
|
||||
|
||||
local timer
|
||||
local function enable_screensaver()
|
||||
local group = vim.api.nvim_create_augroup('CellularAutomatonScreenSaver', {clear=true})
|
||||
|
||||
local animations = {}
|
||||
for name in pairs(automaton.animations) do
|
||||
table.insert(animations, name)
|
||||
end
|
||||
|
||||
local function play_random_animation()
|
||||
local idx = math.random(#animations)
|
||||
local animation_name = animations[idx]
|
||||
if animation_name then
|
||||
automaton.start_animation(animation_name)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({'CursorHold', 'CursorHoldI'}, {
|
||||
group = group,
|
||||
callback = function()
|
||||
-- TODO: Will vim.defer_fn suffice here?
|
||||
timer = vim.loop.new_timer()
|
||||
timer:start(timeout * 1000, 0, vim.schedule_wrap(function()
|
||||
if timer:is_active() then timer:stop() end
|
||||
if not timer:is_closing() then timer:close() end
|
||||
|
||||
play_random_animation()
|
||||
end))
|
||||
|
||||
vim.api.nvim_create_autocmd({'CursorMoved', 'CursorMovedI'}, {
|
||||
group = group,
|
||||
callback = function()
|
||||
if timer:is_active() then timer:stop() end
|
||||
if not timer:is_closing() then timer:close() end
|
||||
end,
|
||||
once = true
|
||||
})
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
enable_screensaver()
|
@ -1,15 +1,19 @@
|
||||
require('colorizer').setup(
|
||||
nil,
|
||||
{
|
||||
RGB = true,
|
||||
RRGGBB = true,
|
||||
names = false,
|
||||
RRGGBBAA = true,
|
||||
rgb_fn = true,
|
||||
hsl_fn = true,
|
||||
css = false,
|
||||
css_fn = false,
|
||||
mode = 'background'
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
'norcalli/nvim-colorizer.lua',
|
||||
config = function()
|
||||
require('colorizer').setup(
|
||||
nil,
|
||||
{
|
||||
RGB = true,
|
||||
RRGGBB = true,
|
||||
names = false,
|
||||
RRGGBBAA = true,
|
||||
rgb_fn = true,
|
||||
hsl_fn = true,
|
||||
css = false,
|
||||
css_fn = false,
|
||||
mode = 'background'
|
||||
}
|
||||
)
|
||||
end
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
local config = {}
|
||||
return {
|
||||
'terrortylor/nvim-comment',
|
||||
requires = 'JoosepAlviste/nvim-ts-context-commentstring',
|
||||
config = function()
|
||||
local config = {}
|
||||
|
||||
if packer_plugins['nvim-ts-context-commentstring'] and packer_plugins['nvim-ts-context-commentstring'].loaded then
|
||||
config.hook = function()
|
||||
if vim.api.nvim_buf_get_option(0, "filetype") == "vue" then
|
||||
require("ts_context_commentstring.internal").update_commentstring()
|
||||
end
|
||||
if packer_plugins['nvim-ts-context-commentstring'] and packer_plugins['nvim-ts-context-commentstring'].loaded then
|
||||
config.hook = function()
|
||||
if vim.api.nvim_buf_get_option(0, "filetype") == "vue" then
|
||||
require("ts_context_commentstring.internal").update_commentstring()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require("nvim_comment").setup(config)
|
||||
end
|
||||
end
|
||||
|
||||
require("nvim_comment").setup(config)
|
||||
}
|
||||
|
6
lua/config/devicons.lua
Normal file
6
lua/config/devicons.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
config = function()
|
||||
require('nvim-web-devicons').setup()
|
||||
end
|
||||
}
|
26
lua/config/dressing.lua
Normal file
26
lua/config/dressing.lua
Normal file
@ -0,0 +1,26 @@
|
||||
return {
|
||||
'stevearc/dressing.nvim',
|
||||
config = function()
|
||||
require('dressing').setup({
|
||||
select = {
|
||||
get_config = function(opts)
|
||||
opts = opts or {}
|
||||
local cfg = {
|
||||
telescope = {
|
||||
layout_config = {
|
||||
-- width = 120,
|
||||
-- height = 60,
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
},
|
||||
},
|
||||
}
|
||||
if opts.kind == 'legendary.nvim' then
|
||||
cfg.telescope.sorter = require('telescope.sorters').fuzzy_with_index_bias({})
|
||||
end
|
||||
return cfg
|
||||
end,
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
local map = require 'utils.map'
|
||||
|
||||
map('n', '<leader>gg', ':G<cr>', { silent = true })
|
||||
return {
|
||||
'tpope/vim-fugitive',
|
||||
config = function ()
|
||||
vim.keymap.set('n', '<leader>gg', ':G<cr>', { silent = true })
|
||||
end
|
||||
}
|
||||
|
@ -1,8 +1,13 @@
|
||||
local map = require 'utils.map'
|
||||
local silent = {silent = true}
|
||||
return {
|
||||
'f-person/git-blame.nvim',
|
||||
config = function ()
|
||||
local map = require 'utils.map'
|
||||
local silent = {silent = true}
|
||||
|
||||
map('n', '<leader>gm', ":GitBlameCopySHA<CR>", silent)
|
||||
map('n', '<leader>gj', ":GitBlameOpenCommitURL<CR>", silent)
|
||||
map('n', '<leader>gu', ":GitBlameToggle<CR>", silent)
|
||||
map('n', '<leader>gm', ":GitBlameCopySHA<CR>", silent)
|
||||
map('n', '<leader>gj', ":GitBlameOpenCommitURL<CR>", silent)
|
||||
map('n', '<leader>gu', ":GitBlameToggle<CR>", silent)
|
||||
|
||||
vim.g["gitblame_enabled"] = 0
|
||||
vim.g["gitblame_enabled"] = 0
|
||||
end
|
||||
}
|
||||
|
@ -1,33 +1,39 @@
|
||||
local gitsigns = require 'gitsigns'
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
config = function ()
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
gitsigns.setup{
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {})
|
||||
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
|
||||
end
|
||||
gitsigns.setup{
|
||||
on_attach = function(bufnr)
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
opts = vim.tbl_extend('force', {noremap = true, silent = true}, opts or {})
|
||||
vim.api.nvim_buf_set_keymap(bufnr, mode, lhs, rhs, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
|
||||
map('n', '[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", {expr=true})
|
||||
-- Navigation
|
||||
map('n', ']c', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", {expr=true})
|
||||
map('n', '[c', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", {expr=true})
|
||||
|
||||
-- Actions
|
||||
map('n', '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map('v', '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map('n', '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('v', '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', '<cmd>Gitsigns stage_buffer<CR>')
|
||||
map('n', '<leader>hu', '<cmd>Gitsigns undo_stage_hunk<CR>')
|
||||
map('n', '<leader>hR', '<cmd>Gitsigns reset_buffer<CR>')
|
||||
map('n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>')
|
||||
map('n', '<leader>hb', '<cmd>lua require"gitsigns".blame_line{full=true}<CR>')
|
||||
map('n', '<leader>tb', '<cmd>Gitsigns toggle_current_line_blame<CR>')
|
||||
map('n', '<leader>hd', '<cmd>Gitsigns diffthis<CR>')
|
||||
map('n', '<leader>hD', '<cmd>lua require"gitsigns".diffthis("~")<CR>')
|
||||
map('n', '<leader>td', '<cmd>Gitsigns toggle_deleted<CR>')
|
||||
-- Actions
|
||||
map('n', '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map('v', '<leader>hs', ':Gitsigns stage_hunk<CR>')
|
||||
map('n', '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('v', '<leader>hr', ':Gitsigns reset_hunk<CR>')
|
||||
map('n', '<leader>hS', '<cmd>Gitsigns stage_buffer<CR>')
|
||||
map('n', '<leader>hu', '<cmd>Gitsigns undo_stage_hunk<CR>')
|
||||
map('n', '<leader>hR', '<cmd>Gitsigns reset_buffer<CR>')
|
||||
map('n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>')
|
||||
map('n', '<leader>hb', '<cmd>lua require"gitsigns".blame_line{full=true}<CR>')
|
||||
map('n', '<leader>tb', '<cmd>Gitsigns toggle_current_line_blame<CR>')
|
||||
map('n', '<leader>hd', '<cmd>Gitsigns diffthis<CR>')
|
||||
map('n', '<leader>hD', '<cmd>lua require"gitsigns".diffthis("~")<CR>')
|
||||
map('n', '<leader>td', '<cmd>Gitsigns toggle_deleted<CR>')
|
||||
|
||||
-- Text object
|
||||
map('o', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
map('x', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
-- Text object
|
||||
map('o', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
map('x', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,3 +1,8 @@
|
||||
local silent = {silent=true}
|
||||
vim.keymap.set("n", "s", "<Plug>(leap-forward-to)", silent)
|
||||
vim.keymap.set("n", "S", "<Plug>(leap-backward-to)", silent)
|
||||
return {
|
||||
'ggandor/leap.nvim',
|
||||
config = function()
|
||||
local silent = {silent=true}
|
||||
vim.keymap.set("n", "s", "<Plug>(leap-forward-to)", silent)
|
||||
vim.keymap.set("n", "S", "<Plug>(leap-backward-to)", silent)
|
||||
end
|
||||
}
|
||||
|
13
lua/config/legendary.lua
Normal file
13
lua/config/legendary.lua
Normal file
@ -0,0 +1,13 @@
|
||||
return {
|
||||
'mrjones2014/legendary.nvim',
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>l", ":Legendary<cr>", {silent = true})
|
||||
|
||||
require("legendary").setup{
|
||||
include_legendary_cmds = false,
|
||||
commands = {
|
||||
{ ":TodoTelescope", description = "Show TODO's in telescope" }
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
local lspconfig_config = require 'config.lspconfig'
|
||||
local lsp_installer = require 'nvim-lsp-installer'
|
||||
local lsp_installer_servers = require'nvim-lsp-installer.servers'
|
||||
local M = {}
|
||||
local lspconfig_config = require('config.lspconfig')
|
||||
local lsp_installer = require('nvim-lsp-installer')
|
||||
local lsp_installer_servers = require('nvim-lsp-installer.servers')
|
||||
|
||||
-- local autoinstall_servers = {"sumneko_lua", "efm"}
|
||||
local autoinstall_servers = {"sumneko_lua"}
|
||||
@ -17,8 +16,8 @@ local capabilities = lspconfig_config.get_capabilities()
|
||||
for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
||||
local opts = {
|
||||
root_dir = function()
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
return vim.fn.getcwd()
|
||||
end,
|
||||
init_options = lspconfig_config.get_server_init_options(server.name),
|
||||
on_attach = lspconfig_config.on_attach,
|
||||
on_init = lspconfig_config.on_init,
|
||||
@ -38,5 +37,3 @@ for _, server in ipairs(lsp_installer.get_installed_servers()) do
|
||||
server:setup(opts)
|
||||
::continue::
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -1,4 +1,9 @@
|
||||
require "lsp_signature".setup{
|
||||
hint_enable = false,
|
||||
toggle_key = '<C-x>'
|
||||
return {
|
||||
"ray-x/lsp_signature.nvim",
|
||||
config = function()
|
||||
require "lsp_signature".setup{
|
||||
hint_enable = false,
|
||||
toggle_key = '<C-x>'
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,43 +1,14 @@
|
||||
if vim.fn.has('nvim-0.5.1') == 1 then
|
||||
vim.lsp.handlers['textDocument/codeAction'] = require'lsputil.codeAction'.code_action_handler
|
||||
vim.lsp.handlers['textDocument/references'] = require'lsputil.locations'.references_handler
|
||||
vim.lsp.handlers['textDocument/definition'] = require'lsputil.locations'.definition_handler
|
||||
vim.lsp.handlers['textDocument/declaration'] = require'lsputil.locations'.declaration_handler
|
||||
vim.lsp.handlers['textDocument/typeDefinition'] = require'lsputil.locations'.typeDefinition_handler
|
||||
vim.lsp.handlers['textDocument/implementation'] = require'lsputil.locations'.implementation_handler
|
||||
vim.lsp.handlers['textDocument/documentSymbol'] = require'lsputil.symbols'.document_handler
|
||||
vim.lsp.handlers['workspace/symbol'] = require'lsputil.symbols'.workspace_handler
|
||||
else
|
||||
local bufnr = vim.api.nvim_buf_get_number(0)
|
||||
vim.lsp.handlers['textDocument/codeAction'] = function(_, _, actions)
|
||||
require('lsputil.codeAction').code_action_handler(nil, actions, nil, nil, nil)
|
||||
return {
|
||||
'RishabhRD/nvim-lsputils',
|
||||
requires = 'RishabhRD/popfix',
|
||||
config = function()
|
||||
vim.lsp.handlers['textDocument/codeAction'] = require'lsputil.codeAction'.code_action_handler
|
||||
vim.lsp.handlers['textDocument/references'] = require'lsputil.locations'.references_handler
|
||||
vim.lsp.handlers['textDocument/definition'] = require'lsputil.locations'.definition_handler
|
||||
vim.lsp.handlers['textDocument/declaration'] = require'lsputil.locations'.declaration_handler
|
||||
vim.lsp.handlers['textDocument/typeDefinition'] = require'lsputil.locations'.typeDefinition_handler
|
||||
vim.lsp.handlers['textDocument/implementation'] = require'lsputil.locations'.implementation_handler
|
||||
vim.lsp.handlers['textDocument/documentSymbol'] = require'lsputil.symbols'.document_handler
|
||||
vim.lsp.handlers['workspace/symbol'] = require'lsputil.symbols'.workspace_handler
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/references'] = function(_, _, result)
|
||||
require('lsputil.locations').references_handler(nil, result, { bufnr = bufnr }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/definition'] = function(_, method, result)
|
||||
require('lsputil.locations').definition_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/declaration'] = function(_, method, result)
|
||||
require('lsputil.locations').declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/typeDefinition'] = function(_, method, result)
|
||||
require('lsputil.locations').typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/implementation'] = function(_, method, result)
|
||||
require('lsputil.locations').implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/documentSymbol'] = function(_, _, result, _, bufn)
|
||||
require('lsputil.symbols').document_handler(nil, result, { bufnr = bufn }, nil)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/symbol'] = function(_, _, result, _, bufn)
|
||||
require('lsputil.symbols').workspace_handler(nil, result, { bufnr = bufn }, nil)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
@ -24,50 +24,50 @@ local theme = {
|
||||
|
||||
local empty = require('lualine.component'):extend()
|
||||
function empty:draw(default_highlight)
|
||||
self.status = ''
|
||||
self.applied_separator = ''
|
||||
self:apply_highlights(default_highlight)
|
||||
self:apply_section_separators()
|
||||
return self.status
|
||||
self.status = ''
|
||||
self.applied_separator = ''
|
||||
self:apply_highlights(default_highlight)
|
||||
self:apply_section_separators()
|
||||
return self.status
|
||||
end
|
||||
|
||||
-- Put proper separators and gaps between components in sections
|
||||
local function process_sections(sections)
|
||||
for name, section in pairs(sections) do
|
||||
local left = name:sub(9, 10) < 'x'
|
||||
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
||||
table.insert(section, pos * 2, { empty, color = { fg = bg, bg = bg } })
|
||||
end
|
||||
for id, comp in ipairs(section) do
|
||||
if type(comp) ~= 'table' then
|
||||
comp = { comp }
|
||||
section[id] = comp
|
||||
end
|
||||
comp.separator = left and { right = '' } or { left = '' }
|
||||
end
|
||||
end
|
||||
return sections
|
||||
for name, section in pairs(sections) do
|
||||
local left = name:sub(9, 10) < 'x'
|
||||
for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
|
||||
table.insert(section, pos * 2, { empty, color = { fg = bg, bg = bg } })
|
||||
end
|
||||
for id, comp in ipairs(section) do
|
||||
if type(comp) ~= 'table' then
|
||||
comp = { comp }
|
||||
section[id] = comp
|
||||
end
|
||||
comp.separator = left and { right = '' } or { left = '' }
|
||||
end
|
||||
end
|
||||
return sections
|
||||
end
|
||||
|
||||
local function search_result()
|
||||
local last_search = vim.fn.getreg('/')
|
||||
if not last_search or last_search == '' then
|
||||
return ''
|
||||
end
|
||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||
local last_search = vim.fn.getreg('/')
|
||||
if not last_search or last_search == '' then
|
||||
return ''
|
||||
end
|
||||
local searchcount = vim.fn.searchcount { maxcount = 9999 }
|
||||
if searchcount.total == 0 then
|
||||
return ''
|
||||
end
|
||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||
return last_search .. '(' .. searchcount.current .. '/' .. searchcount.total .. ')'
|
||||
end
|
||||
|
||||
local function modified()
|
||||
if vim.bo.modified then
|
||||
return '+'
|
||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||
return '-'
|
||||
end
|
||||
return ''
|
||||
if vim.bo.modified then
|
||||
return '+'
|
||||
elseif vim.bo.modifiable == false or vim.bo.readonly == true then
|
||||
return '-'
|
||||
end
|
||||
return ''
|
||||
end
|
||||
|
||||
local function recording_macro()
|
||||
@ -113,49 +113,49 @@ if pcall(require, "luapad.statusline") then
|
||||
end
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = theme,
|
||||
component_separators = '',
|
||||
section_separators = { left = '', right = '' },
|
||||
options = {
|
||||
theme = theme,
|
||||
component_separators = '',
|
||||
section_separators = { left = '', right = '' },
|
||||
-- ignore_focus = {"NvimTree"},
|
||||
globalstatus = true
|
||||
},
|
||||
sections = process_sections {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'error' },
|
||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||
},
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'warn' },
|
||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||
},
|
||||
{ 'filename', file_status = false, path = 1 },
|
||||
{ modified, color = { bg = colors.red } },
|
||||
{ '%w', cond = function() return vim.wo.previewwindow end },
|
||||
{ '%r', cond = function() return vim.bo.readonly end },
|
||||
{ '%q', cond = function() return vim.bo.buftype == 'quickfix' end },
|
||||
},
|
||||
sections = process_sections {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'error' },
|
||||
diagnostics_color = { error = { bg = colors.red, fg = colors.white } },
|
||||
},
|
||||
{
|
||||
'diagnostics',
|
||||
source = { 'nvim' },
|
||||
sections = { 'warn' },
|
||||
diagnostics_color = { warn = { bg = colors.orange, fg = colors.white } },
|
||||
},
|
||||
{ 'filename', file_status = false, path = 1 },
|
||||
{ modified, color = { bg = colors.red } },
|
||||
{ '%w', cond = function() return vim.wo.previewwindow end },
|
||||
{ '%r', cond = function() return vim.bo.readonly end },
|
||||
{ '%q', cond = function() return vim.bo.buftype == 'quickfix' end },
|
||||
{ recording_macro, color = { bg = colors.orange } }
|
||||
},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { search_result, 'filetype' },
|
||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = { search_result, 'filetype' },
|
||||
lualine_z = { '%l:%c', '%p%%/%L' },
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
extensions = extensions
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
local pattern = "^/tmp/.*/%d+_Luapad%.lua$"
|
||||
local group = vim.api.nvim_create_augroup('LuaPadFiletype', {clear=true})
|
||||
local group = vim.api.nvim_create_augroup("LuaPadFiletype", {clear=true})
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = group,
|
||||
callback = function(data)
|
||||
|
@ -1,92 +1,99 @@
|
||||
local ls = require("luasnip")
|
||||
local capture = require("utils.capture")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local function config()
|
||||
local ls = require("luasnip")
|
||||
local capture = require("utils.capture")
|
||||
local s = ls.snippet
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
|
||||
local function getCurrentYear()
|
||||
return os.date("%Y")
|
||||
end
|
||||
|
||||
local function getGitUsername()
|
||||
local stdout = capture("git config user.name")
|
||||
if stdout == "" then
|
||||
return nil
|
||||
local function getCurrentYear()
|
||||
return os.date("%Y")
|
||||
end
|
||||
return stdout
|
||||
end
|
||||
|
||||
ls.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
enable_autosnippets = true
|
||||
}
|
||||
|
||||
vim.keymap.set({"i", "s"}, "<c-k>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
local function getGitUsername()
|
||||
local stdout = capture("git config user.name")
|
||||
if stdout == "" then
|
||||
return nil
|
||||
end
|
||||
return stdout
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = -1 })
|
||||
ls.config.set_config {
|
||||
history = true,
|
||||
updateevents = "TextChanged,TextChangedI",
|
||||
enable_autosnippets = true
|
||||
}
|
||||
|
||||
vim.keymap.set({"i"}, "<c-l>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
||||
vim.keymap.set({"i", "s"}, "<c-k>", function()
|
||||
if ls.expand_or_jumpable() then
|
||||
ls.expand_or_jump()
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
ls.add_snippets("all", {
|
||||
s("MIT", {
|
||||
t({"The MIT License (MIT)", "Copyright © "}),
|
||||
f(getCurrentYear, {}),
|
||||
t(" "),
|
||||
d(1, function()
|
||||
return sn(nil, {
|
||||
i(1, getGitUsername() or "<copyright holders>")
|
||||
})
|
||||
end, {}),
|
||||
t{
|
||||
"",
|
||||
"",
|
||||
"Permission is hereby granted, free of charge, to any person obtaining a copy of",
|
||||
"this software and associated documentation files (the “Software”), to deal in",
|
||||
"the Software without restriction, including without limitation the rights to",
|
||||
"use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies",
|
||||
"of the Software, and to permit persons to whom the Software is furnished to do",
|
||||
"so, subject to the following conditions:",
|
||||
"",
|
||||
"The above copyright notice and this permission notice shall be included in all",
|
||||
"copies or substantial portions of the Software.",
|
||||
"",
|
||||
"THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
|
||||
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
|
||||
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
|
||||
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
|
||||
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
|
||||
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
|
||||
"SOFTWARE.",
|
||||
}
|
||||
})
|
||||
})
|
||||
vim.keymap.set({ "i", "s" }, "<c-j>", function()
|
||||
if ls.jumpable(-1) then
|
||||
ls.jump(-1)
|
||||
end
|
||||
end, { silent = -1 })
|
||||
|
||||
ls.add_snippets("lua", {
|
||||
s("req",
|
||||
fmt([[local {} = require("{}")]], {
|
||||
f(function(module_name)
|
||||
local parts = vim.split(module_name[1][1], ".", true)
|
||||
return (parts[#parts] or ""):gsub("-", "_")
|
||||
end, { 1 }),
|
||||
i(1)
|
||||
vim.keymap.set({"i"}, "<c-l>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
end
|
||||
end)
|
||||
|
||||
ls.add_snippets("all", {
|
||||
s("MIT", {
|
||||
t({"The MIT License (MIT)", "Copyright © "}),
|
||||
f(getCurrentYear, {}),
|
||||
t(" "),
|
||||
d(1, function()
|
||||
return sn(nil, {
|
||||
i(1, getGitUsername() or "<copyright holders>")
|
||||
})
|
||||
end, {}),
|
||||
t{
|
||||
"",
|
||||
"",
|
||||
"Permission is hereby granted, free of charge, to any person obtaining a copy of",
|
||||
"this software and associated documentation files (the “Software”), to deal in",
|
||||
"the Software without restriction, including without limitation the rights to",
|
||||
"use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies",
|
||||
"of the Software, and to permit persons to whom the Software is furnished to do",
|
||||
"so, subject to the following conditions:",
|
||||
"",
|
||||
"The above copyright notice and this permission notice shall be included in all",
|
||||
"copies or substantial portions of the Software.",
|
||||
"",
|
||||
"THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR",
|
||||
"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,",
|
||||
"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE",
|
||||
"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER",
|
||||
"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,",
|
||||
"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE",
|
||||
"SOFTWARE.",
|
||||
}
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
ls.add_snippets("lua", {
|
||||
s("req",
|
||||
fmt([[local {} = require("{}")]], {
|
||||
f(function(module_name)
|
||||
local parts = vim.split(module_name[1][1], ".", true)
|
||||
return (parts[#parts] or ""):gsub("-", "_")
|
||||
end, { 1 }),
|
||||
i(1)
|
||||
})
|
||||
)
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
'L3MON4D3/LuaSnip',
|
||||
config = config
|
||||
}
|
||||
|
@ -1,12 +1,17 @@
|
||||
local opts = { noremap = true, silent = true }
|
||||
-- Normal-mode commands
|
||||
-- vim.keymap.set('n', '<A-j>', ':MoveLine(1)<CR>', opts)
|
||||
-- vim.keymap.set('n', '<A-k>', ':MoveLine(-1)<CR>', opts)
|
||||
-- vim.keymap.set('n', '<A-h>', ':MoveHChar(-1)<CR>', opts)
|
||||
-- vim.keymap.set('n', '<A-l>', ':MoveHChar(1)<CR>', opts)
|
||||
return {
|
||||
'fedepujol/move.nvim',
|
||||
config = function()
|
||||
local opts = { noremap = true, silent = true }
|
||||
-- Normal-mode commands
|
||||
-- vim.keymap.set('n', '<A-j>', ':MoveLine(1)<CR>', opts)
|
||||
-- vim.keymap.set('n', '<A-k>', ':MoveLine(-1)<CR>', opts)
|
||||
-- vim.keymap.set('n', '<A-h>', ':MoveHChar(-1)<CR>', opts)
|
||||
-- vim.keymap.set('n', '<A-l>', ':MoveHChar(1)<CR>', opts)
|
||||
|
||||
-- Visual-mode commands
|
||||
vim.keymap.set('v', '<S-j>', ':MoveBlock(1)<CR>', opts)
|
||||
vim.keymap.set('v', '<S-k>', ':MoveBlock(-1)<CR>', opts)
|
||||
vim.keymap.set('v', '<S-h>', ':MoveHBlock(-1)<CR>', opts)
|
||||
vim.keymap.set('v', '<S-l>', ':MoveHBlock(1)<CR>', opts)
|
||||
-- Visual-mode commands
|
||||
vim.keymap.set('v', '<S-j>', ':MoveBlock(1)<CR>', opts)
|
||||
vim.keymap.set('v', '<S-k>', ':MoveBlock(-1)<CR>', opts)
|
||||
vim.keymap.set('v', '<S-h>', ':MoveHBlock(-1)<CR>', opts)
|
||||
vim.keymap.set('v', '<S-l>', ':MoveHBlock(1)<CR>', opts)
|
||||
end
|
||||
}
|
||||
|
@ -1,13 +1,17 @@
|
||||
local map = require("utils.map")
|
||||
return {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function ()
|
||||
require("nvim-tree").setup{
|
||||
git = {
|
||||
enable = false
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
}
|
||||
|
||||
require("nvim-tree").setup{
|
||||
git = {
|
||||
enable = false
|
||||
},
|
||||
renderer = {
|
||||
group_empty = true,
|
||||
},
|
||||
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", {silent = true})
|
||||
vim.keymap.set("n", "<leader>f", ":NvimTreeFindFileToggle<CR>", {silent = true})
|
||||
end
|
||||
}
|
||||
|
||||
map("n", "<leader>e", ":NvimTreeToggle<CR>", {silent = true})
|
||||
map("n", "<leader>f", ":NvimTreeFindFileToggle<CR>", {silent = true})
|
||||
|
@ -1,8 +1,12 @@
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
return {
|
||||
'unblevable/quick-scope',
|
||||
config = function ()
|
||||
local g = vim.g
|
||||
local cmd = vim.cmd
|
||||
|
||||
-- Trigger a highlight in the appropriate direction when pressing these keys:
|
||||
g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'}
|
||||
|
||||
g['qs_max_chars'] = 150
|
||||
-- Trigger a highlight in the appropriate direction when pressing these keys:
|
||||
g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'}
|
||||
|
||||
g['qs_max_chars'] = 150
|
||||
end
|
||||
}
|
||||
|
@ -1,99 +1,108 @@
|
||||
local telescope = require('telescope')
|
||||
local map = require('utils.map')
|
||||
local actions = require('telescope.actions')
|
||||
local builtin = require('telescope.builtin')
|
||||
local previewers = require('telescope.previewers')
|
||||
local M = {}
|
||||
|
||||
local function sizelimit_maker(filepath, bufnr, opts)
|
||||
opts = opts or {}
|
||||
local size_limit = 100 * 1024 -- 100KiB
|
||||
|
||||
filepath = vim.fn.expand(filepath)
|
||||
vim.loop.fs_stat(filepath, function(_, stat)
|
||||
if not stat then return end
|
||||
if stat.size > size_limit then
|
||||
return
|
||||
else
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- Falling back to find_files if git_files can't find a .git directory
|
||||
function M.project_files(opts)
|
||||
local ok = pcall(builtin.git_files, opts)
|
||||
if not ok then builtin.find_files(opts) end
|
||||
local function project_files()
|
||||
local opts = { prompt_title = 'Project files' }
|
||||
local ok = pcall(builtin.git_files, opts)
|
||||
if not ok then builtin.find_files(opts) end
|
||||
end
|
||||
|
||||
function M.edit_config(_opts)
|
||||
local function edit_config()
|
||||
return M.project_files{
|
||||
cwd = "~/.config/nvim",
|
||||
prompt_title = "Neovim config"
|
||||
}
|
||||
end
|
||||
|
||||
local silent = {silent = true}
|
||||
|
||||
-- Search project files
|
||||
map('n', '<C-p>', [[:lua require('config.telescope').project_files{ prompt_title = 'Project files' }<cr>]], silent)
|
||||
|
||||
-- Search files from current working directory
|
||||
map('n', '<leader>p', [[:lua require('telescope.builtin').find_files()<cr>]], silent)
|
||||
|
||||
-- Edit neovim config
|
||||
map('n', '<leader>ce', [[:lua require('config.telescope').edit_config()<cr>]], silent)
|
||||
|
||||
-- Find string
|
||||
map('n', '<leader>fw', [[:lua require('telescope.builtin').live_grep()<cr>]], silent)
|
||||
|
||||
-- Change colorscheme
|
||||
map('n', '<leader>cs', [[:lua require('telescope.builtin').colorscheme()<cr>]], silent)
|
||||
|
||||
-- See help tags
|
||||
map('n', '<leader>fh', [[:lua require('telescope.builtin').help_tags()<cr>]], silent)
|
||||
|
||||
telescope.setup{
|
||||
defaults = {
|
||||
buffer_previewer_maker = sizelimit_maker,
|
||||
path_display = { "shorten" },
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"-L",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = { mirror = false },
|
||||
width = 0.87,
|
||||
height = 0.80,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_sorter = require("telescope.sorters").get_fuzzy_file,
|
||||
file_ignore_patterns = { "node_modules" },
|
||||
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
|
||||
path_display = { "truncate" },
|
||||
color_devicons = true,
|
||||
winblend = 0,
|
||||
border = {},
|
||||
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
|
||||
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
|
||||
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
|
||||
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
|
||||
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
|
||||
-- Developer configurations: Not meant for general override
|
||||
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
|
||||
mappings = {
|
||||
i = {
|
||||
["<esc>"] = actions.close
|
||||
}
|
||||
}
|
||||
i = { ["<esc>"] = actions.close }
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
marks = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
help_tags = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
oldfiles = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
git_files = {
|
||||
theme = "dropdown",
|
||||
},
|
||||
live_grep = {
|
||||
theme = "dropdown",
|
||||
disable_coordinates = true
|
||||
},
|
||||
colorscheme = {
|
||||
theme = "dropdown",
|
||||
enable_preview = true
|
||||
}
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
telescope.load_extension("ui-select")
|
||||
|
||||
local fzfPlugin = packer_plugins["telescope-fzf-native.nvim"]
|
||||
if fzfPlugin and fzfPlugin.loaded then
|
||||
telescope.load_extension('fzf')
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
local silent = {silent = true}
|
||||
|
||||
-- Search project files
|
||||
vim.keymap.set("n", "<C-p>", project_files, silent)
|
||||
|
||||
-- Search files from current working directory
|
||||
vim.keymap.set("n", "<leader>p", function() builtin.find_files() end, silent)
|
||||
|
||||
-- Edit neovim config
|
||||
vim.keymap.set("n", "<leader>ce", edit_config, silent)
|
||||
|
||||
-- Find string
|
||||
vim.keymap.set("n", "<leader>fw", function() builtin.live_grep() end, silent)
|
||||
|
||||
-- Change colorscheme
|
||||
vim.keymap.set("n", "<leader>cs", function() builtin.colorscheme() end, silent)
|
||||
|
||||
-- See help tags
|
||||
vim.keymap.set("n", "<leader>fh", function() builtin.help_tags() end, silent)
|
||||
|
6
lua/config/tidy.lua
Normal file
6
lua/config/tidy.lua
Normal file
@ -0,0 +1,6 @@
|
||||
return {
|
||||
"mcauley-penney/tidy.nvim",
|
||||
config = function()
|
||||
require("tidy").setup()
|
||||
end
|
||||
}
|
7
lua/config/todo-comments.lua
Normal file
7
lua/config/todo-comments.lua
Normal file
@ -0,0 +1,7 @@
|
||||
return {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup { signs = false }
|
||||
end
|
||||
}
|
@ -1,3 +1,9 @@
|
||||
require('toggleterm').setup()
|
||||
return {
|
||||
'akinsho/toggleterm.nvim',
|
||||
tag = '*',
|
||||
config = function()
|
||||
require('toggleterm').setup()
|
||||
|
||||
vim.keymap.set("n", "<leader>t", ":ToggleTerm<CR>")
|
||||
vim.keymap.set("n", "<leader>t", ":ToggleTerm<CR>")
|
||||
end
|
||||
}
|
||||
|
@ -1,6 +1,12 @@
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = function() require('nvim-treesitter.install').update{ with_sync = true } end,
|
||||
config = function ()
|
||||
local treesitter = require("nvim-treesitter.configs")
|
||||
|
||||
treesitter.setup{
|
||||
highlight = { enable = true },
|
||||
auto_install = true
|
||||
treesitter.setup{
|
||||
highlight = { enable = true },
|
||||
auto_install = true
|
||||
}
|
||||
end
|
||||
}
|
||||
|
@ -1,9 +1,15 @@
|
||||
local map = require 'utils.map'
|
||||
return {
|
||||
'folke/trouble.nvim',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function ()
|
||||
local map = require 'utils.map'
|
||||
|
||||
require('trouble').setup()
|
||||
require('trouble').setup()
|
||||
|
||||
local silent = {silent = true}
|
||||
local silent = {silent = true}
|
||||
|
||||
map('n', '<leader>qq', ':TroubleToggle document_diagnostics<cr>', silent)
|
||||
map('n', '<leader>qf', ':TroubleToggle workspace_diagnostics<cr>', silent)
|
||||
map('n', '<leader>rf', ':TroubleToggle lsp_references<cr>', silent)
|
||||
map('n', '<leader>qq', ':TroubleToggle document_diagnostics<cr>', silent)
|
||||
map('n', '<leader>qf', ':TroubleToggle workspace_diagnostics<cr>', silent)
|
||||
map('n', '<leader>rf', ':TroubleToggle lsp_references<cr>', silent)
|
||||
end
|
||||
}
|
||||
|
5
lua/config/ts-playground.lua
Normal file
5
lua/config/ts-playground.lua
Normal file
@ -0,0 +1,5 @@
|
||||
return {
|
||||
'nvim-treesitter/playground',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
cmd = "TSPlaygroundToggle"
|
||||
}
|
11
lua/disable-builtin.lua
Normal file
11
lua/disable-builtin.lua
Normal file
@ -0,0 +1,11 @@
|
||||
local disabled_built_ins = {
|
||||
'matchit',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
}
|
||||
|
||||
for _, name in ipairs(disabled_built_ins) do
|
||||
vim.g['loaded_' .. name] = 1
|
||||
end
|
@ -1,6 +1,5 @@
|
||||
local map = require 'utils.map'
|
||||
|
||||
map("n", "<leader><leader>x", ":w<cr>:source %<cr>")
|
||||
vim.keymap.set("n", "<leader><leader>x", ":w<cr>:source %<cr>", { silent = true })
|
||||
|
||||
function P(...)
|
||||
print(vim.inspect(...))
|
||||
|
88
lua/plugin-manager.lua
Normal file
88
lua/plugin-manager.lua
Normal file
@ -0,0 +1,88 @@
|
||||
-- Register custom commands for plugin manager
|
||||
vim.cmd [[command! -bang -nargs=+ -complete=customlist,v:lua.require'plugin-manager'.loader_complete PackerLoad lua require('plugin-manager').loader(<f-args>, '<bang>' == '!')]]
|
||||
vim.cmd [[command! PackerInstall packadd packer.nvim | lua require('plugin-manager').install()]]
|
||||
vim.cmd [[command! PackerUpdate packadd packer.nvim | lua require('plugin-manager').update()]]
|
||||
vim.cmd [[command! PackerSync packadd packer.nvim | lua require('plugin-manager').sync()]]
|
||||
vim.cmd [[command! PackerClean packadd packer.nvim | lua require('plugin-manager').clean()]]
|
||||
vim.cmd [[command! PackerCompile source lua/plugin-manager.lua | packadd packer.nvim | lua require('plugin-manager').compile()]]
|
||||
|
||||
-- Bootstrap packer.nvim. If packer.nvim is not installed, install it.
|
||||
local function bootstrap()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
return fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
end
|
||||
end
|
||||
|
||||
local function create_custom_use(use)
|
||||
return function (opts)
|
||||
if type(opts) == "string" then
|
||||
use(opts)
|
||||
return opts
|
||||
elseif type(opts) == "table" then
|
||||
if opts.load_config then
|
||||
local name = vim.split(opts[1], "/")[2]
|
||||
if name:match("%.nvim$") then
|
||||
name = name:sub(1, -6)
|
||||
end
|
||||
opts.config_name = name
|
||||
end
|
||||
if opts.config_name then
|
||||
opts.config = ("require('config.%s')"):format(opts.config_name)
|
||||
end
|
||||
use(opts)
|
||||
|
||||
return opts[1]
|
||||
else
|
||||
error("What are you doing???")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local packer = nil
|
||||
local function init()
|
||||
-- Perform bootstrap
|
||||
local packer_bootstrap = bootstrap()
|
||||
|
||||
-- Initialize packer
|
||||
if packer == nil then
|
||||
packer = require 'packer'
|
||||
local util = require 'packer.util'
|
||||
packer.init {
|
||||
compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer-compiled.lua'),
|
||||
disable_commands = true
|
||||
}
|
||||
end
|
||||
|
||||
-- Reset plugins if already loaded
|
||||
packer.reset()
|
||||
|
||||
-- Packer can manage itself
|
||||
packer.use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Use plugins
|
||||
local use = create_custom_use(packer.use)
|
||||
for _, module_name in ipairs{"plugins", "plugins-local"} do
|
||||
local ok, use_plugins = pcall(require, module_name)
|
||||
if ok then
|
||||
assert(type(use_plugins) == "function")
|
||||
use_plugins(use)
|
||||
end
|
||||
end
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end
|
||||
|
||||
local plugins = setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
init()
|
||||
return packer[key]
|
||||
end
|
||||
})
|
||||
|
||||
return plugins
|
2
lua/plugins-local.lua
Normal file
2
lua/plugins-local.lua
Normal file
@ -0,0 +1,2 @@
|
||||
return function(use)
|
||||
end
|
360
lua/plugins.lua
360
lua/plugins.lua
@ -1,16 +1,87 @@
|
||||
-- TODO: Add minimal plugin mode. Disables all plugins which are not super
|
||||
-- important, to get better performance.
|
||||
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
local function usePlugins(use, use_rocks)
|
||||
-- Toggle terminal
|
||||
use { 'akinsho/toggleterm.nvim', tag = '*', load_config=true }
|
||||
return function(use)
|
||||
local function use_config(name)
|
||||
use(require(("config.%s"):format(name)))
|
||||
end
|
||||
|
||||
-- Colorize ANSI codes
|
||||
use { 'm00qek/baleia.nvim', tag = 'v1.2.0', config=[[require('config.baleia')]] }
|
||||
use_config "toggleterm"
|
||||
use_config "baleia"
|
||||
use_config "todo-comments"
|
||||
use_config "legendary"
|
||||
use_config "dressing"
|
||||
use_config "move"
|
||||
use_config "gitblame"
|
||||
use_config "based"
|
||||
use_config "lspsignature"
|
||||
use_config "lsputils"
|
||||
use_config "luasnip"
|
||||
use_config "trouble"
|
||||
use_config "fugitive"
|
||||
use_config "gitsigns"
|
||||
use_config "nvim-tree"
|
||||
use_config "autosource"
|
||||
use_config "tidy"
|
||||
use_config "quickscope"
|
||||
use_config "leap"
|
||||
use_config "comment"
|
||||
use_config "colorizer"
|
||||
use_config "devicons"
|
||||
use_config "treesitter"
|
||||
use_config "ts-playground"
|
||||
|
||||
use {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
{"nvim-telescope/telescope-fzf-native.nvim", run = "make"}
|
||||
},
|
||||
load_config = true
|
||||
}
|
||||
|
||||
use {
|
||||
"neovim/nvim-lspconfig",
|
||||
config_name = "lspconfig"
|
||||
}
|
||||
|
||||
use {
|
||||
'williamboman/nvim-lsp-installer',
|
||||
requires = 'neovim/nvim-lspconfig',
|
||||
config_name = "lspinstaller"
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
load_config = true
|
||||
}
|
||||
|
||||
use {
|
||||
'rafcamlet/nvim-luapad',
|
||||
config_name = "luapad"
|
||||
}
|
||||
|
||||
use "tpope/vim-eunuch"
|
||||
use "christoomey/vim-tmux-navigator"
|
||||
use "eandrju/cellular-automaton.nvim"
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "tpope/vim-unimpaired"
|
||||
use { "sindrets/diffview.nvim", requires = 'nvim-lua/plenary.nvim' }
|
||||
use "wellle/targets.vim"
|
||||
use "michaeljsmith/vim-indent-object"
|
||||
use "psliwka/vim-smoothie"
|
||||
use "godlygeek/tabular"
|
||||
use "editorconfig/editorconfig-vim"
|
||||
use "tpope/vim-surround"
|
||||
use "tpope/vim-repeat"
|
||||
use "tikhomirov/vim-glsl"
|
||||
|
||||
-- Debugger
|
||||
use { 'mfussenegger/nvim-dap', config_name="dap" }
|
||||
use { "mfussenegger/nvim-dap", config_name="dap" }
|
||||
use { "rcarriga/nvim-dap-ui", requires = "mfussenegger/nvim-dap", config=[[require('dapui').setup()]] }
|
||||
use 'simrat39/rust-tools.nvim'
|
||||
use {
|
||||
@ -19,46 +90,6 @@ local function usePlugins(use, use_rocks)
|
||||
config=[[require('nvim-dap-virtual-text')]]
|
||||
}
|
||||
|
||||
-- Git blame
|
||||
use { 'f-person/git-blame.nvim', config_name="gitblame" }
|
||||
|
||||
use { 'trmckay/based.nvim', load_config = true }
|
||||
|
||||
-- Seemless pane switching betwen tmux and vim
|
||||
use 'christoomey/vim-tmux-navigator'
|
||||
|
||||
-- UNIX commands
|
||||
use 'tpope/vim-eunuch'
|
||||
|
||||
use {'rafcamlet/nvim-luapad', config_name = "luapad"}
|
||||
|
||||
use { 'fedepujol/move.nvim', load_config=true }
|
||||
|
||||
-- fun
|
||||
use {'eandrju/cellular-automaton.nvim', load_config = true}
|
||||
|
||||
-- Movement utilities
|
||||
use 'tpope/vim-unimpaired'
|
||||
|
||||
-- LSP
|
||||
use { 'neovim/nvim-lspconfig', config_name = "lspconfig" }
|
||||
use {
|
||||
'williamboman/nvim-lsp-installer',
|
||||
requires = 'neovim/nvim-lspconfig',
|
||||
config_name = "lspinstaller"
|
||||
}
|
||||
|
||||
-- LSP utils
|
||||
use {"ray-x/lsp_signature.nvim", config_name = "lspsignature"}
|
||||
use {
|
||||
'RishabhRD/nvim-lsputils',
|
||||
config_name = "lsputils",
|
||||
requires = 'RishabhRD/popfix'
|
||||
}
|
||||
|
||||
-- Snippets
|
||||
use { 'L3MON4D3/LuaSnip', config_name = "luasnip" }
|
||||
|
||||
-- Completion
|
||||
use { 'onsails/lspkind-nvim' }
|
||||
use {
|
||||
@ -76,231 +107,20 @@ local function usePlugins(use, use_rocks)
|
||||
use {'hrsh7th/cmp-cmdline', after = 'nvim-cmp', requires = 'hrsh7th/nvim-cmp'}
|
||||
use {'saadparwaiz1/cmp_luasnip', after = 'nvim-cmp', requires = {'L3MON4D3/LuaSnip', 'nvim-cmp'}}
|
||||
|
||||
-- Better diagnostics viewer
|
||||
use {
|
||||
'folke/trouble.nvim',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
load_config = true
|
||||
}
|
||||
|
||||
-- Color themes
|
||||
use 'srcery-colors/srcery-vim'
|
||||
-- use 'morhetz/gruvbox'
|
||||
-- use 'tomasr/molokai'
|
||||
-- use 'Mangeshrex/uwu.vim'
|
||||
-- use 'ayu-theme/ayu-vim'
|
||||
-- use 'sickill/vim-monokai'
|
||||
-- use 'joshdick/onedark.vim'
|
||||
-- use 'mswift42/vim-themes'
|
||||
-- use 'squarefrog/tomorrow-night.vim'
|
||||
-- use 'fnune/base16-vim'
|
||||
|
||||
-- Text object target
|
||||
use 'wellle/targets.vim'
|
||||
|
||||
-- Git integration
|
||||
use { 'tpope/vim-fugitive', config_name = "fugitive" }
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
requires = 'nvim-lua/plenary.nvim',
|
||||
load_config = true
|
||||
-- tag = 'release' -- To use the latest release
|
||||
}
|
||||
|
||||
-- Refactoring
|
||||
-- use {
|
||||
-- "ThePrimeagen/refactoring.nvim",
|
||||
-- requires = {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- "nvim-treesitter/nvim-treesitter"
|
||||
-- },
|
||||
-- disable = true,
|
||||
-- config = [[require 'config.refactoring']]
|
||||
-- }
|
||||
|
||||
-- Analyze startup time
|
||||
use 'tweekmonster/startuptime.vim'
|
||||
|
||||
-- Status line and tab line
|
||||
-- use { 'itchyny/lightline.vim', config = [[require 'config.lightline']]}
|
||||
use {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
load_config = true
|
||||
}
|
||||
|
||||
-- Load project specific settings from exrc
|
||||
use { 'jenterkin/vim-autosource', config_name = "autosource" }
|
||||
|
||||
-- Remove spaces at end of lines
|
||||
use{ "mcauley-penney/tidy.nvim", config = [[require("tidy").setup()]] }
|
||||
do -- Color themes
|
||||
use 'srcery-colors/srcery-vim'
|
||||
-- use 'morhetz/gruvbox'
|
||||
-- use 'tomasr/molokai'
|
||||
-- use 'Mangeshrex/uwu.vim'
|
||||
-- use 'ayu-theme/ayu-vim'
|
||||
-- use 'sickill/vim-monokai'
|
||||
-- use 'joshdick/onedark.vim'
|
||||
-- use 'mswift42/vim-themes'
|
||||
-- use 'squarefrog/tomorrow-night.vim'
|
||||
-- use 'fnune/base16-vim'
|
||||
end
|
||||
|
||||
-- Training plugins
|
||||
-- use 'tjdevries/train.nvim'
|
||||
-- use 'ThePrimeagen/vim-be-good'
|
||||
|
||||
-- Quick movement
|
||||
-- use { 'justinmk/vim-sneak', config = [[require 'config.sneak']] }
|
||||
use { 'unblevable/quick-scope', config_name = "quickscope" }
|
||||
use 'michaeljsmith/vim-indent-object'
|
||||
use { 'ggandor/leap.nvim', load_config = "leap"}
|
||||
|
||||
-- Smooth smooth scrolling
|
||||
-- use { 'karb94/neoscroll.nvim', config = [[require('neoscroll').setup()]] }
|
||||
use 'psliwka/vim-smoothie'
|
||||
|
||||
-- Commenting
|
||||
use {
|
||||
'terrortylor/nvim-comment',
|
||||
config_name = "comment",
|
||||
requires = 'JoosepAlviste/nvim-ts-context-commentstring'
|
||||
}
|
||||
|
||||
-- Color code colorizer
|
||||
use { 'norcalli/nvim-colorizer.lua', config_name = "colorizer" }
|
||||
|
||||
-- Fuzzy file finder
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
load_config = true,
|
||||
requires = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'kyazdani42/nvim-web-devicons',
|
||||
{'nvim-telescope/telescope-fzf-native.nvim', run = 'make'}
|
||||
}
|
||||
}
|
||||
|
||||
-- Align characters vertically
|
||||
use 'godlygeek/tabular'
|
||||
|
||||
-- Used for loading project specific code styles
|
||||
use 'editorconfig/editorconfig-vim'
|
||||
|
||||
-- Provides mappings for working with symbols like (), {}, [], etc.
|
||||
use 'tpope/vim-surround'
|
||||
|
||||
-- Allow repeating
|
||||
use 'tpope/vim-repeat'
|
||||
|
||||
-- GLSL language support
|
||||
use 'tikhomirov/vim-glsl'
|
||||
|
||||
-- Treesitter
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config = [[require 'config.treesitter']],
|
||||
run = function() require('nvim-treesitter.install').update{ with_sync = true } end
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/playground',
|
||||
requires = 'nvim-treesitter/nvim-treesitter',
|
||||
cmd = "TSPlaygroundToggle"
|
||||
}
|
||||
|
||||
-- Dev icons
|
||||
use {'kyazdani42/nvim-web-devicons', config = [[require('nvim-web-devicons').setup()]]}
|
||||
|
||||
-- File browser
|
||||
use {
|
||||
'kyazdani42/nvim-tree.lua',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = [[require 'config.nvim-tree']]
|
||||
}
|
||||
-- use {
|
||||
-- 'lambdalisue/fern.vim',
|
||||
-- config = [[require 'config.fern']],
|
||||
-- requires = {
|
||||
-- 'antoinemadec/FixCursorHold.nvim',
|
||||
-- 'lambdalisue/fern-hijack.vim',
|
||||
-- {'lambdalisue/fern-renderer-nerdfont.vim', config = [[vim.g["fern#renderer"] = "nerdfont"]]},
|
||||
-- 'lambdalisue/nerdfont.vim'
|
||||
-- }
|
||||
-- }
|
||||
-- alternatives:
|
||||
-- use 'kyazdani42/nvim-tree.lua'
|
||||
-- use 'zgpio/tree.nvim'
|
||||
-- use 'tpope/vim-vinegar'
|
||||
end
|
||||
|
||||
-- Register custom commands for plugin manager
|
||||
vim.cmd [[command! -bang -nargs=+ -complete=customlist,v:lua.require'plugins'.loader_complete PackerLoad lua require('plugins').loader(<f-args>, '<bang>' == '!')]]
|
||||
vim.cmd [[command! PackerInstall packadd packer.nvim | lua require('plugins').install()]]
|
||||
vim.cmd [[command! PackerUpdate packadd packer.nvim | lua require('plugins').update()]]
|
||||
vim.cmd [[command! PackerSync packadd packer.nvim | lua require('plugins').sync()]]
|
||||
vim.cmd [[command! PackerClean packadd packer.nvim | lua require('plugins').clean()]]
|
||||
vim.cmd [[command! PackerCompile source lua/plugins.lua | packadd packer.nvim | lua require('plugins').compile()]]
|
||||
|
||||
-- Bootstrap packer.nvim. If packer.nvim is not installed, install it.
|
||||
local function bootstrap()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
return fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
end
|
||||
end
|
||||
|
||||
local function create_custom_use(use)
|
||||
return function (opts)
|
||||
if type(opts) == "string" then
|
||||
use(opts)
|
||||
return opts
|
||||
elseif type(opts) == "table" then
|
||||
if opts.load_config then
|
||||
local name = vim.split(opts[1], "/")[2]
|
||||
if name:match("%.nvim$") then
|
||||
name = name:sub(1, -6)
|
||||
end
|
||||
opts.config_name = name
|
||||
end
|
||||
if opts.config_name then
|
||||
opts.config = ("require('config.%s')"):format(opts.config_name)
|
||||
end
|
||||
use(opts)
|
||||
|
||||
return opts[1]
|
||||
else
|
||||
error("What are you doing???")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local packer = nil
|
||||
local function init()
|
||||
-- Perform bootstrap
|
||||
local packer_bootstrap = bootstrap()
|
||||
|
||||
-- Initialize packer
|
||||
if packer == nil then
|
||||
packer = require 'packer'
|
||||
local util = require 'packer.util'
|
||||
packer.init {
|
||||
compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer-compiled.lua'),
|
||||
disable_commands = true
|
||||
}
|
||||
end
|
||||
|
||||
-- Reset plugins if already loaded
|
||||
packer.reset()
|
||||
|
||||
-- Packer can manage itself
|
||||
packer.use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Use plugins
|
||||
usePlugins(create_custom_use(packer.use), packer.use_rocks)
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end
|
||||
|
||||
local plugins = setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
init()
|
||||
return packer[key]
|
||||
end,
|
||||
})
|
||||
|
||||
return plugins
|
||||
|
Loading…
Reference in New Issue
Block a user