Browse Source
feat:
- Introduce a new prompt to edit doom configurations
- Improve how which-key plugin is being lazy-loaded
- Change kommentary plugin lazy-load event
- Small improvements to startup (decreased by ~10ms)
my-config
NTBBloodbath
3 years ago
No known key found for this signature in database
GPG Key ID: 18D6730BC846AAC5
5 changed files with
44 additions and
13 deletions
init.lua
lua/doom/core/functions/init.lua
lua/doom/core/keybindings/init.lua
lua/doom/modules/config/doom-dashboard.lua
lua/doom/modules/init.lua
@ -57,9 +57,10 @@ async = vim.loop.new_async(vim.schedule_wrap(function()
filetype on
filetype plugin indent on
PackerLoad nvim - treesitter
PackerLoad which - key.nvim
silent ! bufdo e
] ] )
end , 15 )
end , 10 )
end , 0 )
async : close ( )
@ -451,4 +451,38 @@ M.rollback_doom = function()
end
end
-- edit_config creates a prompt to modify a doom configuration file
M.edit_config = function ( )
local selected_config = tonumber (
vim.fn . input (
' Select a configuration file to edit: '
.. ' \n \t 1. doom_config.lua '
.. ' \n \t 2. doomrc.lua '
.. ' \n \t 3. plugins.lua '
.. ' \n \n >> '
)
)
local open_command = config.doom . new_file_split and ' split ' or ' edit '
if selected_config == 1 then
vim.cmd (
string.format (
' %s %s/doom_config.lua ' ,
open_command ,
utils.doom_root
)
)
elseif selected_config == 2 then
vim.cmd (
string.format ( ' %s %s/doomrc.lua ' , open_command , utils.doom_root )
)
elseif selected_config == 3 then
vim.cmd (
string.format ( ' %s %s/plugins.lua ' , open_command , utils.doom_root )
)
else
log.error ( ' Invalid option selected. ' )
end
end
return M
@ -14,14 +14,11 @@ log.debug('Loading Doom keybindings module ...')
-- Additional options for mappings
local opts = { silent = true }
-- selene: allow(undefined_variable)
if packer_plugins and not packer_plugins [ ' which-key.nvim ' ] then
utils.map ( ' n ' , ' <Space> ' , ' <Nop> ' , opts )
vim.g . mapleader = ' '
end
-- Map WhichKey popup menu
utils.map ( ' n ' , ' <Space> ' , ' :WhichKey <leader><CR> ' , opts )
-- utils.map('n', '<Space>', ':WhichKey <leader><CR>', opts )
-------------------------------------------------
@ -257,7 +254,7 @@ utils.map('n', '<leader>bf', '<cmd>FormatWrite<CR>', opts)
utils.map (
' n ' ,
' <leader>dc ' ,
' <cmd>e ' .. utils.doom_root .. ' /doom_config.lua <CR> ' ,
' <cmd>lua require("doom.core.functions").edit_config() <CR> ' ,
opts
)
utils.map ( ' n ' , ' <leader>dd ' , ' <cmd>help doom_nvim<CR> ' , opts )
@ -29,7 +29,7 @@ return function()
} ,
f = {
description = { ' Open Private Configuration SPC d c ' } ,
command = ' :e ' .. doom_root .. ' /doom_config.lua ' ,
command = ' :lua require("doom.core.functions").edit_config() ' ,
} ,
g = {
description = { ' Open Documentation SPC d d ' } ,
@ -180,8 +180,8 @@ packer.startup(function(use)
local disabled_whichkey = functions.is_plugin_disabled ( ' which-key ' )
use ( {
' folke/which-key.nvim ' ,
opt = true ,
config = require ( ' doom.modules.config.doom-whichkey ' ) ,
event = ' BufWinEnter ' ,
disable = disabled_whichkey ,
} )
@ -250,7 +250,6 @@ packer.startup(function(use)
-- Built-in LSP Config
use ( {
' neovim/nvim-lspconfig ' ,
opt = true ,
config = require ( ' doom.modules.config.doom-lspconfig ' ) ,
disable = disabled_lsp ,
event = ' ColorScheme ' ,
@ -353,7 +352,7 @@ packer.startup(function(use)
use ( {
' b3nj5m1n/kommentary ' ,
disable = disabled_kommentary ,
event = ' BufEnter ' ,
event = ' BufWin Enter ' ,
} )
-----[[-------------]]-----