aboutsummaryrefslogtreecommitdiff
path: root/lua/startup/utils.lua
diff options
context:
space:
mode:
authormax397574 <[email protected]>2021-10-24 15:22:47 +0200
committermax397574 <[email protected]>2021-10-24 15:22:47 +0200
commite54b4af46f8a658e4d3c5144828c7859a59461cc (patch)
treeb4809075256a991851b9d84fd5b1fe9c24fe5582 /lua/startup/utils.lua
parente216cf6121aab25e7a19ccbd04cc56dfecacfacf (diff)
feat(plugins): ✨added key help
Diffstat (limited to 'lua/startup/utils.lua')
-rw-r--r--lua/startup/utils.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/lua/startup/utils.lua b/lua/startup/utils.lua
index aa343b8..eb522b5 100644
--- a/lua/startup/utils.lua
+++ b/lua/startup/utils.lua
@@ -1,5 +1,6 @@
U = {}
local flag = false
+local settings = require "startup.config"
local function start_timeout()
flag = true
vim.defer_fn(function()
@@ -20,6 +21,45 @@ function U.spaces(amount)
return string.rep(" ", amount)
end
+function U.key_help()
+ local buf = vim.api.nvim_create_buf(false, true)
+ vim.api.nvim_buf_set_option(buf, "bufhidden", "wipe")
+ vim.api.nvim_buf_set_keymap(
+ buf,
+ "n",
+ "<ESC>",
+ "<cmd>q<CR>",
+ { noremap = true, silent = true, nowait = true }
+ )
+ vim.api.nvim_buf_set_keymap(
+ buf,
+ "n",
+ "q",
+ "<cmd>q<CR>",
+ { noremap = true, silent = true, nowait = true }
+ )
+ local lines = {
+ "startup.nvim mapping:",
+ "",
+ "Execute command: " .. settings.mappings.execute_command,
+ "Open file: " .. settings.mappings.open_file,
+ "Open file in split: " .. settings.mappings.open_file_split,
+ "Open section: " .. settings.mappings.open_section,
+ }
+ vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
+ local win = vim.api.nvim_open_win(buf, true, {
+ relative = "cursor",
+ width = 30,
+ height = 6,
+ col = 1,
+ row = 1,
+ border = "shadow",
+ style = "minimal",
+ })
+ vim.api.nvim_win_set_option(win, "winblend", 20)
+ vim.api.nvim_buf_set_option(buf, "modifiable", false)
+end
+
function U.default_header()
local header = {
" /$$ ",