Skip to content

Commit

Permalink
Bug fixes:
Browse files Browse the repository at this point in the history
- Hide completion levels when entering insert mode
- Change `.styluaignore` to work with everything now (including `goto`
  statements)
- Format with styluaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa


Former-commit-id: 66aa823
  • Loading branch information
vhyrro committed Oct 24, 2021
1 parent f56c27b commit f0fcf4d
Show file tree
Hide file tree
Showing 5 changed files with 312 additions and 291 deletions.
10 changes: 1 addition & 9 deletions .styluaignore
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
.github
after
docs
ftdetect
res

# There is a bug in stylua where it cant parse statements with `goto`, so this file is ignored until its resolved
# https://github.com/JohnnyMorganz/StyLua/issues/229
lua/neorg/modules/core/norg/completion/module.lua
ldoc/
26 changes: 22 additions & 4 deletions lua/neorg/modules/core/keybinds/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,24 @@ module.public = {
-- @Param command (string) - same as the rhs parameter for :h nvim_buf_set_keymap
-- @Param opts (table) - same as the opts parameter for :h nvim_buf_set_keymap
map = function(mode, key, command, opts)
local ok, error = pcall(function() if action then action(0, mode, key, command, opts or {}) else vim.api.nvim_buf_set_keymap(0, mode, key, command, opts or {}) end end)
local ok, error = pcall(function()
if action then
action(0, mode, key, command, opts or {})
else
vim.api.nvim_buf_set_keymap(0, mode, key, command, opts or {})
end
end)

if not ok then
log.trace(string.format("An error occurred when trying to bind key '%s' in mode '%s' in neorg mode '%s' - %s", key, mode, current_mode, error))
log.trace(
string.format(
"An error occurred when trying to bind key '%s' in mode '%s' in neorg mode '%s' - %s",
key,
mode,
current_mode,
error
)
)
end
end,

Expand Down Expand Up @@ -283,11 +297,15 @@ module.on_event = function(event)
module.public.sync()
elseif event.type == "core.mode.events.mode_set" then
-- If a new mode has been set then reset all of our keybinds
module.public.bind_all(function(buf, mode, key) vim.api.nvim_buf_del_keymap(buf, mode, key) end, event.content.current)
module.public.bind_all(function(buf, mode, key)
vim.api.nvim_buf_del_keymap(buf, mode, key)
end, event.content.current)
module.public.bind_all()
elseif event.type == "core.autocommands.events.bufenter" and event.content.norg then
-- If a new mode has been set then reset all of our keybinds
module.public.bind_all(function(buf, mode, key) vim.api.nvim_buf_del_keymap(buf, mode, key) end, module.required["core.mode"].get_previous_mode())
module.public.bind_all(function(buf, mode, key)
vim.api.nvim_buf_del_keymap(buf, mode, key)
end, module.required["core.mode"].get_previous_mode())
module.public.bind_all()
end
end
Expand Down
1 change: 0 additions & 1 deletion lua/neorg/modules/core/mode/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ local module = neorg.modules.create("core.mode")
local log = require("neorg.external.log")

module.config.public = {

-- As the name suggests, stores the current and previous mode
current_mode = "norg",
previous_mode = "norg",
Expand Down
Loading

0 comments on commit f0fcf4d

Please sign in to comment.